-
Notifications
You must be signed in to change notification settings - Fork 450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
click / pop sound at beginning and end of sound playback #406
Comments
hi, after a few experiments I found a work-around which perfomes quite nicely:
now sequential playback of multiple wav files works seamlessly :-) here the commit, please check for possible side-effects: |
@ChrisVeigl Good job, your code works. |
thanks! :-) |
If you use ESP32 with internal dac use this code by Bitluni ULPSound
|
i didn't connect an oscilloscope by now - so i've no idea if the signal behaves the same on the M5Stack where I have deployed my application... I suppose this can be heard as click/pop noise ? |
yes, a nasty plop noise 😅 |
sounds as it looks ;-) strange! did you use this fork? BTW: why do you delete the file (and how could that work if FILENAME doesn't change)? |
i applied the patch. i didn't see the fork 😉 |
the fork has no other changes than the patch, though .. |
🤔 hmmm ... this could be a tricky one. It seems that several problem reports are basicially complaining about similar "pops and clicks". My guess is that the problem needs different solutions, depending on the output device that is used. Actually I don't have a solution (yet), but I played around with my version of ESP8266Audio (ESP32, internal DAC, arduino-esp32 version 1.0.6). and tried to understand some documentation. a) external I2S DAC:
b) internal DAC (aka analogue output pin)
@earlephilhower : what do you think? |
i might add that the patch ChrisVeigl/ESP8266Audio@1ce70dc |
@ChrisVeigl the NS4168 is an "external DAC" with built-in amplifier, correct? So the parts of your patch related to INTERNAL_DAC are not relevant for that configuration? |
yes - but i think this would just be the line https://github.com/ChrisVeigl/ESP8266Audio/blob/1ce70dcd14a70cfe5ebe899e761cfc4f9e3ec278/src/AudioOutputI2S.cpp#L207 I did not try the patch for other configurations. I suppose @Koxx3 is using the internal DAC - where the clicks/pops still happen... should we try to alter |
Hi, . About the problem from @Koxx3, my recommendation would be
Maybe this helps. Please keep in mind that my proposal is more a "dirty hack" than a well-engineered and sound solution - because a bit more thinking may be needed to really solve the problem instead of curing symptoms. |
we could try to copy the function into our source file and replace 0 by 32768 - just to test if this is a promising strategy. regarding the other recommendations: well - these changes made it work for me in the first place - so i'd like to keep them ;-) it would be nice to cooperate for testing different audio setups! |
Actually I'm wondering why Did you also try
I'm here :-) cheers, |
my proposal: I could open a new branch in my fork of ESP8266Audio, so we can work together on a PR until it works for both of us. Then I make an "official PR" so that @earlephilhower can review it, and decide if he want to merge it into master. What do you think? Just give me a few days, this week will get very busy at my job.. |
I have now a setup available which uses the internal DAC (an ODroid-Go device, see: https://github.com/hardkernel/ODROID-GO/blob/master/Documents/ODROID-GO_REV0.1_20180518.pdf) I can confirm that my patch creates noise in this setup; the patched code should only execute if an external DAC is used. I also agree that it is strange that calling i do not hear clicks/pops when i use the original i2c.cpp file from the master branch, when using the internal DAC. anyhow: the audio quality is quite bad and the sound stops during playback (especially at high amplitudes, I have to apply a gain of 0.5 in order to get continuous playback of a demo wav....) - seems to be another issue...? |
Hi @ChrisVeigl, Sorry was "drowning in other business" for some time, now I think I'll find some time over the weekend to continue looking into this topic. I'll check what happens on my two ESP32 boards - one with internal and the other with external I2S dac. |
Dear all, I'm testing the ESP8266Audio Lib with ESP12 and noDAC option. @ChrisVeigl I don't understand how you are able to prevent the plop sound with the original EXP8266Audio Lib and i2c.cpp from master branch. ;) When I'm using the original one, the plop sound is very loud. Which versions of the libraries you use? I figured as well, if you play a sound with silence directly after another file, there is no popping sound. BUT There ist some higher noise instead. Could be that this noise is there as well, when some file is played but not noticable. |
I found the conversation in this issue helpful in taming my pops with the internal DAC. Some of the things mentioned got me looking in the right places and the scope picture helped me realize what was happening. I haven't seen this mentioned so I figured I would describe what solved it for me. The i2s_config.tx_desc_auto_clear setting of true was causing my popping between playbacks, and I see in your source code you have it set to true. That feature is nice in principle, as it detects that you're not feeding samples and it automatically stuffs the buffer to ensure silence. Unfortunately, it's stuffing the buffer with the minimum value rather than the mid-level value and the sharp transition makes the popping sound. I turned that setting off and my code stuffs the buffer with the mid-level value. This ensures the audio idles at the mid-level indefinitely until I start feeding samples again. I still get a startup pop when calling i2s_driver_install, which is caused by it suddenly pulling the floating output down to min-value, but I am able to prevent a secondary pop by ramping up to the mid-value right before I start feeding samples. As I mentioned in previous paragraph, once I've got control of the buffer I'm able to keep it at mid-level when idle by stuffing the buffer when I'm done feeding samples. In my case I never uninstall the driver, so that initial startup pop is only one time when the ESP32 boots. It's not critical in my scenario because the speaker is not usually connected at boot (I'm making a telephone simulator), but the perfectionist in me still wants to control that startup pop. It's worth mentioning that you can use that ramp approach before and after each playback if you want to keep that i2s_config.tx_desc_auto_clear enabled. I was doing that for a while successfully, but I ran in to a situation with an audio stitching feature where the ramps were adding too much delay between stitched segments. Disabling the feature and stuffing the correct silence value into the buffer avoided that problem more elegantly for me. |
I found that it also helped to add I've used a combination of removing Thanks for the tips everyone! |
@tylercamp why not do a PR for your suggestion? |
I need to smoothly change the playback frequency to simulate an engine. But I realized that any change using i2s_set_sample_rates makes clicks in the wave. Is there any other way to change the frequency of the sound? Thanks for your library! |
! issue bug report upstream * first playback after init of class (call of constructor) * may be similar like earlephilhower/ESP8266Audio#406 ! may be check whether this is hardware dependend; may be just internal speaker affected and line out of RCA module not ! may be check wheteher use mic at same time as playback, could avoid i2s re-config and thus clic-noise * see schreibfaul1/ESP32-audioI2S#604 * problem is there is i2s config we don't have control of ! may be use i2s_write(...) with a zero buffer instead of connect, loop and stop playing * prevent clic-noise in beginning of recorded file by skipping some data
hi,
i read several issues about the click/pop noise when playing short sounds on the ESP32 via AudioOutputI2S, including
#68
#230
#367
As none of the above threads clearly shows a way how to slove the problem, i was wondering if it is possible at all (in software) - or why the issues have been closed.
I tried to remove the calls to
i2s_zero_dma_buffer((i2s_port_t)portNo);
in
ESP8266Audio/src/AudioOutputI2S.cpp
Line 207 in 6ed2604
and
ESP8266Audio/src/AudioOutputI2S.cpp
Line 305 in 6ed2604
as suggested, which slightly improved the situation: click noise not as harsh, but somehow another kind of noise remains even after the playback has finished.... so not really a solution. (or am i missing something?)
Is there a strategy to fix this (i seems to be a showstopper for several applications where the noise is very annoying).
thank you for this great library,
chris
The text was updated successfully, but these errors were encountered: