Granulator

This tool is a spatial granular synthesizer1. It generates $N$ streams of “grains” from sound files or from the input signal and spatialize each grain in a moving swarm. The latter is encoded to an Ambisonics bus up to degree $L$. A visual example, of a swarm, made with AntesCollider1, is shown in the following Fig.:

Image
Figure 1: A grain swarm visualization

Compilation parameters

  • L: maximal Spherical Harmonics degree (i.e., Ambisonics order), $L > 0$,
  • N: number of grain streams to synthesize.

Warning: the compilation can last several hours as $L$ and $N$ increase1. Don’t forget the flag -t 0 with the faust2... scripts, as well as the -soundfile tag to embbeded your sound files. It is better practice to compile for low N value and launch several instances of the plugin in your host.

  • S: number of sound file to load: The corresponding sound files path should be given in the sound variable with the following syntax: sound = soundfile("File[url:{'../path/to/soundfile1.wav';'../path/to/soundfile2.wav'}]", 1);,
  • bufsize: length of the buffer (in seconds) for the input signal,
  • oscmeter: generates $N \times 4$ bargraphs in the GUI in order to transmit through OSC each grain spherical coordinates and its instantaneous level. 0 => No bargraphs, 1 => bargraphs. This parameter is useful to drive an external visualizer.

Warning : oscmeter=1 parameter can produce huge GUI if you set a high number $N$ of grains.

  • markerq: use a marker list for each sound file ? 0=> No, i.e., each grain starting sample is chosen randomly withing the sound file start and stop index (see User Interface). 1 => Yes, i.e. each grain starting sample is chosen randomly from the marker list. The marker lists are given as sample number in the parameters marker(i) with $i \in [0 \cdots S-1]$ see hereafter:
  • marker(i): The $i$-th soundfile marker list with $i \in [0 \cdots S-1]$. Each list is given as a list of sample number in the corresponding sound file with the following syntax for $i=0$ : marker(0) = waveform{10240, 59904, 1821184, ..., 3272192.0};.

Inputs / Outputs

  • Inputs: $1$ (for “live” granulation)
  • Outputs: $(L+1)^2$

User Interface

The user interface is divided into two sections: To generate a swarm of $N$ stream of grains, one proceeds as follows:

1) The sound source is chosen between soundfiles or input using the checkbox Soundfile/Input :

  • If the soundfile source is chosen (Soundfile/Input=0), then the soundfile is chosen among the $S$ sound files defined at compilation time (see Compilation parameters) using the slider Soundfile.
  • If the input source is chosen (Soundfile/Input=1), then the input signal buffer is chosen as a sound source. To fill/update this buffer with the current input signal, one set Record=1.

In the latter case, when the buffer is full, older values are replaced with new ones while Record=1 (i.e. circular buffer behaviour).

2) Several ranges are set for each grain parameters in the $N$ streams using corresponding min and max sliders. Each grain has a set of parameters as follows:

  • Length: the grain duration (in seconds),
  • Shift: the grain starting index within the sound source. The value is normalized between $0$ and $1$, where $1$ represents the lenght of the sound source (soundfile or input).

Note that this parameter has no influence if the soundfile source is chosen and markers are used (see Compilation parameters)

  • Read Speed: the grain playback speed. This can produce pitching effect
  • Reverse Forward: the grain playback direction between $-1$ and $1$. If the value is negative the grain is played back in reverse direction. If the value is positive, the grain in played in the forward direction.
  • Radius: the radius position of the grain in the swarm,
  • Azimuth: the azimuth position of the grain in the swarm,
  • Elevation: the elevation parameter of the grain in swarm.

Note that each grain parameter is chosen randomly within the corresponding range. Then, the grain is played and a new set of parameters is chosen randomly. Therefore, $N$ grains stream are synthesized within with constantly varying parameters within the ranges. The ranges for Radius Azimuth and Elevation define a spherical sector (including radius) where each grain is spatialized, hence forming a swarm.

3) Two envelops are chosen (Env 0 and Env 1 parameters) and a crossfade (Envs Crossfade parameter) between these two envelops is applied on each grain in the $N$ streams. The current envelops with their name and corresponding number are shown in the following Figure:

Image
Figure 2: The envelops that can be applied on the grains.

4) Meta parameters applied on the $N$ grain streams are chosen:

  • Gain: the global gain (in dB),
  • Probability: probability, between $0$ and $1$, of a grain to be played.

Finally, the user interface parameters are as follows:

Element OSC Min value Max value
Radius Min (float, m) radius_min 0.5 50
Radius Max (float, m) radius_max 0.5 50
Azimuth Min (float, $^\circ$) azimuth_min -180 180
Azimuth Max (float, $^\circ$) azimuth_max -180 180
Elevation Min (float, $^\circ$) elevation_min -90 90
Elevation Max (float, $^\circ$) elevation_max -90 90
Env 0 (int) env0 0 9
Env 1 (int) env1 0 9
Envs Crossfade (float) envs_crossfade 0 1
Probability (float) proba 0 1
Input/Soundfile (int) input_soundfile 0 1
Record (int) record 0 1
Soundfile (int) soundfile 0 S
Gain (float, dB) gain -40 0
Length Min (float, s) length_min 0 20
Length Max (float, s) length_max 0 20
Read Speed Min (float) read_speed_min -1 1
Read Speed Max (float) read_speed_max 1 1
Shift Min (float) shift_min 0 1
Shift Max (float) shift_max 0 1
  1. P. Lecomte, J-M. Fernandez, « Spatial Granular Syntehsis with Ambitools and AntesCollider», in International Faust Conference 2024, Torino, Italy.  2 3