Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audible "pops" with CAmbisonicProcessor->Process() #5

Open
robotogre opened this issue Sep 20, 2017 · 5 comments
Open

Audible "pops" with CAmbisonicProcessor->Process() #5

robotogre opened this issue Sep 20, 2017 · 5 comments

Comments

@robotogre
Copy link

robotogre commented Sep 20, 2017

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?

@magwyz
Copy link
Contributor

magwyz commented Sep 20, 2017

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

@robotogre
Copy link
Author

robotogre commented Sep 20, 2017

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 ;
  
}   

}

`

@magwyz
Copy link
Contributor

magwyz commented Sep 20, 2017

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?

@robotogre
Copy link
Author

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.

@magwyz
Copy link
Contributor

magwyz commented Sep 26, 2017

Yes, it may not provide fast enough the audio samples to the audio card.
Could you check the processor usage of your app?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants