Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

play-1.js: add support for default instrument #21

Open
joaocc opened this issue Aug 31, 2017 · 4 comments
Open

play-1.js: add support for default instrument #21

joaocc opened this issue Aug 31, 2017 · 4 comments

Comments

@joaocc
Copy link

joaocc commented Aug 31, 2017

Hi,
We are trying to use the play-1.js script on an desktop app that can be used offline. One of the difficulties we are facing has to do with the dynamic download of audio files for MIDI playback.
For offline support, it means that we would have to increase the download size.

An alternative for this would be to define the concept of a user-defined default instrument.
Currently we are focused on violin, which means that most of the files (since they don't explicitly specify an instrument) end up playing as "acoustic_grand_piano".
Allowing setting the default instrument via something like "set_default_instr" could address this.

Another possible improvement would be to detect failure to load an instrument and, in that case, try to load the default instrument. From our analysis of the code, it seems that this could be easier with the 'mp3' mode, as it already has support for "onerror". This would also mean that we would have to pack fewer instruments while still being able to deal with user-defined files.

We can try to add some of this, but we fear our javascript skills are not yet on the required level to deal with play-1.js :)

Anyway, it would be great if you could give some input on this.
Thanks!

joaocc added a commit to highskillz/abc2svg that referenced this issue Aug 31, 2017
@moinejf
Copy link
Owner

moinejf commented Sep 1, 2017 via email

@joaocc
Copy link
Author

joaocc commented Sep 1, 2017

Hi,
Sorry about the multiple questions. I can split in different issues to make discussion easier if you prefer.

[1]
Regarding the default instrument, our initial driver was dealing with files that don't specify an instrument (we have about 40 of those).
In the current implementation, those files are played as "accoustic_grand_piano" (index 0).
We would like to be able to specify a different default in the app (for example, 40 or "violin" depending if we use index into the instrument table or specify the instrument by name).

[2]
This is a related but separate issue.
As of now, we can specify a stf mode of js and mp3. In any of these cases, play-1.js goes out to a server and fetches the needed sound data (either by dynamically loading a ogg-js file or by fetching individual mp3 audiofiles.
For an electron based offline app, for this approach to work, we would need to bundle all the instruments in the installer package (which would make the app even bigger).
Our intent in the pseudo-code in highskillz@e29a47d was to keep the current behaviour (search for the content in 'stu') but, if it fails (ie, the .onerror callback is called), return the audio data for the "default_instrument" (which we would make sure would be available).

[3]
On your proposals for ABC, we don't have enough understanding of the broader use of the ABC standard to be able to have a meaningful opinion. All we can say is that it seams reasonable.
On our side, we would like to keep away from relying on changing content of end-user files, and instead increase the robustness of the processing pipeline.

Thanks

@moinejf
Copy link
Owner

moinejf commented Sep 1, 2017 via email

@joaocc
Copy link
Author

joaocc commented Sep 2, 2017

Looks good. We'll give these a try.

In the meantime, if we manage to implement the "dynamic" detection of missing instruments, we will post them as PR.

Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants