How to get high quality audio from R-Pi?


66 posts   Page 1 of 3   1, 2, 3
by XploD » Fri Aug 10, 2012 1:17 pm
I'm planning to use my R-Pi as my main audio source so I need high quality sound output. Analog audio out on RPi itself is awful so not an option. I don't need an audiophile device, just clean rich sound as from better computer sound cards. Outputing the sound from my TV via HDMI is also not an option because I must have my TV turned on all the time. I thought that buying an HDMI to Analog Audio converter will solve my problem but then I need some HDMI hub too, and all that is expensive and complicates things.

So, how can I export audio in the best quality it can get? USB sound card or what?
Posts: 23
Joined: Sat Mar 17, 2012 12:14 pm
by mikedad » Fri Aug 10, 2012 2:55 pm
I am interested in high quality audio as well. If anyone has any suggestions for a known good quality device that has raspberry pi driver support that would be fantastic.
Posts: 6
Joined: Fri Aug 10, 2012 2:50 pm
by clapper » Fri Aug 10, 2012 3:32 pm
What about an externel usb sound card? Without additional "logic" the board itself can only output via cinch and HDMI.
Posts: 34
Joined: Mon Jan 30, 2012 2:10 pm
by Narf03 » Fri Aug 10, 2012 7:43 pm
I tried USB sound card, it's nothing better.
Posts: 230
Joined: Mon Jun 11, 2012 3:44 pm
by XploD » Sat Aug 11, 2012 8:17 am
Narf03 wrote:I tried USB sound card, it's nothing better.


You scared me now. If it's impossible to get better audio quality, I can throw my Pi in trash :( Although I'm listening to music only from Pi for last two days :D

I thought about buying Terratec Aureon Dual USB card, it's not too expensive and it works with Pi but someone said that the sound laggs. It has an S/PDIF, so maybe the sound is better trough it? Although I don't have such an input on my hi-fi but I can create something to convert.

How is it possible that even with that card the audio is bad? Bad USB drivers? Slow CPU? And, I assume that the sound laggs, but you can't get distortion with quality USB card.

I have Numark DJ/IO but I don't know if it would work with Linux.
Posts: 23
Joined: Sat Mar 17, 2012 12:14 pm
by redhawk » Sat Aug 11, 2012 8:25 am
"I tried USB sound card, it's nothing better." - a good quality USB sound dongle / box is only sounds as good as the software is providing.
I've used 3 different USB dongles including an old Sound Blaster Live 24bit external all sound perfectly fine to me.

Richard S.
User avatar
Posts: 3519
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1
by Narf03 » Sat Aug 11, 2012 2:54 pm
May i know what software and which distro u are using?
Posts: 230
Joined: Mon Jun 11, 2012 3:44 pm
by redhawk » Sat Aug 11, 2012 8:03 pm
The OS I'm using is Rasbian wheezy and the audio application I'm using is qmmp for X-Windows.
When you install qmmp the equaliser must be turned off reason being the PI isn't fast enough the calculate the change in audio.
The following are the audio devices I have tested and tried successfully on the PI (without a USB powered hub):
-Sound Blaster Live 24bit external
-Lindy Audio dongle CM based chipset
-el'cheapo dongle from eBay based on CM108 chipset
-FM transmitter (same as Keene but only 6 quid instead of 15 quid also from eBay)

Image

Richard S.
User avatar
Posts: 3519
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1
by Narf03 » Sun Aug 12, 2012 12:38 pm
thanks redhawk

i got the usb sound card(the little green and yellow with volume control and mic control), will try tomorrow with the software u used. Will report back after testing =)
Posts: 230
Joined: Mon Jun 11, 2012 3:44 pm
by Narf03 » Mon Aug 13, 2012 5:33 am
Just tried qmmp with the USB sound card, unable to get "high" quality audio out too, there are alot of noise behind the music, compare to the pi onboard 3.5mm jack, seriously no improvement beside it can go alot louder.

When I pause the song after start playing, i can hear the noise, its non-stop poping sound, perhaps u can try this, using qmmp, start playing a song, then only pause it, see if u can hear any noise when the song is paused.

Thanks.
Posts: 230
Joined: Mon Jun 11, 2012 3:44 pm
by XploD » Mon Aug 13, 2012 8:40 am
Is there any other way to get direct sound out, without any Pi's sound chip and then create a preamplifier or something? It really a shame that they don't put at least one high quality output.

I didn't expected that Pi would be so miserable. I saw lots of people doing HTPC with it so I was expecting this was the best solution because it's size but this is far from a good hardware for HTPC. High quality sound output is No. 1 requirement for HTPC, and No 2 is easy and fast interface (which isn't the case with Pi, according to my former experience, I don't know is it due to poor hardware or bad Rasbpmc integration). And you cannot claim that it's cheap though. 60$ Pi + wi-fi dongle + external sound card + power supply + case + USB hub and the price raises. I believe that it's possible to buy an used PC for this money.

