On Tue, 2024-09-10 at 16:16 -0400, Bric wrote: > > > On 09/10/2024 4:31 AM EDT Richard Shann <rich...@rshann.plus.com> > > wrote: > > > > > > On Mon, 2024-09-09 at 23:01 -0400, Bric wrote: > > > Attaching a screenshot of misaligned > > in the display? or in the typeset? > > I was using the Staff-wide switch: Staffs/Voices -> Playback -> > Swing Staff > > Denemo then applies its swing algorithm and highlights the swung > duplets blue. I attached the screenshot snippet with two blue swing > notes. They are misaligned.
By "misaligned" here what you mean is that you would like the inequality of the durations to apply to the second two of the three eighth notes. As indicated in the description of the command, Denemo does not offer to do this, it simply looks for the first pair of eighth notes it finds and adds a little to the duration of the first and takes the same amount off the second. Simple, and too crude for your application (it might help to know that this feature was actually created to implement baroque "notes inegales" where it is adequate). > Denemo computed the wrong group of two notes as a swing tuplet. > Should be the final two, not the ones shown. Also was trying to > relate that during the (audible) playback you hear the mis-computed > swing pattern. You hear that which is (incorrectly) highlighted. > > Attaching a more explicit visual, to drive the point home. > > The top fragment circles in red the two incorrectly swung notes -- > denemo highlights them blue, and makes them sound rhythmically wrong, > accordingly. > > The bottom fragment circles in green the two notes denemo SHOULD have > identified as a swing pair. > > > > > swing tuplet > > > > > > This is a 3/4 time signature. Apparently the swing code isn't > > > handling the dotted durations properly. > > > > What command are you using? There is this one: > > Command: Swing Staff > > Changes the playback duration of pairs of 𝅘𝅥𝅮 notes for swing or > > notes > > inègales. Does not affect typesetting. > > Location: Object Menu ▶ Staffs/Voices ▶ Playback > > Internal Name: SwingStaff > > > > as it says it only changes the playback duration of pairs of 1/8th > > notes. It does not affect the typeset, and only affects the display > > inasmuch as it marks in blue notes whose durations have been > > tweaked. > > I never ever addressed swing expression in the typeset. That would be > a gross error in understanding what the swing function is for in this > context. I have always understood it to be strictly for the audio > playback. > > [side note] > For anyone not too familiar with modern swing scores: there really > isn't any special notation for it. The performer executes the swing > rhythm using implicit rules based on eighth note pairs, typically. > Sometimes there is a caption at the top of the score mentioning the > score is to be swung. But more often than not, in jazz, it is > implied and is the default. > > To except a portion of the score from the default swing feel, you'd > need to place explicit markings saying the notes should be played > "straight" (non-swing) - straight sixteenths or straight eighths. > > [/side note] > > Hence the occasional, rare need in scoring editors to mark a passage > as an exception from the set swing/non-swing. The need arises when > your default is swing and you want a few measures to be non-swing (or > the other way around). To do that in typesetting is trivial -- just > add a text label that says "straight eights" and maybe extend a line > throughout that passage. To except a passage in playback, it is, of > course, less trivial, and would require special playback directives. > > > > > > > To do anything more complex you need the command: > > > > Command: Change Sounding Duration > > Changes the duration of the note a the cursor for playback > > purposes, > > typesetting unaffected. > > Location: Object Menu ▶ Notes/Rests ▶ Playback > > Internal Name: ChangeSoundingDuration > > You would need to change more than the duration. Yes, you need to shorten one and lengthen the other - that is sufficient to move the onset/offset times in Denemo - which is all the SwingStaff command does. > You'd need to change the note's start position. Given X% swing, > you'd need to shift the start of the second eighth note in a pair of > swung eighth notes, forward, in time, by (X-50)/50 of its own > duration. (E.g., for a swing of 63, the second note shrinks by (63- > 50)/50 = 13/50, and shifts forward by that difference. > > But again. First, denemo needs to identify each pair of eights > properly, As you have an insight into the choosing of which pairs of eighth notes you would wish to swing I wonder if you would care to implement inside Denemo? You would need to familiarise yourself with Scheme, but that is not so difficult a very simple syntax, and with the procedures available for Denemo such as d-MoveCursorLeft and d-GetNoteDuration. I could help with the latter, it would be a question of modifying the script for the command SwingStaff which you can inspect from within Denemo. > then adjust the playback of the second note. Or -- if the second > note is split into sub-durations, it's a bit more complex -- both of > those sub-eighth notes would need to be compressed in duration and > shifted as I say the shifts happen automatically, computed from the durations as the MIDI is being created. Richard > > > > > > Or maybe missing a more generalized tuplet position > > > calculation. > > > Denemo highlights the wrong two notes blue (should be the last > > > two > > > notes in the measure), and plays them back true to the incorrect > > > highlighting (misaligned)) > > > > > > > > > ==================== > > > > > > I once had a go at coding swing tuplets in a sequence -- > > > successfully, wasn't complex... below is the description of what > > > i > > > did, IIRC, just in case > > > > > > Using 0-remainder to detect start of tuplet (duplet?) position. > > > Let > > > x={swing notation note duration (written, not actual, typically > > > an > > > eighth)}, then 2x would equal swing tuplet duration. Divide the > > > given > > > notation-based position by 2x; if remainder is zero, the given > > > note > > > is at the start of a (theoretical) swing tuplet position. Then go > > > from there to check the actual duration -- if an eight, then the > > > following note -- its swing pair -- gets compressed and shifted > > > forward, according to swing ratio, in the audio playback. This, > > > of > > > course, if not within an explicit triplet group > > > > > > I don't know C (did the above in some scripted language), > > > > you don't need C to change the duration of a note, you can do it > > without recompiling Denemo, look at the code for the above command > > (right click on the menu item and choose "Get Script into Scheme > > Window" to see the script used). > > > > Richard > > > > > so probably wouldn't be able to actually help with the code.