Nahimic (third party binaural)

Audiostack Nahimic™ Binaural module provides binaural spatialization algorithms developed by A-Volute™.

  1. Effects

Effects

Nahimic Binaural Spatialization

Provides Nahimic™ binaural spatialization.

Due to optimized signal processing, spatializated audio is mixed in one output channel.

I/O Channel count Sub channel count
in N 1 (MONO)
out 1 2 (BINAURAL)

Construction

No arguments

Usage :

context.createEffect(EFFECT_ID, BUS_ID, NahimicBinauralSpatialization);

Parameters

ø

Global parameters used by this IO :

  • application/buffer_size
  • application/sample_rate
Runtime
  • src_position (vec3, multivalued) : position of audio source

    This parameter will contain N values, with N equal to the number of channels reaching effect’s input.

    Parameter is mapped by default to source/%src_id/position

    Usage with default vars and patterns:

    float sourcePos[] = {1.0, 2.0, 3.0};
    context.setParameter("source/9/position", sourcePos);
    
  • listener_position (vec3, multivalued) : position of audio listener

    This parameter will contain N values, with N equal to the number of listeners.

    Parameter is mapped by default to listener/%list_id/position

    Usage with default vars and patterns:

    float playerPos[] = {1.0, 2.0, 3.0};
    context.setParameter("listener/1/position", playerPos);
    
  • listener_rotation (vec3, multivalued) : rotation of audio listener

    This parameter will contain N values, with N equal to the number of listeners.

    Parameter is mapped by default to listener/%list_id/rotation

    Usage with default vars and patterns:

    float playerRot[] = {1.0, 2.0, 3.0};
    context.setParameter("listener/1/rotation", playerRot);
    

Note : coordinates in Aspic Audiostack are specified using right-hand axes (X right, Y up, Z backward).



Code samples

For more code samples, see Nahimic samples

Nahimic spatialization sample

This sample spatialize audio for one listener.

For multilistener samples, please see Asio Extension samples.

[...]

enum:int{helloId = 0,outputId = 1, busId = 2, spatId = 3};

AudiostackContext context;
context.setLicenseKeyFromFile("LICENSE_FILE.aslc");
NahimicExtension::Load(context->impl);	// Load extension, allows to use inputs/outputs/effects contained in the extension

context.createInput(helloId, HelloInput);
context.createOutput(outputId, OpenALOutput,true);                 
// Output is stereo, because binaural effect produces a stereo output.

context.createBus(busId);                                       
context.createEffect(spatId,busId,NahimicBinauralSpatialization);

context.connect(helloId,busId);
context.connect(busId,outputId);

float sourcePos[]   =   {0.0, 0.0, -1.0};
float listenerPos[] =   {0.0, 0.0, 1.0};
float listenerRot[] =   {0.0, 0.0, 0.0};

context.setParameter("listener/1/position",listenerPos);
context.setParameter("source/0/position",sourcePos);

context.play();

char c;
do{
	std::cout<<"Press r or l to rotate the listener, press q to exit"<<std::endl;
	std::cin>>c;
	switch(c){
	case 'l':
		listenerRot[1]-=10;
		context.setParameter("listener/1/rotation",listenerRot);
		break;
	case 'r':
		listenerRot[1]+=10;
		context.setParameter("listener/1/rotation",listenerRot);
		break;
	}
}while(c!='q');

context.stop();

[...]