I'm trying now to install XBMC on Raspbian but this Linux makes my crazy :x Tutorials are not noob-proof...
Posts: 23
Joined: Sat Mar 17, 2012 12:14 pm
by dom » Mon Aug 13, 2012 9:48 am
XploD wrote:It really a shame that they don't put at least one high quality output.

HDMI is the high quality audio interface.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4043
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by Narf03 » Wed Aug 15, 2012 8:03 am
Never tried audio from HDMI, i do not have a monitor or device comes with audio output. Gonna get something like this to get better quality audio off my pi.

http://www.ebay.com.my/itm/Mini-HDMI-Di ... 4aba1394a3

it cost half of a pi ...
Posts: 230
Joined: Mon Jun 11, 2012 3:44 pm
by XploD » Wed Aug 15, 2012 2:32 pm
I also haven't tried audio through HDMI but my TV will be connected to HDMI so it will be busy. So I have to buy HDMI to stereo output + HDMI hub which is not cheap. I can export audio through TV but TV's are not meant to play audio so they probably don't have quality audio interface and the result will be loss in audio quality. I also planned to build a Hi-Fi preamplifier and mount it in the same box with Pi so analog audio is must-have in Pi's case (box).

I think that we have to agree that Pi is not a good hardware for media player, at least for now. There's too many problems and bugs. And XBMC is maybe a little to demanding for Pi so it would be better to built another OS from scratch totally adapted to Pi to get optimal performance, quality, speed and smoothness.
Posts: 23
Joined: Sat Mar 17, 2012 12:14 pm
by ghans » Wed Aug 15, 2012 3:24 pm
Did you already try the XMBC distros ?
All of them ?

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
Posts: 4630
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany
by DrK » Wed Aug 15, 2012 3:39 pm
Maybe I'm being a bit simple here, but some of the symptoms described here sound like grounding issues - when I wanted decent audio (I'm in my mid-50's - so hi freq is shot!) from my PC, I had all the popping sounds etc when I connected to my amp - so I put a "GROUND LOOP ISOLATOR GOLD PLATED CONNECTIONS HIGH QUALITY" from Amazon (currently £3 on offer!) between PC and amp and now no popping....

Ken

Feel free to tell me to shut up....
Posts: 2
Joined: Mon Aug 13, 2012 12:50 pm
by RaTTuS » Wed Aug 15, 2012 3:41 pm
audio from the headphone socket is poor ,
audio from the HDMI is excellent
http://www.catb.org/esr/faqs/smart-questions.html <- ask smart Questions
"That's not right, the badgers have moved the goalposts."
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX - Prosliver FTW
User avatar
Posts: 5368
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
by jackokring » Wed Aug 15, 2012 3:44 pm
From what I've read so far, as I haven't got Pi yet... :o ... :D ... The audio connector is PWM, and not DC free. This will require an adaptation with a DC level integrator. I'm not sure how much filtering is done on the Pi. If none, then an external circuit could do a level gain clamp and DC restore. AS to the actual use of PWM, I doubt it gives best quality, as a bit bang serial buffer such as a UART with no start/stop/parity bits. This could give 1-bit DAC quality. I heard DAC7 chips used to be good, so in reality the Pi needs an external opto isolated level sliced board with a stiff PSU with some better output control.
The stereo could be bit interleaved, and the jitter retimer could do the demux. The opto isolation is best placed after the demux to allow power supply isolation. Building in a usb hub to the audio monster may be a cost saving, but will make it dependant on good circuit routing.

This is a at a glance analysis which in no way means good audio is possible without more thought.

Cheers Jacko
Pi=B256R0USB CL4SD8GB Raspbian Stock. https://sites.google.com/site/rubikcompression/strictly-long https://dl.dropboxusercontent.com/u/1615413/Own%20Work/Leptronics.pdf https://groups.google.com/forum/#!topic/comp.compression/t22ct_BKi9w
User avatar
Posts: 784
Joined: Tue Jul 31, 2012 8:27 am
Location: London, UK
by gritz » Wed Aug 15, 2012 6:26 pm
The PWM audio output is limited to 11 bits of depth at 48kHz by clock speed, so it's probably not the best place to start.
Posts: 449
Joined: Sat Jan 28, 2012 2:33 am
by fredjam » Thu Aug 16, 2012 4:24 am
Well thanks Jacko and Gritz but idle speculation and talk about 11 bit audio is not helpful
to anybody. So stop it. Do some real audio testing on a real pi board. Clicks and pops
sound like a latency issue which may be part of the general usb problem.
Posts: 83
Joined: Thu Jul 19, 2012 3:19 am
Location: London UK
by Narf03 » Thu Aug 16, 2012 7:02 am
Jacko and Gritz is saying poor audio is due to hardware limitation?
Posts: 230
Joined: Mon Jun 11, 2012 3:44 pm
by odokemono » Thu Aug 16, 2012 9:03 am
Hello!

I finally received my two RPIs yesterday and have bad sound coming out of the 3.5 Jack (apparently it's 11 bits, so that's expected) but I'm also getting bad sound with two USB audio dongles which work fine on my Linux desktop.

Funnily enough, it's the same distortion that I got using a Beaglebone (another ARM board). Some sort of lag in the USB block transfers or some such and is most noticeable in quiet passages.

So yeah, there's a serious problem.

I've converted a .flac file to .wav to test using aplay. Tomorrow I'll put up some examples on soundcloud.
Posts: 3
Joined: Tue Nov 29, 2011 8:27 pm
by RaTTuS » Thu Aug 16, 2012 9:08 am
http://www.catb.org/esr/faqs/smart-questions.html <- ask smart Questions
"That's not right, the badgers have moved the goalposts."
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX - Prosliver FTW
User avatar
Posts: 5368
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
by gritz » Thu Aug 16, 2012 4:21 pm
fredjam wrote:Well thanks Jacko and Gritz but idle speculation and talk about 11 bit audio is not helpful
to anybody. So stop it. Do some real audio testing on a real pi board. Clicks and pops
sound like a latency issue which may be part of the general usb problem.


Hi, my answer was a reply to jackokring within the context of the thread title - "How to get high quality audio from R-Pi?"

Obviously quality is subjective here, but the analogue out could be considered to be *vaguely* equivalent to FM radio. Good enough for e.g. internet radio streaming with desktop speakers, but not "CD quality".

Regarding USB, the difficulty with real world testing is that unless the testing is carried out with due regard to the exact hardware (including audio interface, USB hub, SD card, any other hardware that's connected, etc) and software (media player type, all preferences and whether / how it was compiled, operating system (including firmware), it's update status and all preference settings, all other modules that are loaded, all details of the file you're trying to play, what you had for breakfast, etc) and all testers give an accurate appraisal of the results they're getting then those results can be misleading and lead to the usual polarisation:

"Mine works fine, therefore you're all idiots."

"Mine doesn't work, therefore you're all idiots."

And, of course...

"I report that mine works fine because I don't care about / haven't noticed issue X, which for other users may be a showstopper"

There are a lot of variables...
Posts: 449
Joined: Sat Jan 28, 2012 2:33 am
by odokemono » Thu Aug 16, 2012 5:15 pm
Here are the promised samples.

Hardware used:

Asus EEEPC 701 Linux 2.6.29.6-smp, running at 115.2 Mhz, to demonstrate that CPU power isn't a factor in getting good audio.

Raspberry Pi "B", 2012-07-15-wheezy-raspbian, generic 4GB Kingston SD card >16MB/s read speed.

Bus 001 Device 008: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter (From Koss, but it's a bog-standard chip). No USB hub was used, the same dongle was connected directly to both machines.

Here's a sample from the EEEPC: http://soundcloud.com/odokemono/mscg_from_eeepc701_115

And the same from the RPI: http://soundcloud.com/odokemono/mscg_fr ... i_700mhz_k

In both there's a bit of analog hum because the cable I used to record is a bit flimsy and long, but the stuttering is clearly evident from the RPI.

In both cases, ALSA's aplay was used to play a .wav file that was sampled directly from a CD. No form of compression was used.

Here are three oscilloscope images of the stuttering from the RPI: http://imgur.com/a/rVR99

The first two are from the soundcloud track, the third is from SOX's play: play -n -c2 synth 100 sine 1000 vol 0.25

It's clear from those flat sections that there's something wrong that makes the USB Audio dongle starve and lag when used on the Pi. I've tried with another dongle from a different manufacturer and got the same results; it uses the same C-Media Electronics chip, but I don't think the problem lies in the USB Audio driver nor the dongle. I've used it on many many different configurations of Linux machines and kernel versions. The only time I got this problem is with the Pi and, interestingly, a BeagleBone (also an ARM board).

Since the 1Khz sample also produced stuttering, any interference from the SD card access can be eliminated as a culprit, since while SOX's play produces the sound, there's no disk I/O going on.

So a bunch of variables are eliminated. Test your audio gear with these commands:

apt-get install sox
aplay -L
export AUDIODEV="default:CARD=XXXXX"
play -n -c2 synth 100 sine 1000 vol 0.25

Where XXXXX is the correct playback device listed from aplay -L.
Posts: 3
Joined: Tue Nov 29, 2011 8:27 pm