element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Rocking Raspberry Pi
  • Challenges & Projects
  • Design Challenges
  • Rocking Raspberry Pi
  • More
  • Cancel
Rocking Raspberry Pi
Blog Rocking Raspberry Pi Challenge Karaoke player demo 2 (with wolfson audio card)
  • Blog
  • Forum
  • Documents
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ss_shrenik
  • Date Created: 1 May 2014 5:25 PM Date Created
  • Views 584 views
  • Likes 0 likes
  • Comments 0 comments
  • rocking_pi
Related
Recommended

Rocking Raspberry Pi Challenge Karaoke player demo 2 (with wolfson audio card)

ss_shrenik
ss_shrenik
1 May 2014

Hi All,

 

As I told before, here I am coming with second implementation which is very basic implementation. In fact I made this in very short time and posting it. I thought of improving and making complete Karaoke based on web and service running on Raspberry Pi, but as short of time I could do only basic playing song, stopping song and show lyrics features.

 

 

Concept Overview-

    In this concept in order to use Wolfson Card to make Karaoke Player, I could not use Pi Face control display, As it could not stack on Wolfson module. Also as in first demo, I didn't want to make Karaoke Player dependent on big screen like TV/Monitor. So in this case Making a Karaoke player for which we can use mobile as User interface and Raspberry Pi as Processing device was better idea for me. Hence I installed apache webserver on Raspberry Pi, also made Raspberry Pi to act as Access point so that I can connect mobile to it to access webserver pages, and wrote a small php script (As I am from electronics background I was new to it) to control songs and lyrics.

 

    You can find demo video here

    Rocking Raspberry Pi Challenge demo 2 (Wolfson Audio Card and Basic Karaoke)

 

Implementation details-

 

Wolfson Card Setup with Raspberry Pi-

    To setup Wolfson card I did some search and then found that the official image for Wolfson Card was too big, that could not fit into 8GB SD card. Hence I came across following link

 

http://www.element14.com/community/message/107186/l/re-re-wolfson-modified-noobs-raspbian-zipped-img-cannot-unzip-new-download#107186

 

where Ragnar jensen provided precompiled kernel image, driver modules and shell scripts that are in official release. Thanks Ragnar Jensen for it.

 

    This made the work easy and saved driver/kernel compilation time which I was going to do.

 

I just downloaded the tar file provided on above link which you can find at

    https://drive.google.com/file/d/0BzlaxMH3N5O1RnJfcGVpdmY1T1E/edit?usp=sharing

   

Download the tar file from above link and just extract it in root folder "/"

cd /

sudo tar -zxvf /tar_file_path/kernel_3_10_25_wolfson.tgz

 

After that your new letest kernel which contains wolfson driver will be there under /boot/kernel_wolfson.img, hence in order to

instruct Raspberry Pi to boot this new kernel from next time you need to mention it in /boot/config.txt file like

    add this line "

kernel = kernel_wolfson.img

" in config.txt file.

and then reboot this will enable driver support in kernel when raspberry pi boots on wolfson kernel provided.

 

    You can download manual about Wolfson card from www.element14.com/wolfson

for further test you can refer user manual for Wolfson Card.

 

Note: I found as Wolfson card connects Raspberry Pi on Pogo Pins sometimes connections are not proper, and you won't hear sound even you detect the wolfson card. So I suggest if you find any problem with working of Wolfson card please check your pogo pin connections are proper or not. Better use screw with the plastic piller which is mounted on Wolfson Card.

 

    Now once your Raspberry Pi rebooted with new kernel, you can play with Wolfson card. In this case Wolfson Audio Card will be having card 0 hardware address and bcm (default audio card) card will be having hardware address 1. So you can use this address in order to access respective card.

In order to set the Input/Output which you are going to use,Wolfson provided use case scripts which you can find in /home/pi/use_case_script. I tried Playback_to_Headset.sh, Playback_to_LineOut.sh, Playback_to_Speakers.sh to play audio out on headphone, line out and loudspeaker connectors respectively.

    you can play audio with following command

