Name
soundfx.Generate -- generate sample and apply effect(s)
Synopsis
[id] = soundfx.Generate(dst, fx)
Function
This function generates a sample and applies the given effect(s) to it. It will create a new sample using the identifier specified by dst. If you pass Nil in dst, soundfx.Generate() will automatically choose an available identifier and return it to you.

Usage is very similar to soundfx.Process() except that soundfx.Generate() doesn't require you to pass input samples. Instead, the source sample is generated by this function. This means that the first effect in the fx table should be a generative effect like the synth effect. After that effect, you could then add some more effects which process the audio data a generative effect like synth has just produced. See below for an example.

Note that if you don't use a generative effect as the first effect in the fx table, this function will run forever because the following effects will wait for audio data which isn't there if you don't use a generative effect first.

You might also want to set the Channels, Bits, and Frequency tags when calling soundfx.Generate() to set the desired format of the sample to be generated.

See the documentation of soundfx.Process() for a detailed description of how to pass effects and options in the fx table.

Inputs
dst
identifier for the new sample or Nil for auto id selection
fx
table containing effect(s) and options to be applied
Results
id
optional: identifier of the sample; will only be returned when you pass Nil as argument 1 (see above)
Example
soundfx.Generate(1, {{"synth", "sin", "%-12", "sin", "%-9", "sin", "%-5",
          "sin", "%-2"}, {"fade", "h", "0.1", "1", "0.1"}, Channels = 1})
The code above creates a synthesised A minor seventh chord with a pipe-organ sound and stores it as sample 1.

Show TOC