paulrosen / abcjs

javascript for rendering abc music notation
Other
1.94k stars 285 forks source link

Feature request: support %%MIDI voice mute #945

Open revad opened 1 year ago

revad commented 1 year ago

I wrote an (unpublished) browser addon for editor.drawthedots.com that temporarily suppresses chords, repeats, and individual voices during playback. It does that by adding buttons that add/remove lines into the ABC. To mute a voice I add a '%%MIDI transpose 60' line, which is a kludge. (It also generates some unwanted network traffic initially, and a lot of logging.)

A better solution would be if I could add '%%MIDI voice mute' commands as specified here: http://abcnotation.com/wiki/abc:standard:v2.1#instrumentation_directives The full syntax is %%MIDI voice [ID] [instrument= [bank=integer]] [mute] I don't know what's involved in the optional 'instrument' argument.

You mentioned this in #220 but it's not clear if anything came of it.

paulrosen commented 1 year ago

There are two things here, I guess - first, I could support muting chords and individual voices in editor.drawthedots.com. That sounds useful and not too hard.

Second, I could support the midi command but that is a little bit of work to parse it. I'd love a pull request for that.

For not taking repeats - I don't think there is a syntax for that. I've been annoyed when composing, too. I just comment out everything but the section I'm working on.

revad commented 1 year ago

It's just muting voices I'm interested in. My browser addon can suppress chords (with %%MIDI gchordoff) and repeats (by temporarily commenting out the colons - that's what #894 was about). It adds commands to the ABC and also removes them with a set of buttons. So I can just play the accompaniment voice for example.

But there is no command I can add that will mute a voice - hence I use the '%%MIDI transpose 60' trick. I want to get rid of that. I don't want to publish the addon with that in it.

seisiuneer commented 11 months ago

In my custom version of abcjs, I created a new custom instrument called mute that has silence for samples. I then have additional code as well in the abcjs MIDI parsing routines that allows you to type:

%%MIDI program mute

for voices you want to silence.

Of course, this is absolutely not ABC 2.1 compliant, but works well within my system.