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

Track/instrument naming #44

Closed
olaviinha opened this issue May 8, 2022 · 2 comments
Closed

Track/instrument naming #44

olaviinha opened this issue May 8, 2022 · 2 comments

Comments

@olaviinha
Copy link

olaviinha commented May 8, 2022

I see there are multiple references to instrument names, particularly in preprocessors.py. However, transcribed midi file is saved with all tracks unnamed. I tried to look through the code to see if names would be easy to add (e.g. as per _SLAKH_CLASS_PROGRAMS), but unfortunately the code is largely sorcery to me without proper diving.

Any of the following solutions will solve my problem at hand:
a) Only drum tracks are named drum tracks.
b) All tracks are named according to instrument.
c) Some other way to output information in the process which track numbers are drum tracks.

Anybody who's more familiar with the code, any tips on passing the instrument names to the resulting midi file? Is this doable?

@olaviinha
Copy link
Author

olaviinha commented May 9, 2022

Ok I have created a pull request for this in the Magenta note-seq repository.

Until then and in case PR is rejected, it is solvabe by simply post-processing the midi file as follows:

note_seq.sequence_proto_to_midi_file(est_ns, '/tmp/transcribed.mid')
pretty_mid = pretty_midi.PrettyMIDI('/tmp/transcribed.mid')
for inst in pretty_mid.instruments:
  inst.name = 'Drums' if inst.is_drum else pretty_midi.program_to_instrument_name(inst.program)
pretty_mid.write('/tmp/transcribed-with-instrument-names.mid')

Leaving this open as a feature request. Feel free to close if feature is assessed as unbeneficial in this repository.

@cghawthorne
Copy link

Thanks for the PR! This is now fixed by magenta/note-seq#60

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