jabelone
Posts: 3
Joined: Wed Mar 18, 2015 3:22 pm
Location: Brisbane, Australia

Raspberry Pi 2 Distorted Audio

Fri May 27, 2016 6:09 pm

I hope this isn't just another one of the "Audio on my pi 2 model B is bad" threads but I'm sorry if it is. Like many people I struggled with the poor audio quality of the analogue connector. The amount of noise/static was so terrible that you could barely hear the actual audio.

Eventually, I found that if you added "audio_pwm_mode=2" to the config.txt the noise was reduced to an acceptable level. However, after changing the pwm mode all output is suddenly distorted. It sounds like someone has "slowed it down". (ie think of the audio in a slow-mo video) Despite the horrific quality, the audio played at the normal pitch/speed before changing the pwm mode. Also, the issue happens on every audio player I tried and goes away if I remove "audio_pwm_mode=2". (but the noise comes back)

Any help is appreciated! Thanks :)

User avatar
flatmax
Posts: 336
Joined: Thu May 26, 2016 10:36 pm

Re: Raspberry Pi 2 Distorted Audio

Sat May 28, 2016 12:52 am

Don't know if I can help you much, however have you though about digging deeper into the kernel code to understand what features are controllable and what else you can play with ?

The dts overlay for pwm doesn't have much in it https://github.com/raspberrypi/linux/bl ... verlay.dts.
One thing to note is in the comment at the to of the file "be careful mixing audio and PWM.". They are talking about the i2s audio and the PWM driver. Have you thought about disabling the i2s audio to see if that gets rid of distortion ?

You can also look at the pwm driver here https://github.com/raspberrypi/linux/bl ... -bcm2835.c

hope that helps.
Matt
Check the Ultra 2 sound card - use our shop instead of Amazon Europe (Amazon USA is live).
Sound card for the Raspberry Pi with inbuilt microphone : www.audioinjector.net
Audio Inector Octo multitrack GPIO sound card

jabelone
Posts: 3
Joined: Wed Mar 18, 2015 3:22 pm
Location: Brisbane, Australia

Re: Raspberry Pi 2 Distorted Audio

Sat May 28, 2016 1:23 am

Thanks flatmax,

I may be good at making little projects and hacking things but delving into kernel code is a bit beyond my level of knowledge. ;) I had a look at disabling i2s but it seems I have to mess around with registers which I'm not comfortable doing. As much as I hate just going and buying something to make something work, I will probably just get a USB audio adapter...

Thanks for the suggestions though.

User avatar
flatmax
Posts: 336
Joined: Thu May 26, 2016 10:36 pm

Re: Raspberry Pi 2 Distorted Audio

Sat May 28, 2016 1:46 am

Rather then a USB audio adapter, you could also get a sound card add on for the Pi. Some advantages to using an audio device which has a low latency connection to the ARM core peripheral i2s controller.

Matt
Check the Ultra 2 sound card - use our shop instead of Amazon Europe (Amazon USA is live).
Sound card for the Raspberry Pi with inbuilt microphone : www.audioinjector.net
Audio Inector Octo multitrack GPIO sound card

jabelone
Posts: 3
Joined: Wed Mar 18, 2015 3:22 pm
Location: Brisbane, Australia

Re: Raspberry Pi 2 Distorted Audio

Sat May 28, 2016 3:00 am

Thanks for that suggestion but I kind of need it within a few days. I ended up finding an old bluetooth dongle and pairing a portable bluetooth speaker I had. After installing and configuring pulseaudio to use the bluetooth speaker as the "fallback" (default?) device it auto connected on boot and worked perfectly.

I know this doesn't fix the actual issue at hand and I would normally try to, however it does the job and that is all I need it to do for this project. Thanks for the help @flatmax.

User avatar
SteveDee
Posts: 343
Joined: Thu Dec 29, 2011 2:18 pm
Location: Sunny Southern England
Contact: Website

Re: Raspberry Pi 2 Distorted Audio

Sat May 28, 2016 10:06 am

I see you have found a work-around for your problem, but I just wanted to say that I have 3 internet radio/audio systems using the Pi, and I'm very happy with the sound quality from the audio jack.

Noise can be a big issue, but there are several ways to overcome this. Using a BlueTooth transmitter is one method I have used in my Insomniacs Bedside Radio.

I also did some tests to compare the Adafruit USB audio module with the Pi jack audio, which may be of general interest: http://captainbodgit.blogspot.co.uk/201 ... audio.html

My conclusion was that there is no benefit is using the Adafruit.

Return to “Troubleshooting”