Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding animoog midi example, midi send example, midi msg fixes

  • Loading branch information...
commit e68c047c1f13f7bb720754fd2c06113fabcd15a3 1 parent 4ff8918
Michael Heuer authored
View
28 AnimoogMidi.ck
@@ -62,8 +62,9 @@ public class AnimoogMidi
35 => static int LFO_SYNC_CC;
36 => static int LFO_RATE_CC;
37 => static int LFO_SHAPE_CC;
- 38 => static int ORIGIN_X_CC;
- 39 => static int ORIGIN_Y_CC;
+ 38 => static int LFO_KB_TRIG_CC;
+ 39 => static int ORIGIN_X_CC;
+ 40 => static int ORIGIN_Y_CC;
0 => static int OFF;
64 => static int ON;
@@ -718,11 +719,28 @@ public class AnimoogMidi
lfoShape(toCC(_lfoShape));
}
+ fun void lfoKeyTriggerOn()
+ {
+ lfoKeyTrigger(ON);
+ }
+
+ fun void lfoKeyTriggerOff()
+ {
+ lfoKeyTrigger(OFF);
+ }
+
+ fun void lfoKeyTrigger(int keyTrigger)
+ {
+ ccMsg.number(LFO_KB_TRIG_CC);
+ ccMsg.value(keyTrigger);
+ out.send(ccMsg);
+ }
+
fun void originX(int originX)
{
ccMsg.number(ORIGIN_X_CC);
ccMsg.value(originX);
- out.send(ccMsg);
+ out.send(ccMsg);
}
fun void originX(float _originX)
@@ -771,8 +789,8 @@ public class AnimoogMidi
}
if (value > 1.0)
{
- return 127;
+ return 121;
}
- return (value * 127.0) $ int;
+ return (value * 121.0) $ int;
}
}
View
6 ControlChangeMidiMsg.ck
@@ -24,20 +24,22 @@ public class ControlChangeMidiMsg extends MidiMsg
{
{
// set status byte, default to channel 1
+ 0xB0 => data1;
}
fun void channel(int channel)
{
// update status byte, x in Bx
+ ((0xB & 0xf) << 4) | ((channel - 1) & 0xf) => data1;
}
fun void number(int number)
{
- // update first data byte
+ number & 0x7f => data2;
}
fun void value(int value)
{
- // update second data byte
+ value & 0x7f => data3;
}
}
View
4 MeeBlipMidi.ck
@@ -554,8 +554,8 @@ http://meeblip.com/use-one/micro-kit-assembly/
}
if (value > 1.0)
{
- return 127;
+ return 121;
}
- return (value * 127.0) $ int;
+ return (value * 121.0) $ int;
}
}
View
2  NoteOffMidiMsg.ck
@@ -24,11 +24,13 @@ public class NoteOffMidiMsg extends MidiMsg
{
{
// set status byte, default to channel 1
+ 0x80 => data1;
}
fun void channel(int channel)
{
// update status byte, x in 8x
+ ((0x8 & 0xf) << 4) | ((channel - 1) & 0xf) => data1;
}
fun void note(int note)
View
6 NoteOnMidiMsg.ck
@@ -24,20 +24,22 @@ public class NoteOnMidiMsg extends MidiMsg
{
{
// set status byte, default to channel 1
+ 0x90 => data1;
}
fun void channel(int channel)
{
// update status byte, x in 9x
+ ((0x9 & 0xf) << 4) | ((channel - 1) & 0xf) => data1;
}
fun void note(int note)
{
- // update first data byte
+ note & 0x7f => data2;
}
fun void velocity(int velocity)
{
- // update second data byte
+ velocity & 0x7f => data3;
}
}
View
116 examples/animoogMidiExample.ck
@@ -0,0 +1,116 @@
+/*
+
+ LiCK Library for ChucK.
+ Copyright (c) 2007-2012 held jointly by the individual authors.
+
+ This file is part of LiCK.
+
+ LiCK is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LiCK is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LiCK. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+// first open a network MIDI session to Animoog app on iPad/iPhone
+AnimoogMidi animoog;
+animoog.out.open(0); // or add a new connect(int) method?
+
+<<<"setting up . . .">>>;
+
+animoog.lpFilter();
+animoog.filterDrive(0.8);
+animoog.filterFreq(0.8);
+animoog.filterEnv(0.2);
+animoog.filterRes(0.3);
+
+animoog.orbitSyncOn();
+animoog.orbitRate(0.8);
+animoog.orbitX(0.2);
+animoog.orbitY(0.3);
+
+animoog.pathSyncOn();
+animoog.pathRate(0.2);
+animoog.loopingPathMode();
+
+animoog.thickCrush(0.5);
+animoog.thickDrive(0.8);
+animoog.thickDetune(0.1);
+animoog.thickUnison2();
+
+animoog.delaySyncOn();
+animoog.delayTime(1.0);
+animoog.delayFeedback(0.8);
+animoog.delayMix(0.4);
+
+animoog.volume(1.0);
+animoog.cor(1.0);
+animoog.glide(1.0);
+
+animoog.ampADSR(0.2, 0.8, 1.0, 0.0);
+animoog.filterADSR(0.4, 0.9, 0.9, 0.2);
+animoog.modADSR(0.3, 0.4, 0.4, 0.2);
+
+animoog.lfoSyncOn();
+animoog.lfoRate(0.2);
+animoog.lfoShapeRamp();
+animoog.lfoKeyTriggerOff();
+
+animoog.originX(0.5);
+animoog.originY(0.5);
+
+<<<"setup done">>>;
+
+
+2::second => now;
+
+261.6256 => float c;
+440.0 => float a;
+
+Chords.majorTriad(c, "C") @=> Chord c_maj;
+Chords.minorThirteenth(a, "A") @=> Chord a_min13;
+
+while (true)
+{
+ <<<c_maj.symbol>>>;
+
+ animoog.freq(c_maj.sample());
+ animoog.noteOn(0.8);
+ 600::ms => now;
+ animoog.noteOff(0.0);
+
+ 200::ms => now;
+
+ animoog.freq(c_maj.sample());
+ animoog.noteOn(0.8);
+ 1200::ms => now;
+ animoog.noteOff(0.0);
+
+ 200::ms => now;
+ <<<a_min13.symbol>>>;
+
+ animoog.freq(a_min13.sample());
+ animoog.noteOn(0.8);
+ 600::ms => now;
+ animoog.noteOff(0.0);
+
+ 200::ms => now;
+
+ animoog.freq(a_min13.sample());
+ animoog.noteOn(0.8);
+ 1200::ms => now;
+ animoog.noteOff(0.0);
+
+ 400::ms => now;
+
+ animoog.originX(Std.rand2f(0.4, 0.6));
+ animoog.originY(Std.rand2f(0.4, 0.6));
+}
View
83 examples/midiSendExample.ck
@@ -0,0 +1,83 @@
+/*
+
+ LiCK Library for ChucK.
+ Copyright (c) 2007-2012 held jointly by the individual authors.
+
+ This file is part of LiCK.
+
+ LiCK is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ LiCK is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LiCK. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+// requires a MIDI loopback device, such as IAC driver on OSX
+MidiIn midiIn;
+MidiMsg midiInMsg;
+
+midiIn.open(0);
+spork ~ listen();
+
+2::second => now;
+
+MidiOut midiOut;
+NoteOnMidiMsg noteOn;
+NoteOffMidiMsg noteOff;
+ControlChangeMidiMsg cc;
+
+midiOut.open(0);
+
+while (true)
+{
+ 1 => int channel;
+ //Std.rand2(1, 16) => int channel;
+ Std.rand2(45, 61) => int note;
+ Std.rand2(10, 127) => int velocity;
+ Std.rand2(1, 16) => int number;
+ Std.rand2(1, 121) => int value;
+
+ 1::second => now;
+
+ <<<"sending noteOn channel", channel, "note", note, "velocity", velocity>>>;
+ noteOn.channel(channel);
+ noteOn.note(note);
+ noteOn.velocity(velocity);
+ midiOut.send(noteOn);
+
+ 1::second => now;
+
+ <<<"sending noteOff channel", channel, "note", note, "velocity", velocity>>>;
+ noteOff.channel(channel);
+ noteOff.note(note);
+ noteOff.velocity(velocity);
+ midiOut.send(noteOff);
+
+ 1::second => now;
+
+ <<<"sending controlChange channel", channel, "number", number, "value", value>>>;
+ cc.channel(channel);
+ cc.number(number);
+ cc.value(value);
+ midiOut.send(cc);
+}
+
+fun void listen()
+{
+ while (true)
+ {
+ midiIn => now;
+ while (midiIn.recv(midiInMsg))
+ {
+ <<<midiInMsg.data1, midiInMsg.data2, midiInMsg.data3>>>;
+ }
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.