|
Post by NightMachines on Jan 6, 2019 14:44:35 GMT
EDIT: SUCCESS! Check my post below ---- original first post ---- I’ve been dabbling in video synthesis recently and needed something easier and more rewarding to do for the weekend, than straight up shader programming, which I still have no clue about So I got the Lumen macOS virtual analog video synth, reminding me of my analog video bending days a few years ago. Unfortunately it is not audio-reactive (yet?), but it can be freely controlled via MIDI CC. You know where this is going ... I checked my DIY drawer* and found a Teensy 2.0++ that I had bought years ago, the one accepting 0-5V analog inputs, which apparently is super easy to add USB MIDI functionality to. Of course I never did anything with that thing and it now turned out that I had bought a counterfeit unit that doesn’t work Luckily, I also found an Arduino Uno, which doesn’t support USB MIDI, but DIN MIDI is easy to implement with just two 220 Ohm resistors. There are lots of Arduino MIDI tutorials out there, so writing the rather simple functionality of reading an analog input voltage and sending out appropriate MIDI CC data was quick and easy. Here’s a first test with the Arduino Uno already powered from the AE Modular’s internal 5V bus, receiving three CV signals and sending out DIN MIDI CC to my MacBook Pro running Lumen, displayed via a tiny LED projector: http://instagr.am/p/BsS9jyCI27D Here’s the Arduino code from the test (works, but needs some tweaking maybe): void setup() { // Set MIDI baud rate: Serial.begin(31250);
// not sure if I need this: pinMode(A0, INPUT_PULLUP); pinMode(A1, INPUT_PULLUP); pinMode(A2, INPUT_PULLUP); pinMode(A3, INPUT_PULLUP); pinMode(A4, INPUT_PULLUP); pinMode(A5, INPUT_PULLUP); }
const int cvInputs = 6; // how many analog inputs are used int cvLevels[cvInputs] = {0, 0, 0, 0, 0, 0}; int analogInputs[cvInputs] = {A0, A1, A2, A3, A4, A5}; // analog inputs int midiChannel = 0; // MIDI channels 0-15 are 1-16 int midiCCnumbers[cvInputs] = {10, 11, 12, 13, 14, 15}; // define CC# for each CV input int midiCCvalues[cvInputs] = {0, 0, 0, 0, 0, 0};
void loop() { for (int i = 0; i < cvInputs; i++) { cvLevels[i] = floor(analogRead(analogInputs[i])/8); // convert 10 bit analog input to 7 bit MIDI range // if cv has changed, update cv input value and send new midi cc value if (cvLevels[i] != midiCCvalues[i]) { midiCCvalues[i] = cvLevels[i]; sendCC(midiChannel, midiCCnumbers[i], midiCCvalues[i]); delay(50); // need to experiment with this delay some more, 50 is probably too long } } }
void sendCC(uint8_t channel, uint8_t control, uint8_t value) { Serial.write(0xB0 | (channel & 0xf)); Serial.write(control & 0x7f); Serial.write(value & 0x7f); }
And some general notes on the MIDI connection: I’ve ordered a genuine Teensy 2.0++ now, as well as a bunch of Arduino Pro Micros, so that I can build a proper AE Modular module in 1U, that supports both DIN MIDI (using a 3.5mm to DIN MIDI converter) and USB MIDI. * I mentioned my DIY drawer a few times already on this forum. As you can imagine, there has been a time when I had really lots of things in my head that I wanted to build. Even though my DIY and coding knowledge was (and is) rudimentary, I ordered various components, but apart from the Axoloti, projects never got far. Why? Because I was trying to build for Eurorack and it just occurred to me now that this was what made me fail. Having to work around the -12V to +12V power specs was too much for this electronics newbie. It is completely different now with the AE Modular, with its 0-5V range. I’m extremely happy and satisfied, as I finally can build stuff that works, without spending too many hours on projects (other adult commitments, you know).
|
|
|
Post by thetechnobear on Jan 6, 2019 20:00:31 GMT
looks fun....
i agree the 0-5v range i find really liberating, makes things easy to work on... (and I worry with my eurorack that a diy module might damage another expense module, or psu... no worries on the AE front on that)
your 'counterfeit' teensy, i had a similar issue with one of my arduino nanos, but a bit of searching online revealed instructions on how to get it working. (primarily using a different firmware boot loader)
usb midi - yeah, ive been thinking about this too... unfortunately the arduino nano i used for ardmod does not support this over its usb connector, so need to think what to use.... ive got an esp32 which im quite keen to give a try... and ive got a few dac chips in my 'diy draw' , so that could allow for more midi cv channels. (I really want to have multiple gate/cv and perhaps some cc -> cv as well)
|
|
|
Post by NightMachines on Jan 7, 2019 20:44:20 GMT
usb midi - yeah, ive been thinking about this too... unfortunately the arduino nano i used for ardmod does not support this over its usb connector, so need to think what to use.... I just received the Arduino Pro Micros (7€ a piece) and they’re tiiiny! They don’t have any DACs though, only nine ADCs. I already quickly tested CV to USB MIDI and it works! Yay! Hopefully I have time to solder everything together in a 1U module tomorrow evening
|
|
|
Post by thetechnobear on Jan 8, 2019 11:12:30 GMT
yeah theres quite a lot of options these days...
Im always after 5v, as many ADC as possible and DACs ... seems DACs are very limited, most provide at most 2. (also watch for their resolution) always keeping my eye out for new options, but currently seems externals DACs are the way forward.
(interesting that the arduino pro micro has both a 3.3v and 5v alternative, thats cool ... always disappointed when I come across 3.3v board, as the extra stepping up/down is a pain)
|
|
|
Post by NightMachines on Jan 8, 2019 19:28:44 GMT
Aaaaand I built it! Trying to cram this into 1U was a challenge at first and I almost threw the Arduino Pro Micro (5V/16MHz) away after a first attempt, which ended up not fitting properly. But I managed to desolder everything and get it done more cleanly. Phew! I'm still waiting for a short micro USB extension lead to arrive, which I will plug into the Arduino's USB port and then feed it out to the front panel through the cut-away top right corner. The 3.5mm TRS socket is for the DIN MIDI adapter (see first post) and then there are 12 AE Modular sockets: 9 analog inputs, 2 digital inputs (not used at the moment in my code) and one ground output (had a socket too much and the ground wire was close ). The AE Modular's 5V bus is connected to the regulated RAW input of the Pro Micro, which is a little low, but so far it seems to work. 6V or more would be better according to the specs. I needed to use the RAW input though, because I also want to use the module with the USB port connected for DIN and/or USB MIDI. There is also an unregulated VCC input on the Arduino, expecting a straight 5V, but this won't work together with a USB plug attached. Here's the updated code for the Arduino Pro Micro: #include <pitchToFrequency.h> #include <pitchToNote.h> #include <frequencyToNote.h> #include <MIDIUSB.h>
// 2019-01-07 AE Modular CV to MIDI CC Module by The Tuesday Night Machines
void setup() { // Set MIDI baud rate: Serial1.begin(31250); //for Arduino Pro Micro it has to be "Serial1", whereas for the Uno (and others?) it's just "Serial"
// don't know if the following instructions are actually needed pinMode(A0, INPUT_PULLUP); pinMode(A1, INPUT_PULLUP); pinMode(A2, INPUT_PULLUP); pinMode(A3, INPUT_PULLUP); pinMode(A6, INPUT_PULLUP); pinMode(A7, INPUT_PULLUP); pinMode(A8, INPUT_PULLUP); pinMode(A9, INPUT_PULLUP); }
const int cvInputs = 9; // number ob analog inputs int cvLevels[cvInputs] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; // this stores the current CV levels
int analogInputs[cvInputs] = {A0, A1, A2, A3, A6, A7, A8, A9, A10}; // Arduino Pro Micro has those nine analog pins
int midiChannel = 0; // 0-15 here are channels 1-16
int midiCCnumbers[cvInputs] = {10, 11, 12, 13, 14, 15, 16, 17, 18}; // MIDI CC# you want to send int midiCCvalues[cvInputs] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; // // this stores the previously sent CC values
void loop() { for (int i = 0; i < cvInputs; i++) { cvLevels[i] = floor(analogRead(analogInputs[i])/8); // convert 10 bit analog input to 7 bit MIDI range // if cv has changed, update cv input value and send new midi cc value if (cvLevels[i] != midiCCvalues[i]) { midiCCvalues[i] = cvLevels[i]; dinCC(midiChannel, midiCCnumbers[i], midiCCvalues[i]); // send DIN MIDI CC usbCC(midiChannel, midiCCnumbers[i], midiCCvalues[i]); // send USB MIDI CC delay(10); // wait 10ms so that noisy inputs don't overload the MIDI signal } }
}
// send USB MIDI CC void usbCC(byte channel, byte control, byte value) { midiEventPacket_t event = {0x0B, 0xB0 | channel, control, value}; MidiUSB.sendMIDI(event); MidiUSB.flush(); // always send USB MIDI data right away and don't wait to package it up }
// send DIN MIDI CC void dinCC(uint8_t channel, uint8_t control, uint8_t value) { Serial1.write(0xB0 | (channel & 0xf)); Serial1.write(control & 0x7f); Serial1.write(value & 0x7f); }
|
|
|
Post by NightMachines on Jan 8, 2019 21:01:15 GMT
And here it is hooked up to the AE Modular system, sending CC data through DIN MIDI to sync the Lumen video synth on the MacBook Pro again. I love it http://instagram.com/p/BsYzv9NIb5T
|
|
|
Post by NightMachines on Jan 9, 2019 18:09:11 GMT
The USB extensions have arrived. Had to cut down one of the plugs, but I already expected that. Seemed to work fine, so off it went into the rack. I’ll have to check and label the input sockets now, draw some other sharpie art on the front panel and then this project is done.
|
|
|
Post by luxasw666 on Jun 11, 2019 15:58:32 GMT
Amazing! i was looking for a cv to midi convertor, i want to get data from a analog synth and get it in openFrameworks. It's seem simple but i'm a little confuse about the connections do you a schematic of the project?
Thanks!
|
|
|
Post by gorkulus on Jun 14, 2019 0:29:50 GMT
This is awesome! Would love to see it going the other way (CCs to CV) also.
This is a tangent, but this has me wondering if there are any DIY modular video synthesis systems out there that would be compatible with AE. Anyone know?
|
|
droffset
New Member
I use the name Polygoon on Discord
Posts: 13
|
Post by droffset on Jun 14, 2019 14:54:12 GMT
This is really cool, looking forward to trying it!
|
|
bahm
Full Member
Posts: 154
|
Post by bahm on Jun 15, 2019 3:26:21 GMT
I like that visualisation too... Really cool. Have seen something similar as a eurorack module, even with moving sprites.
|
|
|
Post by NightMachines on Jun 16, 2019 14:33:17 GMT
Amazing! i was looking for a cv to midi convertor, i want to get data from a analog synth and get it in openFrameworks. It's seem simple but i'm a little confuse about the connections do you a schematic of the project? Thanks! Hi I don’t have any schematics, but I really just connected the CV input sockets to the Arduino’s analog input pins and then used the USB port and TX pin for MIDI output. It would be a good idea though, to pull the Arduino’s analog input pins down using a 100k resistor to ground, to avoid floating inputs.
|
|
|
Post by NightMachines on Jun 16, 2019 14:34:33 GMT
Would love to see it going the other way (CCs to CV) also. Me too! It wouldn’t be difficult to implement, however analog output pins are scarce on Arduino’s unfortunately, whereas analog inputs are plentiful.
|
|
|
Post by gorkulus on Jun 18, 2019 21:18:30 GMT
Would love to see it going the other way (CCs to CV) also. Me too! It wouldn’t be difficult to implement, however analog output pins are scarce on Arduino’s unfortunately, whereas analog inputs are plentiful. I was thinking about this and wondering how simple or easy it would be. Can you just go straight out of PWM outs on an Arduino to generate voltages? Is the PWM fast enough that it doesn't matter? Or does the voltage need to be smoothed / averaged somehow?
|
|
anton
New Member
Posts: 29
|
Post by anton on Sept 4, 2019 20:19:24 GMT
First of all, many thanks, NightMachines! I've assembled the board, it works right out of the box. A friend of mine, who has good experience in arduino coding and prototyping, advised me to use 10k pull-down resistors on the inputs. However, the outputting midi ccs seem to be a bit jerky. I think, I'll try 100k tomorrow. Could you please tell me: may I connect ae's bus +5v to arduino's raw input together with the usb? Both supply power, won't I ruin the board this way?
|
|
|
Post by NightMachines on Sept 6, 2019 13:40:33 GMT
First of all, many thanks, NightMachines! I've assembled the board, it works right out of the box. A friend of mine, who has good experience in arduino coding and prototyping, advised me to use 10k pull-down resistors on the inputs. However, the outputting midi ccs seem to be a bit jerky. I think, I'll try 100k tomorrow. Could you please tell me: may I connect ae's bus +5v to arduino's raw input together with the usb? Both supply power, won't I ruin the board this way? So cool that you built it I usually use 100k pulldown resistors which was recommended to me by Robert a while ago. If the CC values are jerky without any CV input patched in, you could maybe smooth them in software too. As far as I remember (and as i wrote above), the RAW input is regulated and can be used with the USB port together. Maybe google that real quick again to be sure, but I think that’s how it was
|
|
anton
New Member
Posts: 29
|
Post by anton on Sept 6, 2019 14:01:46 GMT
First of all, many thanks, NightMachines! I've assembled the board, it works right out of the box. A friend of mine, who has good experience in arduino coding and prototyping, advised me to use 10k pull-down resistors on the inputs. However, the outputting midi ccs seem to be a bit jerky. I think, I'll try 100k tomorrow. Could you please tell me: may I connect ae's bus +5v to arduino's raw input together with the usb? Both supply power, won't I ruin the board this way? So cool that you built it I usually use 100k pulldown resistors which was recommended to me by Robert a while ago. If the CC values are jerky without any CV input patched in, you could maybe smooth them in software too. As far as I remember (and as i wrote above), the RAW input is regulated and can be used with the USB port together. Maybe google that real quick again to be sure, but I think that’s how it was Thanks!) That's the first Arduino module I've ever assembled!) Yes, I tried to add a 100k resistor to several inputs one by one and noticed no visual difference between 10k and 110k (10+100) on the scope. Anyway, I easily smooth the noises in Audiomulch software. I'll solder an indicator LED to the TX output and provide some photos). BTW, how can I minimize the ADC delay? Maybe I'll try to change 10ms for some lower meaning in the code?
|
|
|
Post by NightMachines on Sept 6, 2019 19:37:07 GMT
Thanks!) That's the first Arduino module I've ever assembled!) Yes, I tried to add a 100k resistor to several inputs one by one and noticed no visual difference between 10k and 110k (10+100) on the scope. Anyway, I easily smooth the noises in Audiomulch software. I'll solder an indicator LED to the TX output and provide some photos). BTW, how can I minimize the ADC delay? Maybe I'll try to change 10ms for some lower meaning in the code? Yeah, the 10ms delay is just a quick and lazy hack. I’m sure you can lower that considerably or create a better way of smoothing or filtering the inputs and outputs
|
|
|
Post by lukylutte on Sept 16, 2019 9:30:01 GMT
Don't have the sufficient knowledge yet. But I'd think by modding the program it could be use to control my 856 for ZELLERSASN? Have been trying with different midi controller but directly from the Ae would be nice! I just want/need random changes so I don't have to constantly tweak it. I think that might do the trick but I got a lot of reading to understand this before even trying... Definitely will try...
|
|
jokke
New Member
Posts: 1
|
Post by jokke on Jun 3, 2020 10:27:53 GMT
Mmm.. Tried it.. Not getting a midi signal.. TX is flashing when changing analog input. I'm just not getting midi data into my pc.. Don't really know where to look. (arduino newbie)
I also tried to change voltage reference and data wires, if I might switched them.. But to no avail. Any ideas? Looking further in the meantime
Edit: Just tried it with an uno instead of nano.. This works fine! What's the difference though? I changed the analog inputs.. didn't have any compiling errors. Did I choose the wrong output? TX1, right? I chose the nano, because it's smaller and has more analog inputs... But if it doesn't work, I'll use the uno.
|
|
namke
wonkystuff
electronics and sound, what's not to like?!
Posts: 690
|
Post by namke on Jun 3, 2020 13:50:38 GMT
Mmm.. Tried it.. Not getting a midi signal.. TX is flashing when changing analog input. I'm just not getting midi data into my pc.. Don't really know where to look. (arduino newbie) I also tried to change voltage reference and data wires, if I might switched them.. But to no avail. Any ideas? Looking further in the meantime Edit: Just tried it with an uno instead of nano.. This works fine! What's the difference though? I changed the analog inputs.. didn't have any compiling errors. Did I choose the wrong output? TX1, right? I chose the nano, because it's smaller and has more analog inputs... But if it doesn't work, I'll use the uno. It might be that the nano is running at a different clock speed IIRC the uno runs at 8MHz, whilst the nano runs at 16, so it *might* be that the serial data is coming out at twice the rate. This may be configurable in the sketch…
|
|
|
Post by NightMachines on Jun 4, 2020 20:22:36 GMT
Mmm.. Tried it.. Not getting a midi signal.. TX is flashing when changing analog input. I'm just not getting midi data into my pc.. Don't really know where to look. (arduino newbie) I also tried to change voltage reference and data wires, if I might switched them.. But to no avail. Any ideas? Looking further in the meantime Edit: Just tried it with an uno instead of nano.. This works fine! What's the difference though? I changed the analog inputs.. didn't have any compiling errors. Did I choose the wrong output? TX1, right? I chose the nano, because it's smaller and has more analog inputs... But if it doesn't work, I'll use the uno. What kind of Nano are you using? Is it an “original” one? I’ve had issues with bootleg Arduinos/Teensies. As far as I know, current Nano versions should be pretty identical to the Uno apart from the number of I/O pins. Do other sketches work on the Nano?
|
|
|
Post by MikMo on Jun 4, 2020 20:36:56 GMT
I had some problems with loading Arduino sketches onto Nano knockoffs after upgrading the Arduino IDE lately.
The Nano's are a couple of years old.
Two things i found that solved my problems:
I was using a library that was missing dependencies. So i deleted the library manually and added it again with the new Manage libraries feature, that check for dependencies and offers to install them along the way.
The other thing that i did was in the tools menu select the Nano board (obviously) then in the Processor menu item select Atmega328P (Old bootloader).
After that my cheap Nano's worked as expected.
But if you got the code onto the Nano, then you probably have other issues.
|
|
bert
Junior Member
Posts: 54
|
Post by bert on Jun 23, 2020 10:11:50 GMT
NightMachines Am I right in saying that the <pitchToFrequency.h>, <pitchToNote.h> and <frequencyToNote.h> includes in your code are not needed? I assume they are leftovers from an older version of the code?
Have you thought about how you would generate NOTE ON/OFF messages from 1V/oct and gate signals? Code-wise I guess this is also pretty straightforward, however you would need a pot to control the pitch offset (or otherwise resort to a 2CVTOOL to do this), wouldn't you?
|
|
|
Post by surferdargile on Apr 9, 2021 8:53:17 GMT
So cool that you built it I usually use 100k pulldown resistors which was recommended to me by Robert a while ago. If the CC values are jerky without any CV input patched in, you could maybe smooth them in software too. As far as I remember (and as i wrote above), the RAW input is regulated and can be used with the USB port together. Maybe google that real quick again to be sure, but I think that’s how it was Thanks!) That's the first Arduino module I've ever assembled!) Yes, I tried to add a 100k resistor to several inputs one by one and noticed no visual difference between 10k and 110k (10+100) on the scope. Anyway, I easily smooth the noises in Audiomulch software. I'll solder an indicator LED to the TX output and provide some photos). BTW, how can I minimize the ADC delay? Maybe I'll try to change 10ms for some lower meaning in the code? Hello I found this thread very interesant and the result is brillant NightMachines ... I've got some question trying to prepare this module. I'm actually sourcing arduino Pro Micro and it's looking that it's 18 euros from the ARduino website, and the cheaper one seems to be counterfeit. Does anyone use other than Arduino brand ? Also I have a question about "pulldown resistors" .. As i'm not keen on electronics , I'm trying to figure where I have to place the resistor .. between each pin and their Patch wire coming from Ae ? Or would it be between each pin and the ground connector of the Arduino / which is conencted to Ground bus of Ae modular ? Thanks and sorry as I beleived that pulldown resistor is, e.G between a MCU and the ground ... Thanks a lot !
|
|