Open jisike opened 6 years ago
I split the audio generation into small tools. For MIDI generation, just replace util/toaudio5.js by MIDI file creation.
could you please give me more detail
I think the interface in util/toaudio5.js is clear enough. You get this source, remove the code of the functions, and convert the play events to a binary MIDI stream. Then, you concatenate util/play.js, util/toaudio.js and your code, and you load the resulting file at the place of play-1.js.
I am also pulling the play events from the player in the callback get_abcmodel
.
abcplay.add(tsfirst, voice_tb)
player_model = abcplay.clear()
where abcplay is an instance of AbcPlay.
This approach has problems for me:
AbcPlay
, even if i do not really want to play. Long story short:
Would it be possible to factor out the creation of the player events from AbcPlay to either another module (e.g. AbcPlayerEvents
like AbcJSON) or to AbcMIDI
respectively Abc
(where parsing and get_abcmodel is done)
This would simplify the subsequent creation of a midi-file.
update: is it correct that such a module already exists "ToAudio"
I changed the code to the following, and it works.
var to_audio = new ToAudio()
to_audio.add(tsfirst, voice_tb)
player_model = to_audio.clear()
Am I misusing ToAudio
with this approach as it is not an official api?
As told previously, the play function has been split into toaudio (play event generation) and toaudio5 (html5 audio playing engine). The file play.js is just a wrapper around these two modules. The API is simple enough:
This permits:
Normally, the APIs should not change.
I take this as a confirmation the the approach of using ToAudio to get the player events is ok. You mentioned that you want to change the player events from an array to a float32 array.
All values in the play event array are numbers. Generating a standard array or a float32array does not change its usage.
abc2svg is the only lib that can render and playback the my multi-part abc file. is there anyway i can create a midi/hack something similar using your lib?