-
Notifications
You must be signed in to change notification settings - Fork 433
Handling Staff-tuning in MusicXML (fixes #778) #1169
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5948,7 +5948,18 @@ def xmlStaffLayoutFromStaffDetails( | |
| except ValueError: | ||
| warnings.warn( | ||
| f'Got an incorrect staff-type in details: {mxStaffType}', MusicXMLWarning) | ||
| # TODO: staff-tuning* | ||
|
|
||
| mxStaffTuning = mxDetails.findall('staff-tuning') | ||
| if mxStaffTuning is not None: | ||
| tuning_pitches = [] | ||
| for i in range(len(mxStaffTuning)): | ||
louisbigo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| staff_tuning = mxStaffTuning[i] | ||
| tuning_step = staff_tuning.find('tuning-step').text | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You might verify that using
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. I can do the following, but maybe we would prefer to give up the whole inclusion of tuning in the case one of the pitch is not valid (in the solution below a tuning of (n-1) pitches will be validated if one pitch is incorrect, which seems unlikely useful). What do you think ?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked and
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You might also include the optional |
||
| tuning_octave = int(staff_tuning.find('tuning-octave').text) | ||
| tuning_pitches.append(pitch.Pitch(tuning_step + str(tuning_octave))) | ||
| fretboard = tablature.FretBoard.getFretBoardFromTuning(tuning_pitches) | ||
| setattr(stl, 'fretboard', fretboard) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Can we just insert into the current measure?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Goodness, alright. My mistake. Looking now, what do you suppose about setting
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably worth a ping for @mscuthbert before you end up wasting too much motion! Myke, any thoughts about these three options: 1a -- use FretBoards, and put them on StaffLayout objects
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One benefit of the instrument approach is that if we have ambiguous data for an instrument but we have staff-tuning tags, we could possibly reclassify the object to be a
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that I'm a bit confused also. We can have ChordWithFretBoard, but we can also have the same thing without a Chord symbol. That's what I'm talking about that I call a FretBoard. I think I'll need to see an image of what everyone is talking about to catch up. But it doesn't seem like any of this belongs on StaffLayout unless it affects the size or amount of space around a staff or the change in the visual appearance. If it's about the tuning of different lines, that's a different object. I don't want to put things into one object that do not belong with it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The So the question is whether the class On the other hand, I agree that the tuning of the string instrument is not supposed to affect the layout of the staff so using
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I agree, we need some other data structure in music21 for tab staves. The image of what we're talking about can be found from the tutorial Louis linked to--we need to capture the pitches of the lines of a tab-staff, which may or may not (although it should) be in the same musicxml I'm thinking the Where to encode the actual pitches, I'm not sure. We could add attributes to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this means breaking out into two PartStaff objects when both are in one
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think the tuning pitches will allways appear on the tab-staff (unless the file is uncorrect) - however the instrument information (guitar in that case) that might only appear in an other musicxml
Both make sense to me. But I guess using
Good for me ! |
||
|
|
||
| # TODO: capo | ||
| seta(stl, mxDetails, 'staff-size', transform=_floatOrIntStr) | ||
| # TODO: musicxml 4: staff-size has a scaling attribute for the notation | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.