Add a swing/shuffle effect to playback/export

• Sep 26, 2009 - 17:02
S5 - Suggestion

I started to implement a swing/shuffle effect.
I think I have the algorithm ok. Bur for the moment the "swing ratio" is hard coded.
I wonder where and how users might want to choose this swing ratio.
- For the whole piece? for a staff? for a measure?
- With predefined value (swing = a quarter note and an 8th in a tuplet, shuffle = a dotted eight and a 16th)
- With a number between 0 (straigh) and 100 (extreme) with 33% for swing, 50% for shuffle... More than shuffle makes sense?

What do you think?

Attached a midi with ratio 0.333 of Promenade

Attachment Size
Promenade-swing.mid 4.47 KB


This looks like a great addition.

If it is not too complicated I would suggest that the user-definable selection be a choice of all 3 that you suggest.

It is complicated ;) At least for me. So I would like a more precise insight. What's number one priority?
My personal point of view for the moment is to add a style settings in Edit style -> Score and let user choose with a number.

Then I would suggest that it be part- or staff-selectable rather than score-selectable. A bit more work for the user, perhaps, but a wider range of choice.

Thanks for all your work.

Although it is very rare, there are times when a part might switch to straight eighths while other parts continue to swing eighths. I have never encountered a piece that has a light swing in one part and a heavy swing in another part; it is either swinging or straight.

In most pieces the swing applies throughout the whole piece but there are instances when it might change midway through a piece. Compilations (such as an arrangement of several movie themes or Christmas tunes) might change styles dramatically at several points throughout the piece.

I don't think the swing settings belong in the the Edit General Style dialog. The style dialogs deal with printed styles and should not mix with playback settings. Swing settings belong in the Play Panel (possibly the Synthesizer) and probably Tempo Text properties (for mid-piece changes).

Take a look at how swing settings are implement in other scorewriters

I think a drop-down menu of present options for swing would be more helpful than a number in a text box since it relates to terminology musicians would be familiar with. For example Finale offers the following four presets for swing "Light", "Standard", "Heavy", "Dotted Eighth, Sixteenth".

In the previous comment I mentioned Tempo Text properties. However it probably better belongs in the generic Staff and System text properties.

As far a priorities: (1) whole score settings for swing (2) measure-by-measure settings for swing (3) part-by-part settings for swing.

Probably the last option (part-by-part settings) could be implemented similar to dynamics which (in theory) can affect a single instrument or a whole system.

Thanks for the answer! It's very helpful! I will try to do something in playback panel tomorrow.
I might need help to define the ratio for every presets.

I commited a first attempt in r2137. Please review the code and the implementation.
For the moment it's just "Straight", "Swing" (0.333) and "Shuffle" (0.50). And it acts on the second eight notes only.

Wonderful start! Two points to look at:

The swing/shuffle modification should only apply to groups of two eighth notes. For example, if you have a group of four sixteenth notes they should sound like four equally spaced sixteenth notes regardless of the swing/shuffle setting. In r.2137 the last two sixteenth notes sound shorter than the first two which is incorrect.

As you mentioned above, the duration of the first eighth note needs to be lengthened so that you don't get a gap in the sound.

The swing/shuffle modification should only apply to groups of two eighth notes.
I will need help here. I agree with you for 4 sixteenths,
But I'm not sure at all for a 8th and two sixteenth.
And what about 2 sixteenths and an 8 th?
8th rest and 8th
eight and a triplet of 16th ? etc

We need to figure out a rule or a reference implementation in a existing software.

I think you'll generally find that swing needs only apply to 2 eighths. The other scenarios you describe, if they need to be swung, can be individually notated.using triplets.

Lasconic, if you don't already have a copy of Finale or Sibelius I recommend you download a demo copy and experiment with the swing tempo there. You will find that it applies only to groups of two eighth notes. The first eighth note of the beat is longer, the second shorter. No other combination of notes is affected by the swing.

I was mistaken. I only checked in Finale and it confirmed what I thought but Sibelius actually behaves differently. In a group of four sixteenth notes the first two notes are lengthen and the last two shortened. In Finale it plays sixteenth notes straight but in a group of two sixteenth notes and one eighth note it plays the first two sixteenth notes straight and shortens the eighth note. All other groups of sixteenth notes and eighth notes appear to play straight.

In r2150, 4 sixteenth notes are straight. The duration of the first 8th of a group of two is increased by the ratio.
The second 8th of a group, even a group of 2*16th and a 8th, is shiften and shortened.

Quoting David Bolton: "As far a priorities: (1) whole score settings for swing (2) measure-by-measure settings for swing "...
for (2) how about about making Swing/Shuffle as a tempo marking?

I agree with tato. I always thought the swing setting should never have been in the play panel in the first place. It properly belongs in the tempo properties. Furthermore, I think setting up the tempo should be part of the new score wizard. Of course I certainly don't mean to belittle the achievement, I'm sure there were reasons it was done that way and it is a great addition.

I still think that there should/could be a swing dialog on the play panel (along with the tempo marking) but not to apply swing or not, but to select the kind/amount of swing on "swinged" parts, because as David said on #4, the kind of swing would almost always be the same throw out the peace, on the other hand changes between swing and shuffle are very common.

There are many compositions that have more movements (symphony, quartet, ...). Nonartifitial music of 20th century has gived new styles of playing such as swing. Some composers of modern classical (George Gershwin, Leonard Bernstein, Bohuslav Martinů, and many more) use nonartiffitial styles and allso swing, blues, etc.

So it has good sense to can set "swing" for a part of score and switch it off by setting "straight". It is not only spetial set of occasional collection

In Sibelius you can write system text and there is dictionary of play modes. But there is not possibility set ratio. Only textual diference - light swing, regular swing, heavy. (I think number should not be bad but for some people may be better text.)

And what shall be swinged? Maybe count period - the denominator of time signature. For 4/4 it could be 8th, for 8/8 16th and so on - half of count period. But...!? I'm not sure.

Lasconic, I tested your algorithm and it sounds better than Sibelieus. 16ths of Sibelius stumble or cripple if they are four together.

Good job. Now I would like to have possibility to write swinging (or straight) into a score to concrete measure and maybe to concrete note from that i wont to swing (or stop swinging).

Sorry for waking up a long silent post, but I wanted to chime in on the utility of having the swing in the play panel. I use this program to practice (a lot). Sometimes when I'm doing rhythm studies I want an easy way to switch between straight, swing, and shuffle. With the recently added metronome, I'm loving this workflow.

While I agree on the previous posts about the most correct ways of implementing it for a score, having the option in the play panel is very helpful to me.

This question was revived and I would like to respond to this: "I wonder where and how users might want to choose this swing ratio.
- For the whole piece? for a staff? for a measure?"

Personally I could use control over this with a measure as the smallest segment.

All this sounds good to me. I'm a starting composer, and I'm arranging piano pieces to jazz band arrangements, and swing/shuffle is very important in the makings of these things.


In the trunk, the swing effect has been removed long time ago. The implementation in the play panel had some limitation, the biggest one was that it was not saved in the file. An implementation like the tempo text would be very welcome. In the meantime I'll remove the combo box in the play panel.

I think this:

Measure is not bad place to switch between feelings, but note could be better. I have written some peace in Sibelius and i have need to switch in halve of a measure. But it was due to feature of Sibelius. I have written few 16'ths in one measure and Sibelius played them crippled. So this part I switched into straight.

For users as Androo would be useful if switch of feeling will be still on play-panel. But default feeling could be "Auto". Then would be preferred what is written in the score (and if is not written - then play straight).

vysata, I worry that switches between feelings at the note level would result in many user errors (for example, if they happen to line it up with the second note of the measure instead of the first). For the exceedingly rare cases where you really want to switch in the middle of a 4/4 measure, you can split it into two partial measures with actual durations of 2/4 and an invisible barline. And as you say, the only reason you used it in the past was to work around a bug/feature in Sibelius.

I don't think mid-measure switches would be exceedingly rare at all - it's not at all uncommon to see a single phrase of just two or three beats I length marked "straight" in an otherwise swing piece, or vice versa. But why would making swing be controlled by a tempo marking mean it could not be on a measure basis? In any case, it wouldn't be crucially important to get playback correct in those cases., so if it did end up being only at the measure level, that would still beat what we have in 1.2 by a mile.

It seems to me that the best implementation would be the most general, since composition is a creative endeavor. If I wanted to create an insane passage in 36/8 time that varied between straight and swing I should be able to do so by marking some set of notes as swing or straight. It should be applicable to all measures, some measures, or notes.

As for user errors: they're always going to happen. Make sure the help section is detailed and it is up to us to read it. Some logical restrictions could be built in to avoid obvious problems but trying to make something idiot-proof is always going to fail with the more idiotic idiot to come along = )

At any rate, I'll take what I can get.

