m-h
Posts: 18
Joined: Sun Jan 11, 2015 10:36 pm

Re: Analogue audio testing

Sun Mar 20, 2016 9:18 pm

You are probably right ;-)
But that is outside my skill set.
So when you feel up to it , and think it is valuable to your project, let me know.

MH

User avatar
GTR2Fan
Posts: 1601
Joined: Sun Feb 23, 2014 9:20 pm
Location: South East UK

Re: Analogue audio testing

Sun Mar 20, 2016 9:57 pm

marcel-heijkoop wrote:@GTR2Fan, If you design an analogue add-on filter ,can you also look into connecting it via the GPIO ?
I reckon it is simpeler and more stable to connect it from the gpio pins with a protoboard .
And I assume it is possible to redirect the audio signals on greater than zero pies too, although I have not seen any reports on that.
I would like to copy your design onto my future protoboard.
The aim is to provide a filter for the analogue output with no other physical connections required apart from power from the GPIO header. As the analogue output is running from its own dedicated regulator on the later Pi models, this seems like the most logical route to take in order to avoid nasty surprises in the audio signal. Believe me, dealing with it all in the analogue domain is far simpler. ;)
Pi2B Mini-PC/Media Centre: ARM=1GHz (+3), Core=500MHz, v3d=500MHz, h264=333MHz, RAM=DDR2-1200 (+6/+4/+4+schmoo). Sandisk Ultra HC-I 32GB microSD card on '50=100' OCed slot (42MB/s read) running Raspbian/KODI16, Seagate 3.5" 1.5TB HDD mass storage.

Horendus
Posts: 31
Joined: Fri Feb 05, 2016 9:07 am

Re: Analogue audio testing

Tue Mar 22, 2016 1:27 pm

The new driver has really improved my MPLAYER based looping MP3 player. Almost no background hiss :D

I do however find that the playback makes random POPS while playing?

Wondering if it was clipping I have tried running mplayer with -volume 25

When volume 25 is used the mp3 is very quite but the POP noise is the same volume level as when mplayer is set to 100.

Interesting right?
Any thoughts?

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2119
Joined: Thu Jul 11, 2013 2:37 pm

Re: Analogue audio testing

Tue Mar 22, 2016 7:06 pm

There's a slight issue in that the SDRAM clock changes still happen even if you set sdram_freq=400 (i.e. sets the SDRAM controller frequency even if there's nothing to change) which causes the pops.

Next rpi-update firmware should remove the requirement to have sdram_freq in config.txt entirely.
Rockets are loud.
https://astro-pi.org

Horendus
Posts: 31
Joined: Fri Feb 05, 2016 9:07 am

Re: Analogue audio testing

Wed Mar 23, 2016 9:49 am

Another driver update to further fix audio issues? Sounds fantastic! Do you expect this to be before the end of the month?

Do you think the the loud CRACK that I hear when the music play first starts and when I sudo reboot be addressable through updates as well ?

mkkyah
Posts: 31
Joined: Fri Jan 25, 2013 2:32 pm

Re: Analogue audio testing

Wed Mar 23, 2016 10:27 am

Hi,
This is great, thank you so far.
I have tested it on a Rpi A+ with a clean Max2Play installation, only Squeezelite active as a LMS player.
Background noise is gone, audio quality is more than acceptable on a Philips Fidelio dock speaker.
Big problem is continuous pops( I don't want to give wrong feedback I don't mean loud pops, should I call them glitches?), which I hope will be fixed soon. I had a few responsiveness of player, but this may be because of power supply (laptop usb) and I didn't test for a long time.
One thing I have observed was that the power supply is important again with the amount of pops. Using usb of my Laptop gives more pops than a regular power supply, even with A+.

I didn't need to run "amixer cset numid=3 1", because Max2play web UI has an option to force headphone out, I guess. Hissing was gone already when I have booted first.
And it seems .it's easy to turn back to normal drivers with uncommenting additional lines in config.txt

I'll be waiting for new releases,
Thanks again

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: Analogue audio testing

Wed Mar 23, 2016 11:05 am

