Scanned synthesis is a variant of physical modeling, where a network of masses connected by springs is used to generate a dynamic waveform. The opcode scanu defines the
mass/spring network and sets it in motion. The opcode scans follows a predefined path (trajectory) around the network and outputs the detected waveform. Several scans instances may follow different paths around the same network.
These are highly efficient mechanical modelling algorithms for both synthesis and sonic animation via algorithmic processing. They should run in real-time. Thus, the output is useful either directly as audio, or as controller values for other parameters.
The Csound implementation adds support for a scanning path or matrix. Essentially, this offers the possibility of reconnecting the masses in different orders, causing the signal to propagate quite differently. They do not necessarily need to be connected to their direct neighbors. Essentially, the matrix has the effect of “molding” this surface into a radically different shape.
To produce the matrices, the table format is straightforward. For example, for 4 masses we have the following grid describing the possible connections:
Whenever two masses are connected, the point they define is 1. If two masses are not connected, then the point they define is 0. For example, a unidirectional string has the following connections: (1,2), (2,3), (3,4). If it is bidirectional, it also has (2,1), (3,2), (4,3)). For the unidirectional string, the matrix appears:
The above table format of the connection matrix is for conceptual convenience only. The actual values shown in te table are obtained by scans from an ASCII file using GEN23. The actual ASCII file is created from the table model row by row. Therefore the ASCII file for the example table shown above becomes:
0100001000010000
The Public Csound Reference Manual Version 4.10 Signal Generators: Scanned Synthesis Page 41-2 This marix example is very small and simple. In practice, most scanned synthesis
instruments will use many more masses than four, so their matrices will be much larger and more complex. See the example in the scans documentation.
Please note that the generated dynamic wavetables are very unstable. Certain values for masses, centering, and damping can cause the system to “blow up” and the most
interesting sounds to emerge from your loudspeakers!
The supplement to this manual contains a tutorial on scanned synthesis. The tutorial, examples, and other information on scanned synthesis is available from the Scanned Synthesis page at cSounds.com (http://www.csounds.com/scanned).
Scanned synthesis developed by Bill Verplank, Max Mathews and Rob Shaw at Interval Research between 1998 and 2000.
The Public Csound Reference Manual Version 4.10 Signal Generators: Scanned Synthesis Page 41-3
41.1 s ca n u
scanu scanu scanu
scanu init, irate, ifnvel, ifnmass, ifnstif, ifncentr, ifndamp, kmass, kstif, kcentr, kdamp, ileft, iright, kpos, kstrngth, ain, idisp, id
D
ESCRIPTIONCompute the waveform and the wavetable for use in scanned synthesis.
I
NITIALIZATIONinit – the initial position of the masses. If this is a negative number, then the absolute of init signifies the table to use as a hammer shape. If init > 0, the length of it should be the same as the intended mass number, otherwise it can be anything.
ifnvel – the ftable that contains the initial velocity for each mass. It should have the same size as the intended mass number.
ifnmass – ftable that contains the mass of each mass. It should have the same size as the intended mass number.
ifnstif – ftable that contains the spring stiffness of each connection. It should have the same size as the square of the intended mass number. The data ordering is a row after row dump of the connection matrix of the system.
ifncentr – ftable that contains the centering force of each mass. It should have the same size as the intended mass number.
ifndamp – the ftable that contains the damping factor of each mass. It should have the same size as the intended mass number.
ileft – If init < 0, the position of the left hammer (ileft = 0 is hit at leftmost, ileft = 1 is hit at rightmost).
iright – If init < 0, the position of the right hammer (iright = 0 is hit at leftmost, iright = 1 is hit at rightmost).
idisp – If 0, no display of the masses is provided.
id – If positive, the ID of the opcode. This will be used to point the scanning opcode to the proper waveform maker. If this value is negative, the absolute of this value is the
wavetable on which to write the waveshape. That wavetable can be used later from an other opcode to generate sound. The initial contents of this table will be destroyed.
P
ERFORMANCEkmass – scales the masses kstif – scales the spring stiffness kcentr – scales the centering force kdamp – scales the damping
kpos – position of an active hammer along the string (kpos = 0 is leftmost, kpos = 1 is rightmost). The shape of the hammer is determined by init and the power it pushes with is kstrngth.
kstrngth – power that the active hammer uses
The Public Csound Reference Manual Version 4.10 Signal Generators: Scanned Synthesis Page 41-4 ain – audio input that adds to the velocity of the masses. Amplitude should not be too great.
E
XAMPLEFor an example, see the documentation on scans.
A
UTHORParis Smaragdis MIT Media Lab
Boston, Massachussetts USA
March, 2000 (New in Csound version 4.05)
The Public Csound Reference Manual Version 4.10 Signal Generators: Scanned Synthesis Page 41-5
41.2 s ca n s
ar scansscansscansscans kamp, kfreq, ifn, id[, iorder]
D
ESCRIPTIONGenerate audio output using scanned synthesis.
I
NITIALIZATIONifn – ftable containing the scanning trajectory. This is a series of numbers that contains addresses of masses. The order of these addresses is used as the scan path. It should not contain values greater than the number of masses, or negative numbers. See the
introduction to the scanned synthesis section.
id – ID number of the scanu opcode's waveform to use
iorder (optional) – order of interpolation used internally. It can take any value in the range 1 to 4, and defaults to 4, which is quartic interpolation. The setting of 2 is quadratic and 1 is linear. The higher numbers are slower, but not necessarily better.
P
ERFORMANCEkamp – output amplitude. Note that the resulting amplitude is also dependent on
instantaneous value in the wavetable. This number is effectively the scaling factor of the wavetable.
kfreq – frequency of the scan rate
E
XAMPLEHere is a simple example of scanned synthesis. The user must supply the matrix file "string-128". This file, as well as several other matrices, is available in a zipped file from the Scanned Synthesis page at cSounds.com (http://www.csounds.com/scanned).
;orchestra ---sr
sr sr
sr = 44100
kr kr kr
kr = 4410
ksmps ksmps ksmps
ksmps = 10
nchnls nchnls nchnls
nchnls = 1
instr instr instr instr 1
a0 ==== 0
scanu scanu scanu
scanu 1,.01, 6, 2, 3, 4, 5, 2, .1, .1, -.01, .1, .5, 0, 0, a0, 1, 2
a1 scansscansscansscans ampdb(p4), cpspch(p5), 7, 2 out
out out
out a1
endin endin endin endin
;score
---; Initial condition f1 0 128 7 0 64 1 64 0
; Masses
f2 0 128 -7 1 128 1
; Spring matrices
f3 0 16384 -23 "string-128"
; Centering force f4 0 128 -7 0 128 2
The Public Csound Reference Manual Version 4.10 Signal Generators: Scanned Synthesis Page 41-6
; Damping
f5 0 128 -7 1 128 1
; Initial velocity f6 0 128 -7 0 128 0
; Trajectories
f7 0 128 -5 .001 128 128
; Note list i1 0 10 86 6.00 i1 11 14 86 7.00 i1 15 20 86 5.00 e
A
UTHORParis Smaragdis MIT Media Lab
Boston, Massachussetts USA
March, 2000 (New in Csound version 4.05)
The Public Csound Reference Manual Version 4.10 Signal Generators: Waveguide Physical Modeling Page 42-1