![]() The second is the Synthesizer, which is capable of producing sounds when written to or when commanded manually via function calls. The Midi Wave exports mentioned before all work with sequences (they read midi files from disk into a Sequence) so I wanted to re-direct the Synthesizer to 'transmit' into a Sequencer 'receiver'. However, when you try to do this, you get a MidiUnavailableException, which lead me to a dead end (no one seems to have overcome this, there are several SO posts with no answers with the same problem as me). While I haven't looked at the source, the 'getMaxTransmitters' function returns 0 on a Synthesizer, leading me to believe this is route is impossible (if someone knows how to do this, please let me know).īecause of that, I decided to go the second route, which is building Midi Sequences from alda scores manually, then writing those scores to disk. ![]() I'm actually a little bit confused at the design for this system. It seems to be scheduling every note start and note end via a callback (via jsyn), and using those callbacks to call functions on the midi Synthesizer. Isn't this fragile (and can lead to timing problems?) From what I can tell, java highly recommends building a sequence if timing is important. This web page was incredibly helpful during this process, I probably couldn't have done anything without it.Įssentially all I'm doing is looping through all the events in a score, and sending corresponding notestart and noteend events (instead of registering callbacks) into a sequencer. Finally, I tell the sequencer to record what I'm transmitting, and it builds a midi sequence for me! Writing it out to a file then is fairly easy, and converting it to a wav is just one more step which should be easy (I didn't do it for now, since I was able to just launch another java process to do that for me). One of the problems with this method is that (because I didn't understand how instruments work) all the events are played with the piano. ![]() However, I think this should be pretty easy to add with a bit more playing around.Īlso because I was super crunched on time, it encodes midi's whenever it plays, to a hardcoded file, but that's not really the point of this :P. I don't know if there's another way to do this 'cleanly'. I really despise listening to audio out (since recording much be done in realtime, and it feels really hacky), so I think that midi export should be a feature in alda even if jsyn features are added (for pure midi tracks). I couldn't find any way to write jsyn out to a file, so I don't know how much luck we'll have with that. Would you like this to be developed further (because it does subvert the core internals of the alda player), or do you think there's a better way to do it? If you think it's good approach, I'll clean it up (eventually.) and make a PR with proper integration in the client/server as well (but this will probably take a while). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |