Audio Popping Question

So, for the final project in a coding class I made a synth using the Maximilian add-on. It works great but half the time I launch it there’s an awful pop. I don’t no how to get rid of it and always just mute my computer when it’s launching. any ideas?


try ramping up the amplitude when the application starts instead of generating sound at the maximum amplitude right away.

@arturo yeah, I saw that mentioned in the of book page about audio. How do I implement that?

just multiply the signal by a number increasing from 0 to 1

would you mind showing me an example of that I still can’t get it to work. I tried 03%20AM

with 2 being the number of channels and that done in setup.

yes that’s pretty much it but with j starting at 0, doing it in the audio callback and declaring j in the .h so you can keep increasing it until it reaches 1. also don’t forget to clamp j between 0 and 1

depending on the increment of j the ramp up will be slower or faster usually 100ms is more than enough

This will not ramp the volume, instead it is just setting the value stored in the buffer.

It should be something like:
in the .h file place the following:

float volumeRamp = 0;
bool bNeedsVolumeRamp = true;

then in the audio callback function, which probably is void ofApp::audioOut(ofSoundBuffer & buffer)
put the following at the end of the function, after you’ve done any processing of the audio signal

size_t nChans =buffer.getNumChannels();
	for (size_t i = 0; i < buffer.getNumFrames(); i++){
		for(size_t j = 0; j < nChans; j++){
			buffer[i*nChans + j] *= volumeRamp;
		volumeRamp += 0.01; // adjust this value to change how much time it takes to make the ramp.
		if(volumeRamp > 1.0f){
			volumeRamp = 1.0f;
		bNeedsVolumeRamp = false;

oh yeah sorry i didn’t realized it was just setting the value not multiplying

1 Like

I’ve had a lot of success and fixing audio popping issues by using a ofScopedLock() in the whole ofApp::AudioOut when dealing with dynamic variables that drive audio parameters, specially using Maximillian. You might want to implement that as well!

1 Like

well that’s something you need to do if you are going to use dynamic variables that are being modified elsewhere as the audio callbacks are running in a different thread. It is also relevant to the popping audio the way in which the dynamic variables change; if these have abrupt changes it might become into a kind of pop, but that depends on what you are doing with these. In order to avoid such abrupt changes you can use some kind of smoothing.