Open robotogre opened 6 years ago
In VLC media player, we do not have recurrent audible pops with the CAmbisonicProcessor. Are you sure you configure it correctly?
For a reference implementation, please have a look at VLC media player source code: https://github.com/videolan/vlc/blob/master/modules/audio_filter/channel_mixer/spatialaudio.cpp
Thank you for the reply and the VLC code!
I am feeding in the PCM data from an ambiX-ordered four-channel b-format audio stream. My code looks like this:
// DEFAULT_ORDER 1 // DEFAULT_SAMPLERATE 48000 // DEFAULT_HEIGHT true int tail; int misc;
`setup ()
{
// AMBISONIC
bin = new CAmbisonicBinauralizer();
zoomer = new CAmbisonicZoomer();
processor = new CAmbisonicProcessor();
processor->Configure(DEFAULT_ORDER, DEFAULT_HEIGHT, 1024, misc);
processor->Refresh();
bin->Configure(DEFAULT_ORDER, DEFAULT_HEIGHT, DEFAULT_SAMPLERATE, 1024, tail);
ppfDst = new float*[2];
ppfDst[0] = new float[1024];
ppfDst[1] = new float[1024];
bool success = myBFormat.Configure(DEFAULT_ORDER, DEFAULT_HEIGHT, 1024);
}
onFrame()
{
myBFormat.InsertStream(AmbChan1, 0, frames);
myBFormat.InsertStream(AmbChan2, 1, frames);
myBFormat.InsertStream(AmbChan3, 2, frames);
myBFormat.InsertStream(AmbChan4, 3, frames);
processor->SetOrientation(Orientation(lastYaw,lastPitch,lastRoll));
processor->Refresh();
processor->Process(&myBFormat, frames);
bin->Process(&myBFormat, ppfDst);
for (int i = 0; i < frames ; i++) {
int16_t sampleLeft = ppfDst[0][i] * 32768;
int16_t sampleRight = ppfDst[1][i] * 32768;
outBuffer16[i * outChannels] = sampleLeft ;
outBuffer16[i * outChannels + 1] = sampleRight ;
}
}
`
If you change the angles on each frame, this is normal in the current version of the lib that you ear pops. The decoding equations are indeed brutally modified, which leads to discontinuities in the decoded signal. Can you reproduce if you set a constant angle?
Sadly, yes. Even processor->SetOrientation(Orientation(0,0,0));
produces intermittent popping. It should be noted that I am running this on Android, so one possibility is that the Android processor simply isn't fast enough to keep up.
Yes, it may not provide fast enough the audio samples to the audio card. Could you check the processor usage of your app?
If I run:
binaurilizer->Process(&myBFormat, ppfDst);
By itself, there is no audible distortion.
However, if I run:
processor->SetOrientation(Orientation(0,0,0)); // The pops occur no matter the Yaw/Pitch/Roll
processor->Refresh();
processor->Process(&myBFormat, frames);
`
binaurilizer->Process(&myBFormat, ppfDst);`Then there are audible "pops".
Is this supposed to happen? If not, is there a sample MP4 I could try to test my implementation?