Added primitive midi metronome

This commit is contained in:
bombinans 2025-10-11 12:53:58 +11:00
parent fe5dd6368a
commit 40145854a5
3 changed files with 34 additions and 2 deletions

View File

@ -12,6 +12,7 @@
OSCdef.freeAll;
// fixme - buflen is derived from BPM now
~to.button('/grains/reset', 0, { | v |
if( v > 0, {
@ -47,6 +48,7 @@ OSCdef.freeAll;
~setrecord = { | track, v |
[ "record", track, v].postln();
~granulators[track].record_(v);
if(v == 0, {
~mixlevel[track] = ~granulators[track].mix;

View File

@ -9,13 +9,18 @@ Server.default.options.outDevice_("Scarlett 2i2 USB");
Server.killAll;
(
MIDIClient.init;
~midiOut = MIDIOut.newByName("Cre8audioNiftyCASE", "Cre8audioNiftyCASE").latency_(Server.default.latency);
)
(
Routine.run({
~usbinput = 2;
~usbinput1 = 2;
~usbinput2 = 3;
~bpm = 90;
~bpm = 120;
~bps = ~bpm / 60;
~beatsperbar = 4;
~buflen = ~beatsperbar / ~bps;
@ -25,7 +30,7 @@ Routine.run({
~tc = TempoClock.new(~bps);
~touchosc_ip = "192.168.0.209";
~touchosc_ip = "192.168.20.10";
("./synths.scd").loadRelative;
Granulator.init(s);
@ -38,9 +43,14 @@ Routine.run({
s.sync;
("./sequencer.scd").loadRelative;
s.sync;
("./midi_sync.scd").loadRelative;
s.sync;
"please wait for the interface to load...".postln;
~buflen.sleep;
("./interface.scd").loadRelative;
"ok go!".postln;
~setrecord.value(0, 1)
});
)
~tc

20
midi_sync.scd Normal file
View File

@ -0,0 +1,20 @@
(
p = Pbind(
\type, \midi,
\midicmd, \noteOn,
\midiout, ~midiOut,
\chan, 0,
\degree, 0,
\dur, Pseq([1/4, Rest(1/4)], inf),
\amp, 1
).play(~tc);
)