Sound quality of the Raspberry Pi B+

It is no secret that the sound quality of the onboard sound of the Raspberry Pi is not really good. Last week the Raspberry Pi foundation announced a new model B+ that is improved in some details. One aspect that was pointed out was the sound quality. It should be better with the new model. I was curious, therefore I ordered some new model B+ Raspberry Pis.

raspberry-bplus

What changed on the audio section? According to the Raspberry Pi foundation, there is an additional voltage regulator for the audio output and an additional output driver to drive low-resistance loads like headphones. However it is still using pulse-width modulation (PWM), which has a major impact on sound quality. The output voltage is still very low. I’ve measured less than 0.4Vrms. But let’s see how other performance parameters changed.

The test setup is as follows: The Raspberry Pi is connected to the network with a UTP cable. This reduces noise coupled in from the Ethernet port. Total harmonic distortions + noise (THD+N) is measured by a special HP8903B audio analyzer. This specialized instrument is able to measure THD+N down to 0.002% and allows also to measure the output voltage to test the linearity of the output. The input impedance of the audio analyzer is 100kOhm. The Raspberry Pi is powered by an external linear power supply.

For THD+N measurements the measurement bandwidth is 30kHz, for the frequency response we used 80kHz bandwidth to make sure that the instrument’s filter does not impact the audible frequency range.

hp8903-raspberry

On the Raspberry Pi, the volume was set to the maximum volume that works without clipping:

amixer sset "PCM" 95%

Test tones were created using SoX. Note that I’m not sure if SoX itself creates optimal sine waves. Therefore a minor part of the distortions might also com from the sine generator. However they will be are in the range < 0.1%. Also, you should not compare the absolute figures here to other measurements. While the HP8903B audio analyzer is a very good instrument, lots of factors influence the result. At THD+N levels < 0.1%, slight changes in the measurement setup can have huge impact on the results.

The following diagram shows the sum of the total harmonic distortions and noise (THD+N) of the old and the new Raspberry Pi. The lower the values the better the system performs.

rpi-new-thd

What happened here? The new Raspberry Pi performs even worse than the old Model B on frequencies below 1kHz.  As the distortions are driven by the frequency is seems that there is much more noise at lower frequencies. Didn’t they say the audio performance was improved by an additional voltage regulator? Yes, but the old Raspberry Pi used a linear voltage regulator to provide the 3.3V to many of the components on the board while the new one uses a switching regulator. Both can perform reasonably well. However switch mode power supplies often show higher noise figures. I will have a look into this in a later article soon.

Why aren’t there data for frequencies above 15kHz? The PWM of the Raspberry Pi is not able to create a signal that is at least similar to a sine wave at these frequencies. Therefore the audio analyzer was not able to determine the base frequency and therefore could not do any measurements.  Have a look how a 20kHz sine wave looks on the Raspberry Pi output:

20ksine-raspberry

Conclusion: Don’t buy the new Raspberry Pi just to get better onboard sound. You won’t get it. However, there are use cases were the new one is better, e.g. if you need 4 USB ports or low power consumption is important. For high-quality sound you still need an additional DAC like the HiFiBerry DAC.

New Lab PC

I used the last days to rearrange my lab workplace. The goal is it to connect all instruments over ethernet and control them using LXI. Then I remembered that I still had an Atom-powered PC lying around that was once built to implement an active crossover for the whole home theater. Unfortunately this project was never finished. The good thing: The PC was still there. Looking from today’s perspective, the specs are not really overwhelming: a dual core 1.8GHz Atom D525, 2GB RAM. But there are also some goodies: the sound card is an Asus Xonar D1, which performs really well and the system disk is an “old” 240GB Intel SSD (that was my first SSD).

labpcThe Asus Xonar D1 shows some impressive specs: THD+N < -105dB at 2Vrms at the output stage. The input isn’t specified, but I will measure it soon. A nice feature for my use case: The Xonar D1 comes with a half-height bracket and fits the small Antec ISK 300-65 Mini-ITX case.

Running Ubuntu 14, the performance is quite good. The system boots fast and the GUI works smoothly. Now I can start implementing virtual instruments on this system, but also use it as an audio measurement system.

I will start an article series about audio measurements soon to give an introduction to some audio measurements. It will not focus only on PC based measurements, but I want to give a more general introduction.

Audio Measurement Handbook

