bformenc1
Prev | Orchestra Opcodes and Operators | Next

## bformenc1

bformenc1 — Codes a signal into the ambisonic B format.

## Description

Codes a signal into the ambisonic B format

## Syntax

    aw, ax, ay, az bformenc1 asig, kalpha, kbeta

    aw, ax, ay, az, ar, as, at, au, av bformenc1 asig, kalpha, kbeta

    aw, ax, ay, az, ar, as, at, au, av, ak, al, am, an, ao, ap, aq bformenc1 \
          asig, kalpha, kbeta

## Performance

aw, ax, ay, ... -- output cells of the B format.

asig -- input signal.

kalpha –- azimuth angle in degrees (anticlockwise).

kbeta -- altitude angle in degrees.

## Example

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

Example 57. Example of the bformenc1 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
    ; Audio out   Audio in    No messages
    ;-odac           -iadc     -d     ;;;RT audio I/O
    ; For Non-realtime ouput leave only the line below:
     -o bformenc.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 8

    instr 1
            ; generate pink noise
            anoise pinkish 1000

            ; two full turns
            kalpha line 0, p3, 720
            kbeta = 0

            ; fade ambisonic order from 2nd to 0th during second turn
            kord0 = 1
            kord1 linseg 1, p3 / 2, 1, p3 / 2, 0
            kord2 linseg 1, p3 / 2, 1, p3 / 2, 0

            ; generate B format
            aw, ax, ay, az, ar, as, at, au, av bformenc1 anoise, kalpha, kbeta, kord0, kord1, kord2

            ; decode B format for 8 channel circle loudspeaker setup
            a1, a2, a3, a4, a5, a6, a7, a8 bformdec1 4, aw, ax, ay, az, ar, as, at, au, av

            ; write audio out
            outo a1, a2, a3, a4, a5, a6, a7, a8
    endin

    </CsInstruments>
    <CsScore>

    ; Play Instrument #1 for 20 seconds.
    i 1 0 20
    e

    </CsScore>
    </CsoundSynthesizer>

## See Also

bformdec1

## Credits

Author: Richard Furse, Bruce Wiggins and Fons Adriaensen, following code by Samuel Groner
2008

New in version 5.09

Prev | Up | Next
bformenc | Home | bformdec