Skip to content

Commit

Permalink
Improve default profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Woyten committed May 11, 2023
1 parent b604574 commit f57e5d6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 48 deletions.
25 changes: 12 additions & 13 deletions microwave/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ The `Fadeout` template provides a value describing to what extent a waveform is

**Note:** Like in the examples before, reacting to the damper pedal is not a hardcoded feature built into `microwave` but customizable behavior.

#### `WaveformOutL` and `WaveformOutR` Templates
#### `EnvelopeL` and `EnvelopeR` Templates

```yml
waveform_templates:
- name: WaveformOutL
- name: EnvelopeL
value:
Mul:
- Controller:
Expand All @@ -191,7 +191,7 @@ waveform_templates:
kind: Volume
map0: 0.0
map1: 0.25
- name: WaveformOutR
- name: EnvelopeR
value:
Mul:
- Controller:
Expand Down Expand Up @@ -219,7 +219,7 @@ Just provide the name of the template as a single string argument. Examples:
```yml
frequency: WaveformPitch
fadeout: Fadeout
out_levels: [WaveformOutL, WaveformOutR]
out_levels: [EnvelopeL, EnvelopeR]
```

### `waveform_envelopes` Section
Expand All @@ -237,7 +237,7 @@ waveform_envelopes:
release_time: 0.25
in_buffer: 7
out_buffers: [0, 1]
out_levels: [WaveformOutL, WaveformOutR]
out_levels: [EnvelopeL, EnvelopeR]
```

with
Expand All @@ -249,18 +249,18 @@ with
- `release_time`: The linear release time in seconds. The waveform is considered exhausted as soon as the integral over `fadeout / release_time * dt` reaches 1.0.
- `in_buffer`: The waveform buffer containing the signal that is supposed to be enveloped.
- `out_buffers`: The (stereo) buffers of the main audio pipeline that the enveloped signal is supposed to be written to.
- `out_levels`: The amplitude factor to apply when writing to the main audio pipeline. It makes sense to use `WaveformOutL`/`WaveformOutR` as a value but the user can choose whatever LF source expression they find useful.
- `out_levels`: The amplitude factor to apply when writing to the main audio pipeline. It makes sense to use `EnvelopeL`/`EnvelopeR` as a value but the user can choose whatever LF source expression they find useful.

### `effect_templates` Section

This section is completely analogous to the `waveform_templates` section but it is dedicated to work in combination with the `Effect` stages documented below. One key difference is that it is not able to access waveform-specific properties like `Velocity`, `KeyPressure`, etc.

## `stages` Section / Main Audio Pipeline

The `stages` section defines the sections that are evaluated sequentially while the main audio thread is running. Not all sections (e.g. `MidiOut`) contribute to the main audio pipeline but it makes sense to declare them here anyway. Some of the sections, the *output targets*, are sensitive to note inputs. In that case, the `note_input` property has to be set. It can have the following values:
The `stages` section defines the sections that are evaluated sequentially while the main audio thread is running. Not all sections (e.g. `MidiOut`) contribute to the main audio pipeline but it makes sense to declare them here anyway. Some of the stages, the *output targets*, are sensitive to note inputs. In that case, the `note_input` property has to be set. It can have the following values:

- **Foreground:** Only activate notes when the given output target is currently active.
- **Background:** Always activate notes when a note event is receivied.
- **Background:** Always activate notes when a note event is received.

### Magnetron Synthesizer – Create Your Own Waveforms

