Mosca:
Filter:
Mosca/Classes (extension) | Libraries > Ambisonic Toolkit | Libraries > HOA

Mosca
ExtensionExtension

GUI-assisted authoring of sound fields
NOTE: Installing the ATK Kernels and Matrices is required, as well as the sc3-plugins version 3.10 or higher. For more Library options, you can install this HOA fork

Description

Mosca is a SuperCollider class for GUI-assisted production of sound fields with simulated moving or stationary sound sources. Input sources may be any combination of mono, stereo or B-format material and the signals may originate from file, from external inputs (physical or from other applications via Jack) or from SuperCollider's own synths. In the case of synth input, each is associated by the user with a particular source and registered in a synth registry. This way, they are spatialised and also receive data from the source control (eg. x, y and z coordinates or auxiliary fader data). Ambisonic Sound fields may be decoded using a variety of built-in decoders (including binaural), Faust Ugens created with the AmbiDecodertoolbox (see HOA decoding) or with external decoders such as Ambdec. Mosca has its own transport provided by the Automation quark for recording and playback of source data. This can be used independently or may be synchronised to a DAW using Midi Machine Control (MMC) messages. This function has been tested to work with Ardour and Jack. The integration of ossia-sclang also allows Mosca's individual parameters to be controled with the interactive sequencer Ossia/score as well as any other application featuring OSCQuerry or plain OSC communication.

Sources

Mono and stereo sources may be spatialized with ugens from a selection of libraries (Ambitools, HoaLib, ADT, ATK, BF-FMH, Josh & VBAP) set indiviualy for each source. For B-format input signals, which are already ambisonically encoded, the available options for transformation the ATK and Abitools. The ATK is used to implement push transformations to manipulate the angular location of sources as well as to perform rotations of the source sound field and to manipulate its directivity. Ambitools is used to implement a beam formation technique. All sources are subject to high frequency attenuation with distance. For a better sensation of nearness, ATK implements a proximity effect, adding a bass boost to proximal sources among other phase effects to simulate wave curvature. To that same effect, the Ambitools encoder makes use of "Near Field Compensation". Generally, the differences between libraries can be summarised as follows:

Ambitoolsmost realistic but CPU demanding
HoaLiblightweight and neutral sounding
ADTlightweight and broad sounding
SC-HOAeven lighter
ATK1st order only but many options
BF-FMH2nd order max
Josh1st order granular effect
VBAPlight and precise but less homogeneous
NOTE: The results of any particular spatialisation library are often dependant on the source material. ADT and ATK may be more suited to wide and deep immersive sounds where more focussed, narrow sounds may be better located by the listener with VBAP. ...

Reverberation

Reverberation is performed either using a B-format tail impulse responses (IRs) or by using reverberators crated with SuperCollider's AllpassC and FreeVerb ugens. With both options, two reverberation level controls are included in the GUI for setting close and distant levels. "Close" reverberation in this case is "global" and is audible by the listener from all directions when the source is close. As it is global, it's type is applied to the entire scene. "Distant" reverb on the other hand is "local" in scope and selected and applied on a per-source basis. It is processed by the individually selected spatialiser along with the dry signal. This effect predominates as the source becomes more distant. For ambisonic signals, the "Close" reverberation may be described as a "2nd order diffuse A-format reverberation". This technique produces reverberation weighted in the direction of sound events and involves conversion to and from A-format in order to apply the effect (ANDERSON). The encoded 2nd order ambisonic signal is converted to a 12-channel A-format signal and then either:

For non-ambisonic signals, spatialised with VBAP, a part of the original source signal is mixed with the W component of the B-format reverb input for an omnidirectional effect. These options are drawing from John Chowning's technique of applying "local" and "global" reverberation to sources (CHOWNING)

NOTE: Please remember that this diffuse reverberation process, especially with large impulse responses, may require the user to increase the audio buffer size, thus adding more latency.

Additional Features

Additional features include a scalable Doppler Effect on moving sources, the looping of sources loaded or streamed from file and the adjustment of the virtual loudspeaker angle for stereo sources. Further, a "contraction" control enables crossfades between B-format signals and their raw W component. In the case B-format input signals the contraction changes the sound from having omnidirectional characteristics to becoming a focussed point source. When using the ATK in the case as mono or stereo input sources (the latter of which are treated as two mono sources with adjustable angle from one another) with the ATK, a de-contraction of the focussed source will render it omnidirectional.

Mosca supports methods for making "A-format inserts" on any source spatialised in the GUI. In this way, the user may write a filtering synth and apply it to the sound without disrupting the encoded spatial characteristics. Please see the guide for examples.

Additionally, Mosca v0.2 implements headtracking with the Arduino 9-axes Motion Shield and an appropriate Arduino board such as an Uno. Mosca may also run GUI-free and has a mechanism for coded control of the interface (Setup example in the guide).

Acknowledgments

The class makes extensive use of the Ambisonic Toolkit (ATK) by Joseph Anderson as well as Florian Grond's SC-HOA, based on Ambitools by Pierre Lecompte, the faust version of the HoaLibrary by Pierre Guillot, the AmbiDecoderToolbox and sevral other supercollider pluggins for spatial renderding. Augmented controll has been granted by the integrating the Automation quark by Neels Hofmeyr and ossia-sclang, made possible by Pierre Cochard, Jean-Michaël Celerier and the OSSIA Team.

Many thanks to Joseph Anderson, Neels Hofmeyr and members of the SuperCollider list for their assistance and valuable suggestions.

References

ANDERSON, Joseph. Authoring complex Ambisonic soundfields: An artist's tips & tricks. DIGITAL HYBRIDITY AND SOUNDS IN SPACE JOINT SYMPOSIUM. University of Derby, UK: 2011.

CHOWNING, John M. The Simulation of Moving Sound Sources. Computer Music Journal, v. 1, n. 3, p. 48-52, 1977.

GROND, Florian & LECOMPTE, Pierre. Higher Order Ambisonics for SuperCollider. Linux Audio Conference, Jean MONNET University. Saint-Etienne France: 2017.

CELERIER, Jean-Michaël. Authoring interactive media : a logical & temporal approach. Ph. D dissertations, University of BOrdeaux, France: 2018.

Class Methods

.new

Create Mosca instance, prepare IR spectrum data and synth internals.

Arguments:

autoDir

Path to automation directory.

nsources

The number of sources to be spatialised.

dur

Duration in seconds of automation transport.

irBank

Path to B-Format ambisonic room impulse responses folder. Ensure that it has the same sample rate as your system.

server

Server used. Default is Server.default.

parentOssiaNode

An OSSIA_Node that will contain all of Mosca's parameters. It would most likely be an OSSIA_Device. see OssiaReference

NOTE: If parentOssiaNode is left blank, an OSSIA_Device named "SC" is created and can be accesed with the .parentOssiaNode method
allCritical

Set all OSSIA_Parameter to "critical" for websocket communication exclusively. (necessary when used outside of a local network). Only relevant when exposing an OSCQuerry server

decoder

The ambisonic decoder to be used. See the following for ATK

for Higher order ambisonics, see the tutorial for the AmbiDecoderToolbox.

NOTE: If decoder is left blank, Mosca will send raw ambisonic signal to the "rawoutbus" for external decoding with, for example, AmbDec. Non-ambisonic signal will still ouput normaly to "outbus". If the string "internal" is passed as the decoder argument, Mosca will use either the BFDecode1 (1st order) or the FMHDecode1 (2nd order) ugens.
maxorder

Maximum Ambisonics order for the rendering system. Default is 1, Mosca's limit (SC_HOA) is 5.

speaker_array

Speaker setup defined with nested array in the form [[speaker 1 azimuth in degrees, speaker 1 elevation in degrees, speaker 1 radius in meters],[speaker 2 ...], ...]

outbus

Index of the first output bus, all other channels folow sequentialy.

suboutbus

Index of the output bus for subwoofers, the signal is a mono mix of all other channels.

rawformat

Starting bus for raw first ambisonic output.

rawoutbus

Starting bus for raw first order ambisonic output.

autoloop

If set true, transport will always loop.

Returns:

New instance.

.printSynthParams

Print Parameters usable in SynthDefs.

Returns:

A string.

Instance Methods

.gui

Create the graphical interface.

Arguments:

size

Pixel width and height of GUI window. Minimum of 550 pixels.

palette

Color palette of the gui.

lag

Maximum interval in seconds to refresh GUI. Default is 0.07.

.headTracker

Connect to the head traker module (Arduino) through the serial port.

Arguments:

port

Name of serial port to receive headtracking data. Eg. "/dev/ttyACM0", or the udp port to connect to pozyx.py, for use with a binaural decoder. Default is nil.

offsetheading

Value in degrees radians to offset heading value of the connected Arduino 9-axes Motion Shield. Default is 0. This may be used to adjust for the "magnetic declination" of your local region, calibrating the shield to true north (see the wikipedia entry and http://www.magnetic-declination.com). It may also be used to rotate North to the direction of your computer monitor. Eg. If when you are facing the monitor and the offsetheading is set to the default 0, you see a heading value (bottom- right of window) of 2.6, set the value to -2.6. The heading value will now be set to zero when you face the monitor.

type
  • \orient allows the use of a BNO05 chip snding serial data through Arduino to control the orientation parameter. See Mosca/headTracker/headTrackGPS.ino
  • \gps adds gps tracking to control the position parameter.
  • \pozyx0SC allows the use of a pozyx tag sending serial data through the pozyx python API to control orientation and position parameters with OSC. See Mosca/headTracker/pozyx.py
extraArgs

Extra arguments for postioning. With \pozyx type, extra Args reprensent the dimensions off the room in centy meters [with, length, height]

.getSCBus

Create the bus associated with synth registrant.

Arguments:

sourceNum

The number of the source (starting with 1).

numChans

The number of channels (starting with 1).

.playAutomation

Non-gui method for playing automation data. Useful for playing data immediately after a Mosca instance is created. If called after loadAutomation (see below), may require a prior "wait" message to allow all data to load.

Arguments:

loop

A boolean to enable/disable looping the automation transport.

.loadAutomation

Loads saved data not recorded directly by Automation. These include GUI checkbox values (with the exception of auxiliary checkboxes) and file names. It is used for loading data immediately after a Mosca instance is created and when running Mosca without a GUI. See code examples below.

Arguments:

directory

Path to automation directory.

Examples

The following is a basic Binaural Setup, see guide-Mosca for more examples