This repository was archived by the owner on Mar 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsynth.ck
77 lines (60 loc) · 1.72 KB
/
synth.ck
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
66
67
68
69
70
71
72
73
74
75
76
77
////////////////////////////////////////////////////////////
// Final Project
// Synth Module
////////////////////////////////////////////////////////////
// Slork 2012
// Mayank Sanganeria, Jiffer Harriman, Hunter McCurry
////////////////////////////////////////////////////////////
// synth patch:
//Impulse i => LPF f => JCRev r => dac;
SndBuf buf => LPF f => JCRev r => dac;
//"/Users/slork/slork/groups/2012/mayank-jiffer-hunter/sounds/" => string path;
"sounds/" => string path;
buf.pos(buf.samples());
.05 => r.mix;
10 => f.Q;
OscRecv listener;
Config.node_to_synth_port => listener.port;
listener.listen();
// sprok me to make sound
fun void make_sound(int file_num, float play_rate, float filter_freq){
<<<"playing sound">>>;
path + file_num + ".wav" => buf.read;
1 => buf.rate;
10000 => f.freq;
if (buf.rate() < 0)
buf.pos(buf.samples());
else
buf.pos(0);
}
// receive play sound cues
fun void listen_for_cue()
{
// create an address in the receiver, store in new variable
listener.event( Config.osc_message_node_to_synth(), Config.osc_message_node_to_synth_data() ) @=> OscEvent play;
<<<"cue">>>;
// infinite event loop
while ( true )
{
// wait for event to arrive
play => now;
<<<"cue to play">>>;
int file_num;
float play_rate;
float filter_freq;
while( play.nextMsg() != 0 )
{
// get values
play.getInt() => file_num;
play.getFloat() => play_rate;
play.getFloat() => filter_freq;
}
spork ~ make_sound(file_num, play_rate, filter_freq);
}
}
spork ~ listen_for_cue();
// loop forever
while(1)
{
1000::week => now;
}