MIDI Audio:
Posted: 21 May 2018, 11:02
Here's a link to functioning MIDI, I'm yet to test it on hardware and haven't uploaded the gt1 file as of yet. I'm in the process of shoehorning the MIDI data into the roughly 10K of RAM I have left in the lower 32K page, (in this video all the MIDI data is located at 0x8000 and above). When I am finally finished with this sample I'll probably release a 32K and 64K version.
In the video you can see me messing around with the memory monitor switching between the audio channels, you can see keyL and keyH changing in response to the notes.
https://youtu.be/I9A3fj4FB7M
Initially I struggled with getting this to work, all I needed was a note on, note off and semi-accurate millisecond timer. Once I realised you can turn off individual channels by setting keyL and keyH to 0, the only difficult part left was the timing; it's achieved by constantly calling a playMidi subroutine, (as long as you call it every few milliseconds at least, the timing is accurate enough that you really can't hear any discrepancies, (although the longer songs can finish 1-2 seconds early or late).
Getting the MIDI data into a simple note on/off/delay structure was accomplished with this:
https://github.com/LenShustek/miditones
In the video you can see me messing around with the memory monitor switching between the audio channels, you can see keyL and keyH changing in response to the notes.
https://youtu.be/I9A3fj4FB7M
Initially I struggled with getting this to work, all I needed was a note on, note off and semi-accurate millisecond timer. Once I realised you can turn off individual channels by setting keyL and keyH to 0, the only difficult part left was the timing; it's achieved by constantly calling a playMidi subroutine, (as long as you call it every few milliseconds at least, the timing is accurate enough that you really can't hear any discrepancies, (although the longer songs can finish 1-2 seconds early or late).
Getting the MIDI data into a simple note on/off/delay structure was accomplished with this:
https://github.com/LenShustek/miditones