Page 1 of 1

Raspberry Pi and Stereo Sound

Posted: Wed Oct 05, 2016 2:04 pm
by mrfarooq
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.

Re: Raspberry Pi and Stereo Sound

Posted: Wed Oct 05, 2016 2:15 pm
by Douglas6
Yes. Perhaps more difficult with the Compute Module, I'm not sure of its audio capabilities.

Re: Raspberry Pi and Stereo Sound

Posted: Wed Oct 05, 2016 4:23 pm
by W. H. Heydt
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.

Re: Raspberry Pi and Stereo Sound

Posted: Wed Oct 05, 2016 6:35 pm
by fruitoftheloom

Re: Raspberry Pi and Stereo Sound

Posted: Thu Oct 06, 2016 12:04 pm
by karrika
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 */
      };
    };

Re: Raspberry Pi and Stereo Sound

Posted: Thu Oct 06, 2016 12:08 pm
by gsh
If you use audio_pwm_mode=2 then you'll get CD quality audio out...