I'm sorry - but for me the implementation of the swing/shuffle/straight-toggle within the play panel was one of the greatest steps forward developing musescore! All better ways of fine-tuning are welcome, but meanwhile: please give me back the toggle for Version 2.0, either within the play panel or in any other way! For many purposes the toggle in V1.3 was completely sufficient! Maybe, as a compromise a score-text could be created, only to be fixed at the very beginning of the score, saved within the mscz-file and toggling the same way as from the former play panel.
But please don't just remove the combo box from the play panel!
Or is there any other way to get a shuffle-playback without noting triplets all over the score?

Anyway - the developers do a great job: thanks a lot to all of them!

Swing Playback
The playback in swing or shuffle feeling is quiet important and should be implemented back
in MuseScore 2.0. But with the 1.x solution to control it in the play panel we are handicapped because we have no alternative to change e.g. the swing back to straight feeling during the piece.

Therefore I suggest connecting this feature with tempo text – always belonging to a bar - to change as often as it’s nessecary. In my Finale 2010 the swing behavior is under control of on an entry which can be set between 0 (straight) and 150 (dotted note). So the playback is changeable and more or less swinging.

I believe that the swing behaviour affects only the main beat in a bar – e.g. in a 4/4 only the 8th and not the 16th !
But I’m not sure about the length (time duration) of 8th and 4th syncopations in swing. Typically the 8th should be as long or even longer as th 4th.

I know the swing functionality in 1.3 is weak, but it is really a lot better than nothing.

Please do not regress this.

It doesn't hurt musescore for it to stay the way it is in 1.3 for now.

To me, there are a couple of potential downsides to maintaining the old scheme:

1) it would presumably take some work to bring that code up to date with the many other changes over the course of 2.0 development, and that work would end up being throwaway once a better scheme was implemented

2) it introduces an expectation that this feature will continue to work in this way, so scores might be created taking advantage of this but that stop working once this feature finally is replaced by something better

I'm not overly concerned with #2, but #1 is the main reason, I think, why this has not been undertaken.

I too am concerned about this as a step backwards, though. I've proposed that perhaps a plugin could be developed to adjust start/stop times. With this approach, you'd have to run the plugin after every edit if you wanted the effect, which of course is not ideal. On the positive side, it would presumably be possible to do this on a selection, allowing a piece to switch between swing and straight. And unlike the play panel scheme, swing created this way would save with the score and also work on

But see #23063: No way of controlling gateTime at present in nightlies. Not sure the plugin route is technically viable either.

At my point of view,
The swing effect should start/stop on Text tags : Swing, Heavy_swing, Shuffle, Straight and the proprerties should be defined throught a sub_menu as it is for the Tempo tag.

Musescore swing or shuffle feel is an interesting issue. For those who want swing-feel when uploaded to, I can recommend to change the notes individually.

To make 8'th notes swing (in playback mode online) you can do the following.

Set the first 8'th note like this:

ontime offset type: auto
ontime offset: 0
offtime offset type: offset
offtime: 66%

And the second 8'th like this:

ontime offset type: offset
ontime offset: 34%
offtime offset type: offset
offtime: -66%

It is very important to change the second 8'th note end-length to minus 66%, as the last triplet-feel 8'th note will "clip" the sound of the next-coming note in playback mode.

On the other hand, if you want to tie the last 8'th with the next-coming note, you have to leave the note end-lenght like this:

ontime offset type: offset
ontime offset: 34%
offtime offset type: auto
offtime: 0

It is a little tricky, but it works.

Feel free to work with the parameters. I often get the best "swing-feel" with a delay around 25%.

Some reggae-grooves has a more "even" swing-feel compared to traditional jazz. It's not an absolute. It's music.

Have a good day!

Status (old) active fixed

As a first result of Google Summer of Code 2014, shredpub has implemented swing playback as a style option. He is now working on a text option to be able to change swing during the score. The style option is available in f4383446ce

Feedback is very welcome! Please open other issues if needed.

Thanks for posting the update and links. Shredpub seems to be on a very good track and I look forward to testing once implemented into the nightlys.

Optimally the swing effect should be applicable by measure and staff and then quantifiable by a spectrum somewhere between triplets and dotted eight and 16th. In my experience, tempo extremes can make one or the other sound like not swinging.
However, there is a lot of coding and testing before you reach that goal and there are many useful increments along the way. I would be happy with a simple switch to render eights in any swing feel provided during playback. When you write a swing piece, you generally write eight notes and leave it tot the player to render that according to their own expression. Eights are so much easier to read and write. HTH.