MUFF WIGGLER Forum Index
 FAQ & Terms of UseFAQ & Terms Of Use   Wiggler RadioMW Radio   Muff Wiggler TwitterTwitter   Support the site @ PatreonPatreon 
 SearchSearch   RegisterSign up   Log inLog in 
WIGGLING 'LITE' IN GUEST MODE

Arduino nano midi translator attempt (MidiSerial)
MUFF WIGGLER Forum Index -> Music Tech DIY  
Author Arduino nano midi translator attempt (MidiSerial)
re8et
PS: If you want the code, from now on , ask it directly to cctv.fm, as I am not the author of the working code, this posted here is just an attempt (not working). The code is written for a Vbeat IN to MG Bastl out, but could be used for many other stuff.



Hi, I'm planning to put an arduino nano and some basic circuitry into a Microgranny.
Microgranny has some space inside where there should go the battery that can fit it.
I already added an extra midi input and should also add four more mono cv input jacks and possibly a button or switch.
The Nano should get the power directly from the Microgranny board 5v, otherwise I could add a 7805 to convert th 9v input.

What I would like to do is input a cv to the nano, that should be a 0-5v dc envelope (or monotron lfo-eg) with 100k serial resistor before an opamp.
use the analog ref of the board, plus the 3,3 voltage to feed an MPC 6004 quad opamp, that should scale all cv inputs into an acceptable range for the analog pin read of the nano without risking to blow it up.
the circuit for the input is basically the same as
the one seen here https://www.muffwiggler.com/forum/viewtopic.php?t=209561&postdays=0&po storder=asc&start=0

All cv inputs should be translated to a midi cc message ranging 0-127
for to control all 8 knobs from only 4 inputs, to do that I should add possibly a button on another analog input that would switch between the first 4 midi cc and the other 4, from the same input cv's. Otherwise just 4 are fine.

the sketch itself should include a midithroughfilter for the clock so none of it goes to the midi input of the nano, I only want to send out the midi cc, the clock sync if everything works and do not overflows over other midi, and the translated midi notes out.

I have set the incoming midi notes as constants, that should trigger a midi note on event for notes 0-5 for the granny to read.

The note trigger comes from a volca beat first 6 channels midi out.

Last the Arduino should output the midi Tx to the Microgranny.


I want to thanks the Tuesday late night machine for the cv part conversion of the sketch, but It ain't be tested yet, anyone could take a look at the sketch and see if there are some blatant errors in it??

Further credit: The original idea came after the volca beat trigger arduino project idea from Filip https://www.cctv.fm/post/volca-trigger-out-modification

Tnx.

Ps. Presumably all relevant midi should get out the nano tx channel and then fed into the MG.
re8et
After a week of trials and errors, Filip from cctv.fm decoded to help< decided to help with the code. New code makes use of Temp Analog and it's compiling, whereas my merging effort was not a good one (EXPE)

For the new code I had changed what Arduino should receive from the Volca beat. Monitoring the V beat midi it seemed I had a different kind of message. (From the original Filip sketch).

So I changed some code.
the Midi noteon from 0x99 to 0x90.
and noteoff from 0x89 to 0x80.

The new code for the nano CH340 (chinese model-no usb native) is written using Midiserial.

Does anyone has an idea why Midi note on would be 0x99?
Is there a particular reason for this?

European volca vs USA-Canadian Volca midi handling??
Arduino internal midi decoding could differs from midi Ox??


Here is European Vbeat Midi Monitored through Midi OX, all ten notes in succession.
widdly
0x8n note on, where n is the channel number (0..15)
0x9n note off, where n is the channel number.

0x89 and 0x99 is using channel 10, which is the standard channel for drums.
0x80 and 0x90 are using channel 1

The channel in the second byte applies to CC's as well as most other channelized midi data.
re8et
Oh, that I did not know! Tnx

We got some overflow problems, trying to tweak the code a bit, we got lots of skipped messages on the Terminal print. I believe the timing clock is asking too much to the Nano, also polyphonic input have me worried. It's an evolving situation by now.
ixtern
I you are unsure how to implement MIDI functionality you can always study Arduino Midi Library source code:
https://github.com/FortySevenEffects/arduino_midi_library
(I have used this library in some my Arduino projects and it is really good).
Library has also very good documentation:
Documentation
re8et
ixtern wrote:
I you are unsure how to implement MIDI functionality you can always study Arduino Midi Library source code:
https://github.com/FortySevenEffects/arduino_midi_library
(I have used this library in some my Arduino projects and it is really good).
Library has also very good documentation:
Documentation


Problem here is the Nano has not hadware Serial, all is coded with MidiSerial, which I'm having a hard time find where to study material, thank you anyway.

I am dissecting the code in smaller parts now, also in the code there is not a buffer.flush, so studying that part also.

tnx.
ixtern
re8et wrote:

Problem here is the Nano has not hadware Serial, all is coded with MidiSerial, which I'm having a hard time find where to study material, thank you anyway.

I am dissecting the code in smaller parts now, also in the code there is not a buffer.flush, so studying that part also.

tnx.

Don't know what kind of Nano you have but my Nano has hardware serial (RxD/TxD) and I had used it in my Arduino MIDI projects.

BTW. It doesn't matter if you are using hardware or software serial. Application should be written such way that you isolate transport layer (serial) from application layer (MIDI). And MIDI handlers is what important and worth of studying in this library.
re8et
Terrible (good) News!

I have splitted the code in two temporarily

One part is JUSTMIDI and the other JUSTCC... a small flashback...

I have been monitoring the midi output and there was a flooding of midicc, with some midi timecode here and there, and no notes at all...

So I splitted, and skimmed the code. First to go was clock.
then all trigs out.
After the split the terminal and midiox monitor both were much more responsive on the in/out displaying of notes.
I realized thanks to midi ox that I was playing a wrong conversion for the MG to read.
the corrected lowest note now was 0x0.
took out the noteoff section because MG did not trig samples, she's monophonic, so it's good.

MG started playing the Vbeat pattern... Horrray!!!!
re8et
ixtern wrote:

Don't know what kind of Nano you have but my Nano has hardware serial (RxD/TxD) and I had used it in my Arduino MIDI projects.

BTW. It doesn't matter if you are using hardware or software serial. Application should be written such way that you isolate transport layer (serial) from application layer (MIDI). And MIDI handlers is what important and worth of studying in this library.


Midi handlers is what I think it is necessary to flush the buffer, I've been trying to implement it, without much success, while going with subtraction worked, at least for a splitted part of the code, correctly... the hard part is to know where is the floor ( available buffer bytes) before overflood hits...
re8et
re8et wrote:
Terrible (good) News!


(the TRIGONLY original code is working alone as originally written by cctv.fm)

re8et
Project completed.
The two parts of code had been merged back together, everything had been tested and works fine now.
I limited the final version to just one CC input for practicality.
Arduino get its power from the Microgranny onboard 7805.

PS: the final code is substantially different from the code posted initially.
For the full code ask Filip at www.cctv.fm.


MUFF WIGGLER Forum Index -> Music Tech DIY  
Page 1 of 1
Powered by phpBB © phpBB Group