I'm very new to audio processing and the opensl es system. I'm currently developing an app that generates anti noise. My idea is to invert the values in the audio buffer queue, however, all the methods I've tried are not working. I'm using opensl es as my app requires low latency.
Configuration:
uint8_t *buffer; //buffer size is 384
engine.bitsPerSample_ = SL_PCMSAMPLEFORMAT_FIXED_16;
engine.sampleChannels_ = 1;
Methods tried:
- Bitwise negation: e.g.
bufffer[i] = ~buffer[i];
- standard math: e.g. if buffer[i] is 200 then buffer[i] = 127 - 73(difference between 127 and 200);
- Various other methods which were more or less trial and error
Aim:
All the values in the buffer are correctly inverted and when enqueued to SLAndroidSimpleBufferQueueItf the playback sound is the inverse of the source.
Does anyone know what the best way to solve this is?
Any and all help will be greatly appreciated :)