All MPEG-4 Structured Audio generators are briefly discussed here. A generator is nothing more than a line of arguments, which you have to type at the command line in the table editor.

In MPEG-4, all arguments are seperated with a comma. In CPS, you can leave out the comma's and use a space instead; the comma's are added automaticly when you export the .cps file to a SAOL file.

The second parameter of each generator, is the size of the table. In some cases, the length is undefined; then '-1' is allowed as length parameter. If the size is bigger than the given arguments use, then the table is often zero-padded at the end.

*Syntax*: **'sample' size which [skip [channel]]**

The sample generator is for reading in audio samples from external sources. These external sources can be audiofiles but in principle also other MPEG-4 bitstreams (=other running 'patches' in a MPEG-4 'scene'). In CPS, you can use 'sample' to load in samples from disk. Samples in tables are always mono, because a table is mono. You do not have to put the filename between quotation-marks (for example "sample23.aiff"), but if there are spaces in the filename, you must use them. The channel parameter is not part of MPEG-4 Structured Audio.

*Example*: **sample -1 noname.wav 4000 1**

*Means*: load file noname.wav with undefined length, skip the first 4000 samples and use the right channel.

*Example*: **sample -1 noname.aiff**

*Means*: load file noname.aiff with undefined length.

*Syntax*: **'data' size [p1, p2, p3, ....]**

The data generator is for putting seperatly defined data elements in a table. If the size is -1, then the size is as big as the list of given value's. If the size parameter is bigger than the list of given value's, then the table is zero-padded at the end.

*Example*: **data 4 1 2 3 4**

*Means*: make a data table with size 10 and fill the first 4 value's with 1,2,3,4.

*Example*: **data 10 1 2 3 4**

*Means*: make a data table with size 10 and fill the first 4 value's with 1,2,3,4.

*Syntax*: **'polynomial' size xmin xmax a0 a1 a2 ...**

The polynomial generator filles a table with an arbitrary section of an arbitrary polynomial function. The polynomial function is: a0 + a1x + a2x^2 + ..., evaluated between xmin and xmax.

*Example*: **polynomial 100 0 100 1 -50 0.5**

*Means*: make a table with size 100, filled with an polynomial generator x-50x^2+0.5x^3 where the x goes from 0 to 100.

*Syntax*: **'concat' size table1 table2 table3 ...**

The concat generator concats several tables together. If you select a table and press PAGE_UP or PAGE_DOWN then the table gets more or less inputs for other tables.

*Syntax*: **'expseg' size '0' y1 x2 y2 [x2 ...]**

The expseg generator filles a table with exponential linesegments. The tables is created by defining (x,y) pairs. If the size is -1, then the size is the largest x-value.

*Example*: expseg 100 0 1 50 70

*Means*: make a table with size 100, filled with an exponential line from 1 at point 0 to 70 at point 50; leave the rest empty.

*Syntax*: **'cubicseg' size infl1 y1 x1 y2 infl2 y3 x2 y4 ...**

The cubicseg generator filles a table with segments of cubic polynomials (ax^3+bx^2+cx+d). A segment is specified by two inflection points, and an x point which lies in between. The x-y pairs are shown in the syntax by the extra spaces.

*Example*: **cubicseg -1 0 1 50 2 100 3 150 2 200 1**

*Means*: make a table filled with two cubic polynomals that go throught the points (0,1) (50,2) (100,3) and through the points (100,3) (150,2) (200,1).

*Syntax*: **'lineseg' size '0' y1 x2 y2 [x2 ...]**

The lineseg generator filles a table with linesegments. The tables is created by defining (x,y) pairs. If the size is -1, then the size is the largest x-value.

*Example***: lineseg 100 0 0 99 20**

*Means*: make a table with size 100, filled with a line from 0 at point 0 to 20 at point 99.

*Syntax*: **'spline' size '0' y1 k1 x2 y2 k2 ...**

The spline generator filles a table with a smoothly varying function between the given points (using cubic polynomials). The 'k'-parameter is for the derivate at the 'x2' point.

*Example*: **spline -1 0 1 4 2 200 4**

*Syntax*: **'harm' size f1 f2 f3 ...**

The harm generator generates one cycle of a composite waveform, made up of a weighted sum of zero-phased sinusoids.

*Example*: **harm 1024 1 0.5 0.25 0.125 0.064 0.032**

*Means*: make a table with size 1024, filled with each time one,two,three,.. periods of a sinus, multiplied with the given argument and fitted in the table size.

*Syntax*: **'harm_phase' size f1 ph1 f2 ph2 ...**

The harm_phase generator fills the table with one cycle of a composite waveform, made up of a weighted sum of zero-DC sinusoids, each with a initial phase (in radians).

*Example*: **harm_phase 1024 1 0 0.5 0 0.25 0**

*Means*: make a table with size 1024, filled with one period and multiples of the period, of a sinus, each time with a amplitude and phase given in the arguments.

*Syntax*: **'periodic' size p1 fr1 ph1 p2 fr2 ph2 ...**

The periodic generator fills the table with one cycle of an arbitrary periodic waveform, specified as the sum of several sinusiods, each specified by a frequency, magnitude and phase (in radians).

*Syntax*: **'buzz' size nharm lowharm rolloff**

The buzz generator fills the table with one cycle of the sum of a series of spectrally-sloped cosine partials (or: a bandlimited pulse train).

*Example*: **buzz 16048 10 0 0.9**

*Means*: make a table with size 16048 and fill it with the buzz generator, which calculates 10 harmonics, starting with the zeroth harmonic, and which uses a rolloff of 0.6.

*Syntax*: **'empty' size**

This generator generates an empty table. A table in CPS has is initially an empty table with size 16 ("empty 16").

*Syntax*: **'window' size type [p]**

The window generator fills the table with a traditional window function.

If type is 1, then a hamming window is generated. If the type is 2, then a hanning window (raised cosine) is generated; if type=3, then a Bartlett (or triangular) window is generated; with type 4, a Gaussian window is generated. The 4th type is a Kaiser window with parameter p. The 6th type is a boxcar window (everything 1)

*Example*: **window 1024 1**

*Means*: make a table with size 1024, filled with a Hamming window.

*Syntax*: **'random' size distribution p1 [p2]**

The random generator fills the table with pseudo-random numbers. Several distributions are possible.

If the 'distribution' parameter is 1 then the uniform distribution is used (white noise); all values will be generated between p1 and p2.

If the 'distribution' parameter is 2, then a linearly ramped distribution is used, with parameters p1 and p2.

If the 'distribution' parameter is 3, then exponential distribution is used with p1 as parameter.

If the 'distribution' parameter is 3, then gaussian distribution is used; with p1 as mean, and p2 as the variance.

*Example*: **random 1024 1 -1 1**

*Means*: make a table with size 1024 filled with uniform random values between -1 and 1.

*Example*: **random 65535 4 3 6**

*Means*: make a table with size 65535 filled with gaussian distributed value's with mean=3 and variance=6.

*Syntax*: **'step' size '0' y1 x2 [y2 x2 ...]**

The step generator fills several regions of the the table with the same value.

*Example*: step 100 0 10 33 20 66 30 99

*Means*: make a table with size 100, filled with '10' from 0 to 32, '20' from 33 to 65, and with '30' from 66 to 99.