VBAP multispeaker spatialization

VBAP extension provides effects for spatialization over multiple speaker. The effects of this module will apply the appropriate gain on all speakers to perceive sound from the correct direction. This extension also handles delay and frequency corrections to ensure a smooth rendering.

Note : To address multiple harware outputs see Asio or Jack.

  1. Effects
  2. Helpers
  3. Code samples

Effects

Multi Channel Spatialization

Provides VBAP-based spatialization for rendering over speakers.

Each input channel is spatialized independently (no mixing), which enables you to add more “per-channel” effects after this spatialization.

I/O Channel count Sub channel count
in N 1 (MONO)
out N M (nb speakers)

Construction

  • nbSubChannel (unsigned int) : count of output subchannels.

    Warning: nbSubChannel must equals the installation speaker count

  • defaultSpeakerPositions (float) : array of default speaker positions. This float[] must have a length equal to 3x nbSubChannel

Usage :

float[] speakerPos{-1,0,1, 1,0,1, 1,0,-1, -1,0,-1};
context.createEffect(EFFECT_ID, BUS_ID, MultiChannelSpatialization, 4, speakerPos);

Example for a 3 speakers positions array :

0 1 2 3 4 5 6 7 8
S1.x S1.y S1.z S2.x S2.y S2.z S3.x S3.y S3.z

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

Parameters

  • 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);
    
  • hardware_position(vec3, multivalued) : position of each speaker

    This parameter will contain N values, with N equal to the number of speakers/subchannels.

    Parameter is mapped by default to hardware/%speaker_id/position

    Usage with default vars and patterns:

    float oneSpeakerPos[] = {1.0, 2.0, 3.0};
    context.setParameter("hardware/4/position", oneSpeakerPos);	// move 5th speaker position
    

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



Helpers

Calibration

VBAP extension offers methods to calibrate your speaker setup. Using sine sweeps and offline processing, it computes gain, delay, and filters to ensure your setup will provide homogeneous renderings.

These helpers are being documented, if you have specific questions, please contact us.




Code samples

For more code samples, see VBAP samples

Please note that our VBAP samples use ASIO or JACK outputs, in order to provide multiple speakers capabilities.

VBAP spatialization sample

This sample spatialize hello input for one listener with 4 speakers. Audio output is achieved with jack but could rely on ASIO with a slightly different code.

[...]

enum:int{helloIn=0,jackOut=1,bus,vbap};

AudiostackContext context;
context.setLicenseKeyFromFile("LICENSE.aslc");

context.createInput(helloIn,HelloInput);
context.createOutput(jackOut,JackOutput,4U);	// 4 outputs

context.createBus(bus);
context.createEffect(vbap,bus,MultiChannelSpatialization,4U);

float pos1[] = {-1,0,1};
float pos2[] = {-1,0,-1};
float pos3[] = {1,0,-1};
float pos4[] = {1,0,1};

context.setParameter("hardware/0/position",pos1);
context.setParameter("hardware/1/position",pos2);
context.setParameter("hardware/2/position",pos3);
context.setParameter("hardware/3/position",pos4);

context.connect(helloIn, bus);
context.connect(bus,jackOut);

context.play();

float pos[] = {0.0,0.0,-1.0};
float listPos[] = {0.0,0.0,0.0};
float listRot[] = {0.0,0.0,0.0};
context.setParameter("source/0/position",pos);
context.setParameter("listener/1/position",listPos);
context.setParameter("listener/1/rotation",listRot);

char c;
do{
	std::cout<<"Feel free to connect jack ports (with program such as 'qjackctl').\n\tPress r or l to rotate the listener, press q to exit"<<std::endl;
	std::cin>>c;
	switch(c){
	case 'l':
		listRot[1]-=10;
		context.setParameter("listener/1/rotation",listRot);
		break;

	case 'r':
		listRot[1]+=10;
		context.setParameter("listener/1/rotation",listRot);
		break;

	}
}while(c!='q');

context.stop();

[...]


For more code samples, see VBAP samples