When I first read this I got the impression that the audio improvement does not happen on PiZero.
jdb wrote:The basic method of audio generation is the same across all models of Pi (except Zero, which doesn't have it).
But obviously the text means that the PiZero does not have the chips for doing the A/D conversion. So by adding a few resistors and capacitors this improved sound is available even on a PiZero :D

So stupid of me to misunderstand this. Time to put squeezeplayer on my PiZero + Miscap.

Swinging Yours,

Karri

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2119
Joined: Thu Jul 11, 2013 2:37 pm

Re: Analogue audio testing

Wed Mar 23, 2016 1:14 pm

mkkyah wrote:Hi,
This is great, thank you so far.
I have tested it on a Rpi A+ with a clean Max2Play installation, only Squeezelite active as a LMS player.
Background noise is gone, audio quality is more than acceptable on a Philips Fidelio dock speaker.
Big problem is continuous pops( I don't want to give wrong feedback I don't mean loud pops, should I call them glitches?), which I hope will be fixed soon. I had a few responsiveness of player, but this may be because of power supply (laptop usb) and I didn't test for a long time.
One thing I have observed was that the power supply is important again with the amount of pops. Using usb of my Laptop gives more pops than a regular power supply, even with A+.

I didn't need to run "amixer cset numid=3 1", because Max2play web UI has an option to force headphone out, I guess. Hissing was gone already when I have booted first.
And it seems .it's easy to turn back to normal drivers with uncommenting additional lines in config.txt

I'll be waiting for new releases,
Thanks again
Horendus wrote:The new driver has really improved my MPLAYER based looping MP3 player. Almost no background hiss :D

I do however find that the playback makes random POPS while playing?

Wondering if it was clipping I have tried running mplayer with -volume 25

When volume 25 is used the mp3 is very quite but the POP noise is the same volume level as when mplayer is set to 100.

Interesting right?
Any thoughts?
Are you using both

Code: Select all

force_turbo=1
audio_pwm_mode=2
in config.txt?

If you play silence (i.e. turn volume down to 0), are these pops still there?
Are you using latest rpi-update firmware?
Rockets are loud.
https://astro-pi.org

mkkyah
Posts: 31
Joined: Fri Jan 25, 2013 2:32 pm

Re: Analogue audio testing

Wed Mar 23, 2016 2:40 pm

-Yes I'm using both lines and "sdram_freq=400" is already there on config.txt
-updated firmware, I think start.elf is dated 22.3.2016
-no pops during silence

Edit:
I have activated the driver and testing again with same setup.
-To be more accurate they are not pops, but drops or stuttering during playback.
- After first 5 seconds playback audio has gone and I had to reboot. I'm testing and it's gone again after 5minutes of playing Flacs from network.

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2119
Joined: Thu Jul 11, 2013 2:37 pm

Re: Analogue audio testing

Wed Mar 23, 2016 4:52 pm

mkkyah wrote:-Yes I'm using both lines and "sdram_freq=400" is already there on config.txt
-updated firmware, I think start.elf is dated 22.3.2016
-no pops during silence

Edit:
I have activated the driver and testing again with same setup.
-To be more accurate they are not pops, but drops or stuttering during playback.
- After first 5 seconds playback audio has gone and I had to reboot. I'm testing and it's gone again after 5minutes of playing Flacs from network.
From a fresh Jessie install, what do I need to do to replicate your setup?
Rockets are loud.
https://astro-pi.org

mkkyah
Posts: 31
Joined: Fri Jan 25, 2013 2:32 pm

Re: Analogue audio testing

Wed Mar 23, 2016 5:05 pm

jdb wrote:
mkkyah wrote:-Yes I'm using both lines and "sdram_freq=400" is already there on config.txt
-updated firmware, I think start.elf is dated 22.3.2016
-no pops during silence

Edit:
I have activated the driver and testing again with same setup.
-To be more accurate they are not pops, but drops or stuttering during playback.
- After first 5 seconds playback audio has gone and I had to reboot. I'm testing and it's gone again after 5minutes of playing Flacs from network.
From a fresh Jessie install, what do I need to do to replicate your setup?
I'm using wheezy image for all Rpi boards from max2play(beta rpi3 image is jessy): http://www.max2play.com/max2play-image/
After burning the image I only activate Squeezelite from Audioplayer tab, do not activate/install kodi, squeezeserver(but you need a squeezeserver on the network) and others.

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2119
Joined: Thu Jul 11, 2013 2:37 pm

Re: Analogue audio testing

Wed Mar 23, 2016 9:40 pm

I can replicate the issue where audio drops out after a period of time (91 minutes since the last time the driver was opened - coincides with a 32-bit counter wrap). Currently the only way to fix this is to reboot.

I have seen a case where doing Ctrl-C on aplay at the "wrong" time can cause audio to stop working until a reboot. This may be related to the 5-seconds-then-fail case, but am not sure.
Rockets are loud.
https://astro-pi.org

mkkyah
Posts: 31
Joined: Fri Jan 25, 2013 2:32 pm

Re: Analogue audio testing

Thu Mar 24, 2016 9:52 am

jdb wrote:I can replicate the issue where audio drops out after a period of time (91 minutes since the last time the driver was opened - coincides with a 32-bit counter wrap). Currently the only way to fix this is to reboot.

I have seen a case where doing Ctrl-C on aplay at the "wrong" time can cause audio to stop working until a reboot. This may be related to the 5-seconds-then-fail case, but am not sure.
I have tested the driver for a long time, yesterday. I can confirm that audio drops are irregular; 1min, 5min, 15 min. periods. but it's definitely happening.

DaveAitch
Posts: 14
Joined: Thu Mar 24, 2016 6:06 pm
Contact: Website

Re: Analogue audio testing

Thu Mar 24, 2016 7:09 pm

Hi,

I came across this thread late last night after several hours of fruitless searching for a solution to my noise problem.

And you've fixed it for me! Thanks very much! :D

My story - I'm running mpd on a Pi B. I recently upgraded from Wheezy to Jessie, and I *think* that's when the noise started. Or got worse. But I've changed some other things at the same time, including new headphones to replace my old cheap & nasty headset. (The new ones are cheap but not nearly so nasty ;) ).

The threads and other sites that I found recommended all sorts of strange solutions - installing Pulse (that added its own noise on top of what was already there), getting a better PSU with a ferrite bead (all my PSUs were the same), adding

Code: Select all

disable_audio_dither=1
to confix.txt (that reduced the noise but didn't eliminate it).

I noticed that the noise was quite low when playing WAV files, a little higher when playing FLAC, and much higher when playing OGG. I didn't try MP3 or any other encoding.

Anyway, thanks once again for the solution. Just one small problem - the "pop" as MPD starts up, which is described in several threads, has now inflicted itself on me. It wasn't there before. Any ideas?

So thanks again for solving my problem. A write-up would be very useful. I *thought* I knew what a sigma-delta DAC is, but only in terms of a single-bit data stream.
Last edited by DaveAitch on Tue Mar 29, 2016 8:01 am, edited 1 time in total.

Man in a van
Posts: 138
Joined: Sat Dec 27, 2014 2:41 pm
Location: Staffordshire, UK.

Re: Analogue audio testing

Thu Mar 24, 2016 10:11 pm

Just yesterday I made a fresh install of Squeezelite on Raspbian Jessie-Lite on a new pi3 following these instructions by Gerrelt.

http://www.gerrelt.nl/RaspberryPi/wordp ... -raspbian/

Today I followed the instructions on this thread as detailed in the first post
Run sudo rpi-update

In /boot/config.txt add the following lines:

Code: Select all

   force_turbo=1
    audio_pwm_mode=2
Before using the audio for the first time, you should run amixer cset numid=3 1
Using a pair of earphones plugged into the headphone output of the pi the sound was choppy and stopped after a few seconds (using the pi as a player client for LMS installed on an Odroid U3).

I then added two extra lines to the config file so that it looked like this
disable_pvt=1
force_turbo=1
audio_pwm_mode=2
audio_sdm_mod_order=2
The sound was still broken up and again stopped after a few seconds.

I then added another line to the config file
sdram_freq=400
The sound was still broken up and still only played for a short time.

Then I remembered a post on Gerrelt's thread on this forum

viewtopic.php?f=38&t=25778&start=250

and did the following
Open the settings file:

Code: Select all

sudo nano /usr/local/bin/squeezelite_settings.sh
And changed the #SL_ALSA_PARAMS line to:

Code: Select all

SL_ALSA_PARAMS="-a 80:4:24:0"

The sound is now playing properly and there have been no break ups or interruptions (apart from when I have had to restart the player).

So it would seem that audio output settings have quite an influence, especially with Squeezelite.

Over the weekend I'll try and do a fresh install with just the post #1 settings and use the current values for Squeezelite.

I hope this is useful feedback and helps someone.

I'm sorry it's such a long post.

atb

Ronnie

Man in a van
Posts: 138
Joined: Sat Dec 27, 2014 2:41 pm
Location: Staffordshire, UK.

Re: Analogue audio testing

Thu Mar 24, 2016 10:51 pm

Well, it's all a bit of a Curate's Egg (and not chocolate).

Streaming BBC6 was fine and changing to BBC2 was OK, but Spotify was broken up and then the sound stopped.

Returned to BBC6 and no sound, but restarting Squeezelite produced music, Radio Paradise was broken up sound and a couple of channel hops stopped everything.

Squeezelite restart got things going again.

More research by myself on the ALSA PARAMS is obviously required.

Whilst playing, the sound quality is a big improvement over the stock output setting.

Well done jdb, you code tinkerer!

Ronnie.

mkkyah
Posts: 31
Joined: Fri Jan 25, 2013 2:32 pm

Re: Analogue audio testing

Fri Mar 25, 2016 12:08 pm

Man in a van wrote:Well, it's all a bit of a Curate's Egg (and not chocolate).

Streaming BBC6 was fine and changing to BBC2 was OK, but Spotify was broken up and then the sound stopped.

Returned to BBC6 and no sound, but restarting Squeezelite produced music, Radio Paradise was broken up sound and a couple of channel hops stopped everything.

Squeezelite restart got things going again.

More research by myself on the ALSA PARAMS is obviously required.
Man in a Van,
Thanks for the tip. I can confirm changing alsa params for the squeezelite to 80:4:24:0 definitely works. (as you suspected, no need to do other changes)
- No hissing
- No stuttering
- Good audio quality
- No audio drops, which needed reboots
It's been 30 minutes, no problems. I have also tried BBC2, BBC6(live and on demand), Radio Paradise, Deezer(I have no Spotify), all playing smooth, no problems there, too.
Really well done jdb!
I'm keeping this as default on this player, let's see what happens in long term.

Horendus
Posts: 31
Joined: Fri Feb 05, 2016 9:07 am

Re: Analogue audio testing

Sat Mar 26, 2016 9:30 am

I would like to report im now getting NO popping in my MPLAYER playback of mp3 file. :D

Im running Jessie Lite and Pi2 same as before

Since my last post I have done
sudo apt-get update && sudo apt-get upgrade
sudo rpi-update

My config file has the following added at the bottom

force_turbo=1
audio_pwm_mode=2
sdram_freq=400
disable_audio_dither=1
disable_audi_dither=1

The ONLY artifact is the CRACK noise just before playback FIRST starts and if you do REBOOT of the pi during playback

Hope this info helps with the driver development. I cant wait for everyone to have EASY artifact free playback on the analog audio jack :) ....the Pi has been out for 4 years hehe.


I have disable_audio_dither=1 and disable_audi_dither=1 because im not sure when it correct. The previous poster said to use disable_audi_dither=1 but "audi" seems incorrect to me for obvious reasons....

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5341
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Analogue audio testing

Sat Mar 26, 2016 1:23 pm

Horendus wrote: I have disable_audio_dither=1 and disable_audi_dither=1 because im not sure when it correct. The previous poster said to use disable_audi_dither=1 but "audi" seems incorrect to me for obvious reasons....
disable_audi_dither is obviously a typo and will have no effect.
I believe you can remove:
force_turbo=1
sdram_freq=400

if you wish. Latest firmware will set sdram_freq=400 if you don't have force_turbo=1 set and you enable audio_pwm_mode=2.

Horendus
Posts: 31
Joined: Fri Feb 05, 2016 9:07 am

Re: Analogue audio testing

Sat Mar 26, 2016 3:09 pm

Thanks, iv just done that!

Now if I could only get mplayer to run continually....

Pi just crashes after 8 > 24 hours of looping mplayer with a playlist :(
Its been so hard to get a pi to just loop mp3s without falling over after a day or so :(

omxplayer was no better...would just crash out after a day or so needing a reboot.

pmsr
Posts: 1
Joined: Sat Mar 26, 2016 10:07 pm

Re: Analogue audio testing

Sat Mar 26, 2016 10:29 pm

This is an amazing development, thank you so much. On a Rpi 3 with the latest firmware, a simple audio_pwm_mode=2 line in the /boot/config.txt file and I was back to enjoying the Fuse ZX Spectrum emulator (sdl version). No more annoying background noise, or even worse, the constant change between silence and noise that put me off the emulation after just a few minutes. There is a louder than usual crack at the start of the emulation when sound is enabled, but I think I can live with that. :D

tpfkanep
Posts: 16
Joined: Mon Feb 29, 2016 8:34 am

Re: Analogue audio testing

Sun Mar 27, 2016 6:56 pm

RPi 2B - experiencing audio drops (after about an hour-and-a-half with deadbeef). Only way to get audio working again is to quit deadbeef & start it again.

With kodi = unplayable audio (mp3).

vcgencmd get_config int

Code: Select all

arm_freq=1000
audio_pwm_mode=2
audio_sdm_mod_order=2
config_hdmi_boost=5
disable_audio_dither=1
disable_commandline_tags=2
disable_l2cache=1
disable_pvt=1
disable_splash=1
enable_uart=1
force_eeprom_read=1
force_pwm_open=1
framebuffer_ignore_alpha=1
framebuffer_swap=1
hdmi_force_cec_address=65535
init_uart_clock=0x2dc6c0
lcd_framerate=60
max_usb_current=1
over_voltage=6
over_voltage_avs=0x1b774
overscan_bottom=6
overscan_left=7
overscan_right=7
overscan_top=6
pause_burst_frames=1
program_serial_random=1
sdram_freq=400
temp_limit=85
vcgencmd version:

Code: Select all

Mar 24 2016 12:37:55 
Copyright (c) 2012 Broadcom
version e16cd015026a8bda22bb50dc30b30ce07f52a202 (clean) (release)
uname:
Linux rpi 4.1.20-3-ARCH #1 SMP Wed Mar 23 19:01:10 MDT 2016 armv7l GNU/Linux
What am I doing wrong?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5341
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Analogue audio testing

Sun Mar 27, 2016 9:49 pm

tpfkanep wrote:What am I doing wrong?
Nothing. You are reporting the issue described here which is not yet solved.

clivem
Posts: 79
Joined: Sun Aug 03, 2014 11:18 am

Re: Analogue audio testing

Sun Mar 27, 2016 11:21 pm

Man in a van wrote:

Code: Select all

SL_ALSA_PARAMS="-a 80:4:24:0"
The sound is now playing properly and there have been no break ups or interruptions (apart from when I have had to restart the player).
I'm guessing, but probably the fourth arg, disabling mmap for data transfer that is "fixing" or hiding the issue..... ISTR, that squeezelite will use mmap by default if the ALSA audio device "advertises" that capability......

Man in a van
Posts: 138
Joined: Sat Dec 27, 2014 2:41 pm
Location: Staffordshire, UK.

Re: Analogue audio testing

Mon Mar 28, 2016 9:14 am

Ah well!, You see Clive, I just copied that line from a poster on another thread.

The original OP claimed not to know what mmap is, and I have to say, that I have only just found out after reading your post (still have no understanding, as all this computering is too "new age" for me :) ).

When I get an opportunity I will try it with a value of 1 (just to see if it makes a difference).

Thanks for the information, every little helps (slaps backside ;) ).

Ronnie

Return to “Advanced users”