aplay -Dhw:0 -r 44100 -c 2 -f S32_LE <file>

 

    In order to record input from any input you can use

 

arecord -Dhw:0 -r 44100 -c 2 -f S32_LE <file>

In my implementation I am using DMIC input using above mentioned command when I play song from web browser.

 

Setting Raspberry Pi as Wifi Access Point-

   

    I refered Online resources for setting up this.

 

    Following are the steps to make Raspberry Pi as Wifi Access Point with WiPi Wifi Module

 

Install following demon to make it Access point and DHCP server so that it can provide IPs to connected devices

 

sudo apt-get update   

sudo apt-get install hostapd isc-dhcp-server

 

Setting up dhcp server configuration

    open DHCP configuration file to change settings

sudo vi /etc/dhcp/dhcpd.conf

then comment following lines

option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;

like this

#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;

Also find

#authoritative;

and remove comments from it (remove #).

    Then save file and exit from file.

 

Then run

sudo vi /etc/default/isc-dhcp-server

   

    and find INTERFACES="" and make it INTERFACES="wlan0" so that DHCP server will work on wlan interface.

 

Then run

sudo vi /etc/network/interfaces

and edit file

    Find auto wlan0  and comment it by adding # in front of it.

    Also comment following lines

#iface wlan0 inet static
    #wpa-roam /etc/wpa-supplicant/wpa_supplicant.conf
    #iface default inet dhcp
    and add following line after "auto wlan0" to set static IP to WLAN0 interface
    iface wlan0 inet static
    address 192.168.1.1
    netmask 255.255.255.0

Save and exit.

 

    sudo ifconfig wlan0 192.168.1.1 which will be AP and DHCP server address.

Now configure access Point details by creating new hostapd config file

sudo vi /etc/hostapd/hostapd.conf

    You can edit

ssid="yourid" and 
wpa_passphrase="yourpw"

as per your requirements.

    Also make

driver=nl80211

   

Save and exit.

 

    then open

sudo vi /etc/default/hostapd

find #DAEMON_CONF="" and uncomment and edit it to access hostapd.conf like DAEMON_CONF="/etc/hostapd/hostapd.conf".

 

    Then start both hostapd and DHCP server service.

   

sudo service hostapd start
sudo service isc-dhcp-server start

 

    Then you must be able to connect your mobile to Raspberry Pi.

 

Install Apache server and php on Raspberry Pi

    sudo apt-get update
    sudo apt-get install apache2 php5 libapache2-mod-php5

You can edit permissions and user groups from /etc/apache2/envvars

 

PHP script to play song and show lyrics placed under /var/www/ folder-

 

   

<html><body><h1>Raspberry Pi Karaoke Player!</h1>
</body></html>

<?php
    if (isset($_POST['Lyrics']))
    {
        echo file_get_contents( "lyrics.php" ); // get the contents, and echo it out.
    }
?>
<?php
    if (isset($_POST['button']))
    {
    
    echo 'Playing song';
    system('mplayer -vo null -ao alsa /home/pi/Karaoke/devashreeganesha.mp3 ');
    }
?>
<html>
<body>
    <form method="post">
    <p>
        <button name="button">Play Song</button>
    </p>
    </form>
</body>

<html>
<body>
    <form method="post">
    <p>
        <button name="Lyrics">Show Lyrics</button>
    </p>
    </form>
</body>

<?php
    if (isset($_POST['closebtn']))
    {
        echo 'closing song';
        system('killall mplayer');
    }
?>
<html>
<body>
    <form method="post">
    <p>
        <button name="closebtn">stop song</button>
    </p>
    </form>
</body>

       

 

 

 

I hope the implementation details I gave should be fine. I thought of implementing more but as time was short I couldnt. I will update same demo even after this challenge. Kindly let me know if I am missing something in here.

 

    Thanks Element14 for giving me such opportunity.

 

Thanks,

Shrenik Shikhare.

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube