Module: Ruby2Faust::DSL
- Defined in:
- lib/ruby2faust/dsl.rb
Overview
DSL module with comprehensive Faust library primitives.
Constant Summary collapse
- SR =
Constant aliases for those who prefer the capitalized look
DSP.new(Node.new(type: NodeType::SR))
- PI =
DSP.new(Node.new(type: NodeType::PI))
- TEMPO =
DSP.new(Node.new(type: NodeType::TEMPO))
Class Method Summary collapse
- .aa_arctan ⇒ Object
- .aa_cubic1 ⇒ Object
- .aa_cubic2 ⇒ Object
- .aa_hardclip ⇒ Object
- .aa_parabolic ⇒ Object
- .aa_sin ⇒ Object
- .aa_softclip ⇒ Object
-
.aa_tanh1 ⇒ Object
ANTIALIASING (aa.) =========================================================================.
- .aa_tanh2 ⇒ Object
- .abs_ ⇒ Object
- .abs_envelope_rect(period) ⇒ Object
- .abs_envelope_tau(tau) ⇒ Object
- .acos_ ⇒ Object
- .acosh_ ⇒ Object
- .add ⇒ Object
- .adsr(attack, decay, sustain, release, gate) ⇒ Object
- .adsre(attack, decay, sustain, release, gate) ⇒ Object
- .allpass(maxdelay, delay, feedback) ⇒ Object
-
.amp_follower(t) ⇒ Object
Analyzers (an.).
- .amp_follower_ar(attack, release) ⇒ Object
- .amp_follower_ud(up, down) ⇒ Object
-
.ar(attack, release, gate) ⇒ Object
ENVELOPES (en.) =========================================================================.
- .asin_ ⇒ Object
- .asinh_ ⇒ Object
- .asr(attack, sustain_level, release, gate) ⇒ Object
- .atan2(y, x) ⇒ Object
- .atan_ ⇒ Object
- .atanh_ ⇒ Object
- .auto_wah(level) ⇒ Object
- .ba_if(cond, then_val, else_val) ⇒ Object
- .ba_take(idx, tuple) ⇒ Object
- .bandstop(order, freq, q) ⇒ Object
- .block(n) ⇒ Object
- .bp(freq = wire, q: 1) ⇒ Object
-
.build_metadata(name, order: nil, style: nil, unit: nil, tooltip: nil, scale: nil, **_) ⇒ Object
Build Faust metadata string from kwargs.
-
.bus(n) ⇒ Object
ROUTING (si./ro.) =========================================================================.
- .button(name) ⇒ Object
- .ceil_ ⇒ Object
- .checkbox(name) ⇒ Object
- .clip(min_val, max_val) ⇒ Object
-
.compressor(ratio, thresh, attack, release) ⇒ Object
COMPRESSORS (co.) =========================================================================.
- .conv(impulse, size) ⇒ Object
- .cos_ ⇒ Object
- .cosh_ ⇒ Object
- .crybaby(wah) ⇒ Object
-
.cubicnl(drive, offset) ⇒ Object
Effects (ef.).
- .cut ⇒ Object
-
.db2linear(x) ⇒ Object
CONVERSION (ba.) =========================================================================.
- .dcblock ⇒ Object
-
.delay(maxdelay, d) ⇒ Object
DELAYS (de.) =========================================================================.
- .div ⇒ Object
-
.doc(text) ⇒ DSP
Line comment (appears on its own line in Faust output).
- .dry_wet_mixer(mix) ⇒ Object
- .dry_wet_mixer_cp(mix) ⇒ Object
- .echo(maxdel, del, fb) ⇒ Object
- .ef_compressor_mono(ratio, thresh, attack, release) ⇒ Object
- .ef_compressor_stereo(ratio, thresh, attack, release) ⇒ Object
- .ef_limiter_1176_mono ⇒ Object
- .ef_limiter_1176_stereo ⇒ Object
- .exp_ ⇒ Object
- .fbcombfilter(maxdel, del, fb) ⇒ Object
- .fdelay(maxdelay, d) ⇒ Object
- .ffcombfilter(maxdel, del) ⇒ Object
- .fi_pole(p) ⇒ Object
- .fi_zero(z) ⇒ Object
- .fir(coeffs) ⇒ Object
-
.flambda(*params) { ... } ⇒ DSP
Lambda expression: (x).(body).
- .flanger_mono(dmax, delay_freq, level, feedback, invert) ⇒ Object
- .flanger_stereo(dmax, delay_freq, level, feedback, invert, lfsr, lfsf) ⇒ Object
- .float_ ⇒ Object
- .floor_ ⇒ Object
- .fmod(x, y) ⇒ Object
-
.fpar(count) {|DSP| ... } ⇒ DSP
Parallel iteration: par(i, n, expr).
-
.fprod(count) {|DSP| ... } ⇒ DSP
Product iteration: prod(i, n, expr).
-
.freeverb(fb1, fb2, damp, spread) ⇒ Object
REVERBS (re.) =========================================================================.
-
.fseq(count) {|DSP| ... } ⇒ DSP
Sequential iteration: seq(i, n, expr).
-
.fsum(count) {|DSP| ... } ⇒ DSP
Summation iteration: sum(i, n, expr).
-
.gain(x) ⇒ Object
MATH (primitives + ma.) =========================================================================.
- .gate_mono(thresh, attack, hold, release) ⇒ Object
- .gate_stereo(thresh, attack, hold, release) ⇒ Object
- .hgroup(name, content = nil, &block) ⇒ Object
- .high_shelf(freq, q, gain) ⇒ Object
- .highpass3e(freq) ⇒ Object
- .highpass6e(freq) ⇒ Object
- .hp(freq = wire, order: 1) ⇒ Object
- .hz2midi(x) ⇒ Object
- .iir(bcoeffs, acoeffs) ⇒ Object
- .imptrain(freq = wire) ⇒ Object
- .int_ ⇒ Object
- .jpverb(t60, damp, size, early_diff, mod_depth, mod_freq, low, mid, high, low_cut, high_cut) ⇒ Object
- .lf_saw(freq) ⇒ Object
- .lf_square(freq) ⇒ Object
- .lf_triangle(freq) ⇒ Object
- .limiter ⇒ Object
- .linear2db(x) ⇒ Object
- .literal(expr, channels: 1) ⇒ Object
- .log10_ ⇒ Object
- .log_ ⇒ Object
- .low_shelf(freq, q, gain) ⇒ Object
-
.lowpass3e(freq) ⇒ Object
Other filter types.
- .lowpass6e(freq) ⇒ Object
-
.lp(freq = wire, order: 1) ⇒ Object
FILTERS (fi.) =========================================================================.
- .max_(a, b) ⇒ Object
- .mem ⇒ Object
- .midi2hz(x) ⇒ Object
- .min_(a, b) ⇒ Object
- .ms_envelope_rect(period) ⇒ Object
- .ms_envelope_tau(tau) ⇒ Object
- .mul ⇒ Object
- .neg ⇒ Object
- .nentry(name, init:, min:, max:, step: 1) ⇒ Object
-
.noise ⇒ Object
NOISE (no.) =========================================================================.
- .notchw(freq, width) ⇒ Object
-
.num(value) ⇒ Object
Wrap a numeric value as a DSP node (constant signal) Useful when composing with >> which would otherwise be Ruby’s bit-shift.
-
.osc(freq = wire) ⇒ Object
OSCILLATORS (os.) =========================================================================.
-
.panner(pan) ⇒ Object
SPATIAL (sp.) =========================================================================.
-
.param(name) ⇒ DSP
Parameter reference within a lambda.
- .peak_envelope(t) ⇒ Object
- .peak_eq(freq, q, gain_db) ⇒ Object
- .peak_eq_cq(freq, q, gain) ⇒ Object
- .phaser2_mono(nstages, freq, speed, depth, feedback, spread) ⇒ Object
- .phaser2_stereo(nstages, freq, speed, depth, feedback, spread) ⇒ Object
- .phasor(tablesize, freq) ⇒ Object
- .pi ⇒ Object
- .pink_noise ⇒ Object
- .pole2tau(pole) ⇒ Object
- .pow(base, exponent) ⇒ Object
- .pulsetrain(freq, duty) ⇒ Object
-
.rdtable(size, init, ridx) ⇒ DSP
Read-only table: rdtable(n, init, ridx).
- .resonbp(freq, q, gain = 1) ⇒ Object
- .resonhp(freq, q, gain = 1) ⇒ Object
- .resonlp(freq, q, gain = 1) ⇒ Object
- .rint_ ⇒ Object
- .rms_envelope_rect(period) ⇒ Object
- .rms_envelope_tau(tau) ⇒ Object
-
.route(ins, outs, connections) ⇒ DSP
Route signals: route(ins, outs, connections).
-
.rwtable(size, init, widx, wsig, ridx) ⇒ DSP
Read/write table: rwtable(n, init, widx, wsig, ridx).
- .samp2sec(x) ⇒ Object
- .saw(freq = wire) ⇒ Object
- .sdelay(maxdelay, interp, d) ⇒ Object
- .sec2samp(x) ⇒ Object
-
.select2(condition, a, b) ⇒ Object
SELECTORS =========================================================================.
-
.select3(sel, a, b, c) ⇒ DSP
3-way selector: select3(sel, a, b, c).
- .selectn(n, index, *signals) ⇒ Object
- .selector(n, sel, *inputs) ⇒ Object
- .sin_ ⇒ Object
- .sinh_ ⇒ Object
- .slider(name, init:, min:, max:, step: 0.01, **meta) ⇒ Object
- .smoo ⇒ Object
-
.smooth(tau) ⇒ Object
SMOOTHING (si.) =========================================================================.
- .speakerbp(flo, fhi) ⇒ Object
- .sqrt_ ⇒ Object
- .square(freq = wire) ⇒ Object
-
.sr ⇒ Object
CONSTANTS =========================================================================.
- .sub ⇒ Object
- .svf_ap(freq, q) ⇒ Object
- .svf_bell(freq, q, gain) ⇒ Object
- .svf_bp(freq, q) ⇒ Object
- .svf_hp(freq, q) ⇒ Object
- .svf_hs(freq, q, gain) ⇒ Object
-
.svf_lp(freq, q) ⇒ Object
SVF (State Variable Filter) filters.
- .svf_ls(freq, q, gain) ⇒ Object
- .svf_notch(freq, q) ⇒ Object
-
.svfLowShelf(freq, q, gain = 1) ⇒ Object
Convenience alias for svf_ls (low shelf).
- .tan_ ⇒ Object
- .tanh_ ⇒ Object
- .tau2pole(tau) ⇒ Object
- .tempo ⇒ Object
- .tf1(b0, b1, a1) ⇒ Object
- .tf1s(b0, b1, a1) ⇒ Object
- .tf2(b0, b1, b2, a1, a2) ⇒ Object
- .tf2s(b0, b1, b2, a1, a2) ⇒ Object
- .tgroup(name, content = nil, &block) ⇒ Object
- .to_dsp(value) ⇒ Object
- .transpose(w, x, s) ⇒ Object
- .triangle(freq = wire) ⇒ Object
- .vgroup(name, content = nil, &block) ⇒ Object
- .vocoder(bands, range) ⇒ Object
- .vslider(name, init:, min:, max:, step: 0.01) ⇒ Object
- .wah4(fr) ⇒ Object
-
.waveform(*values) ⇒ DSP
Waveform constant table: waveformv2, ….
-
.wire ⇒ Object
UTILITY =========================================================================.
- .zita_rev(rdel, f1, f2, t60dc, t60m, fsmax) ⇒ Object
Class Method Details
.aa_arctan ⇒ Object
1117 1118 1119 |
# File 'lib/ruby2faust/dsl.rb', line 1117 def aa_arctan DSP.new(Node.new(type: NodeType::AA_ARCTAN)) end |
.aa_cubic1 ⇒ Object
1137 1138 1139 |
# File 'lib/ruby2faust/dsl.rb', line 1137 def aa_cubic1 DSP.new(Node.new(type: NodeType::AA_CUBIC1)) end |
.aa_cubic2 ⇒ Object
1141 1142 1143 |
# File 'lib/ruby2faust/dsl.rb', line 1141 def aa_cubic2 DSP.new(Node.new(type: NodeType::AA_CUBIC2)) end |
.aa_hardclip ⇒ Object
1125 1126 1127 |
# File 'lib/ruby2faust/dsl.rb', line 1125 def aa_hardclip DSP.new(Node.new(type: NodeType::AA_HARDCLIP)) end |
.aa_parabolic ⇒ Object
1129 1130 1131 |
# File 'lib/ruby2faust/dsl.rb', line 1129 def aa_parabolic DSP.new(Node.new(type: NodeType::AA_PARABOLIC)) end |
.aa_sin ⇒ Object
1133 1134 1135 |
# File 'lib/ruby2faust/dsl.rb', line 1133 def aa_sin DSP.new(Node.new(type: NodeType::AA_SIN)) end |
.aa_softclip ⇒ Object
1121 1122 1123 |
# File 'lib/ruby2faust/dsl.rb', line 1121 def aa_softclip DSP.new(Node.new(type: NodeType::AA_SOFTCLIP)) end |
.aa_tanh1 ⇒ Object
ANTIALIASING (aa.)
1109 1110 1111 |
# File 'lib/ruby2faust/dsl.rb', line 1109 def aa_tanh1 DSP.new(Node.new(type: NodeType::AA_TANH1)) end |
.aa_tanh2 ⇒ Object
1113 1114 1115 |
# File 'lib/ruby2faust/dsl.rb', line 1113 def aa_tanh2 DSP.new(Node.new(type: NodeType::AA_TANH2)) end |
.abs_ ⇒ Object
599 600 601 |
# File 'lib/ruby2faust/dsl.rb', line 599 def abs_ DSP.new(Node.new(type: NodeType::ABS)) end |
.abs_envelope_rect(period) ⇒ Object
1166 1167 1168 |
# File 'lib/ruby2faust/dsl.rb', line 1166 def abs_envelope_rect(period) DSP.new(Node.new(type: NodeType::ABS_ENVELOPE_RECT, args: [period])) end |
.abs_envelope_tau(tau) ⇒ Object
1170 1171 1172 |
# File 'lib/ruby2faust/dsl.rb', line 1170 def abs_envelope_tau(tau) DSP.new(Node.new(type: NodeType::ABS_ENVELOPE_TAU, args: [tau])) end |
.acos_ ⇒ Object
683 684 685 |
# File 'lib/ruby2faust/dsl.rb', line 683 def acos_ DSP.new(Node.new(type: NodeType::ACOS)) end |
.acosh_ ⇒ Object
671 672 673 |
# File 'lib/ruby2faust/dsl.rb', line 671 def acosh_ DSP.new(Node.new(type: NodeType::ACOSH)) end |
.add ⇒ Object
579 580 581 |
# File 'lib/ruby2faust/dsl.rb', line 579 def add DSP.new(Node.new(type: NodeType::ADD)) end |
.adsr(attack, decay, sustain, release, gate) ⇒ Object
552 553 554 555 556 557 558 559 |
# File 'lib/ruby2faust/dsl.rb', line 552 def adsr(attack, decay, sustain, release, gate) attack = to_dsp(attack) decay = to_dsp(decay) sustain = to_dsp(sustain) release = to_dsp(release) gate = to_dsp(gate) DSP.new(Node.new(type: NodeType::ADSR, inputs: [attack.node, decay.node, sustain.node, release.node, gate.node])) end |
.adsre(attack, decay, sustain, release, gate) ⇒ Object
561 562 563 564 565 566 567 568 |
# File 'lib/ruby2faust/dsl.rb', line 561 def adsre(attack, decay, sustain, release, gate) attack = to_dsp(attack) decay = to_dsp(decay) sustain = to_dsp(sustain) release = to_dsp(release) gate = to_dsp(gate) DSP.new(Node.new(type: NodeType::ADSRE, inputs: [attack.node, decay.node, sustain.node, release.node, gate.node])) end |
.allpass(maxdelay, delay, feedback) ⇒ Object
306 307 308 309 310 311 |
# File 'lib/ruby2faust/dsl.rb', line 306 def allpass(maxdelay, delay, feedback) maxdelay = to_dsp(maxdelay) delay = to_dsp(delay) feedback = to_dsp(feedback) DSP.new(Node.new(type: NodeType::ALLPASS, inputs: [maxdelay.node, delay.node, feedback.node])) end |
.amp_follower(t) ⇒ Object
Analyzers (an.)
1146 1147 1148 |
# File 'lib/ruby2faust/dsl.rb', line 1146 def amp_follower(t) DSP.new(Node.new(type: NodeType::AMP_FOLLOWER, args: [t])) end |
.amp_follower_ar(attack, release) ⇒ Object
1150 1151 1152 |
# File 'lib/ruby2faust/dsl.rb', line 1150 def amp_follower_ar(attack, release) DSP.new(Node.new(type: NodeType::AMP_FOLLOWER_AR, args: [attack, release])) end |
.amp_follower_ud(up, down) ⇒ Object
1154 1155 1156 |
# File 'lib/ruby2faust/dsl.rb', line 1154 def amp_follower_ud(up, down) DSP.new(Node.new(type: NodeType::AMP_FOLLOWER_UD, args: [up, down])) end |
.ar(attack, release, gate) ⇒ Object
ENVELOPES (en.)
537 538 539 540 541 542 |
# File 'lib/ruby2faust/dsl.rb', line 537 def ar(attack, release, gate) attack = to_dsp(attack) release = to_dsp(release) gate = to_dsp(gate) DSP.new(Node.new(type: NodeType::AR, inputs: [attack.node, release.node, gate.node])) end |
.asin_ ⇒ Object
679 680 681 |
# File 'lib/ruby2faust/dsl.rb', line 679 def asin_ DSP.new(Node.new(type: NodeType::ASIN)) end |
.asinh_ ⇒ Object
667 668 669 |
# File 'lib/ruby2faust/dsl.rb', line 667 def asinh_ DSP.new(Node.new(type: NodeType::ASINH)) end |
.asr(attack, sustain_level, release, gate) ⇒ Object
544 545 546 547 548 549 550 |
# File 'lib/ruby2faust/dsl.rb', line 544 def asr(attack, sustain_level, release, gate) attack = to_dsp(attack) sustain_level = to_dsp(sustain_level) release = to_dsp(release) gate = to_dsp(gate) DSP.new(Node.new(type: NodeType::ASR, inputs: [attack.node, sustain_level.node, release.node, gate.node])) end |
.atan2(y, x) ⇒ Object
691 692 693 694 695 |
# File 'lib/ruby2faust/dsl.rb', line 691 def atan2(y, x) y = to_dsp(y) x = to_dsp(x) DSP.new(Node.new(type: NodeType::ATAN2, inputs: [y.node, x.node])) end |
.atan_ ⇒ Object
687 688 689 |
# File 'lib/ruby2faust/dsl.rb', line 687 def atan_ DSP.new(Node.new(type: NodeType::ATAN)) end |
.atanh_ ⇒ Object
675 676 677 |
# File 'lib/ruby2faust/dsl.rb', line 675 def atanh_ DSP.new(Node.new(type: NodeType::ATANH)) end |
.auto_wah(level) ⇒ Object
1243 1244 1245 |
# File 'lib/ruby2faust/dsl.rb', line 1243 def auto_wah(level) DSP.new(Node.new(type: NodeType::AUTO_WAH, args: [level])) end |
.ba_if(cond, then_val, else_val) ⇒ Object
767 768 769 770 771 772 |
# File 'lib/ruby2faust/dsl.rb', line 767 def ba_if(cond, then_val, else_val) cond = to_dsp(cond) then_val = to_dsp(then_val) else_val = to_dsp(else_val) DSP.new(Node.new(type: NodeType::BA_IF, inputs: [cond.node, then_val.node, else_val.node])) end |
.ba_take(idx, tuple) ⇒ Object
780 781 782 783 784 |
# File 'lib/ruby2faust/dsl.rb', line 780 def ba_take(idx, tuple) idx = to_dsp(idx) tuple = to_dsp(tuple) DSP.new(Node.new(type: NodeType::BA_TAKE, inputs: [idx.node, tuple.node])) end |
.bandstop(order, freq, q) ⇒ Object
404 405 406 407 408 409 |
# File 'lib/ruby2faust/dsl.rb', line 404 def bandstop(order, freq, q) order = to_dsp(order) freq = to_dsp(freq) q = to_dsp(q) DSP.new(Node.new(type: NodeType::BANDSTOP, inputs: [order.node, freq.node, q.node])) end |
.block(n) ⇒ Object
824 825 826 |
# File 'lib/ruby2faust/dsl.rb', line 824 def block(n) DSP.new(Node.new(type: NodeType::BLOCK, args: [n], channels: 0)) end |
.bp(freq = wire, q: 1) ⇒ Object
279 280 281 282 283 |
# File 'lib/ruby2faust/dsl.rb', line 279 def bp(freq = wire, q: 1) freq = to_dsp(freq) q = to_dsp(q) DSP.new(Node.new(type: NodeType::BP, inputs: [freq.node, q.node])) end |
.build_metadata(name, order: nil, style: nil, unit: nil, tooltip: nil, scale: nil, **_) ⇒ Object
Build Faust metadata string from kwargs
878 879 880 881 882 883 884 885 886 887 |
# File 'lib/ruby2faust/dsl.rb', line 878 def self.(name, order: nil, style: nil, unit: nil, tooltip: nil, scale: nil, **_) = "" += "[#{order}]" if order += "[style:#{style}]" if style += "[unit:#{unit}]" if unit += "[tooltip:#{tooltip}]" if tooltip += "[scale:#{scale}]" if scale # If name already has metadata, append; otherwise prefix name.to_s.include?("[") ? name.to_s : "#{meta}#{name}" end |
.bus(n) ⇒ Object
ROUTING (si./ro.)
820 821 822 |
# File 'lib/ruby2faust/dsl.rb', line 820 def bus(n) DSP.new(Node.new(type: NodeType::BUS, args: [n], channels: n)) end |
.button(name) ⇒ Object
902 903 904 |
# File 'lib/ruby2faust/dsl.rb', line 902 def (name) DSP.new(Node.new(type: NodeType::BUTTON, args: [name])) end |
.ceil_ ⇒ Object
701 702 703 |
# File 'lib/ruby2faust/dsl.rb', line 701 def ceil_ DSP.new(Node.new(type: NodeType::CEIL)) end |
.checkbox(name) ⇒ Object
906 907 908 |
# File 'lib/ruby2faust/dsl.rb', line 906 def checkbox(name) DSP.new(Node.new(type: NodeType::CHECKBOX, args: [name])) end |
.clip(min_val, max_val) ⇒ Object
615 616 617 618 619 |
# File 'lib/ruby2faust/dsl.rb', line 615 def clip(min_val, max_val) min_val = to_dsp(min_val) max_val = to_dsp(max_val) DSP.new(Node.new(type: NodeType::CLIP, inputs: [min_val.node, max_val.node])) end |
.compressor(ratio, thresh, attack, release) ⇒ Object
COMPRESSORS (co.)
852 853 854 855 856 857 858 |
# File 'lib/ruby2faust/dsl.rb', line 852 def compressor(ratio, thresh, attack, release) ratio = to_dsp(ratio) thresh = to_dsp(thresh) attack = to_dsp(attack) release = to_dsp(release) DSP.new(Node.new(type: NodeType::COMPRESSOR, inputs: [ratio.node, thresh.node, attack.node, release.node])) end |
.conv(impulse, size) ⇒ Object
491 492 493 494 495 |
# File 'lib/ruby2faust/dsl.rb', line 491 def conv(impulse, size) impulse = to_dsp(impulse) size = to_dsp(size) DSP.new(Node.new(type: NodeType::CONV, inputs: [impulse.node, size.node])) end |
.cos_ ⇒ Object
647 648 649 |
# File 'lib/ruby2faust/dsl.rb', line 647 def cos_ DSP.new(Node.new(type: NodeType::COS)) end |
.cosh_ ⇒ Object
663 664 665 |
# File 'lib/ruby2faust/dsl.rb', line 663 def cosh_ DSP.new(Node.new(type: NodeType::COSH)) end |
.crybaby(wah) ⇒ Object
1247 1248 1249 |
# File 'lib/ruby2faust/dsl.rb', line 1247 def crybaby(wah) DSP.new(Node.new(type: NodeType::CRYBABY, args: [wah])) end |
.cubicnl(drive, offset) ⇒ Object
Effects (ef.)
1187 1188 1189 |
# File 'lib/ruby2faust/dsl.rb', line 1187 def cubicnl(drive, offset) DSP.new(Node.new(type: NodeType::CUBICNL, args: [drive, offset])) end |
.cut ⇒ Object
1071 1072 1073 |
# File 'lib/ruby2faust/dsl.rb', line 1071 def cut DSP.new(Node.new(type: NodeType::CUT, channels: 0)) end |
.db2linear(x) ⇒ Object
CONVERSION (ba.)
727 728 729 730 |
# File 'lib/ruby2faust/dsl.rb', line 727 def db2linear(x) x = to_dsp(x) DSP.new(Node.new(type: NodeType::DB2LINEAR, inputs: [x.node])) end |
.dcblock ⇒ Object
313 314 315 |
# File 'lib/ruby2faust/dsl.rb', line 313 def dcblock DSP.new(Node.new(type: NodeType::DCBLOCK)) end |
.delay(maxdelay, d) ⇒ Object
DELAYS (de.)
514 515 516 517 518 |
# File 'lib/ruby2faust/dsl.rb', line 514 def delay(maxdelay, d) maxdelay = to_dsp(maxdelay) d = to_dsp(d) DSP.new(Node.new(type: NodeType::DELAY, inputs: [maxdelay.node, d.node])) end |
.div ⇒ Object
591 592 593 |
# File 'lib/ruby2faust/dsl.rb', line 591 def div DSP.new(Node.new(type: NodeType::DIV)) end |
.doc(text) ⇒ DSP
Line comment (appears on its own line in Faust output)
193 194 195 |
# File 'lib/ruby2faust/dsl.rb', line 193 def doc(text) DSP.new(Node.new(type: NodeType::COMMENT, args: [text], channels: 0)) end |
.dry_wet_mixer(mix) ⇒ Object
1259 1260 1261 |
# File 'lib/ruby2faust/dsl.rb', line 1259 def dry_wet_mixer(mix) DSP.new(Node.new(type: NodeType::DRY_WET_MIXER, args: [mix])) end |
.dry_wet_mixer_cp(mix) ⇒ Object
1263 1264 1265 |
# File 'lib/ruby2faust/dsl.rb', line 1263 def dry_wet_mixer_cp(mix) DSP.new(Node.new(type: NodeType::DRY_WET_MIXER_CP, args: [mix])) end |
.echo(maxdel, del, fb) ⇒ Object
1215 1216 1217 |
# File 'lib/ruby2faust/dsl.rb', line 1215 def echo(maxdel, del, fb) DSP.new(Node.new(type: NodeType::ECHO, args: [maxdel, del, fb])) end |
.ef_compressor_mono(ratio, thresh, attack, release) ⇒ Object
1199 1200 1201 |
# File 'lib/ruby2faust/dsl.rb', line 1199 def ef_compressor_mono(ratio, thresh, attack, release) DSP.new(Node.new(type: NodeType::EF_COMPRESSOR_MONO, args: [ratio, thresh, attack, release])) end |
.ef_compressor_stereo(ratio, thresh, attack, release) ⇒ Object
1203 1204 1205 |
# File 'lib/ruby2faust/dsl.rb', line 1203 def ef_compressor_stereo(ratio, thresh, attack, release) DSP.new(Node.new(type: NodeType::EF_COMPRESSOR_STEREO, args: [ratio, thresh, attack, release], channels: 2)) end |
.ef_limiter_1176_mono ⇒ Object
1207 1208 1209 |
# File 'lib/ruby2faust/dsl.rb', line 1207 def ef_limiter_1176_mono DSP.new(Node.new(type: NodeType::EF_LIMITER_1176_MONO)) end |
.ef_limiter_1176_stereo ⇒ Object
1211 1212 1213 |
# File 'lib/ruby2faust/dsl.rb', line 1211 def ef_limiter_1176_stereo DSP.new(Node.new(type: NodeType::EF_LIMITER_1176_STEREO, channels: 2)) end |
.exp_ ⇒ Object
631 632 633 |
# File 'lib/ruby2faust/dsl.rb', line 631 def exp_ DSP.new(Node.new(type: NodeType::EXP)) end |
.fbcombfilter(maxdel, del, fb) ⇒ Object
497 498 499 500 501 502 |
# File 'lib/ruby2faust/dsl.rb', line 497 def fbcombfilter(maxdel, del, fb) maxdel = to_dsp(maxdel) del = to_dsp(del) fb = to_dsp(fb) DSP.new(Node.new(type: NodeType::FBCOMBFILTER, inputs: [maxdel.node, del.node, fb.node])) end |
.fdelay(maxdelay, d) ⇒ Object
520 521 522 523 524 |
# File 'lib/ruby2faust/dsl.rb', line 520 def fdelay(maxdelay, d) maxdelay = to_dsp(maxdelay) d = to_dsp(d) DSP.new(Node.new(type: NodeType::FDELAY, inputs: [maxdelay.node, d.node])) end |
.ffcombfilter(maxdel, del) ⇒ Object
504 505 506 507 508 |
# File 'lib/ruby2faust/dsl.rb', line 504 def ffcombfilter(maxdel, del) maxdel = to_dsp(maxdel) del = to_dsp(del) DSP.new(Node.new(type: NodeType::FFCOMBFILTER, inputs: [maxdel.node, del.node])) end |
.fi_pole(p) ⇒ Object
438 439 440 441 |
# File 'lib/ruby2faust/dsl.rb', line 438 def fi_pole(p) p = to_dsp(p) DSP.new(Node.new(type: NodeType::FI_POLE, inputs: [p.node])) end |
.fi_zero(z) ⇒ Object
443 444 445 446 |
# File 'lib/ruby2faust/dsl.rb', line 443 def fi_zero(z) z = to_dsp(z) DSP.new(Node.new(type: NodeType::FI_ZERO, inputs: [z.node])) end |
.fir(coeffs) ⇒ Object
486 487 488 489 |
# File 'lib/ruby2faust/dsl.rb', line 486 def fir(coeffs) coeffs = to_dsp(coeffs) DSP.new(Node.new(type: NodeType::FIR, inputs: [coeffs.node])) end |
.flambda(*params) { ... } ⇒ DSP
Lambda expression: (x).(body)
985 986 987 988 |
# File 'lib/ruby2faust/dsl.rb', line 985 def flambda(*params, &block) raise ArgumentError, "flambda requires a block" unless block_given? DSP.new(Node.new(type: NodeType::LAMBDA, args: [params, block])) end |
.flanger_mono(dmax, delay_freq, level, feedback, invert) ⇒ Object
1223 1224 1225 |
# File 'lib/ruby2faust/dsl.rb', line 1223 def flanger_mono(dmax, delay_freq, level, feedback, invert) DSP.new(Node.new(type: NodeType::FLANGER_MONO, args: [dmax, delay_freq, level, feedback, invert])) end |
.flanger_stereo(dmax, delay_freq, level, feedback, invert, lfsr, lfsf) ⇒ Object
1227 1228 1229 |
# File 'lib/ruby2faust/dsl.rb', line 1227 def flanger_stereo(dmax, delay_freq, level, feedback, invert, lfsr, lfsf) DSP.new(Node.new(type: NodeType::FLANGER_STEREO, args: [dmax, delay_freq, level, feedback, invert, lfsr, lfsf], channels: 2)) end |
.float_ ⇒ Object
719 720 721 |
# File 'lib/ruby2faust/dsl.rb', line 719 def float_ DSP.new(Node.new(type: NodeType::FLOAT)) end |
.floor_ ⇒ Object
697 698 699 |
# File 'lib/ruby2faust/dsl.rb', line 697 def floor_ DSP.new(Node.new(type: NodeType::FLOOR)) end |
.fmod(x, y) ⇒ Object
709 710 711 712 713 |
# File 'lib/ruby2faust/dsl.rb', line 709 def fmod(x, y) x = to_dsp(x) y = to_dsp(y) DSP.new(Node.new(type: NodeType::FMOD, inputs: [x.node, y.node])) end |
.fpar(count) {|DSP| ... } ⇒ DSP
Parallel iteration: par(i, n, expr)
941 942 943 944 945 |
# File 'lib/ruby2faust/dsl.rb', line 941 def fpar(count, &block) raise ArgumentError, "fpar requires a block" unless block_given? var = block.parameters.first&.last || :it DSP.new(Node.new(type: NodeType::FPAR, args: [var, count, block], channels: count)) end |
.fprod(count) {|DSP| ... } ⇒ DSP
Product iteration: prod(i, n, expr)
971 972 973 974 975 |
# File 'lib/ruby2faust/dsl.rb', line 971 def fprod(count, &block) raise ArgumentError, "fprod requires a block" unless block_given? var = block.parameters.first&.last || :it DSP.new(Node.new(type: NodeType::FPROD, args: [var, count, block])) end |
.freeverb(fb1, fb2, damp, spread) ⇒ Object
REVERBS (re.)
832 833 834 835 836 837 838 |
# File 'lib/ruby2faust/dsl.rb', line 832 def freeverb(fb1, fb2, damp, spread) fb1 = to_dsp(fb1) fb2 = to_dsp(fb2) damp = to_dsp(damp) spread = to_dsp(spread) DSP.new(Node.new(type: NodeType::FREEVERB, inputs: [fb1.node, fb2.node, damp.node, spread.node])) end |
.fseq(count) {|DSP| ... } ⇒ DSP
Sequential iteration: seq(i, n, expr)
951 952 953 954 955 |
# File 'lib/ruby2faust/dsl.rb', line 951 def fseq(count, &block) raise ArgumentError, "fseq requires a block" unless block_given? var = block.parameters.first&.last || :it DSP.new(Node.new(type: NodeType::FSEQ, args: [var, count, block])) end |
.fsum(count) {|DSP| ... } ⇒ DSP
Summation iteration: sum(i, n, expr)
961 962 963 964 965 |
# File 'lib/ruby2faust/dsl.rb', line 961 def fsum(count, &block) raise ArgumentError, "fsum requires a block" unless block_given? var = block.parameters.first&.last || :it DSP.new(Node.new(type: NodeType::FSUM, args: [var, count, block])) end |
.gain(x) ⇒ Object
MATH (primitives + ma.)
574 575 576 577 |
# File 'lib/ruby2faust/dsl.rb', line 574 def gain(x) x = to_dsp(x) DSP.new(Node.new(type: NodeType::GAIN, inputs: [x.node])) end |
.gate_mono(thresh, attack, hold, release) ⇒ Object
1191 1192 1193 |
# File 'lib/ruby2faust/dsl.rb', line 1191 def gate_mono(thresh, attack, hold, release) DSP.new(Node.new(type: NodeType::GATE_MONO, args: [thresh, attack, hold, release])) end |
.gate_stereo(thresh, attack, hold, release) ⇒ Object
1195 1196 1197 |
# File 'lib/ruby2faust/dsl.rb', line 1195 def gate_stereo(thresh, attack, hold, release) DSP.new(Node.new(type: NodeType::GATE_STEREO, args: [thresh, attack, hold, release], channels: 2)) end |
.hgroup(name, content = nil, &block) ⇒ Object
910 911 912 913 914 915 |
# File 'lib/ruby2faust/dsl.rb', line 910 def hgroup(name, content = nil, &block) content = block.call if block_given? raise ArgumentError, "hgroup requires content or a block" if content.nil? content = to_dsp(content) DSP.new(Node.new(type: NodeType::HGROUP, args: [name], inputs: [content.node], channels: content.node.channels)) end |
.high_shelf(freq, q, gain) ⇒ Object
424 425 426 427 428 429 |
# File 'lib/ruby2faust/dsl.rb', line 424 def high_shelf(freq, q, gain) freq = to_dsp(freq) q = to_dsp(q) gain = to_dsp(gain) DSP.new(Node.new(type: NodeType::HIGH_SHELF, inputs: [freq.node, q.node, gain.node])) end |
.highpass3e(freq) ⇒ Object
389 390 391 392 |
# File 'lib/ruby2faust/dsl.rb', line 389 def highpass3e(freq) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::HIGHPASS3E, inputs: [freq.node])) end |
.highpass6e(freq) ⇒ Object
399 400 401 402 |
# File 'lib/ruby2faust/dsl.rb', line 399 def highpass6e(freq) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::HIGHPASS6E, inputs: [freq.node])) end |
.hp(freq = wire, order: 1) ⇒ Object
274 275 276 277 |
# File 'lib/ruby2faust/dsl.rb', line 274 def hp(freq = wire, order: 1) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::HP, args: [order], inputs: [freq.node])) end |
.hz2midi(x) ⇒ Object
752 753 754 755 |
# File 'lib/ruby2faust/dsl.rb', line 752 def hz2midi(x) x = to_dsp(x) DSP.new(Node.new(type: NodeType::HZ2MIDI, inputs: [x.node])) end |
.iir(bcoeffs, acoeffs) ⇒ Object
480 481 482 483 484 |
# File 'lib/ruby2faust/dsl.rb', line 480 def iir(bcoeffs, acoeffs) bcoeffs = to_dsp(bcoeffs) acoeffs = to_dsp(acoeffs) DSP.new(Node.new(type: NodeType::IIR, inputs: [bcoeffs.node, acoeffs.node])) end |
.imptrain(freq = wire) ⇒ Object
242 243 244 245 |
# File 'lib/ruby2faust/dsl.rb', line 242 def imptrain(freq = wire) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::IMPTRAIN, inputs: [freq.node])) end |
.int_ ⇒ Object
715 716 717 |
# File 'lib/ruby2faust/dsl.rb', line 715 def int_ DSP.new(Node.new(type: NodeType::INT)) end |
.jpverb(t60, damp, size, early_diff, mod_depth, mod_freq, low, mid, high, low_cut, high_cut) ⇒ Object
844 845 846 |
# File 'lib/ruby2faust/dsl.rb', line 844 def jpverb(t60, damp, size, early_diff, mod_depth, mod_freq, low, mid, high, low_cut, high_cut) DSP.new(Node.new(type: NodeType::JPVERB, args: [t60, damp, size, early_diff, mod_depth, mod_freq, low, mid, high, low_cut, high_cut], channels: 2)) end |
.lf_saw(freq) ⇒ Object
227 228 229 230 |
# File 'lib/ruby2faust/dsl.rb', line 227 def lf_saw(freq) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::LF_SAW, inputs: [freq.node])) end |
.lf_square(freq) ⇒ Object
237 238 239 240 |
# File 'lib/ruby2faust/dsl.rb', line 237 def lf_square(freq) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::LF_SQUARE, inputs: [freq.node])) end |
.lf_triangle(freq) ⇒ Object
232 233 234 235 |
# File 'lib/ruby2faust/dsl.rb', line 232 def lf_triangle(freq) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::LF_TRIANGLE, inputs: [freq.node])) end |
.limiter ⇒ Object
860 861 862 |
# File 'lib/ruby2faust/dsl.rb', line 860 def limiter DSP.new(Node.new(type: NodeType::LIMITER)) end |
.linear2db(x) ⇒ Object
732 733 734 735 |
# File 'lib/ruby2faust/dsl.rb', line 732 def linear2db(x) x = to_dsp(x) DSP.new(Node.new(type: NodeType::LINEAR2DB, inputs: [x.node])) end |
.literal(expr, channels: 1) ⇒ Object
1079 1080 1081 |
# File 'lib/ruby2faust/dsl.rb', line 1079 def literal(expr, channels: 1) DSP.new(Node.new(type: NodeType::LITERAL, args: [expr], channels: channels)) end |
.log10_ ⇒ Object
639 640 641 |
# File 'lib/ruby2faust/dsl.rb', line 639 def log10_ DSP.new(Node.new(type: NodeType::LOG10)) end |
.log_ ⇒ Object
635 636 637 |
# File 'lib/ruby2faust/dsl.rb', line 635 def log_ DSP.new(Node.new(type: NodeType::LOG)) end |
.low_shelf(freq, q, gain) ⇒ Object
417 418 419 420 421 422 |
# File 'lib/ruby2faust/dsl.rb', line 417 def low_shelf(freq, q, gain) freq = to_dsp(freq) q = to_dsp(q) gain = to_dsp(gain) DSP.new(Node.new(type: NodeType::LOW_SHELF, inputs: [freq.node, q.node, gain.node])) end |
.lowpass3e(freq) ⇒ Object
Other filter types
384 385 386 387 |
# File 'lib/ruby2faust/dsl.rb', line 384 def lowpass3e(freq) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::LOWPASS3E, inputs: [freq.node])) end |
.lowpass6e(freq) ⇒ Object
394 395 396 397 |
# File 'lib/ruby2faust/dsl.rb', line 394 def lowpass6e(freq) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::LOWPASS6E, inputs: [freq.node])) end |
.lp(freq = wire, order: 1) ⇒ Object
FILTERS (fi.)
269 270 271 272 |
# File 'lib/ruby2faust/dsl.rb', line 269 def lp(freq = wire, order: 1) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::LP, args: [order], inputs: [freq.node])) end |
.max_(a, b) ⇒ Object
609 610 611 612 613 |
# File 'lib/ruby2faust/dsl.rb', line 609 def max_(a, b) a = to_dsp(a) b = to_dsp(b) DSP.new(Node.new(type: NodeType::MAX, inputs: [a.node, b.node])) end |
.mem ⇒ Object
1075 1076 1077 |
# File 'lib/ruby2faust/dsl.rb', line 1075 def mem DSP.new(Node.new(type: NodeType::MEM)) end |
.midi2hz(x) ⇒ Object
747 748 749 750 |
# File 'lib/ruby2faust/dsl.rb', line 747 def midi2hz(x) x = to_dsp(x) DSP.new(Node.new(type: NodeType::MIDI2HZ, inputs: [x.node])) end |
.min_(a, b) ⇒ Object
603 604 605 606 607 |
# File 'lib/ruby2faust/dsl.rb', line 603 def min_(a, b) a = to_dsp(a) b = to_dsp(b) DSP.new(Node.new(type: NodeType::MIN, inputs: [a.node, b.node])) end |
.ms_envelope_rect(period) ⇒ Object
1174 1175 1176 |
# File 'lib/ruby2faust/dsl.rb', line 1174 def ms_envelope_rect(period) DSP.new(Node.new(type: NodeType::MS_ENVELOPE_RECT, args: [period])) end |
.ms_envelope_tau(tau) ⇒ Object
1178 1179 1180 |
# File 'lib/ruby2faust/dsl.rb', line 1178 def ms_envelope_tau(tau) DSP.new(Node.new(type: NodeType::MS_ENVELOPE_TAU, args: [tau])) end |
.mul ⇒ Object
583 584 585 |
# File 'lib/ruby2faust/dsl.rb', line 583 def mul DSP.new(Node.new(type: NodeType::MUL)) end |
.neg ⇒ Object
595 596 597 |
# File 'lib/ruby2faust/dsl.rb', line 595 def neg DSP.new(Node.new(type: NodeType::NEG)) end |
.nentry(name, init:, min:, max:, step: 1) ⇒ Object
898 899 900 |
# File 'lib/ruby2faust/dsl.rb', line 898 def nentry(name, init:, min:, max:, step: 1) DSP.new(Node.new(type: NodeType::NENTRY, args: [name, init, min, max, step])) end |
.noise ⇒ Object
NOISE (no.)
257 258 259 |
# File 'lib/ruby2faust/dsl.rb', line 257 def noise DSP.new(Node.new(type: NodeType::NOISE)) end |
.notchw(freq, width) ⇒ Object
411 412 413 414 415 |
# File 'lib/ruby2faust/dsl.rb', line 411 def notchw(freq, width) freq = to_dsp(freq) width = to_dsp(width) DSP.new(Node.new(type: NodeType::NOTCHW, inputs: [freq.node, width.node])) end |
.num(value) ⇒ Object
Wrap a numeric value as a DSP node (constant signal) Useful when composing with >> which would otherwise be Ruby’s bit-shift
1085 1086 1087 |
# File 'lib/ruby2faust/dsl.rb', line 1085 def num(value) DSP.new(Node.new(type: NodeType::LITERAL, args: [value.to_s])) end |
.osc(freq = wire) ⇒ Object
OSCILLATORS (os.)
201 202 203 204 |
# File 'lib/ruby2faust/dsl.rb', line 201 def osc(freq = wire) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::OSC, inputs: [freq.node])) end |
.panner(pan) ⇒ Object
SPATIAL (sp.)
868 869 870 871 |
# File 'lib/ruby2faust/dsl.rb', line 868 def panner(pan) pan = to_dsp(pan) DSP.new(Node.new(type: NodeType::PANNER, inputs: [pan.node], channels: 2)) end |
.param(name) ⇒ DSP
Parameter reference within a lambda
993 994 995 |
# File 'lib/ruby2faust/dsl.rb', line 993 def param(name) DSP.new(Node.new(type: NodeType::PARAM, args: [name])) end |
.peak_envelope(t) ⇒ Object
1182 1183 1184 |
# File 'lib/ruby2faust/dsl.rb', line 1182 def peak_envelope(t) DSP.new(Node.new(type: NodeType::PEAK_ENVELOPE, args: [t])) end |
.peak_eq(freq, q, gain_db) ⇒ Object
317 318 319 320 321 322 |
# File 'lib/ruby2faust/dsl.rb', line 317 def peak_eq(freq, q, gain_db) freq = to_dsp(freq) q = to_dsp(q) gain_db = to_dsp(gain_db) DSP.new(Node.new(type: NodeType::PEAK_EQ, inputs: [freq.node, q.node, gain_db.node])) end |
.peak_eq_cq(freq, q, gain) ⇒ Object
431 432 433 434 435 436 |
# File 'lib/ruby2faust/dsl.rb', line 431 def peak_eq_cq(freq, q, gain) freq = to_dsp(freq) q = to_dsp(q) gain = to_dsp(gain) DSP.new(Node.new(type: NodeType::PEAK_EQ_CQ, inputs: [freq.node, q.node, gain.node])) end |
.phaser2_mono(nstages, freq, speed, depth, feedback, spread) ⇒ Object
1231 1232 1233 |
# File 'lib/ruby2faust/dsl.rb', line 1231 def phaser2_mono(nstages, freq, speed, depth, feedback, spread) DSP.new(Node.new(type: NodeType::PHASER2_MONO, args: [nstages, freq, speed, depth, feedback, spread])) end |
.phaser2_stereo(nstages, freq, speed, depth, feedback, spread) ⇒ Object
1235 1236 1237 |
# File 'lib/ruby2faust/dsl.rb', line 1235 def phaser2_stereo(nstages, freq, speed, depth, feedback, spread) DSP.new(Node.new(type: NodeType::PHASER2_STEREO, args: [nstages, freq, speed, depth, feedback, spread], channels: 2)) end |
.phasor(tablesize, freq) ⇒ Object
221 222 223 224 225 |
# File 'lib/ruby2faust/dsl.rb', line 221 def phasor(tablesize, freq) tablesize = to_dsp(tablesize) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::PHASOR, inputs: [tablesize.node, freq.node])) end |
.pi ⇒ Object
1097 1098 1099 |
# File 'lib/ruby2faust/dsl.rb', line 1097 def pi DSP.new(Node.new(type: NodeType::PI)) end |
.pink_noise ⇒ Object
261 262 263 |
# File 'lib/ruby2faust/dsl.rb', line 261 def pink_noise DSP.new(Node.new(type: NodeType::PINK_NOISE)) end |
.pole2tau(pole) ⇒ Object
762 763 764 765 |
# File 'lib/ruby2faust/dsl.rb', line 762 def pole2tau(pole) pole = to_dsp(pole) DSP.new(Node.new(type: NodeType::POLE2TAU, inputs: [pole.node])) end |
.pow(base, exponent) ⇒ Object
621 622 623 624 625 |
# File 'lib/ruby2faust/dsl.rb', line 621 def pow(base, exponent) base = to_dsp(base) exponent = to_dsp(exponent) DSP.new(Node.new(type: NodeType::POW, inputs: [base.node, exponent.node])) end |
.pulsetrain(freq, duty) ⇒ Object
247 248 249 250 251 |
# File 'lib/ruby2faust/dsl.rb', line 247 def pulsetrain(freq, duty) freq = to_dsp(freq) duty = to_dsp(duty) DSP.new(Node.new(type: NodeType::PULSETRAIN, inputs: [freq.node, duty.node])) end |
.rdtable(size, init, ridx) ⇒ DSP
Read-only table: rdtable(n, init, ridx)
1006 1007 1008 1009 1010 1011 |
# File 'lib/ruby2faust/dsl.rb', line 1006 def rdtable(size, init, ridx) size = to_dsp(size) init = to_dsp(init) ridx = to_dsp(ridx) DSP.new(Node.new(type: NodeType::RDTABLE, inputs: [size.node, init.node, ridx.node])) end |
.resonbp(freq, q, gain = 1) ⇒ Object
299 300 301 302 303 304 |
# File 'lib/ruby2faust/dsl.rb', line 299 def resonbp(freq, q, gain = 1) freq = to_dsp(freq) q = to_dsp(q) gain = to_dsp(gain) DSP.new(Node.new(type: NodeType::RESONBP, inputs: [freq.node, q.node, gain.node])) end |
.resonhp(freq, q, gain = 1) ⇒ Object
292 293 294 295 296 297 |
# File 'lib/ruby2faust/dsl.rb', line 292 def resonhp(freq, q, gain = 1) freq = to_dsp(freq) q = to_dsp(q) gain = to_dsp(gain) DSP.new(Node.new(type: NodeType::RESONHP, inputs: [freq.node, q.node, gain.node])) end |
.resonlp(freq, q, gain = 1) ⇒ Object
285 286 287 288 289 290 |
# File 'lib/ruby2faust/dsl.rb', line 285 def resonlp(freq, q, gain = 1) freq = to_dsp(freq) q = to_dsp(q) gain = to_dsp(gain) DSP.new(Node.new(type: NodeType::RESONLP, inputs: [freq.node, q.node, gain.node])) end |
.rint_ ⇒ Object
705 706 707 |
# File 'lib/ruby2faust/dsl.rb', line 705 def rint_ DSP.new(Node.new(type: NodeType::RINT)) end |
.rms_envelope_rect(period) ⇒ Object
1158 1159 1160 |
# File 'lib/ruby2faust/dsl.rb', line 1158 def rms_envelope_rect(period) DSP.new(Node.new(type: NodeType::RMS_ENVELOPE_RECT, args: [period])) end |
.rms_envelope_tau(tau) ⇒ Object
1162 1163 1164 |
# File 'lib/ruby2faust/dsl.rb', line 1162 def rms_envelope_tau(tau) DSP.new(Node.new(type: NodeType::RMS_ENVELOPE_TAU, args: [tau])) end |
.route(ins, outs, connections) ⇒ DSP
Route signals: route(ins, outs, connections)
1045 1046 1047 |
# File 'lib/ruby2faust/dsl.rb', line 1045 def route(ins, outs, connections) DSP.new(Node.new(type: NodeType::ROUTE, args: [ins, outs, connections], channels: outs)) end |
.rwtable(size, init, widx, wsig, ridx) ⇒ DSP
Read/write table: rwtable(n, init, widx, wsig, ridx)
1020 1021 1022 1023 1024 1025 1026 1027 |
# File 'lib/ruby2faust/dsl.rb', line 1020 def rwtable(size, init, widx, wsig, ridx) size = to_dsp(size) init = to_dsp(init) widx = to_dsp(widx) wsig = to_dsp(wsig) ridx = to_dsp(ridx) DSP.new(Node.new(type: NodeType::RWTABLE, inputs: [size.node, init.node, widx.node, wsig.node, ridx.node])) end |
.samp2sec(x) ⇒ Object
737 738 739 740 |
# File 'lib/ruby2faust/dsl.rb', line 737 def samp2sec(x) x = to_dsp(x) DSP.new(Node.new(type: NodeType::SAMP2SEC, inputs: [x.node])) end |
.saw(freq = wire) ⇒ Object
206 207 208 209 |
# File 'lib/ruby2faust/dsl.rb', line 206 def saw(freq = wire) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::SAW, inputs: [freq.node])) end |
.sdelay(maxdelay, interp, d) ⇒ Object
526 527 528 529 530 531 |
# File 'lib/ruby2faust/dsl.rb', line 526 def sdelay(maxdelay, interp, d) maxdelay = to_dsp(maxdelay) interp = to_dsp(interp) d = to_dsp(d) DSP.new(Node.new(type: NodeType::SDELAY, inputs: [maxdelay.node, interp.node, d.node])) end |
.sec2samp(x) ⇒ Object
742 743 744 745 |
# File 'lib/ruby2faust/dsl.rb', line 742 def sec2samp(x) x = to_dsp(x) DSP.new(Node.new(type: NodeType::SEC2SAMP, inputs: [x.node])) end |
.select2(condition, a, b) ⇒ Object
SELECTORS
803 804 805 806 807 808 |
# File 'lib/ruby2faust/dsl.rb', line 803 def select2(condition, a, b) condition = to_dsp(condition) a = to_dsp(a) b = to_dsp(b) DSP.new(Node.new(type: NodeType::SELECT2, inputs: [condition.node, a.node, b.node], channels: a.node.channels)) end |
.select3(sel, a, b, c) ⇒ DSP
3-way selector: select3(sel, a, b, c)
1055 1056 1057 1058 1059 1060 1061 |
# File 'lib/ruby2faust/dsl.rb', line 1055 def select3(sel, a, b, c) sel = to_dsp(sel) a = to_dsp(a) b = to_dsp(b) c = to_dsp(c) DSP.new(Node.new(type: NodeType::SELECT3, inputs: [sel.node, a.node, b.node, c.node], channels: a.node.channels)) end |
.selectn(n, index, *signals) ⇒ Object
810 811 812 813 814 |
# File 'lib/ruby2faust/dsl.rb', line 810 def selectn(n, index, *signals) index = to_dsp(index) signals = signals.map { |s| to_dsp(s) } DSP.new(Node.new(type: NodeType::SELECTN, args: [n], inputs: [index.node] + signals.map(&:node), channels: signals.first&.node&.channels || 1)) end |
.selector(n, sel, *inputs) ⇒ Object
774 775 776 777 778 |
# File 'lib/ruby2faust/dsl.rb', line 774 def selector(n, sel, *inputs) sel = to_dsp(sel) inputs = inputs.map { |i| to_dsp(i) } DSP.new(Node.new(type: NodeType::SELECTOR, args: [n], inputs: [sel.node] + inputs.map(&:node))) end |
.sin_ ⇒ Object
643 644 645 |
# File 'lib/ruby2faust/dsl.rb', line 643 def sin_ DSP.new(Node.new(type: NodeType::SIN)) end |
.sinh_ ⇒ Object
659 660 661 |
# File 'lib/ruby2faust/dsl.rb', line 659 def sinh_ DSP.new(Node.new(type: NodeType::SINH)) end |
.slider(name, init:, min:, max:, step: 0.01, **meta) ⇒ Object
889 890 891 892 |
# File 'lib/ruby2faust/dsl.rb', line 889 def (name, init:, min:, max:, step: 0.01, **) full_name = DSL.(name, **) DSP.new(Node.new(type: NodeType::SLIDER, args: [full_name, init, min, max, step])) end |
.smoo ⇒ Object
795 796 797 |
# File 'lib/ruby2faust/dsl.rb', line 795 def smoo DSP.new(Node.new(type: NodeType::SMOO)) end |
.smooth(tau) ⇒ Object
SMOOTHING (si.)
790 791 792 793 |
# File 'lib/ruby2faust/dsl.rb', line 790 def smooth(tau) tau = to_dsp(tau) DSP.new(Node.new(type: NodeType::SMOOTH, inputs: [tau.node])) end |
.speakerbp(flo, fhi) ⇒ Object
1255 1256 1257 |
# File 'lib/ruby2faust/dsl.rb', line 1255 def speakerbp(flo, fhi) DSP.new(Node.new(type: NodeType::SPEAKERBP, args: [flo, fhi])) end |
.sqrt_ ⇒ Object
627 628 629 |
# File 'lib/ruby2faust/dsl.rb', line 627 def sqrt_ DSP.new(Node.new(type: NodeType::SQRT)) end |
.square(freq = wire) ⇒ Object
211 212 213 214 |
# File 'lib/ruby2faust/dsl.rb', line 211 def square(freq = wire) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::SQUARE, inputs: [freq.node])) end |
.sr ⇒ Object
CONSTANTS
1093 1094 1095 |
# File 'lib/ruby2faust/dsl.rb', line 1093 def sr DSP.new(Node.new(type: NodeType::SR)) end |
.sub ⇒ Object
587 588 589 |
# File 'lib/ruby2faust/dsl.rb', line 587 def sub DSP.new(Node.new(type: NodeType::SUB)) end |
.svf_ap(freq, q) ⇒ Object
350 351 352 353 354 |
# File 'lib/ruby2faust/dsl.rb', line 350 def svf_ap(freq, q) freq = to_dsp(freq) q = to_dsp(q) DSP.new(Node.new(type: NodeType::SVF_AP, inputs: [freq.node, q.node])) end |
.svf_bell(freq, q, gain) ⇒ Object
356 357 358 359 360 361 |
# File 'lib/ruby2faust/dsl.rb', line 356 def svf_bell(freq, q, gain) freq = to_dsp(freq) q = to_dsp(q) gain = to_dsp(gain) DSP.new(Node.new(type: NodeType::SVF_BELL, inputs: [freq.node, q.node, gain.node])) end |
.svf_bp(freq, q) ⇒ Object
338 339 340 341 342 |
# File 'lib/ruby2faust/dsl.rb', line 338 def svf_bp(freq, q) freq = to_dsp(freq) q = to_dsp(q) DSP.new(Node.new(type: NodeType::SVF_BP, inputs: [freq.node, q.node])) end |
.svf_hp(freq, q) ⇒ Object
332 333 334 335 336 |
# File 'lib/ruby2faust/dsl.rb', line 332 def svf_hp(freq, q) freq = to_dsp(freq) q = to_dsp(q) DSP.new(Node.new(type: NodeType::SVF_HP, inputs: [freq.node, q.node])) end |
.svf_hs(freq, q, gain) ⇒ Object
370 371 372 373 374 375 |
# File 'lib/ruby2faust/dsl.rb', line 370 def svf_hs(freq, q, gain) freq = to_dsp(freq) q = to_dsp(q) gain = to_dsp(gain) DSP.new(Node.new(type: NodeType::SVF_HS, inputs: [freq.node, q.node, gain.node])) end |
.svf_lp(freq, q) ⇒ Object
SVF (State Variable Filter) filters
326 327 328 329 330 |
# File 'lib/ruby2faust/dsl.rb', line 326 def svf_lp(freq, q) freq = to_dsp(freq) q = to_dsp(q) DSP.new(Node.new(type: NodeType::SVF_LP, inputs: [freq.node, q.node])) end |
.svf_ls(freq, q, gain) ⇒ Object
363 364 365 366 367 368 |
# File 'lib/ruby2faust/dsl.rb', line 363 def svf_ls(freq, q, gain) freq = to_dsp(freq) q = to_dsp(q) gain = to_dsp(gain) DSP.new(Node.new(type: NodeType::SVF_LS, inputs: [freq.node, q.node, gain.node])) end |
.svf_notch(freq, q) ⇒ Object
344 345 346 347 348 |
# File 'lib/ruby2faust/dsl.rb', line 344 def svf_notch(freq, q) freq = to_dsp(freq) q = to_dsp(q) DSP.new(Node.new(type: NodeType::SVF_NOTCH, inputs: [freq.node, q.node])) end |
.svfLowShelf(freq, q, gain = 1) ⇒ Object
Convenience alias for svf_ls (low shelf)
378 379 380 |
# File 'lib/ruby2faust/dsl.rb', line 378 def svfLowShelf(freq, q, gain = 1) svf_ls(freq, q, gain) end |
.tan_ ⇒ Object
651 652 653 |
# File 'lib/ruby2faust/dsl.rb', line 651 def tan_ DSP.new(Node.new(type: NodeType::TAN)) end |
.tanh_ ⇒ Object
655 656 657 |
# File 'lib/ruby2faust/dsl.rb', line 655 def tanh_ DSP.new(Node.new(type: NodeType::TANH)) end |
.tau2pole(tau) ⇒ Object
757 758 759 760 |
# File 'lib/ruby2faust/dsl.rb', line 757 def tau2pole(tau) tau = to_dsp(tau) DSP.new(Node.new(type: NodeType::TAU2POLE, inputs: [tau.node])) end |
.tempo ⇒ Object
1101 1102 1103 |
# File 'lib/ruby2faust/dsl.rb', line 1101 def tempo DSP.new(Node.new(type: NodeType::TEMPO)) end |
.tf1(b0, b1, a1) ⇒ Object
448 449 450 451 452 453 |
# File 'lib/ruby2faust/dsl.rb', line 448 def tf1(b0, b1, a1) b0 = to_dsp(b0) b1 = to_dsp(b1) a1 = to_dsp(a1) DSP.new(Node.new(type: NodeType::TF1, inputs: [b0.node, b1.node, a1.node])) end |
.tf1s(b0, b1, a1) ⇒ Object
464 465 466 467 468 469 |
# File 'lib/ruby2faust/dsl.rb', line 464 def tf1s(b0, b1, a1) b0 = to_dsp(b0) b1 = to_dsp(b1) a1 = to_dsp(a1) DSP.new(Node.new(type: NodeType::TF1S, inputs: [b0.node, b1.node, a1.node])) end |
.tf2(b0, b1, b2, a1, a2) ⇒ Object
455 456 457 458 459 460 461 462 |
# File 'lib/ruby2faust/dsl.rb', line 455 def tf2(b0, b1, b2, a1, a2) b0 = to_dsp(b0) b1 = to_dsp(b1) b2 = to_dsp(b2) a1 = to_dsp(a1) a2 = to_dsp(a2) DSP.new(Node.new(type: NodeType::TF2, inputs: [b0.node, b1.node, b2.node, a1.node, a2.node])) end |
.tf2s(b0, b1, b2, a1, a2) ⇒ Object
471 472 473 474 475 476 477 478 |
# File 'lib/ruby2faust/dsl.rb', line 471 def tf2s(b0, b1, b2, a1, a2) b0 = to_dsp(b0) b1 = to_dsp(b1) b2 = to_dsp(b2) a1 = to_dsp(a1) a2 = to_dsp(a2) DSP.new(Node.new(type: NodeType::TF2S, inputs: [b0.node, b1.node, b2.node, a1.node, a2.node])) end |
.tgroup(name, content = nil, &block) ⇒ Object
924 925 926 927 928 929 |
# File 'lib/ruby2faust/dsl.rb', line 924 def tgroup(name, content = nil, &block) content = block.call if block_given? raise ArgumentError, "tgroup requires content or a block" if content.nil? content = to_dsp(content) DSP.new(Node.new(type: NodeType::TGROUP, args: [name], inputs: [content.node], channels: content.node.channels)) end |
.to_dsp(value) ⇒ Object
176 177 178 179 180 181 182 183 184 |
# File 'lib/ruby2faust/dsl.rb', line 176 def to_dsp(value) case value when DSP then value when Numeric then literal(value.to_s) when String then literal(value) when Symbol then literal(value.to_s) else raise ArgumentError, "Cannot convert #{value.class} to DSP" end end |
.transpose(w, x, s) ⇒ Object
1219 1220 1221 |
# File 'lib/ruby2faust/dsl.rb', line 1219 def transpose(w, x, s) DSP.new(Node.new(type: NodeType::TRANSPOSE, args: [w, x, s])) end |
.triangle(freq = wire) ⇒ Object
216 217 218 219 |
# File 'lib/ruby2faust/dsl.rb', line 216 def triangle(freq = wire) freq = to_dsp(freq) DSP.new(Node.new(type: NodeType::TRIANGLE, inputs: [freq.node])) end |
.vgroup(name, content = nil, &block) ⇒ Object
917 918 919 920 921 922 |
# File 'lib/ruby2faust/dsl.rb', line 917 def vgroup(name, content = nil, &block) content = block.call if block_given? raise ArgumentError, "vgroup requires content or a block" if content.nil? content = to_dsp(content) DSP.new(Node.new(type: NodeType::VGROUP, args: [name], inputs: [content.node], channels: content.node.channels)) end |
.vocoder(bands, range) ⇒ Object
1251 1252 1253 |
# File 'lib/ruby2faust/dsl.rb', line 1251 def vocoder(bands, range) DSP.new(Node.new(type: NodeType::VOCODER, args: [bands, range])) end |
.vslider(name, init:, min:, max:, step: 0.01) ⇒ Object
894 895 896 |
# File 'lib/ruby2faust/dsl.rb', line 894 def (name, init:, min:, max:, step: 0.01) DSP.new(Node.new(type: NodeType::VSLIDER, args: [name, init, min, max, step])) end |
.wah4(fr) ⇒ Object
1239 1240 1241 |
# File 'lib/ruby2faust/dsl.rb', line 1239 def wah4(fr) DSP.new(Node.new(type: NodeType::WAH4, args: [fr])) end |
.waveform(*values) ⇒ DSP
Waveform constant table: waveformv2, …
1032 1033 1034 |
# File 'lib/ruby2faust/dsl.rb', line 1032 def waveform(*values) DSP.new(Node.new(type: NodeType::WAVEFORM, args: values)) end |
.wire ⇒ Object
UTILITY
1067 1068 1069 |
# File 'lib/ruby2faust/dsl.rb', line 1067 def wire DSP.new(Node.new(type: NodeType::WIRE)) end |
.zita_rev(rdel, f1, f2, t60dc, t60m, fsmax) ⇒ Object
840 841 842 |
# File 'lib/ruby2faust/dsl.rb', line 840 def zita_rev(rdel, f1, f2, t60dc, t60m, fsmax) DSP.new(Node.new(type: NodeType::ZITA_REV, args: [rdel, f1, f2, t60dc, t60m, fsmax], channels: 2)) end |