Welcome! Log In Create A New Profile

Advanced

USB sound - scratchy [ SOLVED ]

Posted by petergunn 
Re: USB sound - scratchy [ SOLVED ]
December 16, 2010 04:03AM
Peter
What could be cool would be to use a keyboard to control internet radio stations. Maybe a combo key would be "key" to launch the program and all the keys would be different stations.
If we could set it up so no LCD is needed , anybody could just assign different keys to their favorite stations. With a couple of keys for volume and other stuff.

So we turn on dockstar. Plug in keyboard and press control F1 and it would be in internet radio mode. Then all 50 keys would be different stations. :)
Re: USB sound - scratchy [ SOLVED ]
December 16, 2010 05:17AM
rgtaa Wrote:
-------------------------------------------------------
> Peter
> What could be cool would be to use a keyboard to
> control internet radio stations.

Hmmm... st2205term already has all the code necessary to read the keyboard and interpret the keycodes and with the right config it should work with cheap keypads. I could either get st2205term to do things (run scripts etc.) when keys are pressed even if there is no screen, or I could separate out the keyboard code into a different application.

A web based interface might be more useful though - that would allow control from other PCs, tablets, and phones.

-PG
rat
Re: USB sound - scratchy [ SOLVED ]
December 16, 2010 07:55PM
petergunn Wrote:
-------------------------------------------------------
>A web based interface might be more useful though - that would allow control from other PCs, tablets, and phones.

*spooge*

Dude.

Oh. Man. That would be SO awesome.
Re: USB sound - scratchy [ SOLVED ]
December 17, 2010 08:10AM
Run mpd with some web interface, there are plenty to choose from. For keyboard this: http://forum.doozan.com/read.php?2,2471 coupled with mpc should do the trick.
Re: USB sound - scratchy [ SOLVED ]
December 19, 2010 06:48PM
Something odd going on with my dockstar after installing MPD... The install seemed ok - but I got this message at the very end of the install of MPD...

...
Starting Music Player Daemon: mpdcreating /var/lib/mpd/tag_cache... (warning).
...


The later today i noticed the following when I did an 'lsusb' command...


root@debian:~# lsusb
lsusb: cannot open "/var/lib/usbutils/usb.ids", Not a directory
Bus 001 Device 004: ID 0d8c:0103  
Bus 001 Device 003: ID 0951:1603  
Bus 001 Device 002: ID 05e3:0608  
Bus 001 Device 001: ID 1d6b:0002  
root@debian:~# apt-get update
E: Archives directory /var/cache/apt/archives/partial is missing. - Acquire (2: No such file or directory)
W: Not using locking for read only lock file /var/lib/dpkg/lock
root@debian:~# cd /var/lib/dbkg/
-bash: cd: /var/lib/dbkg/: No such file or directory
root@debian:~# cd /var/lib/
root@debian:/var/lib# ls -la
ls: usbutils: Input/output error
ls: alsa: Input/output error
ls: ucf: Input/output error
ls: x11: Input/output error
ls: mplayer: Input/output error

So, it looks like something has caused 'usbutils' a problem AND 'apt-get' seems messed up too.

... not sure what the 'Input/out error' messages are all about...

Anybody have any ideas what might be going on???

Thanks,

- Ray



Edited 2 time(s). Last edit at 12/19/2010 09:44PM by sandbasser.
Re: USB sound - scratchy [ SOLVED ]
December 20, 2010 10:18AM
I'm sort of hoping Peter will post a "copy and paste" of a MPD server and client program all set up for us that WORKS! (with auto start) :) ... that we can control from our PC or monitor attached to dockstar. That would be cool.

Peter seems to be able to figure this stuff out "on the fly".

If someone else can get MPD server and client program figured out that WORKS, maybe you can beat Peter to it, and post some sort of copy and paste apt-get type stuff and help us with setting it up to auto-start and web interface help.

We are trying to figure out cool stuff to use our audio tongles for on the dockstar.

