examples.md : Updates.

This commit is contained in:
kevin 2024-12-20 14:35:45 -05:00
parent af6529ac73
commit f2271e1f79

View File

@ -11,6 +11,8 @@ Features of the language include:
- Clear and easily interpreted network execution semantics. - Clear and easily interpreted network execution semantics.
- Automatic user interface generation. - Automatic user interface generation.
- Large collection of data flow unit processors. - Large collection of data flow unit processors.
- Automatic multi-thread programming support.
@ -78,7 +80,7 @@ The `args:{ ... }` statment lists processor specific arguments used to create th
`af` instance. In this case `af.fname` names the output file. The use of the `af` instance. In this case `af.fname` names the output file. The use of the
`$` prefix on the file name indicates that the file should be written to `$` prefix on the file name indicates that the file should be written to
the _project directory_ which is formed by joining `base_dir` with the program name. the _project directory_ which is formed by joining `base_dir` with the program name.
The _project directory_ is automatically created when the program is run. The _project directory_ is automatically created, if it doesn't already exist, when the program is run.
### Processor Class Descriptions ### Processor Class Descriptions
@ -163,8 +165,9 @@ midi | MIDI message array.
runtime | 'no_src' variable whose type is determined by the types of the other variables. See the 'list' processor. runtime | 'no_src' variable whose type is determined by the types of the other variables. See the 'list' processor.
numeric | bool | uint | int | float | double numeric | bool | uint | int | float | double
all | This variable can be any type. Commonly used for variables which act as triggers. See the 'counter' processor. all | This variable can be any type. Commonly used for variables which act as triggers. See the 'counter' processor.
record | This type is used to form records of fields based on the the above types.
A few type aliases are defined to help document the intended purpose of a given variable. A few type aliases are also defined. Thse aliases are intended to help document the intended purpose of a given variable.
Type aliases: Type aliases:
Alias | Type | Description Alias | Type | Description
@ -182,10 +185,11 @@ an example of a class preset used this way.
### Example 02: Modulated Sine Signal ### Example 02: Modulated Sine Signal
This example is an extended version of `ex_01_sine_file` where a low frequency oscillator (LFO) This example extends `ex_01_sine_file` by using a low frequency oscillator (LFO) to
modulate the frequency of a second audio oscillator. The LFO
is formed using a second `sine_tone` processor and a sample and hold unit. The output is formed using a second `sine_tone` processor and a sample and hold unit. The output
of the sample and hold unit is then used to modulate the frequency of an audio of the sample and hold unit is then used to set the frequency of the audio
frequency `sine_tone` oscillator. `sine_tone` oscillator.
Note that the LFO output is a 3 Hertz sine signal Note that the LFO output is a 3 Hertz sine signal
with a gain of 110 (220 peak-to-peak amplitude) and an offset with a gain of 110 (220 peak-to-peak amplitude) and an offset
@ -213,10 +217,11 @@ ex_02_mod_sine: {
The `osc` instance in this example uses a `preset` statement. This will have The `osc` instance in this example uses a `preset` statement. This will have
the effect of applying the class preset `mono` to the `osc` when it is the effect of applying the class preset `mono` to the `osc` when it is
instantiated. Based on the `sine_tone` class description the `osc` will then instantiated. Based on values in the `mono` preset the `osc` will therefore initially have
have a single audio channel with an amplitude of 0.75. a single audio channel with an amplitude of 0.75.
In this example the sample and hold unit is necessary to convert the audio signal to a scalar In this example the sample and hold unit is necessary to convert the audio signal, which
is internally represented as a vector value, to a scalar
value which is suitable as a `coeff` type value for the `hz` variable of the audio oscillator. value which is suitable as a `coeff` type value for the `hz` variable of the audio oscillator.
Here is the `sample_hold` class description: Here is the `sample_hold` class description:
@ -245,7 +250,7 @@ presets which can set the network, or a given processor, to a particular state.
audio channels generated by the audio oscillator. `ex_03_presets` shows audio channels generated by the audio oscillator. `ex_03_presets` shows
how presets can be specified and applied for the entire network. how presets can be specified and applied for the entire network.
In this example four network presets are specified in the `presets` statement In this example four network presets are given in the `presets` statement
and the "a" preset is automatically applied once the network is created and the "a" preset is automatically applied once the network is created
but before it starts to execute. but before it starts to execute.
@ -331,7 +336,7 @@ on either preset then it uses the value from channel 0.
TODO: Check that this accurately describes preset interpolation. TODO: Check that this accurately describes preset interpolation.
### Example 04 : Event Programming ### Example 04 : Programming
``` ```
ex_04_program: { ex_04_program: {