JMTek USB Soundcard - no sound


9 posts
by StevenP » Mon Oct 29, 2012 1:59 pm
I bought a cheap (5 pounds) USB soundcard from Amazon (PC-Trading). I did the standard changes to /etc/modprobe.d/alsa-base.conf to select the USB card instead of the standard bcm2835 ALSA. With command: aplay -l
I get
**** List of PLAYBACK Hardware Devices ****
card 0: Set [USB Headphone Set], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1

which looks healthy. Command: lsusb gives
Bus 001 Device 005: ID 0c76:1607 JMTek, LLC. audio controller


At booting, I get:
usbcore:registered new interface driver snd-usb-audio

Command: alsamixer lets me set volume on the usb soundcard (in theory in any case) but I just never get any sound from the device. I have tried playing mp3s using omxplayer or mpd/mpc internet radio and epseak text to speech.

Has anyone used this USB JMTek, LLC. soundcard successfully on the PI/Raspbian distribution? Any ideas what to try next? Thanks!
User avatar
Posts: 30
Joined: Tue Aug 14, 2012 7:55 pm
Location: Germany / UK
by StevenP » Tue Oct 30, 2012 7:33 pm
OK, it's not looking hopeful for my cheap soundcard then...

I am thinking of buying a Creative Play USB Soundcard as a replacement since it's on the Wiki compatible hardware list and also gets good audio quality reviews. Does anyone have a good experience on the Pi with the Creative Play USB?
Cheers.
User avatar
Posts: 30
Joined: Tue Aug 14, 2012 7:55 pm
Location: Germany / UK
by ktuomain » Sun Nov 04, 2012 8:38 pm
OK, it's not looking hopeful for my cheap soundcard then...


Don't give up so soon. Have you tried explicitly specifying the name of the card when playing something?

I modified /etc/modprobe.d/alsa-base.conf file (perhaps not correctly) and although I could see my USB card (Terratec Aureon Dual USB, which is on the verified peripherals list) on alsamixer, I couldn't hear any sound on speakers - using USB sound card or built in 3.5 mm plug on Raspberry Pi.

Then I run command "aplay -L" and got following list of devices:

Code: Select all
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    Playback/recording through the PulseAudio sound server
sysdefault:CARD=Device
    USB PnP Sound Device, USB Audio
    Default Audio Device
front:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Front speakers
surround40:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device


I was then finally able to hear sound using USB sound card by using following command (I copied the line from that listing as a device name and I have noticed than on some other USB cards that line is not exactly same):

Code: Select all
aplay /usr/share/sounds/alsa/Front_Center.wav -D sysdefault:CARD=Device


I then tried playing some mp3 files using mpg123 and specifying the same device, but the sound was terrible and had cracking noises and sounded quite corrupted:

Code: Select all
mpg123 -a sysdefault:CARD=Device   *.mp3


Then I noticed that if I specified following device when playing mp3 files, the sound was fine:

Code: Select all
mpg123 -a front:CARD=Device,DEV=0 *.mp3


I recommend that you try "aplay -L" command and then try playing sound files by using several different devices on that list with aplay or mpg123, like I did. Maybe then you will be able to get it work.
Posts: 1
Joined: Sun Nov 04, 2012 8:11 pm
by kyelo » Mon Nov 05, 2012 1:44 am
Do you have an /etc/asound.conf?

If so, what does it look like?
Posts: 64
Joined: Sun Oct 23, 2011 6:31 pm
by HanlonsRazor » Fri Nov 09, 2012 6:58 pm
StevenP wrote:Has anyone used this USB JMTek, LLC. soundcard successfully on the PI/Raspbian distribution? Any ideas what to try next? Thanks!

Hi Steven,
I'm listening to music through this exact device, via mpd, on my pi right now.
I'm using raspberrypi 3.2.27+ #244 PREEMPT Sat Oct 6 17:26:38 BST 2012 armv6l GNU/Linux.

