File: bowedOsc.dsp

package info (click to toggle)
faust 2.81.10%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 431,496 kB
  • sloc: cpp: 283,941; ansic: 116,215; javascript: 18,529; sh: 14,356; vhdl: 14,052; java: 5,900; python: 5,091; objc: 3,852; makefile: 2,725; cs: 1,672; lisp: 1,146; ruby: 954; yacc: 586; xml: 471; lex: 247; awk: 111; tcl: 26
file content (65 lines) | stat: -rw-r--r-- 1,567 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
declare name    "Bowed Oscillator";
declare author  "James Leonard";
declare date    "April 2020";

/* ========= DESCRITPION =============

Friction-based interaction with a simple oscillator => cool squeaky sounds.
    - inputs: position control of the "bowing" mass
    - outputs: oscillator position.
    - controls: none.

Note: the "type" parameter changes the way the friction interaction is calculated
(set to 0 for piecewise linear function or 1 for friction à-la-Bilbao).
*/

import("stdfaust.lib");

in1 = hslider("Bow Position", 0, 0, 100, 0.001):si.smoo:si.smoo:si.smoo; 	//Need very smooth position data here !

OutGain = 20;

type = 0;

model = (
	mi.oscil(1., 0.1, 0.0003, 0, 0., 0.),
	mi.posInput(1.):
	RoutingMassToLink :
	mi.nlBow(1.2, 0.001, type, 0., 1.),
	par(i, nbOut, _):
	RoutingLinkToMass
)~par(i, nbMass, _):
par(i, nbMass, !), par(i, nbOut , _)
with{
	RoutingMassToLink(m0, m1) = /* routed positions */ m0, m1, /* outputs */ m0;
	RoutingLinkToMass(l0_f1, l0_f2, p_out1) = /* routed forces  */ l0_f1, l0_f2, /* pass-through */ p_out1;
	nbMass = 2;
	nbOut = 1;
};
process = in1 : model:*(OutGain);


/*
========= MIMS SCRIPT USED FOR MODEL GENERATION =============

# MIMS script file
# Script author: James Leonard

# parameter to switch how the
# bowing interaction is calculated
@type param 0

# Integrated harmonic oscillator 
@o osc 1. 0.1 0.0003 0. 0.

# Position input, controlled by audio signal
@in1 posInput 1.

@b nlBow @o @in1 1.2 0.001 type

# Add position output from the oscillator
@out1 posOutput @o

# end of MIMS script

*/