How to get high quality audio from R-Pi?


61 posts   Page 3 of 3   1, 2, 3
by Wanderlei » Thu Aug 23, 2012 4:39 am
fredjam wrote:What don't you understand? You can get high quality sound from the HDMI connector.
Many recent sound systems accept a HDMI connection and can use the high quality sound
it provides.


That what I was trying to say and that it is just small link in the chain of having "good quality audio". So if he dosnt have the other equipment for "good quality audio", he wont get it. Just need a receiver that has HDMI and he is golden.
Posts: 76
Joined: Tue Aug 21, 2012 2:01 pm
by fredjam » Fri Aug 24, 2012 12:05 am
If you don't have a hi-fi system that accepts a HDMI input then you can still get high
quality sound by going through your HDMI TV or monitor. Just feed the audio output
form the TV or monitor into one of your your amplifiers input sockets. Of course it all
depends on what you mean by high quality. I mean at least good CD audio quality.
Posts: 83
Joined: Thu Jul 19, 2012 3:19 am
Location: London UK
by mahjongg » Fri Aug 24, 2012 12:16 am
Just google for "hdmi to sound adapter", but remember that the PI can only provide a maximum of 200mA to such a device (if your PSU is up to it, that is), so maybe you need one that is externally powered.
With such an adapter you should get sound exceeding CD quality.
User avatar
Moderator
Posts: 3207
Joined: Sun Mar 11, 2012 12:19 am
by Redshift187 » Fri Aug 24, 2012 7:20 pm
The analogue output is capable of higher quality than it comes with.
Note: these improvements involve voiding your warranty.

First, C34 and C48, part of the bandpass filter, also removes any DC component from the audio. However, immediately after that are 4 diodes (in two packages, D12 and D13). These are meant as voltage clamps, but they clamp the now AC signal to between 0.6V and 2.7V (clipping all of the negative half of the waveform, and adding a DC component back that changes with the sound being played). Removing these diodes is the first step.

Second, C34 and C48, being 10uF, work with R20 and R26 to form a high-pass filter, limiting the low end of the bandwidth to approximately 100Hz. If you were to replace these capacitors with 47uF ones, you would have low end down to about 22Hz.
Posts: 3
Joined: Fri Aug 24, 2012 7:10 pm
by gritz » Fri Aug 24, 2012 9:39 pm
Redshift187 wrote:The analogue output is capable of higher quality than it comes with.
Note: these improvements involve voiding your warranty.

First, C34 and C48, part of the bandpass filter, also removes any DC component from the audio. However, immediately after that are 4 diodes (in two packages, D12 and D13). These are meant as voltage clamps, but they clamp the now AC signal to between 0.6V and 2.7V (clipping all of the negative half of the waveform, and adding a DC component back that changes with the sound being played). Removing these diodes is the first step.

Second, C34 and C48, being 10uF, work with R20 and R26 to form a high-pass filter, limiting the low end of the bandwidth to approximately 100Hz. If you were to replace these capacitors with 47uF ones, you would have low end down to about 22Hz.


Edit: You're right about the diode network - it will clamp at 1 diode drop below 0V. I'd just written some blah about clamping at the supply rails and then realised that the diodes are after the coupling cap. Hang on though - R20 and R21 form a voltage divider that cut the 3v3/2 negative excursion by about a third, so maybe it's not a big deal. The bav99 is a silicon diode with a Vf of about 0v6, so it shouldn't be too troubled. Bit messy though...

Re the 10u cap: Yes and no.

If the output is plugged into a line input at an impedance of ~10k ohms then the -3dB freq. will be in the order of 1.59Hz (with a caveat regarding my mental arithmetic...) Good enough to listen to that album of whale song. ;)

If the output is supplying a set of low impedance headphones (at say 16-32R) then yeah, it will be rather toppy. I'm not sure there's room on the board for a pair of 1000u caps though! Also, looking at the lpf and whatnot I'd wager the output's not really designed with low impedance headphones in mind anyway. I don't remember the current sourcing ability of the BCM's PWM outputs, but I expect they're fairly non-zero output impedance too.
Posts: 429
Joined: Sat Jan 28, 2012 2:33 am
by Redshift187 » Fri Aug 24, 2012 11:14 pm
gritz wrote:Edit: You're right about the diode network - it will clamp at 1 diode drop below 0V. I'd just written some blah about clamping at the supply rails and then realised that the diodes are after the coupling cap. Hang on though - R20 and R21 form a voltage divider that cut the 3v3/2 negative excursion by about a third, so maybe it's not a big deal. The bav99 is a silicon diode with a Vf of about 0v6, so it shouldn't be too troubled. Bit messy though...

Re the 10u cap: Yes and no.

If the output is plugged into a line input at an impedance of ~10k ohms then the -3dB freq. will be in the order of 1.59Hz (with a caveat regarding my mental arithmetic...) Good enough to listen to that album of whale song. ;)

If the output is supplying a set of low impedance headphones (at say 16-32R) then yeah, it will be rather toppy. I'm not sure there's room on the board for a pair of 1000u caps though! Also, looking at the lpf and whatnot I'd wager the output's not really designed with low impedance headphones in mind anyway. I don't remember the current sourcing ability of the BCM's PWM outputs, but I expect they're fairly non-zero output impedance too.


Perhaps the diode network doesn't have that much effect, but IMO it's entirely unnecessary and I don't like any sort of asymmetrical clamp on an audio signal.

As for the line impedance, it should be orders of magnitude away from R20 and R26 (150R), so the filter frequency would be set by approximately 150R. 150R and 10uF has a -3dB of about 106Hz.
Last edited by Redshift187 on Fri Aug 24, 2012 11:23 pm, edited 1 time in total.
Posts: 3
Joined: Fri Aug 24, 2012 7:10 pm
by Redshift187 » Fri Aug 24, 2012 11:22 pm
Really though, neither of my suggestions had a huge impact. It sounds better with both (I just tried), but there's still a crackling that sounds like bad clipping happening somewhere else. I guess I'll just wait for the USB audio capability, since I have a few decent sounding DACs lying around.
Posts: 3
Joined: Fri Aug 24, 2012 7:10 pm
by gritz » Fri Aug 24, 2012 11:40 pm
Don't fret - the analogue out is never going to be great with only 11 bits. In addition, there might be issues with the low level PWM engine, the ALSA layer, interrupt handling or a combo of allsorts causing your crackling. The analogue out is a bit of a waste of space IMO.

On the bright side, USB handling seems to be improving, so don't lose hope!
Posts: 429
Joined: Sat Jan 28, 2012 2:33 am
by XploD » Fri Oct 19, 2012 4:37 pm
Oh I was inactive for a while and you have entered into deatils and wrote a lot :D

First of all, what is a high quality (at least for me)? I think that PC/laptop's out is something normal. The sound must be crystal clear, and smooth, without A SINGLE stutter/click/pop during playback. This is a good quality. I repeat, everything worse than standard laptop's output is not worth listening for me. Somebody mentioned FM tuners. I don't listen to tuners but the built-in FM tuner on my hi-fi sounds better than PI's analog out.

To conclude, HDMI is the best audio out so far? If it is, I'll have to use HDMI, at least for now. I have a Sony TV through which I can forwad audio to my Hi-Fi (I don't have AV Receiver, just a micro Hi-Fi system from Philips - it does have a HDMI but just output because it's a dvd player too). But I was scared that TV will mess audio quality. But when I tried listening to music through TV (from TV's USB player) it does sound a lot better than Pi's analog out. The song is crystal clear (no noise) and if there is a lack of bass or treble, I can fix it by playing with hi-fi's equilaizer.

Now I started using Spotify as a main source of music so I'm thinking about Despotify on PI, controlled by TV's remote through HDMI-CEC. Later I'll buy HDMI to audio out and use some android app to control it that I can power off my TV.
Posts: 23
Joined: Sat Mar 17, 2012 12:14 pm
by Narf03 » Fri Oct 19, 2012 7:32 pm
I noticed the analog sound quality of Pi has been improved a lot lately, but there is still pop sound when starting /ending music, using mplayer so far, I think it's doing better than omxplayer in term of quality. I think if given more time, they should be able to improve it to pc quality.
Posts: 140
Joined: Mon Jun 11, 2012 3:44 pm
by XploD » Sat Nov 10, 2012 11:49 am
I finally tried HDMI output and yes, it works well :) Even more, there is a newer version of Raspbmc since last time I used it which works even better, without stuttering and pause between songs. Even HDMI CEC works out-of-the-box and wi-fi should work OOTB too. I only noticed when the song starts playing it stutter just once and that's it. It's not a problem but it could be due to my power supply (5.5V 800mA). I'll buy stronger power supply soon.

The thing that shocked me yesterday is a fact that there is no GUI based player in raspbian (I tried new raspbian with 1 GHz OC). Terminal-based player? Come on, this is the stupidest thing I've ever seen :mrgreen: But I'll be using Raspbmc anyway so it doesn't bother me, just made me and my friends laugh hard. When I finally managed to play track, I felt like I've been coding a mp3 player myself :lol:

Now I'm waiting for Raspbmc team to fix last.fm scrobbling issue to start using it as a main player. This bug is present a long time ago, I don't know why it haven't been fixed yet :( I contacted the developer and ask him if he could fix it.
Posts: 23
Joined: Sat Mar 17, 2012 12:14 pm