Go Down

Topic: Real time midi recording (Read 3364 times) previous topic - next topic

flocked

Sep 20, 2013, 06:17 pm Last Edit: Sep 20, 2013, 06:35 pm by flocked Reason: 1
Hi,

If I want to have realtime midi recording on my arduino, should I just add a timer with e.g. 96 ā€˛ticks" per beat ? Or do I need to consider anything else? I then would create a 4x96 sized array (for one bar) and add the midi note values to each array[tick]; Is this the correct way? :)

And If I want to record several notes, let's say a maximum of 16 notes, do I really need to create 16  4x96 sized sized arrays or do I overlook something?

CrossRoads

Not getting into the method of how you capture all the data, because a MIDI controller sends out data in a continuous stream yes?
http://en.wikipedia.org/wiki/MIDI
"MIDI messages are made up of 8-bit words (commonly called bytes) that are transmitted serially at 31.25 kbaud. "

What are you going to store all this recorded data onto?
Aruino's only have limited SRAM; you've got to move that data to a big memory chip, or if there will be a lot of it, to an SD card.
Checkout fat16lib's SDfat.h library for the latter.
http://code.google.com/p/sdfatlib/
For the latter, you will have to decide how many seconds worth you want to store & size up memory accordingly.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

marco_c

I did something similar some time ago - just recording the MIDI stream coming from a keyboard and then playing it back. At the time it was to try and understand what was happening in the MIDI stream. I have attached it to the post in case it can be useful to you.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

flocked

thanks marco_c! :)

Recording the notes/midi events with a timestemp into an array seems to be the best solution. But what happens If I want to overdub the recording during playback. I could of course add the new notes+timestemp to the array, but they would be at the end of the array. I could then sort the array by timestemp after overdubbing, but this would maybe take some time. Overdubing should happen during playback without break. - Any idea how I could solve this problem?

CrossRoads

Use a PC with a real program that can do that?  You only have a little SRAM to use before you need to start adding external memory to store all the data. How long are you planning to record and then try &  add to with overdubbing?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

pab

Hi,

Finally, how did I finish the project?

I'm interested in doing something similar. Record MIDI notes in a memory (SD or SRAM) and play it later.

@Marco_c Your program performs the function of recording MIDI notes? Where do you record them?SRAM?
I just tried to compile your program and it gives me error in the library "MD_Seg7x2.h". I can not find it.

Thanks for everything,

Regards

Pablo

marco_c

#6
Aug 16, 2017, 01:24 am Last Edit: Aug 16, 2017, 01:25 am by marco_c
Seg7x2 is now an obsolete library that I wrote some time ago (the original post is from 2013!). Just turn off the DEBUG_DISP #define and all that code should vanish from the compile. I was a small library that displayed 2 digits on a 7 segment LED display, easier to use a LCD module if you want to replace it.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

pab

Really ... I'm only interested in the part of recording sound.

In your program would it be saved directly in the SRAM?
And one more thing .... I have removed everything that refers to DEBUG DISP and gives me an error when compiling:

- MIDI_Playback:83: error: 'MIDI' was not declared in this scope MIDI.begin(MIDI_CHANNEL_OMNI);
- MIDI_Playback:143: error: 'MIDI' was not declared in this scope MIDI.read();   // keep this going as fast as       possible and empty buffer all the time
- exit status 1 'MIDI' was not declared in this scope

Do you know why? Is it possible that the library I have installed in MIDI is more current and this point you have to write different?

Thank you very much for answering me!!

pab

PS: the maximum notes to record are 50. If you increase this number could you record more? Or is it the maximum that arduino memory allows?

And sorry!

marco_c

It is only saved to the memory array. You can make it as big as you like in the memory you have.

Hard to answer your other question as there is no code to see. You have probably deleted too much, including the declaration if the variable. Or you have a different library. Up to you to work out I think, from the midi.h header file that tells you which functions are declared, or some other library documentation.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

Go Up