-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37417cf
commit fddcbd5
Showing
3 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import type { DspDefinition } from "../types"; | ||
|
||
const dsp = ` | ||
import("stdfaust.lib"); | ||
table_size = 999999; | ||
start = 4000.0; | ||
len = 581.0; | ||
end = start + len; | ||
raw = _; | ||
// use trigger to start! | ||
no_play = (ba.time > start) & (ba.time <= end); | ||
rec_active = ba.time > start; | ||
slide = (ba.time - start) / len * 0.1; | ||
slide_floor = float(int(slide)); | ||
slide_remain = slide % 1.0; | ||
rec_head = rec_active : ba.sweep(9999999.0); | ||
play_head = ba.if(no_play, rec_head, no_play' == 0 : ba.sweep(end - start) + 1); | ||
play_head_progress = play_head / len; | ||
cross(a, b, f, x) = a(x) * (1.0 - f) + b(x) * f; | ||
table(p) = rwtable(table_size, 0.0, int(rec_head), _, int(p)); | ||
microloop(r) = cross(table(play_head + len * (r + 1.0)), table(play_head + len * r), play_head_progress); | ||
wet = cross(microloop(slide_floor),microloop(slide_floor + 1.0), slide_remain); | ||
out = cross(_,wet,min(rec_head / 1000.0, 1.0)); | ||
`; | ||
|
||
const dspDefinition: DspDefinition = { | ||
id: "autosampler-2", | ||
name: "Autosampler 2", | ||
description: "Grabbing a single cycle of audio and osc it", | ||
dsp, | ||
type: "offline", | ||
channels: 1, | ||
sampleRate: 48000, | ||
inputFile: "/audio/cycfi-q-pitch-test/1a-Low-E.wav", | ||
inputOffset: 47500 + 5000 + 30000, | ||
outputLength: 200000, | ||
output: ["raw", "out"], | ||
}; | ||
|
||
export default dspDefinition; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import type { DspDefinition } from "../types"; | ||
|
||
const dsp = ` | ||
import("stdfaust.lib"); | ||
filter_top_freq = 1250.0; | ||
filter_bands = 8; | ||
active_channel = 6; | ||
sign(x) = ba.if(x > 0, 1, 0); | ||
detect_crossing(x) = sign(x) != sign(x'); | ||
pitch(x) = hz,osc | ||
with { | ||
lowest_pitch = 0.25; | ||
longest_cycle = ma.SR / lowest_pitch; | ||
crossed_up(x) = (x' < 0) & (x >= 0); | ||
safe_divide(num, denom) = num / max(denom, 1) - num * (denom == 0); | ||
reject_sub_pitches(x) = ba.if(x > longest_cycle, 0, x); | ||
crossed = crossed_up(x); | ||
cycle = ba.countup(ma.SR, crossed') | ||
: ba.sAndH(crossed) | ||
: reject_sub_pitches; | ||
hz = safe_divide(ma.SR, cycle); | ||
osc = os.osc(hz) * 0.2; | ||
}; | ||
per_band = pitch : _,!; | ||
// TODO track amplitude | ||
// reject any too quiet, or where hz is too variable | ||
filter = fi.mth_octave_filterbank(active_channel, 1, filter_top_freq, filter_bands); | ||
zero = par(i, filter_bands, per_band); | ||
input = _; | ||
process_1250 = _ : filter : zero : ba.selector(0, filter_bands) <: _,_; | ||
process_625 = _ : filter : zero : ba.selector(1, filter_bands) <: _,_; | ||
process_312 = _ : filter : zero : ba.selector(2, filter_bands) <: _,_; | ||
process_156 = _ : filter : zero : ba.selector(3, filter_bands) <: _,_; | ||
process_78 = _ : filter : zero : ba.selector(4, filter_bands) <: _,_; | ||
`; | ||
|
||
const dspDefinition: DspDefinition = { | ||
id: "multiband-filter", | ||
name: "Multiband filter", | ||
description: "Multiband filter", | ||
dsp, | ||
type: "offline", | ||
inputFile: "/audio/cycfi-q-pitch-test/GLines3.wav", | ||
channels: 1, | ||
sampleRate: 48000, | ||
output: [ | ||
"input", | ||
"process_1250", | ||
"process_625", | ||
"process_312", | ||
"process_156", | ||
"process_78", | ||
], | ||
outputLength: 48000, | ||
inputOffset: 18000 + 13000, | ||
}; | ||
|
||
export default dspDefinition; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters