Powered by coANDco UK

How to play a sound on a usb speaker on a Raspberry Pi

From How2s

Install Alsa

sudo apt-get install alsa-utils

Then you can use the following command to play a wav file

aplay -D default:CARD=Device cowbell.wav

You can change the volume by using the command

alsamixer -c 1

You can also use mpg123

apt-get install mpg123

to play mp3s. If you struggle to output them to the usb device, convert your files to wav using

mpg123 -w yourfile.wav yourfile.mp3


and then use aplay to push it to the usb device.

Please check out our sponsor, thanks to whom How2s.org is FREE: