0

for an exam project i'm programming a 1 octave playable midi keayboard on phone. I managed, thank to things found here on SO, to make the keyboard work but i have no clue on what i can do to record what I'm playing. I should be able to play a melody ( record it by pressing a button, i guess) and save it on a folder as a .mp3 file. Is that possible by not using the device microphone or is it indispensable?

  • How exactly are you playing the sounds? – CL. Jun 05 '20 at 15:43
  • buttons play notes on a midi library. i followed this topic https://stackoverflow.com/questions/36193250/android-6-0-marshmallow-how-to-play-midi-notes to play one note, then i made it work for all the others –  Jun 08 '20 at 05:42
  • As far as I know, it is not possible to redirect the output of that library, or of the Android sound output. Why not saving the melody as a .mid file? – CL. Jun 08 '20 at 07:13
  • actually it's because i don't know how hard it can be, you mean that when i play i should "write" a .mid file that can be played on apps like guitarpro ? or just that i record an audio of what i'm playing then convert to a .mid file? –  Jun 08 '20 at 09:33
  • Converting an audio file to MIDI is practically impossible, and you would not be able to get it in the first place. You already have the MIDI messages; with timing information, that's exactly what a .mid file contains. – CL. Jun 08 '20 at 10:08
  • Ok, i understand, so how can i pass the midi message of what i played on my keyboard? –  Jun 09 '20 at 09:25
  • Use some library for writing .mid files. Google finds, for example, https://github.com/LeffelMania/android-midi-lib. – CL. Jun 09 '20 at 09:28

1 Answers1

0

at the end, i made it by recording a plain file with byte data where every byte is an object of tipe "record" that is called by the midi controller that plays the note, with it it's saved the duration of all the notes, so when you open the file 'recorded' by the midicontroller it pays the note you recorded with the same timing you played them first. i can share code if anyone is interested.