fbpx
Skip to main content

MIDI Forum

I am programming an...
 
Notifications
Clear all

I am programming an Android Studio keyboard with java, can you give me some hints?

3 Posts
2 Users
0 Reactions
14.2 K Views
Carlo
Posts: 2
New Member
Topic starter
 

Hi everyone, i'm a programming college student from Italy and i need help for a project that involves midi.
The thing: I created a midi keyboard using java and i developed it on android studio, the keyboard works well and i can easily play that keyboard without any issue.
The problem: I now am trying to record what i play on the keyboard on some kind of midi file but i have no clue on where to start to do this part.

What i would like to do is: the user play a note or a melody on the midi keyboard, then when he plays "record" the midi are written in a file that can be riproduced as an audio when played, is that possible, do you know anyone that managed to to this already? Thanks in advance for your answers.

 
Posted : 29/06/2020 1:53 am
Jonas
Posts: 207
Reputable Member
 

I guess you send some signal/command when the the virtual keyboard pressed and released?
And Java must have some sort of timer/clock. Isn't it simplest for a virtual keyboard, that just write the integer notevalue into a two dimensional array together with the clock timestamp after "rec" pressed and notes start to be pressed.and released. You could use 0-127 for pressed and 128-255 for released notes.
And then save these to a simple textfile?

I guess since you use a virtual keyboard there really is no other information to save or?
At playup you just read in file again to array, and from it generate/calculate a time difference array between notes. This differences between timed events is then used in a thread that sleeps x milliseconds and then send the next array element command to playup or release next note in array?

JT

"Or do i missunderstand you is there a hardware keyboard connected over midi? That play up tonegenerator or samples on computer?"

 
Posted : 29/06/2020 2:43 am
Carlo
Posts: 2
New Member
Topic starter
 

Ok i didin't think about that but i believe that it's a possible solution, i'll now try to implement this idea that seems kinda easy.

btw it's a virtual keyboard, it uses simple buttons note-shaped and for the rest you guesset right

 
Posted : 29/06/2020 3:34 am
Share: