mellowtigger: (penguin coder)
[personal profile] mellowtigger
This topic requires a post of its own because audio is mildly "broken" in the latest Raspbian image.

Raspbian uses ALSA (Advanced Linux Sound Architecture), and it comes with a standard "aplay" command to play audio files. You can try it yourself with audio files that are already installed. Telnet to your Raspberry Pi and try the following command.
sudo aplay /usr/share/sounds/alsa/Front_Center.wav
If your speakers are hooked up to your Pi, you probably heard the audio message. That success is encouraging, at least until you try to play some music files of your own. Suddenly, you find playback quite restrictive. Aplay is working only with audio files that are:
  1. stored with old .WAV or .AU file format,
  2. stored with integer (not floating point) values, and
  3. sampled with cd-quality resolution (such as 144,000 Hertz).
Those limitations severely cramp the utility of the Pi. I scanned a lot of forum posts that offered workarounds, but none of them worked for me. I'm a big fan of the VLC player on Windows, but even it was of no help on Raspbian. Some people found that a particular package added to the most recent Raspbian image is causing their problem. Removing it seems to be a useful improvement, at least for this current Raspbian release.
sudo apt-get --purge remove pulseaudio
Now let's download some audio files in other formats.
cd ~/Desktop
wget http://www.soundjay.com/nature/river-4.wav
wget http://www.soundjay.com/nature/river-4.mp3
If we try the standard Aplay program, we find that we can play other .wav files, but we still can't hear the .mp3 file. You can use Control-C to interrupt playback.
aplay river-4.wav
aplay river-4.mp3
We'll need to install a different program to play the .mp3 file. We find the opposite issue with this program; it plays .mp3 files but not .wav formats.
sudo apt-get install mpg321
mpg321 river-4.mp3
mpg321 river-4.wav
There's still a slight "pop" sound as the audio engages/disengages.  At least we have our playback options covered with these two programs together. We really need to get a single program that covers all the formats, with playlists, and with repeating loops. Until then, audio is less than "friendly" in the current Raspbian distribution.  I'm certain that better solutions will appear in future releases.

Profile

mellowtigger: (Default)
mellowtigger

June 2017

S M T W T F S
    123
45678910
1112 1314151617
18192021222324
252627282930 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 21st, 2017 12:57 am
Powered by Dreamwidth Studios