Pop and click with Audio
When I play audio there is an pop-click on startup and in some cases when the file is finished. I am working with wav files. I don't mind an initial power up pop but every time I play a wav sound it has the pop sound. If I play a wav file in a continuous loop then there is no pop sound. If there is just the slightest gap between the end and start of the file then you here the pop on start of the wav file and end of the wav file. I am using Rayman's SPIN WAV Player Ver. 1a. The pop sound is also present on startup if I run the singing demo. I have connected the board directly to a TV and most recently to a MAX4364 amp with built in pop-click suppression but the pop-click is still quite loud and very noticeable. I have looked through the forums and have seen different posts that mention the pop but no information on how to eliminate it. The HSS Demo doesn't appear to have this problem. I looked and there is a function "VolumeInterpol" that seems to be the way he eliminated the pop but I don't understand how it works since there is so much going on with the hss engine. I am using the Proto Board. Following the Propeller cookbook I connected a 200ohm resitor, .1uF capacitor and 10uf capacitor.

Comments
NextCnt:=cnt+1005000 FRQA:=$000F_FFFF repeat while FRQA < $8FFF_FFFF FRQA:=FRQA + $FFFF NextCnt+=5000 ' need this to be 5000 for 16KSPS @ 80 MHz waitcnt(NextCnt)In the above code if I set FRQA to anything higher than $000F_FFFF then you hear the pop. I think you are on the right track but there seems to be something else I just can't grasp.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
repeat if notEOF ==1 repeat i from 0 to buffSize-1 NextCnt+=5000 ' need this to be 5000 for 16KSPS @ 80 MHz waitcnt(NextCnt) if (j) 'if (p > 0) FRQA:=buff1[i]~ FRQB:=FRQA else ' if (buff2[i] < 0) FRQA:=buff2[i]~ FRQB:=FRQA NOT j [/i][/i][/i]http://www.rayslogic.com/propeller/Programming/dac/dac.htm
The SPIN loop is very tight, no room for anything extra...
If you have 1.58V before the audio starts, in most cases this is bad - the wav file should have a DC offset of 0V, so the pop you here is the the output changing from 1.58V to 0V. The output should always be at 0 when there is no audio, and most wav files should also have a DC offset of 0V
I hope this helps.
John
When the board starts up before the cap I am show 1.5v. Still get the pop on startup and when starting a new wav file.
Post Edited (drazmo) : 4/7/2008 8:58:15 PM GMT
PUB Play(s) | n,i,j,p i:=sd.mount(0) p:=0 repeat ' if PlayNow =1, play song stored based on s if (playNow==1) if (s==0) i:=sd.popen(string("Intro16.wav"), "r") ' <--------- Change .wav filename here !!!!!!!!!!!!!! elseif (s==1) i:=sd.popen(string("carry16s.wav"), "r") ' <--------- Change .wav filename here !!!!!!!!!!!!!! elseif (s==2) i:=sd.popen(string("test1.wav"), "r") else i:=sd.popen(string("test2.wav"), "r") 'ignore the file header (so you better have the format right!) 'See here for header format: http://ccrma.stanford.edu/CCRMA/Courses/422/projects/WaveFormat/ i:=sd.pread(@MonoData, 44) 'read data words to input stereo buffer 'Keep filling buffers until end of file ' note: using alternating buffers to keep data always at the ready... ' repeat n:=buffSize-1 j:=buffsize*2 repeat while (j==buffsize*2) 'repeat until end of file if (buff1[noparse][[/noparse]n]==0) j:=sd.pread(@MonoData, buffSize*2) 'read data words to input stereo buffer 'fill table 1 if buffer incomplete with last known value if (j==buffsize * 2) repeat i from 0 to n buff1[i]:=($8000+MonoData[i])<<16 bufflast:=buff1[noparse][[/noparse]n] else repeat i from 0 to n buff1[i]:=bufflast if (buff2[noparse][[/noparse]n]==0) j:=sd.pread(@MonoData, buffSize*2) 'read data words to input stereo buffer 'fill table 2 if buffer incomplete with last known value if (j==buffsize * 2) repeat i from 0 to n buff2[i]:=($8000+MonoData[i])<<16 bufflast:=buff1[noparse][[/noparse]n] else repeat i from 0 to n buff2[i]:=bufflast 'must have reached the end of the file, so close it playNow:=0 'sd.pclose ' keep buffer filled...while idle if (buff1[noparse][[/noparse]n]==0) 'fill table 1 repeat i from 0 to n buff1[i]:=bufflast if (buff2[noparse][[/noparse]n]==0) 'fill table 2 repeat i from 0 to n buff2[i]:=bufflast ' Pause before going to next wav p++ if (p==200) playNow:=1 p:=0 s++ if s >3 s:=0 else text.str(num.ihex(bufflast,8)) [/i][/i][/i][/i][/i][/i][/i][/i]▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
I have been able to eliminate the pop when a file starts to play with this code right after the "setup" in the asm routine. The code was posted on a mono wav player in the forums I just adapted it.
' Declick mov val, #0 :declick ' ramp up the audio DC output voltage from 0 to midway (0.5 VDD) 'waitcnt nexttime, delta mov nexttime, cnt add nexttime, delay waitcnt nexttime, delta mov frqa, val mov frqb, val add val,fadeval cmp val,midval wz ' midway yet? if_ne jmp #:declickThe pop at the end of playback can be removed if I remove 1000 from the samples read from the header. With...
SUBS nSamples,#500 SUBS nSamples,#500 MainLoop SUB nSamples,#1 .......It seems to play the entire audio file and no pop at the end. I just don't understand...why? Any suggestions? Some files end without the pop and some due if I leave the samples alone. If I remove the 1000 then it works. I am using GoldWave to edit my wav files.