Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faust docs improvements #12

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Faust/00Bypass.dsp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
process = _;
process = _, _;
2 changes: 1 addition & 1 deletion Faust/01Message.dsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ declare message "Hello\nmake some noise";

import("stdfaust.lib");

process = no.noise : *(0.5);
process = no.noise : *(0.5) <: _, _;
2 changes: 1 addition & 1 deletion Faust/02Input.dsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import("stdfaust.lib");

freq = hslider("Frequency[OWL:A]", 60, 60, 440, 1);

process = os.osc(freq);
process = os.osc(freq) <: _, _;
2 changes: 1 addition & 1 deletion Faust/03Harmonics.dsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ process = par(
i,
8,
hslider("Harmonic %i[OWL:%i]", 1 / (1 + i), 0, 1, 0.001) * os.oscs(i * freq + freq)
) :> _ : *(0.125) <: _, _;
) :> _ : *(0.125) <: _, _;
4 changes: 2 additions & 2 deletions Faust/04Output.dsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import("stdfaust.lib");

freq = hslider("Frequency[OWL:A]", 60, 60, 440, 1);
lfo_freq = hslider("LFO frequency[OWL:B]", 0.3, 0.01, 1.0, 0.01) : si.smoo;
lfo_out = hbargraph("LFO>[OWL:C]", -1, 1);
lfo_out = hbargraph("LFO>[OWL:F]", -1, 1);

process = attach(os.osc(freq), os.osc(lfo_freq) : lfo_out);
process = attach(os.osc(freq), os.osc(lfo_freq) : lfo_out) <: _, _;
6 changes: 6 additions & 0 deletions Faust/05Buttons.dsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import("music.lib");

btn1 = button("Button1[OWL:B1]");
led1 = hbargraph("LED2>[OWL:B1]", 0, 1);

process = attach(osc(220) * btn1, 1-btn1 : led1) <: _, _;
2 changes: 1 addition & 1 deletion Faust/05MIDI.dsp → Faust/06MIDI.dsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ gain = hslider("gain", 0.0, 0.0, 1.0, 0.001);
gate = button("gate");
sustain = hslider("Sustain[OWL:A]", 5.0, 1.0, 10.0, 0.01);

process = sy.combString(freq, gain * sustain, gate);
process = sy.combString(freq, gain * sustain, gate) <: _, _;
2 changes: 1 addition & 1 deletion Faust/06VoctIn.dsp → Faust/07VoctIn.dsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import("owl.lib");

tune = hslider("Tune[OWL:A]", 0, -2, 2, 0.01);

process = sample2hertz(tune) : os.oscs;
process = sample2hertz(tune) : os.oscs <: _, _;
File renamed without changes.
16 changes: 8 additions & 8 deletions Faust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This compiles the patch and stores it on the device in memory slot 5.
Simplest patch in FAUST would look like this:

```
process = _;
process = _, _;
```

What it does is takes input from first audio channel and sends it to output without any modifications.
Expand All @@ -55,7 +55,7 @@ declare message "Hello\nmake some noise";

import("stdfaust.lib");

process = no.noise : *(0.5);
process = no.noise : *(0.5) <: _, _;
```

Here the first line adds a metadata declaration, second line imports FAUST's standard library and the last line sends output from a white noise generator to output channel 1 with gain reduced by half.
Expand All @@ -68,7 +68,7 @@ You can control patch parameters by binding them with FAUST UI controls. Let's l
```
import("stdfaust.lib");
freq = hslider("Frequency[OWL:A]", 60, 60, 440, 1);
process = os.osc(freq);
process = os.osc(freq) <: _, _;
```

``[OWL:A]`` in parameter label is what binds your device's input to FAUST parameter. Parameter ranges that you can use are A-H, AA-AH, BA-BH, CA-CH and DA-DH. The buttons are assigned with B1, B2 et c. This is what FAUST patches support, but the actual parameters that have physical inputs on a particular device would be more limited. You would have to use MIDI to access those that don't have physical control on device.
Expand Down Expand Up @@ -107,7 +107,7 @@ freq = hslider("Frequency[OWL:A]", 60, 60, 440, 1);
lfo_freq = hslider("LFO frequency[OWL:B]", 0.3, 0.01, 1.0, 0.01) : si.smoo;
lfo_out = hbargraph("LFO>[OWL:F]", -1, 1);

process = attach(os.osc(freq), os.osc(lfo_freq) : lfo_out);
process = attach(os.osc(freq), os.osc(lfo_freq) : lfo_out) <: _, _;
```

This patch produces a static sine wave tone initially. But if we connect output from patch point `F` with the input on patch point `A`, then we get a slow frequency modulation in our audio.
Expand All @@ -124,10 +124,10 @@ Here is an example that sends the inverted button value out to control the B1 LE
```
import("music.lib");

btn1 = button("btn1[OWL:B1]");
led1 = hbargraph("led2>[OWL:B1]", 0, 1);
btn1 = button("Button1[OWL:B1]");
led1 = hbargraph("LED2>[OWL:B1]", 0, 1);

process = attach(osc(1000) * btn1, 1-btn1 : led1);
process = attach(osc(220) * btn1, 1-btn1 : led1) <: _, _;
```

Gate outputs will have hardware specific assignments, e.g. on the Lich it is ``B3``, while the two gate outputs on the Witch are designated ``B5`` and ``B6``. You can also use ``PUSH`` as a more generic name for the first button or gate, and it works with both inputs and outputs.
Expand All @@ -147,7 +147,7 @@ gain = hslider("gain", 0.0, 0.0, 1.0, 0.001);
gate = button("gate");
sustain = hslider("Sustain[OWL:A]", 5.0, 1.0, 10.0, 0.01);

process = sy.combString(freq, gain * sustain, gate);
process = sy.combString(freq, gain * sustain, gate) <: _, _;
```

First of all, you must enable MIDI with metadata declaration.
Expand Down
25 changes: 14 additions & 11 deletions Faust/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import argparse
import os
import shutil
import subprocess

parser = argparse.ArgumentParser('Upload Faust samples')
parser.add_argument('--owl', help='path to OwlProgram directory', default='../../OwlProgram/')
parser.add_argument('--slot', help='slot number used for first patch', default=1, type=int)
parser.add_argument('--load', help='load patches instead of storing', action=argparse.BooleanOptionalAction)

args = parser.parse_args()

Expand All @@ -19,17 +19,20 @@

env = os.environ.copy()

print(f'Using owl program from {owl}')
print(f'Using OWL program from {owl}')

env['PATCHSOURCE'] = os.getcwd()

for i, fname in enumerate(faust_files):
# copy file without first 2 symbols used for sorting
dst = os.path.join(owl, 'PatchSource', fname[2:])
shutil.copy(fname, dst)
# set env vars for current patch processing
env['SLOT'] = str(args.slot + i)
env['FAUST'] = fname[2:-4]
env['FAUST'] = fname[:-4]
env['PATCHNAME'] = fname[2:-4]
print()
print(f'{env["SLOT"]} <= {env["FAUST"]}')
# upload patch
subprocess.run(['make', 'clean', 'store'], cwd=os.path.abspath(args.owl), env=env)
os.remove(dst)
if args.load:
# load patch
subprocess.run(['make', 'clean', 'load'], cwd=os.path.abspath(args.owl), env=env, check=True)
else:
# store patch
env['SLOT'] = str(args.slot + i)
print(f'{env["SLOT"]} <= {env["FAUST"]}')
subprocess.run(['make', 'clean', 'store'], cwd=os.path.abspath(args.owl), env=env, check=True)