mrfarooq
Posts: 1
Joined: Wed Oct 05, 2016 1:58 pm

Raspberry Pi and Stereo Sound

Wed Oct 05, 2016 2:04 pm

I need some advice. I need to playback in a continuous loop a 15 second audio clip in stereo that is CD quality (44.1k 16 bit). Would Raspberry Pi be suitable for this application? Thanks.

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Raspberry Pi and Stereo Sound

Wed Oct 05, 2016 2:15 pm

Yes. Perhaps more difficult with the Compute Module, I'm not sure of its audio capabilities.

W. H. Heydt
Posts: 12783
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Raspberry Pi and Stereo Sound

Wed Oct 05, 2016 4:23 pm

Pi audio is done with PWM on GPIO pins. Check the documents for fully featured Pi boards (B, A+, B+, Pi2B, Pi3B) to see what GPIO pins are used. Then connect your audio output to them. Or, if you want to improve the audio quality, connect a DAC and feed that the audio in digital form.

fruitoftheloom
Posts: 23548
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Raspberry Pi and Stereo Sound

Wed Oct 05, 2016 6:35 pm

Rather than negativity think outside the box !
RPi 4B 4GB (SSD Boot) RaspiOS64 ARM64
Asus ChromeBox 3 Celeron is my other computer...

User avatar
karrika
Posts: 1125
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: Raspberry Pi and Stereo Sound

Thu Oct 06, 2016 12:04 pm

There is also a nice player called omxplayer.

omxplayer -o local --loop sound.mp3

The keyword "local" directs the sound to the GPIO pins you have chosen for audio instead of HDMI.

You may want to create a dt blob with the correct audio pin settings. I have an example at discohat.com/miscap.

Code: Select all

    /* Audio */

    fragment@5 {
      target = <&audio_pins>;
      __overlay__ {
        brcm,pins = <12 13>;
        brcm,function = <4>; /* alt0 */
      };
    };

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1564
Joined: Sat Sep 10, 2011 11:43 am

Re: Raspberry Pi and Stereo Sound

Thu Oct 06, 2016 12:08 pm

If you use audio_pwm_mode=2 then you'll get CD quality audio out...
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

Return to “Compute Module”