Hi there JUCE community, I try to write a program that can play the contents of one audio buffer and write the recorded samples in the other audio buffer.
So, I have have tried to do it with AudioIODeviceCallback class, where I set up the device via device manager using JUCE selector component, AudioDeviceSelectorComponent.
Here is how I managed to do it:
In the audio callback method
void audioDeviceIOCallback(const float** inputChannelData, int numInputChannels, float** outputChannelData, int numOutputChannels, int numSamples)
First I store the input data into my recording buffer, and then I put the new samples from my playback buffer in the output data. And that solution seemed to work.
About the playback signals, I have two different. First one is chirp, sine-sweep, signal which I generate by myself, while the second one is a pink noise signal which I load from my BinaryData. The problem is the following, when I try out my method with chirp signal, it actually works, it gets reproduced and recorded at the same time. But, with pink noise it is different. It appears like the mic is not detecting it.
I use a laptop, when I try it out speakers are blasting the freaking pink noise, it is impossible for mic not to detect it, but a funny thing is that when I try and speak while noise is being reproduced, mic detects it and record it. When I save that recording as a wav file,and listen to it, I can hear only the parts with my voice where you can hear actual noise on top of it,but in between is nothing,just a really low level noise being recorded.
Now is that something that I shall maybe fix with playing with input/output latencies? Or is it maybe, it came to my mind now while I was writing this, that my laptop and its built-in mic actually have some type of noise canceller?! I will give it a quick try to see and I’ll let you know.
If you have some advices,please feel free to share it.
Thanks in advance, Cila
Edit: The thing is that when it starts reproducing the pink noise, recorder detects it for a short period of time, maybe 10-20ms and then it smoothly reduce its level, so maybe it really is a noise cancelling thing with a mic, but I am now trying to see if I have an option to somehow deactivate that?
Edit_2: Hahaha it is fixed,noise cancellation actually did its job very well. Now it works,very well. This can be closed. Cheers!