Post by duddex on Dec 5, 2021 21:28:44 GMT
Inspired by the GRAINS "Midi out" module and a post from NightMachines I created a little module which converts CV input to MIDI note and velocity values.
CV is sent to IN1 and IN2 and gate to input "A". I used the Arduino MIDI library and the "Hairless MIDI<->Serial Bridge" software which is also described in the README.md of the "Midi out" module.
I didn't use the "GrainsIO" class. And I didn't use interrupts. So the code is rather simple and could probably be more elegant or efficient.
I made a short video where I sent gate and cv information from SEQ8 to the GRAINS cv-to-MIDI module:
I connected GRAINS with a USB cable to my laptop. I started VCV Rack 2 and loopMidi and the "Hairless MIDI<->Serial Bridge". You can find some more information about this on the Hairless MIDI<->Serial Bridge website.
The VCV Rack 2 patch is the default template. I just rearranged the modules to fit in one row. I used the loopMidi port as an input port. I used the "VEL" (velocity) output not as velocity information, but to change the value of the resonance of the VCV filter.
After I watched my video myself I thought that this is maybe more confusing than helpful. Let me know if you have questions or remarks.
I will upload the code to Github soon
CV is sent to IN1 and IN2 and gate to input "A". I used the Arduino MIDI library and the "Hairless MIDI<->Serial Bridge" software which is also described in the README.md of the "Midi out" module.
I didn't use the "GrainsIO" class. And I didn't use interrupts. So the code is rather simple and could probably be more elegant or efficient.
#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();
void setup() {
pinMode(A1, INPUT); // IN2 / Pot2 -> used for velocity
pinMode(A2, INPUT); // IN1 / Pot1 -> used for pitch
pinMode(A4, INPUT); // A -> used to detect gate
// Initialization as described on the "Hairless MIDI<->Serial Bridge" page
// https://projectgus.github.io/hairless-midiserial/
// (section "How do I use the Arduino MIDI Library?")
MIDI.begin();
Serial.begin(115200);
}
boolean gate = false;
boolean oldgate = false;
byte note = 0;
byte midiport = 1;
void loop() {
// Check for gate on GRAINS input "A" (Arduino Pin A4):
// "analogRead()" returns values between 0 and 1023.
// If the value is bigger than 512, this is considered as "gate on"
gate = analogRead(A4) > 512;
// React only if the state of input "A" changed
if (oldgate != gate) {
if (gate) {
// Input on IN1 is mapped to a value between 0 and 127 for MIDI note value
note = map(analogRead(A2), 0, 1023, 0, 127);
// Input on IN2 is mapped to a value between 0 and 127 for MIDI velocity value
MIDI.sendNoteOn(note, map(analogRead(A1), 0, 1023, 0, 127), midiport);
} else {
// Send noteOff for the note that was
MIDI.sendNoteOff(note, 0, midiport);
}
oldgate = gate;
}
}
I made a short video where I sent gate and cv information from SEQ8 to the GRAINS cv-to-MIDI module:
I connected GRAINS with a USB cable to my laptop. I started VCV Rack 2 and loopMidi and the "Hairless MIDI<->Serial Bridge". You can find some more information about this on the Hairless MIDI<->Serial Bridge website.
The VCV Rack 2 patch is the default template. I just rearranged the modules to fit in one row. I used the loopMidi port as an input port. I used the "VEL" (velocity) output not as velocity information, but to change the value of the resonance of the VCV filter.
After I watched my video myself I thought that this is maybe more confusing than helpful. Let me know if you have questions or remarks.
I will upload the code to Github soon