-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsimplemidi.sc
64 lines (53 loc) · 1.62 KB
/
simplemidi.sc
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
Quarks.gui
m = SimpleMIDIFile.read( "C:\\Users\\Tracy\\Documents\\bird.mid" );
t = m.generatePatternSeqs;
MIDIClient.init;
c = MIDIOut(0, MIDIClient.destinations.at(1).uid);
~loopMidiOutPort = MIDIOut.newByName("loopMIDI Port", "loopMIDI Port");
~loopMidiOutPort.noteOn(2);
~loopMidiOutPort.noteOff(2);
c.noteOn(2);
c.noteOff(2);
t.postln;
q = Pbind([\midinote, \dur], Pseq(t[1], 1));
q.play();
q = Pbind(\type, \midi, \midiout, c, [\midinote, \dur], Pseq(t[1], 1));
q.play();
~wrenmidi = Pbind(\type, \midi, \chan, 3, \midiout, c, [\midinote, \dur], Pseq(t[1], 1));
~wrenmidiloop = Pbind(\type, \midi, \chan, 3, \midiout, c, [\midinote, \dur], Pseq(t[1], inf));
~wrenplaying = ~wrenmidiloop.play();
~wrenplaying.stop();
~wrenmidi.play();
~wrenmidis = [~wrenmidi];
~birdmidis = [~wrenmidi];
~wren = Buffer.read(s, "C:\\wren.wav");
(
{Out.ar(0, PlayBuf.ar(1, ~wren)* 0.8)}.play;
{Out.ar(3, PlayBuf.ar(1, ~wren)* 0.8)}.play;
{Out.ar(5, PlayBuf.ar(1, ~wren)* 0.8)}.play;
)
(
SynthDef("bird", {
arg channel = 0, volume = 0.3;
var playBuf = PlayBuf.ar(1, ~wren, doneAction: Done.freeSelf);
Out.ar(channel, playBuf * volume);
}).add();
)
~wrenmidis[0].play();
Synth("bird", [\channel, 4, \volume, 0.1]);
~wrensynths = ["bird"];
~birdsynths = ["bird"];
~host = NetAddr("localhost", NetAddr.langPort);
~host.sendMsg("/bird2", 0, 0.8);
(
~responder = OSCresponder(
~host, "/bird2",
{|time, responder, message, address|
[\responder, time, message, address].postln;
message[1].postln;
Synth(~birdsynths[message[1]], message[2]);
~birdmidis[0].play();
}
).add;
)
Platform.userConfigDir.postln; // +/+ "startup.scd" is the initialization file.