1

I am having some issues with understanding Superpowered audio output processing. Everything was fine when I was using SuperpoweredFloatToShortInt input buffers as;

buffer[n] = (float *)memalign(16, (buffersize + 16) * sizeof(float) * 2);)

then I realised my audio output have been mono all this while so I decided to process my output using SuperpoweredFloatToShortIntInterleave to give out surround stereo effect. Using the same buffer[n] variable, my audio got processed but was distorted and low-pitched towards bass when testing on device.

I have also tried having separate buffer variables as learnt here with these:

inputBufferFloat = (float *)malloc(buffersize * sizeof(float) * 2 + 128);
 leftInputBuffer = (float *)malloc(buffersize * sizeof(float) + 128);
 rightInputBuffer = (float *)malloc(buffersize * sizeof(float) + 128);
 leftOutputBuffer = (float *)malloc(buffersize * sizeof(float) + 128);
 rightOutputBuffer = (float *)malloc(buffersize * sizeof(float) + 128)


static bool audioProcessing(void * __unused clientdata, short int *audioInputOutput, int numberOfSamples, int 
__unused samplerate) {
 SuperpoweredShortIntToFloat(audioInputOutput, inputBufferFloat, numberOfSamples, 2);
 SuperpoweredDeInterleave(inputBufferFloat, leftInputBuffer, rightInputBuffer, numberOfSamples);
 FIR(leftInputBuffer, leftOutputBuffer, numberOfSamples);
 FIR(rightInputBuffer, rightOutputBuffer, numberOfSamples);
 SuperpoweredFloatToShortIntInterleave(leftOutputBuffer, rightOutputBuffer, audioInputOutput, 
numberOfSamples);
 return true;
}

But the app crashes instantly at test. Please, any help at all will be much appreciated. Thanks.

1 Answers1

0

You may set up the audio I/O with a different "buffersize", such as "buffersize" multiplied by two. In this case your "numberOfSamples" will be twice as big and your buffers not big enough.

Gabor Szanto
  • 1,329
  • 8
  • 12