audiomeasurementhandbookAre you serious about audio measurements? Then the “Audio measurement handbook” by Bob Metzler is a very good introduction to the topic. You can buy used versions of the book on Amazon for more than 200US$ or you can get it for free from Audio Precision. Check out their starter kit. The book is from 1993, however most of the basic measurements haven’t changed. There is only one topic that the book does not cover: measurements of Class-D amplifiers. You can find a white paper about this in the AP white paper archive.

BTW: I will test an APx525 in the next time and compare it to older audio test equipment. Whit a price of >10k$ this is definitely not a hobbyist instrument. It is todays gold standard for audio measurements.

Buying electronic parts from eBay

It is sometimes interesting to read how people buy expensive Opamps at eBay to very attractive prices. One IC that is sold often on eBay is the AD797. It is used a lot from people who want to “improve” their audio equipment. I will not discuss this here, why these “improvements” often make things worse, but look at the prices you pay on eBay. The retail price of a single AD797 chip at European retailers is >10$, but you find Chinese retailers on eBay that sell two of them for less than 6$. Looking at the price list from Analog, you will notice that this is even less than the price per IC you have to pay for 1000 units from Analog. How can this be? The answer is easy: fakes. Most of the buyers use these opamps in audio circuits. They never notice that it is a fake. Why? Because even the cheapest Opamps work great in audio circuits. Depending on the circuit, they might even perform better than expensive chips. The chip might not be an AD797, but it works well. So everybody is happy.

Fakes are one reason, why I would never buy parts like this on eBay. I’ve already seen fakes even for relatively inexpensive chips.

But today I found an interesting board:

regboard This is a switching voltage regulator based on the LM2596-ADJ. 5 boards are 4.81€ including shipping from China. Are you kidding me? The chip itself costs about 2-3 US$ when you buy it in large quantities. In small quantities it is about 5 US$. There is no chance to build 5 boards like this and ship it to Europe for under 5€. How can it be?

Some ideas:

  • The chip itself is a fake or it is an old non-ROHS version that cannot be used anymore. But even with this, it will be really hard to build it cheap enough. The inductance on the board alone will cost at least 0.30-0.50 USD.
  • The board itself was produced for something else and never used. Looking at the board this seems also relatively unlikely as this is a standalone PCB and input and output are designed to solder cables.
  • This is an old evaluation module for this IC.

In 3-4 weeks these boards should arrive here and I will have a closer look. I will also order a sample from TI to find out if these chip on these boards look and behave different from genuine TI parts.

One final remark: Independent if these boards work well, I cannot recommend eBay to source electronic components. Ask yourself: Why should components from a 3rd party source be cheaper than from the supplier? The risk to buy fakes is very high. Sometimes suppliers have different qualities of the same chip design. Some guys buy the cheapest version and relabel it as the most expensive version.

PS: I will not post the eBay link.

10-34 Mk II

10-34

Here is the first result of the current speaker build projects. This speaker is the “10-34″ from “Klang & Ton”. Is is not exactly a small speaker, with the OSD cabinet it is also not really good-looking. But it sound really good and it can get LOUD. But even powered by the small HiFiBerry Amp, the speaker works well. You won’t reach it’s limit with 25W amplification, but with 92db/W it already gets quite loud.



chassis

Last week a huge package from Germany arrived with some interesting chassis:

  • Visaton BF32
  • Visaton W100 S
  • Tangband W6-1974
  • IMG StageLine MRD-34PA
  • IMG StageLine SPA-110PA

If you wonder how these fit together: they don’t. The chassis will be used for 3 different projects:

  • a mini system for better TV sound
  • a replacement for the current speakers in the living room
  • a nice fun-LOUDspeaker based on the PA chassis

All will be powered by the Raspberry/Amp combination. The living room speakers will be the most complex, they will need some CNC milling.

Cheat sheet: Download the Raspberry Pi Linux kernel sources

I do not often work on the Linux kernel and I’m also not a Git expert. Therefore getting the latest Linux kernel sources for the Raspberry Pi always takes time. This is a short cheat sheet how to get the latest 3.12 kernel sources:

mkdir linux3.12
cd linux3.12/
git init
git fetch https://github.com/raspberrypi/linux rpi-3.12.y:refs/remotes/origin/rpi-3.12.y
git checkout rpi-3.12.y