vbapg
Prev | Orchestra Opcodes and Operators | Next

## vbapg

vbapg — Calculates the gains for a sound location between multiple channels.

## Description

Calculates the gains for a sound location for up to 64.

## Syntax

    k1[, k2...] vbapg kazim [,kelev] [, kspread] [, ilayout]

    karray[] vbapg kazim [,kelev] [, kspread] [, ilayout]

## Initialization

ilayout -- index of the speaker layout in the range 0-99, corresponding to a call to vbaplsinit. The default value is 0.

## Performance

kazim -- azimuth angle of the virtual source

kelev (optional) -- elevation angle of the virtual source

kspread (optional) -- spreading of the virtual source (range 0 - 100). If value is zero, conventional amplitude panning is used. When kspread is increased, the number of loudspeakers used in panning increases. If value is 100, the sound is applied to all loudspeakers.

vbapg calculates the gains that an input signal would have between multiple speakers according to the controls kazim and kelev, and the configured loudspeaker placement ilayout. If idim = 2, kelev is set to zero. The distribution is performed using Vector Base Amplitude Panning (VBAP - See reference). VBAP distributes the signal using loudspeaker data configured with vbaplsinit. The signal is applied to, at most, two loudspeakers in 2-D loudspeaker configurations, and three loudspeakers in 3-D loudspeaker configurations. If the virtual source is panned outside the region spanned by loudspeakers, the nearest loudspeakers are used in panning.

| Warning
Please note that all vbap panning opcodes require the vbap system to be initialized using vbaplsinit.

## Examples

## Reference

Ville Pulkki: “Virtual Sound Source Positioning Using Vector Base Amplitude Panning” Journal of the Audio Engineering Society, 1997 June, Vol. 45/6, p. 456.

## Examples

Here is an example of the vbapg opcode. It uses the file vbapg.csd.

Example 1106. Example of the vbapg opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    -odac  ;;;realtime audio out
    ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ; -o vbap4.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    sr = 44100
    ksmps = 32
    nchnls = 4	;quad
    0dbfs  = 1

    vbaplsinit 2.01, 4, 0, 90, 180, 270

    instr 1

    asig diskin2 "beats.wav", 1, 0, 1		;loop beats.wav
    kaz  line 0, p3, p4				;come from right rear speaker &
    k1,k2,k3,k4 vbapg  180, 100, kaz, 1             ;change spread of soundsource
         printks "spread of source = %d\n", 1, kaz	;print spread value
         outq asig*k1,asig*k2,asig*k3,asig*k4

    endin
    </CsInstruments>
    <CsScore>

    i 1 0 12 100

    e
    </CsScore>
    </CsoundSynthesizer>

Its output should include lines like these:

    spread of source = 0
    spread of source = 8
    spread of source = 17
    spread of source = 25
    spread of source = 33
    spread of source = 42
    spread of source = 50
    spread of source = 58
    spread of source = 67
    spread of source = 75
    spread of source = 83
    spread of source = 92
    spread of source = 100

## See Also

vbap, vbapmove, vbap4, vbap4move, vbap8, vbap8move, vbap16, vbap16move, vbaplsinit, vbapz, vbapzmove

## Credits

Author: Ville Pulkki
Sibelius Academy Computer Music Studio
Laboratory of Acoustics and Audio Signal Processing
Helsinki University of Technology
Helsinki, Finland
May 2000
Author: John ffitch
July 2012, Sept 2013

New in Csound Version 5.17.13.

Array version new in Csound Version 6.01.

Prev | Up | Next
vbapmove | Home | vbapgmove