Macro for all notes in chord

Hello list,

I recorded the attached macro, which should do the following:

  • select all notes in the chord
  • turn alpha channel into 0

This works when executing by hand. But when recalling the macro, it only changes the note of the chord that was selected, although I do see all notes being selected. Any suggestions regarding running macros on chords?
It seems that the same happens with other operations.

Best,
jmmmp
usermacro.lua (247 Bytes)

1 Like

Hi João, what is it you’re wanting to achieve by making noteheads transparent? We tend to ask users what their desired end result is rather than focusing necessarily on one specific method as there might be other ways of achieving it.

For example, if you don’t want to show noteheads, you can create a noteheadless notehead set. If you want to show gaps in the staff, you could instead change the note spacing.

Hi. The purpose is to hide the chords completely (for which I couldn’t find a simple option). When I searched this topic some months ago I noticed that there were some issues when creating a headless notehead set, which I remember faintly:

  • back then I messed up the default notehead (of course it comes from my inexperience)
  • the spacing didn’t work except when using a specific slot which I forgot.
    So to make it faster, I thought to use the easiest process for now and later will try to document this throroughly.

But this doesn’t change the main question: I just tested and indeed it seems that indeed the macro works in chords to change the notehead type. But then remain the leger lines and accidentals visible, except for the first selected note.

I’m not well-versed in recording macros, I’m afraid, but I would strongly recommend looking at the more robust method of hiding notes using a noteheadless notehead set.

The trick (as I mentioned in the post I linked, which comes from other users’ advice) is to add text to the notehead that consists of several Spaces - to ensure you can still select the notehead once you’ve changed it - and to make sure you’re not editing a notehead used in other sets. Creating a brand new notehead set and adding a new notehead (and removing the default black notehead) should be sufficient.

Or, if you’re hiding chords that you want to hear in playback but don’t want to appear in the music anywhere, why not write them on a staff that you hide using manual staff visibility?

As for ledger lines and accidentals - these are separate from the notehead, and have respective properties (links here for ledger lines and here for accidentals).

If you find yourself using the Alpha 0 trick often (I do too), you can make a keycommand for it, by pasting the macro into the kGlobal context of your keycommands file. It should end up like this, with whatever you choose for a shortcut of course:

As you have discovered this won’t hide accidentals, but there already is a “Toggle Accidental Visibility” keycommand option you can use. Depending on what it is exactly you are trying to do, it might be easier to have a chord playback staff that is hidden in the score. You wouldn’t need to bother with hiding everything, just hide the whole staff. I frequently do drum parts this way so I can have one drum staff for notation, and one for playback which isn’t seen.