Expand Down Expand Up @@ -303,11 +303,10 @@ waveforms:
resonance:
Mul:
- WaveformPitch
- Time:
start: 0.0
end: 0.1
from: 2.0
to: 4.0
- Fader:
movement: 10.0
map0: 2.0
map1: 4.0
quality: 5.0
in_buffer: 1
out_buffer: 7
Expand Down
65 changes: 30 additions & 35 deletions microwave/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn get_default_profile() -> MicrowaveProfile {
},
TemplateSpec {
// Total output: -18 dBFS = -6dBFS (pan) - 12dBFS (volume)
name: "WaveformOutL".to_owned(),
name: "EnvelopeL".to_owned(),
value: LfSourceExpr::Controller {
kind: LiveParameter::Pan,
map0: LfSourceExpr::Property(WaveformProperty::Velocity).wrap(),
Expand All @@ -76,7 +76,7 @@ pub fn get_default_profile() -> MicrowaveProfile {
},
TemplateSpec {
// Total output: -18 dBFS = -6dBFS (pan) - 12dBFS (volume)
name: "WaveformOutR".to_owned(),
name: "EnvelopeR".to_owned(),
value: LfSourceExpr::Controller {
kind: LiveParameter::Pan,
map0: LfSource::Value(0.0),
Expand All @@ -103,8 +103,8 @@ pub fn get_default_profile() -> MicrowaveProfile {
in_buffer: 7,
out_buffers: (0, 1),
out_levels: (
LfSource::template("WaveformOutL"),
LfSource::template("WaveformOutR"),
LfSource::template("EnvelopeL"),
LfSource::template("EnvelopeR"),
),
},
},
Expand All @@ -118,8 +118,8 @@ pub fn get_default_profile() -> MicrowaveProfile {
in_buffer: 7,
out_buffers: (0, 1),
out_levels: (
LfSource::template("WaveformOutL"),
LfSource::template("WaveformOutR"),
LfSource::template("EnvelopeL"),
LfSource::template("EnvelopeR"),
),
},
},
Expand All @@ -133,8 +133,8 @@ pub fn get_default_profile() -> MicrowaveProfile {
in_buffer: 7,
out_buffers: (0, 1),
out_levels: (
LfSource::template("WaveformOutL"),
LfSource::template("WaveformOutR"),
LfSource::template("EnvelopeL"),
LfSource::template("EnvelopeR"),
),
},
},
Expand All @@ -148,8 +148,8 @@ pub fn get_default_profile() -> MicrowaveProfile {
in_buffer: 7,
out_buffers: (0, 1),
out_levels: (
LfSource::template("WaveformOutL"),
LfSource::template("WaveformOutR"),
LfSource::template("EnvelopeL"),
LfSource::template("EnvelopeR"),
),
},
},
Expand Down Expand Up @@ -595,11 +595,10 @@ pub fn get_default_magnetron_spec() -> MagnetronSpec {
kind: FilterKind::HighPass2 {
quality: LfSource::Value(5.0),
resonance: LfSource::template("WaveformPitch")
* LfSourceExpr::Time {
start: LfSource::Value(0.0),
end: LfSource::Value(0.1),
from: LfSource::Value(2.0),
to: LfSource::Value(4.0),
* LfSourceExpr::Fader {
movement: LfSource::Value(10.0),
map0: LfSource::Value(2.0),
map1: LfSource::Value(4.0),
}
.wrap(),
},
Expand Down Expand Up @@ -797,11 +796,10 @@ pub fn get_default_magnetron_spec() -> MagnetronSpec {
frequency: LfSource::Value(5.0),
phase: None,
baseline: LfSource::Value(1.0),
amplitude: LfSourceExpr::Time {
start: LfSource::Value(0.0),
end: LfSource::Value(2.0),
from: LfSource::Value(0.0),
to: LfSource::Value(0.01),
amplitude: LfSourceExpr::Fader {
movement: LfSource::Value(0.5),
map0: LfSource::Value(0.0),
map1: LfSource::Value(0.01),
}
.wrap(),
}
Expand Down Expand Up @@ -1343,11 +1341,10 @@ pub fn get_default_magnetron_spec() -> MagnetronSpec {
StageSpec::Filter(Filter {
kind: FilterKind::LowPass {
cutoff: LfSource::template("WaveformPitch")
* LfSourceExpr::Time {
start: LfSource::Value(0.0),
end: LfSource::Value(2.0),
from: LfSource::Value(0.0),
to: LfSource::Value(10.0),
* LfSourceExpr::Fader {
movement: LfSource::Value(0.5),
map0: LfSource::Value(0.0),
map1: LfSource::Value(10.0),
}
.wrap(),
},
Expand Down Expand Up @@ -1376,11 +1373,10 @@ pub fn get_default_magnetron_spec() -> MagnetronSpec {
StageSpec::Filter(Filter {
kind: FilterKind::LowPass2 {
resonance: LfSource::template("WaveformPitch")
* LfSourceExpr::Time {
start: LfSource::Value(0.0),
end: LfSource::Value(2.0),
from: LfSource::Value(1.0),
to: LfSource::Value(32.0),
* LfSourceExpr::Fader {
movement: LfSource::Value(0.5),
map0: LfSource::Value(1.0),
map1: LfSource::Value(32.0),
}
.wrap(),
quality: LfSource::Value(5.0),
Expand Down Expand Up @@ -1410,11 +1406,10 @@ pub fn get_default_magnetron_spec() -> MagnetronSpec {
StageSpec::Filter(Filter {
kind: FilterKind::HighPass {
cutoff: LfSource::template("WaveformPitch")
* LfSourceExpr::Time {
start: LfSource::Value(0.0),
end: LfSource::Value(200.0),
from: LfSource::Value(1.0),
to: LfSource::Value(1000.0),
* LfSourceExpr::Fader {
movement: LfSource::Value(0.005),
map0: LfSource::Value(1.0),
map1: LfSource::Value(1000.0),
}
.wrap(),
},
Expand Down

0 comments on commit f57e5d6

Please sign in to comment.