I didn't actually change anything in /etc/asound.conf to get it to work. When I booted up, the card showed up in lsusb, and in "aplay -l" just like yours. The only difference was that mine shows up as "card 1". I have the device plugged directly into the pi. I don't have a keyboard / mouse attached right now (just using ssh), and the pi seems to be OK with the the power load (I'm using the 5.25V 1A power supply from Adafruit, ID: 501).

All I did to make it work with mpd was to edit /etc/mpd.conf. I changed the audio_output configuration:

Code: Select all
audio_output {
        type            "alsa"
        name            "My ALSA Device"
#       device          "hw:0,0"        # original
        device          "hw:1,0"        # point to JMTek USB card
        format          "44100:16:2"    # optional
        mixer_device    "default"       # optional
        mixer_control   "PCM"           # optional
        mixer_index     "0"             # optional
}

I switched it to "hw:1,0" because my JMTek shows up as "card 1" in "aplay -l". If yours is showing up as card 0, then I expect you'd want to leave it at "hw:0,0".
At that point mpd was working - sound was coming out of the analog out. Unfortunately, when playing music through mpd, the pi became quite slow, and the music playback would crash after a while (mpd would become unresponsive). When I had a keyboard attached, I started having problems typing (it would lose keystrokes!) I did some digging around and noticed that the "rsyslogd" process was chewing up cycles at an alarming rate. There was a lot (like 41,000 lines) of this being dumped into /var/log/syslog:
Code: Select all
Nov  9 16:48:38 raspberrypi kernel: [ 1624.632885] delay: estimated 0, actual 144
Nov  9 16:48:38 raspberrypi kernel: [ 1624.640881] delay: estimated 0, actual 144
...

I found this thread http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=15204 titled 'MPD filling kern.log with "delay: estimated 0, actual xxx"' that suggested to change the "nrpacks" option for the snd-usb-audio driver by adding:
Code: Select all
options snd-usb-audio nrpacks=1

This setting limits how many packets the driver will send to the device during an interrupt. After rebooting, it seemed much better / stable and the syslog messages stopped. Even so, the load average was still high. I assumed that the more packets it can send in an interrupt, the more efficient it would be, so I tried bumping nrpacks up a bit. It seems to work OK if I increase it to 3, but when I try 4 I get the delay messages again. I can't say for sure if raising it to 3 had any positive effect, but at least it hasn't had a negative effect, so I'm leaving it there for now. The mpd process is hovering around 30% CPU in top, and the load average is about 1.40, but everything seems stable / responsive. I'm pulling my music files over a SMB/CIFS mount, so I'm sure that adds to the work it has to do.
I haven't tried to get any audio input functions to work at this point. If you have any questions, I'd be happy to post any of the config files - but I assure you, they're essentially the stock raspbian files.

Russ
(HanlonsRazor)
Posts: 4
Joined: Fri Nov 09, 2012 5:32 pm
by HanlonsRazor » Sat Nov 10, 2012 7:10 pm
Just after posting this yesterday, I realized the volume wasn't working, because I'd forgotten to change the mixer_device. Here's the final /etc/mpd.conf:
Code: Select all
audio_output {
        type            "alsa"
        name            "My ALSA Device"
#       device          "hw:0,0"        # original
        device          "hw:1,0"        # point to JMTek USB card
        format          "44100:16:2"    # optional
#       mixer_device    "default"       # original
        mixer_device    "hw:1"       # point to JMTek USB card
        mixer_control   "PCM"           # optional
        mixer_index     "0"             # optional
}

Now when I bring up MPDroid on my phone, or mPod on my iPad, moving the volume slider works as expected.
Posts: 4
Joined: Fri Nov 09, 2012 5:32 pm
by HanlonsRazor » Thu Nov 22, 2012 7:33 am
Just a side note - I was getting an annoying interference in the sound from this setup, so I moved the JMTek adapter to a powered USB hub. My Pi revision has the fuses replaced w/ 0 ohm links, so the hub can back power the Pi through the USB port. After I did that, the ticking in the audio went away. I might eventually spring for a sound adapter that does S/PDIF, but I'm pretty happy with what I was able to throw together using leftover parts. Now, to get another Pi for another project!
Posts: 4
Joined: Fri Nov 09, 2012 5:32 pm
by StevenP » Sun Dec 02, 2012 8:24 pm
Many thanks to everyone with the tips and help. I actually ordered a Creative Play! USB soundcard for 8 Euro from Ebay before I got any replies . Anyway I had exactly the same lack of sound problem as with the JKTek so I needed to use all the advice I had been given to get that working too!

I also did two additional things which helped me. The first was to remove the driver for onboard sound by editing the file '/etc/modules' to comment out the 'snd_bcm2835' line, i.e:
#snd_bcm2835

The second thing I tried which helped a lot was completely deleting file '/etc/asound.conf'. I read in the ALSA documentation that you don't need the file for ALSA sound to work. I had tried lots of different configurations but I think most of them were actually stopping sound. After deleting, sound just worked!

The sound from the Creative Play! is excellent by the way, much better than the JMTek, and I would recommend it to anyone who wants good sound.

I was a little disappointed with the audio quality from MPD (I use it for internet radio) at first but simply increasing the buffer size the sound is now surprisingly good. I will probably open a new topic to discuss MPD audio tuning as I have got a few more ideas I want to try yet.
Thanks again for the help - my internet radio project is working great - just need a nice wooden box to house it all now - any ideas? :)
User avatar
Posts: 30
Joined: Tue Aug 14, 2012 7:55 pm
Location: Germany / UK
by HanlonsRazor » Sat Dec 15, 2012 2:26 pm
Sorry, no ideas there. Though, if you're going wood, the sky's the limit. Plane some thin pieces of hardwood, glue, route/carve out a cavity, drill holes for wires, LEDs and a little airflow, sand, finish... It could look anywhere from a beat up 2x4" to functional fine furniture. If it turns out like fine furniture, post up some plans & pics on the Cases forum!
Posts: 4
Joined: Fri Nov 09, 2012 5:32 pm