Arduino Forum

Products => Arduino Yún => Topic started by: smakson on Feb 09, 2014, 08:40 pm

Title: Sound quality issues with USB audio devices
Post by: smakson on Feb 09, 2014, 08:40 pm
I just got a Yun and CMedia USB audio adapter to replace the Uno + mp3 shield I have been using to playback MP3s.  I can playback files with madplay and aplay but the sound has lots of clicks and added noise.  I've tried two different usb audio adapters with similar results, although both sound fine when plugged into my laptop.  Others seem to be able fix this problem by adjusting their ALSA configurations, but that has not worked for me.

Has anyone else experienced poor sound quality form the Yun?
Title: Re: Sound quality issues with USB audio devices
Post by: desordenado on Feb 10, 2014, 11:41 am
I had audio noise issues, but solved those with ALSA configurations. Info on that here (it also explains how to install mpg123):

http://how-i-did-that.blogspot.com/2014/01/arduino-yun-grooveshark-radio.html

Once I did that sound was perfect. I used 2 different USB sound cards. This one:
http://www.amazon.com/SODIAL-TM-Adaptor-Windows-Compatible/dp/B008KGL2L2
And this other one:
http://www.ebay.com/itm/PCM2704-USB-DAC-USB-to-S-PDIF-Sound-Card-Decoder-Board-3-5mm-Analog-Output-/200876070476?ssPageName=ADME:L:OU:US:3160

Title: Re: Sound quality issues with USB audio devices
Post by: sonnyyu on Feb 10, 2014, 04:32 pm

I had audio noise issues, but solved those with ALSA configurations. Info on that here (it also explains how to install mpg123):

http://how-i-did-that.blogspot.com/2014/01/arduino-yun-grooveshark-radio.html

Once I did that sound was perfect. I used 2 different USB sound cards. This one:
http://www.amazon.com/SODIAL-TM-Adaptor-Windows-Compatible/dp/B008KGL2L2
And this other one:
http://www.ebay.com/itm/PCM2704-USB-DAC-USB-to-S-PDIF-Sound-Card-Decoder-Board-3-5mm-Analog-Output-/200876070476?ssPageName=ADME:L:OU:US:3160




Noted. Thanks a lot.
Title: Re: Sound quality issues with USB audio devices
Post by: smakson on Feb 10, 2014, 10:58 pm
Thanks for your reply, desordenado.  That ALSA configuration certainly helps, but there are still a lot of artifacts being added even when no audio is playing. 

madplay does add it's own high pitch whine compared to aplay playing a predecoded wav, do you think mp3123 would do a better job of decoding? 
Title: Re: Sound quality issues with USB audio devices
Post by: sonnyyu on Feb 11, 2014, 02:01 am
Arduino Yun 5v pin doesnt give me 5v. ( USB got less than 5v)

http://forum.arduino.cc/index.php?topic=209836.msg1542386#msg1542386 (http://forum.arduino.cc/index.php?topic=209836.msg1542386#msg1542386)

I have better luck to connect my USB audio adapter behind the Self Powered USB Hub.
Title: Re: Sound quality issues with USB audio devices
Post by: desordenado on Feb 11, 2014, 01:56 pm

Thanks for your reply, desordenado.  That ALSA configuration certainly helps, but there are still a lot of artifacts being added even when no audio is playing. 

madplay does add it's own high pitch whine compared to aplay playing a predecoded wav, do you think mp3123 would do a better job of decoding?   


Do you really think it is a decoding issue? seems strange that there could be decoding differences.
One thing I noticed with my USB audio cards is that this one:

http://www.amazon.com/SODIAL-TM-Adaptor-Windows-Compatible/dp/B008KGL2L2

Is a hell of a lot noiser than this one:

http://www.ebay.com/itm/PCM2704-USB-DAC-USB-to-S-PDIF-Sound-Card-Decoder-Board-3-5mm-Analog-Output-/200876070476?ssPageName=ADME:L:OU:US:3160

I blamed it on the cheap hardware rather than on the software, in fact I can hear noises on the first one even when no decoder is running, just having it plugged to the arduino and those noises changed pitch depending on what was the processor doing, just as if noise in the electric line was getting into the audio path.


Arduino Yun 5v pin doesnt give me 5v. ( USB got less than 5v)

http://forum.arduino.cc/index.php?topic=209836.msg1542386#msg1542386 (http://forum.arduino.cc/index.php?topic=209836.msg1542386#msg1542386)

I have better luck to connect my USB audio adapter behind the Self Powered USB Hub.


hmmm... I guess that can also explain the USB audio card operating badly
Title: Re: Sound quality issues with USB audio devices
Post by: smakson on Feb 11, 2014, 08:08 pm
I'm guessing the power has more to do with the problem than the software.  That whine could be electrical noise from the increased processor activity.
Title: Re: Sound quality issues with USB audio devices
Post by: ProfePaco on Feb 11, 2014, 09:54 pm
As I explained in another thread, have a look with a scope to the 0 and 1 pins, i.e. the USB serial pins.

There is a lot of noise... so much noise I could not use them to communicate with another Arduino, a nano.

My Yun is busy now. May be later or another person can post a picture of this noise...

Title: Re: Sound quality issues with USB audio devices
Post by: smakson on Feb 15, 2014, 07:14 am
So I gave my USB sound card better power using one of those Y-USB cables, which cleaned up a lot of the noise, especially the low frequency stuff.

However, madplay's output is still not as clean as playing a wav file (one I decoded from the same mp3).  There are a few spikes of noise at roughly 700hz and the next few multiples up.
Title: Re: Sound quality issues with USB audio devices
Post by: jziesing on May 30, 2014, 01:39 am
How do I install aplay?  I need something to play wav files on my yun.


thanks to all
Title: Re: Sound quality issues with USB audio devices
Post by: sonnyyu on May 30, 2014, 04:13 am

How do I install aplay?  I need something to play wav files on my yun.
...



Yun, one way you could use USB sound adaptor ( costs few dollar at Amazon).

Code: [Select]

opkg update
opkg install kmod-sound-core
opkg install kmod-usb-audio
opkg install alsa-utils


Code: [Select]

aplay -t  wav  -f dat   some.wav
-f cd (16 bit little endian, 44100, stereo)
-f cdr (16 bit big endian, 44100, stereo)
-f dat (16 bit little endian, 48000, stereo)