Also, still looking for ready made internet Radio program, where it has hundreds of stations and we just choose them at root access with numbers or letters. Peter figured out iradio for us, but only 5 of those stations work, but the menu program is there. I am just still a newbie at linux so I generally need some type of copy and paste still.
Re: USB sound - scratchy [ SOLVED ]
December 22, 2010 08:05AM
I think mpd almost works out of the box with the default config? But not sure, I am using plugbox and had to do some small changes. Any mpd client will do.

Got a setup like this: http://www.youtube.com/watch?v=yxttHqXoH6Q
Just using and ipod touch with mpod and a lcd displaying the information with lcd4linux.

Google a guide for mpd on debian. The only thing to keep in mind is to choose a fast resampling method if you are using a cheap usb soundcard that does not support 44.1 khz audio.
Re: USB sound - scratchy [ SOLVED ]
January 04, 2011 06:40PM
Just for the record this works on what I'll guess is the cheaper one PG referred to:
lsusb shows:

Bus 001 Device 004: ID 1267:0a01 Logic3 / SpectraVideo plc
Which I'm going to guess is it. Back of the plug says:
Model PD552
USB 3d sound

I looked over my own config and was on a similar path but the asound.conf is what did it.

Thanks PG

btw: two stations for fun...

whrv main station
sudo mplayer http://64.5.130.41

whrv big band old time radio 20s etc.
sudo mplayer http://64.5.130.43



Edited 2 time(s). Last edit at 01/04/2011 08:02PM by gzader.
Re: USB sound - scratchy [ SOLVED ]
January 14, 2011 11:28AM
Hey Everyone,

Thanks for sharing the tips for getting USB sound up and running. I've recently installed MOC (music on console) which is a lightweight but full-featured console-based music player. Seems to work really well with the Dockstar and the $2 USB audio adapter that petergunn suggested.

To install:
apt-get install moc

To run:
mocp

I find that using MOC is pretty intuitive but if you'd like to quickly view the available commands and key mappings, just press "h"

Note: to control the volume, press "x" to toggle the mixer channel and then use the following keys:
<              Decrease volume by 1%
>              Increase volume by 1%
,              Decrease volume by 5%
.              Increase volume by 5%

Note: If you haven't already done so, you'll also need to install alsa:
apt-get install alsa-base alsaplayer alsaplayer-text alsa-utils

Also, you'll want to follow petergunn's fix for the scratchy sound and to ensure the USB card is recognized after reboot.
truxntrax
Re: USB sound - scratchy [ SOLVED ]
January 20, 2011 02:21PM
I'm having problems getting my audio to work on my dockstar. Bought a cheap USB audio device:

any help would be hugely appreciated - here are the outputs of the commands you asked others to try:


root@debian:/home# lsusb
Bus 001 Device 006: ID 0c76:1607 JMTek, LLC. audio controller


root@debian:/home# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 1: Set [USB Headphone Set], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0


root@debian:/home# for x in /proc/asound/{version,cards,devices,timers,pcm}; do echo $x:; cat $x; done
/proc/asound/version:
Advanced Linux Sound Architecture Driver Version 1.0.21.
/proc/asound/cards:
1 [Set ]: USB-Audio - USB Headphone Set
USB Headphone Set at usb-orion-ehci.0-1.4, full speed
/proc/asound/devices:
2: : timer
3: : sequencer
4: [ 1- 0]: digital audio playback
5: [ 1- 0]: digital audio capture
6: [ 1] : control
/proc/asound/timers:
G0: system timer : 10000.000us (10000000 ticks)
P1-0-0: PCM playback 1-0-0 : SLAVE
P1-0-1: PCM capture 1-0-1 : SLAVE
/proc/asound/pcm:
01-00: USB Audio : USB Audio : playback 1 : capture 1
root@debian:/home#

No luck in playing any audio:

root@debian:/home# alsaplayer http://www.moviesoundscentral.com/sounds/harry_potter/urscary.wav
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_card_driver returned error: No such device
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_concat returned error: No such device
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_refer returned error: No such device
ALSA lib conf.c:4649:(snd_config_expand) Evaluate error: No such device
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM default
snd_pcm_open: No such device (default)
Failed to initialize plugin!
Failed to register plugin: /usr/lib/alsaplayer/output/libalsa_out.so
Failed to load output plugin "alsa". Trying defaults.
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_card_driver returned error: No such device
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_concat returned error: No such device
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_refer returned error: No such device
ALSA lib conf.c:4649:(snd_config_expand) Evaluate error: No such device
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM default
snd_pcm_open: No such device (default)
Failed to initialize plugin!
/usr/lib/alsaplayer/output/libalsa_out.so failed to load
NOTE: THIS IS THE NULL PLUGIN. YOU WILL NOT HEAR SOUND!!

Thanks for your kind assistance

Trux
Re: USB sound - scratchy [ SOLVED ]
January 20, 2011 08:43PM
Hi Trux, have a look at my earlier post

You need the following in /etc/modprobe.d/alsa-base.conf to make sure adapter is loaded as card '0' after reboot
# Allow snd-usb-audio to be loaded as first soundcard
options snd-usb-audio index=0
-PG



Edited 1 time(s). Last edit at 01/20/2011 08:44PM by petergunn.
truxntrax
Re: USB sound - scratchy [ SOLVED ]
January 21, 2011 06:02AM
Many thanks Peter - I had read this but didn't know it was appropriate to my set up. I'll give this a go.
Re: USB sound - scratchy [ SOLVED ]
January 21, 2011 06:10AM
Truxntrax, I think you have exactly the same adapter I do (although it will work for must usb adapters). You should just be able replicate the config exactly.

-PG
TEN
Re: VFD (cashier's display) via lcdproc
February 13, 2011 06:28PM
Quote
TEN
Quote
rgtaa
use the 5 dollar lcd
Another good idea might be to use a cashier's display via lcdproc (newer version than in Debian repository needs to be built for this particular model as well as its 4-line sibling BA66) as per http://vdr-portal.de/board/thread.php?postid=961264#post961264 - they have the advantage of being huge and easily readable at quite an angle even from several meters away (follow links for further images). The smarthome server silently sitting on top of a wardrobe... is real.
It has been accomplished, using lcdproc-0.5.3 (please package as this takes some effort to compile) for an NCID client interfacing with the PBX to display incoming phone calls and the respective caller names (replace +49 with your country code):
#!/bin/bash

FIFO=/tmp/test_fifo_0815
FIFO2=/tmp/test_fifo_0816

LCDproc_HOST=localhost
LCDproc_PORT=13666

HDD_HOST=192.168.2.1
HDD_PORT=3333

mkfifo $FIFO
# contrived by SHF on http://vdr-portal.de/board/thread.php?postid=979080 to establish background connection
( trap "rm -f $FIFO" EXIT HUP INT TERM ABRT ; netcat $LCDproc_HOST $LCDproc_PORT <>$FIFO ; rm -f $FIFO ) &
# from this day onward anything sent into $FIFO will serve us, erm, be served to a Borg-droned LCDproc port

echo -e 'hello' >$FIFO
echo -e 'client_set -name name' >$FIFO

sleep 2

mkfifo $FIFO2
( trap "rm -f $FIFO2" EXIT HUP INT TERM ABRT ; netcat $HDD_HOST $HDD_PORT >$FIFO2 ; rm -f $FIFO2 ) &
# all lines received from the NCID server are assimilated into $FIFO2 (resistance is futile, those not starting by CID: are irrelevant)

while read -s <$FIFO2
do 
        if [ ${REPLY:0:4} = "CID:" ]; then 
                echo -e 'screen_add CallerID\nscreen_set CallerID -priority alert -timeout 240' >$FIFO
                echo -e 'widget_add CallerID Number scroller\nwidget_add CallerID Name scroller' >$FIFO
                Number=`echo $REPLY |grep -m 1 ^CID:|cut -d"*" -f 9|sed s/^00/+/|sed s/^0/\+49/`
                echo $Number
                echo -e "widget_set CallerID Number 1 1 20 1 m 2 \"$Number \"" >$FIFO
                Name=`grep $Number ~/Callers.txt|cut -d";" -f 2`
                echo $Name
                echo -e "widget_set CallerID Name 1 2 20 2 m 2 \"$Name \"" >$FIFO
        fi
done
Used with a streaming music player, one might think of it as a "poor man's Roku tube"...
Finding out which USB speakers are supported by debianized DockStars sounds like yet another promising project.

And if you want a wakeup message (use your allusion but be sure off W.O.P.R. if your GF/SO is visiting, unless she's a geek girl of course ;)) from your DockStar's /etc/crontab in addition to a few irsend commands:
echo -e 'hello\nscreen_add Greetings\nscreen_set Greetings -priority alert -timeout 720\nwidget_add Greetings Line1 scroller\nwidget_add Greetings Line2 scroller\nwidget_set Greetings Line1 1 1 20 1 m 2 "Good morning Dr Falken. "\nwidget_set Greetings Line2 1 2 20 2 m 2 "How about a game of Global Thermonuclear War? "'|nc localhost 13666 -w 14

The next step for anyone running out of USBs might be to repurpose the interal serial port to drive an LCD/VFD:
Quote
TEN
Of course I know the DockStar has an internal serial port that interfaces nicely with half an Xbox 360 DVD power cable, but I haven't pried open mine just yet.
Re: USB sound - scratchy [ SOLVED ]
March 11, 2011 03:22AM
--Posted Issue in new Thread. Do not want to hijack this thread.



Edited 1 time(s). Last edit at 03/11/2011 04:47AM by BigRon.
Re: USB sound - scratchy
March 14, 2011 12:50PM
Hi Peter,
I don't get why you set rate to 50000. Wouldn't 44100 or 48000 make more sense?
Anyway I set ist to 44100 so I don't have to do sample conversion on my Terratec Areon Dual USB.
Is it normal to still have 25% CPU when playing mp3 files?

Edit: mplayer take 25%, mpg123 take 3-4%

petergunn Wrote:
-------------------------------------------------------
> I created the following /etc/asound.conf file:
>
> pcm.!default {
> type plug
> slave.pcm "softvol"
> }
> pcm.dmixer {
> type dmix
> ipc_key 1024
> slave {
> pcm "hw:0"
> period_time 0
> period_size 4096
> buffer_size 131072
> rate 50000
> }
>....



Edited 1 time(s). Last edit at 03/14/2011 01:05PM by bandan.
Re: USB sound - scratchy
March 14, 2011 02:34PM
No specific reason for the 50k number. I think I tried 44k and my adapter didn't like it so I just guessed at 50k and it seemed to work so I kept it. 48k probably makes more sense. :-)

-PG
Re: USB sound - scratchy
May 10, 2011 03:24PM
Hi petergunn, thanks for sharing your config!

-- Just feedback. Maybe someone got the same Problem. --

I've got mpd running on my dockstar with this cheap soundcard: http://images.google.com/images?q=1130:f211+tenx+sound
root@dockstar ~ # lsusb -d 1130:f211
Bus 001 Device 037: ID 1130:f211 Tenx Technology, Inc. TP6911 Audio Headset

I used the alsa - asound.conf settings from petergunn, which can be found here.
Quote
petergunn - December 03, 2010 06:13PM
Fixed it! I used the alsa "softvol" feature and bumped up the buffer sizes from a config I found on the net:
I created the following /etc/asound.conf file:
[...]


Additionally, i had to change the mixer_control in /etc/mpd.conf from PCM to Master, because:
  • Using PCM (the default) as mixer control, the volume did not change in the range from 8%-100% (stayed at full volume).
  • Lowering it, the volume suddenly goes to zero somewhere between 8% and 7%(, so 0%-7% equals mute).
With the following lines in /etc/mpd.conf, the volume can now be set from within mpd:
audio_output {
        type            "alsa"
        name            "My ALSA Device"
#       mixer_control   "PCM"
        mixer_control   "Master"
}

You can get the right name for the mixer_control from:
root@dockstar ~ # amixer | grep control
Simple mixer control 'Master',0
Simple mixer control 'PCM',0
Simple mixer control 'Mic',0
or simply by starting alsamixer and testing which control regulates the volume correctly.
Ralphy
Re: USB sound - scratchy [ SOLVED ]
August 23, 2011 06:48AM
The softvol hack only masks the real issue. My dockstar still had a slight hint of static using it.

You need to rebuild the usb-snd modules disabling mmap support by commenting out SNDRV_PCM_INFO_MMAP* in snd_usb_hardware info field in sound/usb/pcm.c.

--- linux-2.6.38.8/sound/usb/pcm.c.orig 2011-06-02 21:35:11.000000000 -0400
+++ linux-2.6.38.8/sound/usb/pcm.c      2011-08-21 12:10:44.000000000 -0400
@@ -423,8 +423,8 @@
 
 static struct snd_pcm_hardware snd_usb_hardware =
 {
-       .info =                 SNDRV_PCM_INFO_MMAP |
-                               SNDRV_PCM_INFO_MMAP_VALID |
+       .info =                 /* SNDRV_PCM_INFO_MMAP | */
+                               /* SNDRV_PCM_INFO_MMAP_VALID | */
                                SNDRV_PCM_INFO_BATCH |
                                SNDRV_PCM_INFO_INTERLEAVED |
                                SNDRV_PCM_INFO_BLOCK_TRANSFER |

The downside to this fix is that you can no longer use dmix and need to disable it by commenting out this line from /usr/share/alsa/alsa/conf as the default ALSA device uses dmix by default.
--- /usr/share/alsa/alsa.conf.orig      2011-08-23 11:45:12.000000000 +0000
+++ /usr/share/alsa/alsa.conf   2011-08-21 20:02:28.000000000 +0000
@@ -129,7 +129,7 @@
 pcm.iec958 cards.pcm.iec958
 pcm.spdif iec958
 pcm.hdmi cards.pcm.hdmi
-pcm.dmix cards.pcm.dmix
+# pcm.dmix cards.pcm.dmix
 pcm.dsnoop cards.pcm.dsnoop
 pcm.modem cards.pcm.modem
 pcm.phoneline cards.pcm.phoneline
Treblig
Re: USB sound - scratchy [ SOLVED ]
November 12, 2011 08:36AM
I got a cheap "USB EXTERNAL 3D VIRTUAL 5.1 CHANNEL AUDIO PC SOUND CARD" from ebay UK
lsusb says : ID 0d8c:000e C-Media Electronics, Inc. Audio Adapter (Planet UP-100, Genius G-Talk)
Dockstar is running Shyd's 2.6.38 Debian off a 500 Go USB ext3 HDD .

I installed it according to petergunn instructions on page one and it works fine.

If anyone is interested in Chinese web radios, here are a few ones that I use in the iradio bash script mentionned on page 1 of this topic:
stations=(\
'0 - Love China - Chinese Hits - www.facebook.com/lovechinaradio' \
'mplayer -ao alsa -msgcolor -cache 128 -playlist http://yp.shoutcast.com/sbin/tunein-station.pls?id=1272577'; \
'1 - CPOP @ Big B Radio - www.facebook.com/BigBRadio143' \
'mplayer -ao alsa -msgcolor -cache 128 -playlist http://yp.shoutcast.com/sbin/tunein-station.pls?id=2128261'; \
'2 - Big B Radio - Asian Pop: JPOP, KPOP, CPOP, ... - www.facebook.com/BigBRadio143' \
'mplayer -ao alsa -msgcolor -cache 128 -playlist http://yp.shoutcast.com/sbin/tunein-station.pls?id=2047934'; \
'3 - On Air Power - Hong Kong 24hrs Chinese Web Radio - www.onairpower.com' \
'mplayer -ao alsa -msgcolor -cache 128 -playlist http://yp.shoutcast.com/sbin/tunein-station.pls?id=234733'; \
'4 - 1hk - Hong Kong, Taiwan, English music - www.1hk.net' \
'mplayer -ao alsa -msgcolor -cache 128 -playlist http://yp.shoutcast.com/sbin/tunein-station.pls?id=378610'; \
)

There's a mix of Mandarin, Cantonese, Hong Kongese. My interest is Mandarin but I could not find the streaming addresses of many such web radios (there must be some soft to "trap" theses addresses). I did not find any "News" channels either.

Thanks to Peter for the easy-to-follow instructions.
luttan
ALSA And MPD
September 12, 2012 04:45AM
thanks
/etc/asound.conf made the trick

luttan
Author:

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: