-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add abjad.VoiceNumber indicator #1135
Comments
trevorbaca
changed the title
Add abjad.VoiceNumber, abjad.OneVoice indicators
Add abjad.VoiceNumber indicator
Apr 6, 2023
trevorbaca
added a commit
that referenced
this issue
Apr 6, 2023
Set n to 1, 2, 3, 4 or none. Models LilyPond ``\voiceOne``, ``\voiceTwo``, ``\voiceThree``, ``\voiceFour``, ``\oneVoice`` commands. def make_staff(): staff = abjad.Staff() voice_1 = abjad.Voice("g'8 a' b' c''") command = abjad.VoiceNumber(n=1) abjad.attach(command, voice_1[0]) voice_2 = abjad.Voice("e'8 f' g' a'") command = abjad.VoiceNumber(n=2) abjad.attach(command, voice_2[0]) container = abjad.Container([voice_1, voice_2], simultaneous=True) staff.append(container) voice = abjad.Voice("c''4 a'") command = abjad.VoiceNumber() abjad.attach(command, voice[0]) staff.append(voice) >>> staff = make_staff() >>> string = abjad.lilypond(staff) >>> print(string) \new Staff { << \new Voice { \voiceOne g'8 a'8 b'8 c''8 } \new Voice { \voiceTwo e'8 f'8 g'8 a'8 } >> \new Voice { \oneVoice c''4 a'4 } } The abjad.VoiceNumber indicator is contexted at the level of abjad.Voice. Use abjad.get.effective() to get the abjad.VoiceNumber indicator in effect for any leaf: >>> for leaf in abjad.select.leaves(staff): ... command = abjad.get.effective(leaf, abjad.VoiceNumber) ... print(f"{leaf}, {command}") Note("g'8"), VoiceNumber(n=1) Note("a'8"), VoiceNumber(n=1) Note("b'8"), VoiceNumber(n=1) Note("c''8"), VoiceNumber(n=1) Note("e'8"), VoiceNumber(n=2) Note("f'8"), VoiceNumber(n=2) Note("g'8"), VoiceNumber(n=2) Note("a'8"), VoiceNumber(n=2) Note("c''4"), VoiceNumber(n=None) Note("a'4"), VoiceNumber(n=None) Closes #1135.
trevorbaca
added a commit
that referenced
this issue
Apr 7, 2023
Set n to 1, 2, 3, 4 or none. Models LilyPond ``\voiceOne``, ``\voiceTwo``, ``\voiceThree``, ``\voiceFour``, ``\oneVoice`` commands. def make_staff(): staff = abjad.Staff() voice_1 = abjad.Voice("g'8 a' b' c''") command = abjad.VoiceNumber(n=1) abjad.attach(command, voice_1[0]) voice_2 = abjad.Voice("e'8 f' g' a'") command = abjad.VoiceNumber(n=2) abjad.attach(command, voice_2[0]) container = abjad.Container([voice_1, voice_2], simultaneous=True) staff.append(container) voice = abjad.Voice("c''4 a'") command = abjad.VoiceNumber() abjad.attach(command, voice[0]) staff.append(voice) >>> staff = make_staff() >>> string = abjad.lilypond(staff) >>> print(string) \new Staff { << \new Voice { \voiceOne g'8 a'8 b'8 c''8 } \new Voice { \voiceTwo e'8 f'8 g'8 a'8 } >> \new Voice { \oneVoice c''4 a'4 } } The abjad.VoiceNumber indicator is contexted at the level of abjad.Voice. Use abjad.get.effective() to get the abjad.VoiceNumber indicator in effect for any leaf: >>> for leaf in abjad.select.leaves(staff): ... command = abjad.get.effective(leaf, abjad.VoiceNumber) ... print(f"{leaf}, {command}") Note("g'8"), VoiceNumber(n=1) Note("a'8"), VoiceNumber(n=1) Note("b'8"), VoiceNumber(n=1) Note("c''8"), VoiceNumber(n=1) Note("e'8"), VoiceNumber(n=2) Note("f'8"), VoiceNumber(n=2) Note("g'8"), VoiceNumber(n=2) Note("a'8"), VoiceNumber(n=2) Note("c''4"), VoiceNumber(n=None) Note("a'4"), VoiceNumber(n=None) Closes #1135.
trevorbaca
added a commit
that referenced
this issue
Apr 7, 2023
Set n to 1, 2, 3, 4 or none. Models LilyPond ``\voiceOne``, ``\voiceTwo``, ``\voiceThree``, ``\voiceFour``, ``\oneVoice`` commands. def make_staff(): staff = abjad.Staff() voice_1 = abjad.Voice("g'8 a' b' c''") command = abjad.VoiceNumber(n=1) abjad.attach(command, voice_1[0]) voice_2 = abjad.Voice("e'8 f' g' a'") command = abjad.VoiceNumber(n=2) abjad.attach(command, voice_2[0]) container = abjad.Container([voice_1, voice_2], simultaneous=True) staff.append(container) voice = abjad.Voice("c''4 a'") command = abjad.VoiceNumber() abjad.attach(command, voice[0]) staff.append(voice) >>> staff = make_staff() >>> string = abjad.lilypond(staff) >>> print(string) \new Staff { << \new Voice { \voiceOne g'8 a'8 b'8 c''8 } \new Voice { \voiceTwo e'8 f'8 g'8 a'8 } >> \new Voice { \oneVoice c''4 a'4 } } The abjad.VoiceNumber indicator is contexted at the level of abjad.Voice. Use abjad.get.effective() to get the abjad.VoiceNumber indicator in effect for any leaf: >>> for leaf in abjad.select.leaves(staff): ... command = abjad.get.effective(leaf, abjad.VoiceNumber) ... print(f"{leaf}, {command}") Note("g'8"), VoiceNumber(n=1) Note("a'8"), VoiceNumber(n=1) Note("b'8"), VoiceNumber(n=1) Note("c''8"), VoiceNumber(n=1) Note("e'8"), VoiceNumber(n=2) Note("f'8"), VoiceNumber(n=2) Note("g'8"), VoiceNumber(n=2) Note("a'8"), VoiceNumber(n=2) Note("c''4"), VoiceNumber(n=None) Note("a'4"), VoiceNumber(n=None) Closes #1135.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
These will model LilyPond
\voiceOne
,\voiceTwo
,\voiceThree
,\voiceFour
and\oneVoice
commands.The text was updated successfully, but these errors were encountered: