Welcome! Log In Create A New Profile

Advanced

Add sound to the dumb linux boxes so it can do alarm, etc...

Posted by daviddyer 
Add sound to the dumb linux boxes so it can do alarm, etc...
December 01, 2020 01:52PM
Yesterday, I ordered a usb sound card at newegg for $1.80 shipped. It was RCAC-17001. Newegg changed the price to $29.99 today, but it is easy to find a cheap replacement on eBay, such as item 193156653105. I guess they were from the same factory. :P

I got one of these long time ago from newegg for free after rebate. Just added it to my dockstar so this dumb box can have sound. :P

Here are the steps.

0 Update uboot, get debian file system running. I just used Bodhi's Debian-5.2.9-mvebu-tld-1-rootfs-bodhi.tar.bz2. Login as root to do all these steps.

1 apt-get update
apt-get upgrade
apt-get install mpg123 alsa-utils

2 Insert the sound card to the usb, run dmesg, you should see some info

[  165.543475] usb 1-1.4: new full-speed USB device number 3 using orion-ehci
[  165.697551] usb 1-1.4: New USB device found, idVendor=1b3f, idProduct=2008, bcdDevice= 1.00
[  165.706678] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  165.715062] usb 1-1.4: Product: USB Audio Device
[  165.720405] usb 1-1.4: Manufacturer: GeneralPlus
[  165.796265] media: Linux media interface: v0.10
[  165.805142] input: GeneralPlus USB Audio Device as /devices/platform/ocp@f1000000/f1050000.ehci/usb1/1-1/1-1.4/1-1.4:1.3/0003:1B3F:2008.0001/input/input0
[  165.885289] hid-generic 0003:1B3F:2008.0001: input,hidraw0: USB HID v2.01 Device [GeneralPlus USB Audio Device] on usb-f1050000.ehci-1.4/input3
[  165.916825] usbcore: registered new interface driver usbhid
[  165.923134] usbhid: USB HID core driver
[  165.950098] usbcore: registered new interface driver snd-usb-audio

3 run cat /proc/asound/cards

you should get something like

 1 [Device         ]: USB-Audio - USB Audio Device
                      GeneralPlus USB Audio Device at usb-f1050000.ehci-1.4, full speed

This card is # 1.

So create asound.conf file in /etc/. Content of asound.conf file

defaults.pcm.card 1
defaults.ctl.card 1

Save it.

4 Get speaker ready, connect the speaker to the usb sound card, get the mp3 file, run

mpg123 mp3filename

To adjust volume, we can use amixer or alsamixer, or use the up / down button of the usb sound card, or use the volume control on your speaker.

5 Allow normal user "pi" to use the sound card : add pi to audio group

use root or sudo to run

usermod -a -G audio pi


Done...

Now your dockstar can be an alarm clock ... :P

You guys who have the M300 which needs a usb device for assisted SATA booting, try adding this card to see if it works. :P

I added a MP3 file for you to test.



Edited 7 time(s). Last edit at 12/02/2020 10:00AM by daviddyer.
Attachments:
open | download - test_file.mp3 (18.1 KB)
Re: Add sound to the dumb linux boxes so it can do alarm, etc...
December 01, 2020 04:54PM
Thanks! I've been thinking of something like this for a while, so why not? I just ordered 2 off of ebay. I'll let you know how it goes when I get them in 1 to 3 months. :-)
Re: Add sound to the dumb linux boxes so it can do alarm, etc...
December 01, 2020 08:02PM
Very nice added functionality for $2 :))

Will add to the Wiki.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Add sound to the dumb linux boxes so it can do alarm, etc...
December 01, 2020 08:07PM
David,

Install alsa-utils, and use amixer to control this sound card.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Add sound to the dumb linux boxes so it can do alarm, etc...
December 01, 2020 09:36PM
Updated. Added alsa-utils, amixer.

Added a MP3 file for fun.
Re: Add sound to the dumb linux boxes so it can do alarm, etc...
December 01, 2020 11:42PM
Added to the Wiki.

Quote

Media Streaming

OpenMediaVault
Debian Stretch and OMV4
Streaming music from Kirkwood plugs to IOS devices via WiFi
Create Your Own In-Home Radio Station Using a Pogoplug Mobile
Install Logitech Media Server on Debian wheezy
Install Logitech Media Server on Debian jessie
Install Logitech Media Server with nightly build (WIP)
Plex media server on PogoPlug
Airplay on a Pogoplug
Add USB sound card

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Add sound to the dumb linux boxes so it can do alarm, etc...
January 23, 2021 03:18AM
I got mine today. It only took 2 months. :-)

It may be a slightly different device:
cat /proc/asound/cards
 1 [Device         ]: USB-Audio - USB PnP Sound Device
                      C-Media Electronics Inc. USB PnP Sound Device at usb-f1050000.ehci-1.4, full sp

I followed David's instructions and it just works! The mute and volume buttons don't seem to do anything, but I'm not concerned about that. I can use alsamixer to set the volume.

I've been playing with gTTS (Google text to speech) and espeak.
pip install gTTS
apt-get install espeak

I already have my Dockstar sending me text messages when certain things happen so I'm thinking of having it announce them as well.

espeak is faster than gTTS, but it only creates WAV files, so they'd have to be converted to MP3 to use mpg123. gTTS can be used as is:
gtts-cli "hello" | mpg123 -

Thanks for letting us know about these cheap devices!
-JT
Re: Add sound to the dumb linux boxes so it can do alarm, etc...
January 23, 2021 03:31PM
JT,


Quote

I've been playing with gTTS (Google text to speech) and espeak.
pip install gTTS
apt-get install espeak

I already have my Dockstar sending me text messages when certain things happen so I'm thinking of having it announce them as well.

Cool! let us know how well this work.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: