This system is called "that", as in "you know that".
This is a condensed version of the real time sound analysis we did in the Musikinformatik seminar May/June 2021 @ RSH Düsseldorf which was rewritten into a Quark.
That allows to use values of UGens (which are running on the server) in the sclang domain which allows for interaction with live material by using analysis UGens on the signal. This allows the creation of autonomous systems such as Voyager by George Lewis, but is not limited to that.
SuperCollider is designed in such a way that sclang sends OSC messages to the server. This way of communication is well established, e.g. when adding a SynthDef to the server it gets transferred from sclang to the server via OSC as the server is only capable of generating sound. For more information on this please refer to OSC Communication.
But communicating values from the server (so a value of a UGen) to sclang has always been a bit tricky but possible via SendReply. That is a framework which helps reducing the cognitive and maintenance overhead of the server->language communication.
That relies on an input signal on which an analyzer can be applied upon. The result of the analyzer (which is an Event) gets calculated on the server and send back to sclang via OSC. The analyzer runs as a Ndef on the server (with a separated namespace by prepending that_ on its name) and the receiving OSCdef function receives those values and stores its value to the That instance and also allows for a callback everytime a new value is received.
Before we start discussing each fragment of That we will demonstrate it.
an Event in which all running that instances are registered
Creates a new That analyzer from scratch. Take a look at the constructors which use an existing analyzerFunction or at the examples.
name |
Unique Symbol which is also used to internally set up the Ndef for the analyzer and the OSCdef for communication. |
input |
Either a SynthDef, a Function or a Ndef which is the signal one wants to perform analysis on. |
analyzerFunction |
Function which analyzes the signal and determines the times when the callback is called. The first parameter of the function is the providid input signal. The function must return an Event with at least the key trigger with a UGen as value which defines the times when the callback function gets called .For specifics check out the examples. |
callback |
A function which gets called when the analyzerFunction returns a new value. The first parameter of the d function is the result of the analyzer. Iff the analyzerFunction returns one value it is an Array of values with the respecting number of input channels, otherwhise the argument will be an Event with key-value pairs of name of the parameter and its channel array. |
The created That instance
A constructor which uses Amplitude to analyse the amplitude of each channel of the signal. See new for more information on the parameters.
name | |
input | |
callback | |
triggerFunction |
A function which allows to specify the triggering of messages. The first parameter is the input signal and the secound parameter is the default trigger of the analyzerFunction. Take a look at the examples or the source code for more information. |
A constructor which uses Tartini to analyse the pitch of each channel of the signal. See new and amp for more information on the parameters.
name | |
input | |
callback | |
triggerFunction |
A constructor which uses Tartini to analyse the pitch and Onsets to analyse the onsets on each channel of the signal. See new and amp for more information on the parameters.
name | |
input | |
callback | |
triggerFunction |
A constructor which allows to access the raw values of the input signal. See new and amp for more information on the parameters.
name | |
input | |
callback | |
triggerFunction |
A constructor which uses MFCC to analyse the mel spectogram of the mono signal. See new and amp for more information on the parameters.
name | |
input | |
callback | |
triggerFunction | |
fftSize |
Allows to replace the analyzerFunction while running. Check source code for further information on how such an analyzerFunction needs to look like.
newAnalyzerFunction |
Allows access to the Ndef which runs the analyzerFunction which can be used to adjust the parameters of the analyzer, e.g.
Allows to access the latest value send from the analyzer independent of a callback.
Name of That.
Input used to analyse the material, possible to change while running.
newInput |
Allows to access and replace the callback function.
Although there are a variety of analyzerFunctions provided via the constructors it is possible to write such a custom function.