I'm trying to figure out how to save MIDI-entered chords to eeprom. the rk002 can store parameters in long term memory but I'm not sure that fits well. I've pasted a link to the parameters below. I'd planned on entering a learn-mode where I store note on/offs in some kind of array and then hopefully call that array when a certain note was sent. That doesn't seem possible though.
According to the page, there can be 32 parameters. Does storing each note as a parameter seem to be the best solution for what I want to do? Id have to somehow figure out how to differentiate one chord from another if I used parameters. then again, i could misunderstand how this is implemented. Any tips?
parameters page
. That doesn't seem possible though.
Why?
You have given little detail and I am not sure of the overall picture here.
I would have thought you could do this without a rk002. I have no idea what this device actually is, do you expect me to read the manual and work it out.
As I see it you want to trigger sending a chord when an Arduino spots you are sending a specific note. So to my mind that is simply putting an Arduino in the MIDI stream that simply passes the midi in to midi out and then when it spots a specific note number also adds a chord. Seems simple enough.
Grumpy_Mike:
Why?
because I have yet to come across or come up with a way to save an array of differentiated numbers (aka chords). However, like a good boy, I'm learning.
Grumpy_Mike:
You have given little detail and I am not sure of the overall picture here.
I would have thought you could do this without a rk002. I have no idea what this device actually is, do you expect me to read the manual and work it out.
on the contrary, I've told you exactly what I want to do : store notes in arrays as a chord group into eeprom and be able to recall them, distinctly. You don't have to know anything about the device, its a question about eeprom, as its used in the rk002 library or its use outside of that.
Grumpy_Mike:
As I see it you want to trigger sending a chord when an Arduino spots you are sending a specific note. So to my mind that is simply putting an Arduino in the MIDI stream that simply passes the midi in to midi out and then when it spots a specific note number also adds a chord. Seems simple enough.
yeah, that would be simple. I can do that. What I am having trouble with is figuring out how to do one of two things:
-
use the rk002 library parameters to store notes - I don't expect anyone to try and figure out the library. I'll have to look at it more and examples of usage before it makes sense to me.
-
use the standard eeprom library to store notes - this seems more straight fwd.
i apologize for not asking a specific question, I thought I'd get some general guidance on eeprom & arrays or how to approach it. It was a shot in the dark, lesson learned.
I've told you exactly what I want to do : store notes in arrays as a chord group into eeprom and be able to recall them, distinctly
Ok EEPROM is organised in terms of bytes, just like normal memory all you have to do is to use a structure to turn this byte array into an array of another type.
This link shows you the basics of this https://www.baldengineer.com/arduino-eeprom-stores-any-datatype.html
So an array of say thee bytes at a time, for three MIDI notes, would store each byte in consecutive address locations. So the note numbers would have an index I and stored in eeprom address A. Where A = I * 3 and the address of each of the three notes would be A+0, A+1 and A+2
So it is simply a matter of putting that calculation in a small function and you can read or write individual notes in your chord.
Like a normal array the format of it is fixed and can’t be dynamically changes. That means if you want say five notes in a chord, all array entries must have the space for five notes, if a chord had fewer then you would pad it out with zeros.
For more memory efficient ways of storing a variable amount of notes in a chord Look at a structure called a linked list.
My tutorial on arrays is here http://www.thebox.myzen.co.uk/Tutorial/Arrays.html