Encoding FOA:
Filter:
atk-sc3/Guides (extension) | Libraries > Ambisonic Toolkit > Guides & Tutorials

Encoding FOA
ExtensionExtension

First Order Ambisonic (FOA) encoding examples
 

Authoring

Most users approaching Ambisonics are usually presented with two avenues to author an Ambisonic soundfield: capture a natural soundfield directly with a Soundfield microphone, 1 or author a planewave from a monophonic signal.2 SuperCollider's inbuilt PanB provides the latter solution.

The ATK provides a much wider palate of authoring tools via FoaEncode. These include:

In combination with the ATK's imaging tools, sound images can then be compositionally controlled as required.

The examples below are intended to briefly illustrate some of the first order encoding options made available in the Ambisonic Toolkit.

NOTE: See FoaEncode, FoaEncoderMatrix and FoaEncoderKernel for more details regarding FOA encoding.

Choose a decoder

As the Ambisonic technique is a hierarchal system, numerous options for playback are possible. These include two channel stereo, two channel binaural, pantophonic and full 3D periphonic. With the examples below, we'll take advantage of this by first choosing a suitable decoder with with to audition.

Choose a decoder suitable for your system, as illustrated here. You'll end up definining ~decoder and ~renderDecode .

NOTE: If you choose a kernel decoder, FoaDecoderKernel, be sure to free the kernel after use.

Mono

We have many choices to make when encoding a mono source. These examples include following an encoder with a transformer.

Omni & Push

Encoded as an omnidirectional soundfield (no space!), PinkNoise is used as the example sound source.

In a well aligned, dampend studio environment, this usually sounds "in the head". FoaPush is used to "push" the omnidirectional soundfield so that it becomes a planewave (infinite distance, in an anechoic environment) arriving from some direction.

The soundfield is controlled by MouseX and MouseY, where MouseX specifies the incident azimuth angle (pi to -pi; left to right of display) and MouseY the FoaPush angle (0 to pi/2; bottom to top of display). With the mouse at the bottom of the display, the soundfield remains omnidirectional. Placed at the top of the display, the soundfield becomes directional, and varying left/right position will vary the incident azimuth of the resulting planewave.

If you haven't already choosen a ~decoder and defined ~renderDecode, do so now.

NOTE: A matrix type encoder, see FoaEncoderMatrix: *newOmni for further details.

Frequency spreading & Push

Encoded as a frequency spread soundfield, PinkNoise is used as the example sound source. This sounds as spread across the soundfield, with the various frequency components appearing in various places. FoaPush is used to "push" the omnidirectional soundfield so that it becomes a planewave (infinite distance, in an anechoic environment) arriving from some direction.

The soundfield is controlled by MouseX and MouseY, where MouseX specifies the incident azimuth angle (pi to -pi; left to right of display) and MouseY the FoaPush angle (0 to pi/2; bottom to top of display). With the mouse at the bottom of the display, the soundfield remains spread. Placed at the top of the display, the soundfield becomes directional, and varying left/right position will vary the incident azimuth of the resulting planewave.

If you haven't already choosen a ~decoder and defined ~renderDecode, do so now.

NOTE: A kernel type encoder, see FoaEncoderKernel: *newSpread for further details.
WARNING: Kernel encoders require special care. Allow the kernel time to load before attempting to use. Additionally, the kernel buffer should be freed through the use of FoaEncoderKernel: -free after use.

Frequency diffusion & Push

Encoded as a frequency diffused soundfield, PinkNoise is used as the example sound source. This sounds as diffused across the soundfield, with the various frequency components appearing in various places, with various phases. FoaPush is used to "push" the omnidirectional soundfield so that it becomes a planewave (infinite distance, in an anechoic environment) arriving from some direction.

The soundfield is controlled by MouseX and MouseY, where MouseX specifies the incident azimuth angle (pi to -pi; left to right of display) and MouseY the FoaPush angle (0 to pi/2; bottom to top of display). With the mouse at the bottom of the display, the soundfield remains spread. Placed at the top of the display, the soundfield becomes directional, and varying left/right position will vary the incident azimuth of the resulting planewave.

If you haven't already choosen a ~decoder and defined ~renderDecode, do so now.

NOTE: A kernel type encoder, see FoaEncoderKernel: *newDiffuse for further details.
WARNING: Kernel encoders require special care. Allow the kernel time to load before attempting to use. Additionally, the kernel buffer should be freed through the use of FoaEncoderKernel: -free after use.

Stereo

As with mono sources, we have numerous options when encoding stereo sources. Here are a few.

Pan2, Stereo matrix & Zoom

In this example we first encode a single channel of PinkNoise into a stereophonic signal with Pan2. FoaZoom is then used to balance the soundfield across the x-axis (front/back).

The soundfield is controlled by MouseX and MouseY, where MouseX specifies the left to right position of the stereo panned source and MouseY the FoaZoom front to back position (distortion angle). Moving the mouse in a circular motion results in a circular motion of the sound.3

If you haven't already choosen a ~decoder and defined ~renderDecode, do so now.

NOTE: A matrix type encoder, see FoaEncoderMatrix: *newStereo for further details.

Stereo matrix

For this example we'll look at encoding stereo soundfiles.

The stereo encoder places the left channel at +pi/4 and the right at -pi/4. Compare to the Super Stereo encoder below.

If you haven't already choosen a ~decoder and defined ~renderDecode, do so now.

NOTE: A matrix type encoder, see FoaEncoderMatrix: *newStereo for further details.
NOTE: Soundfile Credits

Super Stereo

Super Stereo4 is the classic Ambisonic method to encode stereophonic files, and is considered to be optimal for frontal stereo encoding.

If you haven't already choosen a ~decoder and defined ~renderDecode, do so now.

NOTE: A kernel type encoder, see FoaEncoderKernel: *newSuper for further details.
WARNING: Kernel encoders require special care. Allow the kernel time to load before attempting to use. Additionally, the kernel buffer should be freed through the use of FoaEncoderKernel: -free after use.
NOTE: Soundfile Credits

Ambisonic UHJ stereo

Ambisonic UHJ is the stereo format for Ambisonics.

If you haven't already choosen a ~decoder and defined ~renderDecode, do so now.

NOTE: A kernel type encoder, see FoaEncoderKernel: *newUHJ for further details.
WARNING: Kernel encoders require special care. Allow the kernel time to load before attempting to use. Additionally, the kernel buffer should be freed through the use of FoaEncoderKernel: -free after use.
NOTE: Soundfile Credits

Tetrahedral, aka A-format

You may like to review the discussion on Gerzon's experimental tetrahedral recording, along with the discussion of the spatial domains.

NOTE: The ATK views A-format as a uniform spherical soundfield decomposition, rather than as raw, uncorrected microphone feeds.

Diffuse field & Push

Here we encode four channels of decorrelated PinkNoise as a decorrelated soundfield, resulting in a maximally diffuse soundfield. FoaPush is used to "push" the soundfield so that it becomes a planewave (infinite distance, in an anechoic environment) arriving from some direction. This technique gives the opportunity to continuously modulate between a directional and a diffuse soundfield.

The soundfield is controlled by MouseX and MouseY, where MouseX specifies the incident azimuth angle (pi to -pi; left to right of display) and MouseY the FoaPush angle (0 to pi/2; bottom to top of display). With the mouse at the bottom of the display, the soundfield remains omnidirectional. Placed at the top of the display, the soundfield becomes directional, and varying left/right position will vary the incident azimuth of the resulting planewave.

If you haven't already choosen a ~decoder and defined ~renderDecode, do so now.

NOTE: A matrix type encoder, see FoaEncoderMatrix: *newAtoB for further details.

Spaced microphones

This example is somewhat unconvential as regards the literature. Four microphones (omnis) are place around the performer in a tetrahedron. This is then matrixed into B-format.

As the performer rotates and moves about, the image shifts through the sound-scene. In a compositional context, FoaPush could be used to control the soundfield.

If you haven't already choosen a ~decoder and defined ~renderDecode, do so now.

NOTE: A matrix type encoder, see FoaEncoderMatrix: *newAtoB for further details.
NOTE: Soundfile Credits

2D & 3D surround

Octophonic

The pantophonic encoder may be used to transcode from one format to another. This example transcodes an octophonic recording to the decoder you've chosen.

If you haven't already choosen a ~decoder and defined ~renderDecode, do so now.

NOTE: A matrix type encoder, see FoaEncoderMatrix: *newPanto for further details.
NOTE: Soundfile Credits

Dome

The directions encoder may be used to transcode from one format to another. This example transcodes a periphonic 12-channel recording to the decoder you've chosen.

If you haven't already choosen a ~decoder and defined ~renderDecode, do so now.

NOTE: A matrix type encoder, see FoaEncoderMatrix: *newPanto for further details.
NOTE: Soundfile Credits

2D ZoomH2

While no longer manufactured, the ATK includes an encoder for the ZoomH2 handheld digital audio recorder.

NOTE: As a simple matrix encoder, no frequency dependent spatial domain correction is applied.

ZoomH2, forward

The ZoomH2 is a convenient, portable handheld recorder. The device only records horizontal surround (pantophonic), so we don't get height.

As a relatively inexpensive piece of equipment, the imaging of the ZoomH2 isn't always as consistent as we'd prefer. To remedy, the Y gain is tweaked to widen the image, and dominance is applied to stabilise the front.

If you haven't already choosen a ~decoder and defined ~renderDecode, do so now.

NOTE: A matrix type encoder, see FoaEncoderMatrix: *newZoomH2 and FoaXformerMatrix: *newDominateX for further details.
NOTE: Soundfile Credits

ZoomH2, reversed

As described here, the ZoomH2 encoder reverses the labels for front and back of the ZoomH2. This is done to favour the use of the decoder as a roving, hand-held device, with the display facing the operator.

If one wishes to respect the labelled orientation of the device as does Courville in the example below, we'll need to either adjust the angles argument or apply FoaXform: *newMirrorX. For this example, we'll set angles = [3/4*pi, pi/3], which are those specified in the ZoomH2 documentation.

As a relatively inexpensive piece of equipment, the imaging of the ZoomH2 isn't always as consistent as we'd prefer. To remedy, the Y gain is tweaked to widen the image.

If you haven't already choosen a ~decoder and defined ~renderDecode, do so now.

NOTE: A matrix type encoder, see FoaEncoderMatrix: *newZoomH2 for further details.
NOTE: Soundfile Credits

[1] - J.-M. Batke, "The B-Format Microphone Revised," presented at the Ambisonics Symposium 2009, Graz, 2009.
[2] - D. G. Malham and A. Myatt, "3-D Sound Spatialization using Ambisonic Techniques," Computer Music Journal, vol. 19, no. 4, pp. 58-70, 1995.
[3] - We don't advise using this approach for encoding monophonic sources. The technique illustrated here is the idiomatic method. If one desires a similar use of the mouse, MouseX and MouseY can be mapped appropriately to FoaPush's angle, theta, and phi parameters.