How to apply swing to triplets with delay commands?

(lettuce) #1

I have been trying to work out how to use delay commands to swing renoise timing in the same way as roger linn did on his drum machines. That is, by delaying the second of every sixteenth note. But I have encountered problems trying to apply these swings to triplets. Can someone help me?

For example:

70.83333333333334% sixteenth note swing is ( 1st 16th note - 17 ticks / 2nd 16th note - 7 ticks )

00 C-4 00 – -- ----

01 C-4 00 – -- -Q05

02 C-4 00 – -- ----

03 C-4 00 – -- -Q05

( repeat )

Usually triplets by delay commands would be done as follows:

00 C-4 00 – ----

01 C-4 00 – -Q04

02 C-4 00 – -Q08

03 — – -- ----

04 C-4 00 – ----

05 C-4 00 – -Q04

06 C-4 00 – -Q08

07 — – -- ----

( repeat )

or for slow triplets like this:

00 C-4 00 – ----

01 — – -- ----

02 C-4 00 – -Q08

03 — – -- ----

04 — – -- ----

05 C-4 00 – -Q04

06 — – -- ----

07 — – -- ----

08 C-4 00 – ----

09 — – -- ----

10 C-4 00 – -Q08

11 — – -- ----

12 — – -- ----

13 C-4 00 – -Q04

14 — – -- ----

15 — – -- ----

( repeat )

How do I add the 70.83333333333334% sixteenth note swing from the first example to the normal ( non swung ) triplets of the second two examples to make them “swung triplets” and not “normal triplets”?

I know renoise has the option to swing the timing with the use of sliders on the swing device but I’m trying to align swung patterns from MPC and Sunvox with the swing in renoise, so that I can sample freely from those into renoise and still have swing. For this purpose ( especially for sunvox ) I need swing by delay command and I still want to to use triplets.

(dblue) #2

While I’d argue that a “swung triplet” doesn’t really make any sense, I understand where you’re coming from and what you’re trying to achieve in general.

The tick-based note delay command is of course governed by the number of ticks per line in your song, limiting the overall resolution you can get from it.

If you want to start exploring more free-form rhythms and more precise delays, then you’ll simply need to use the dedicated note delay column instead, which has a resolution of 256 divisions per line.

Using the delay column, your typical triplet examples look like this:

00 C-4 00 .. --
01 C-4 00 .. 55
02 C-4 00 .. AA
03 --- -- .. --
04 C-4 00 .. --
05 C-4 00 .. 55
06 C-4 00 .. AA
07 --- -- .. --

00 C-4 00 .. --
01 --- -- .. --
02 C-4 00 .. AA
03 --- -- .. --
04 --- -- .. --
05 C-4 00 .. 55
06 --- -- .. --
07 --- -- .. --

Silly bonus example song: 7929 dblue-2018-01-25-triplets.xrns

Now, to achieve some “swing” or extra grooviness on these triplets, I imagine you’d simply want to fool around shortening/lengthening the delay values to taste.

What those exact values are, I’m not sure, as I’ve never dug too deeply into all this Roger Linn business you’re referring to.

If you can provide me with a clear audio example of what your “swung triplets” should sound like, I’m sure I can match the values for you, though it’s a relatively simple process of playing such an audio loop in Renoise and then exprimenting with delay values to match the timing.

(lettuce) #3

Thankyou for your response and the example. That was funky I like it.

I need the ‘swing by delay note command’ rather than by ‘delay column units’ because Im hoping to sample stuff ive written in sunvox ( and maybe milkytracker ) into renoise whilst still using swing. “Interoperability of groove”.

I thought there must be some way to add those Q05s from the 70% sixteenth note swing by delay note command into the triplet structures to make them align properly with that swing. Seems like there is more to it than just adding the Q05s to the existing Q command values in the triplets when they fall on the same line.

I can hear how the swung triplets should sound when I turn global groove to 90% on your example, but I cant recreate it.

There must be a way to divide up the ticks correctly to get the triplets swinging in alignment with the sixtenth note swing?

I really wonder what method should be used to distribute the ticks properly in a ‘swung triplet’.

Sorry, I know I could try to do it by ear but ill be working with sunvox and milkytracker then sampling into renoise so I want to make sure the triplets are swung perfectly ( in samples obtained from sunvox and milkytracker ) so it all lines up nice without sounding out of time or like “flams”…and so I don’t have to change every single delay command in the song by ear ( in all three softwares milky, sunvox and renoise ) over and over until it all lines up.

Ideally it would be great to know exactly how renoise global groove applies swing to triplets.

When I swung your pattern at 90% with global groove it sounds awesome. You can hear how the triplets change.

(Zer0 Fly) #4

My thought was to calculate each note’s position in the grid, and shift it depending how close it is to the maximum shifted 16th.

I have written a little lua function. It is my initial take and not very clean or optimised yet. Not sure if errors, please only feed with valid data. I am very tired and have not thuroughly tested. Its results seem to match the data in your other thread, but sometimes not? One of us must be wrong there. But it can work on any linear note position, and apply swing to it by interpolating the applied delay linearly depending on how close to the swung 16th.

Here the function:

function swingshift(line, dly, percent, lp16, dupl)
 local pos = 2*((line*dupl+dly) % (2*dupl*lp16)) / (2*dupl*lp16)
 local fac = 1 - math.abs( 1-pos )
 local swng = fac*((percent-50)/50)
 local rpos = line*dupl+dly+dupl*lp16*swng
 local rline = math.floor(rpos/dupl)
 local rdly = math.floor(rpos - rline*dupl + 0.5)
 return rline, rdly

It will calculate the new position of a note, with swing added. You feed it with some parameters:

line = the line in pattern starting with zero which is the 1st line,

dly = whatever delay or Qxx value the note has

percent = your swing percentage between 50% and 75%

lp16 = how many lines are one 16th note, for example lpb4 it will be 1, lpb8 it will be 2

dupl = delay units per line, so 256 if you want to use delay column and else the tpl if you want to work with Qxx commands

You can call it like this to shift notes:

>>> print( string.format( "%i - %X",swingshift(1,0,60.15625,1,256) ) )
1 - 34

This means the line 1 (second line, so shifted 16th) in lpb4 will have to be shifted to be still on line 1, but have hexadecimal delay value 34 added. Note it is operating with 256 step delay, and second parameter is zero, but could be any delay value.

Now these 8th triplets on lpb4:

00 C-4 00 .. --
01 C-4 00 .. 55
02 C-4 00 .. AA
03 --- -- .. --
04 C-4 00 .. --
05 C-4 00 .. 55
06 C-4 00 .. AA
07 --- -- .. --

Lets calculate the values:

>>> print( string.format( "%i - %X",swingshift(0,0,60.15625,1,256) ) )
0 - 0
>>> print( string.format( "%i - %X",swingshift(1,0x55,60.15625,1,256) ) )
1 - 78
>>> print( string.format( "%i - %X",swingshift(2,0xAA,60.15625,1,256) ) )
2 - CD

Very interesting. The Pattern above, swung by 60.15625% on every 2nd 16th note should thus be:

00 C-4 00 .. --
01 C-4 00 .. 78
02 C-4 00 .. CD
03 --- -- .. --
04 C-4 00 .. --
05 C-4 00 .. 78
06 C-4 00 .. CD
07 --- -- .. --

What do you think? You may use my function as basis for a tool, if other users may download it for free. Of course you must calculate the triplet positions as they would be in a straight beat, first.

I’m interested in further discussion on this.

(joule) #5

A very small note: I’m still not sure why peope insist on triplets being 55 and AA. If you use normal rounding principles, it would be 55 and AB?

(dblue) #6

A very small note: I’m still not sure why peope insist on triplets being 55 and AA. If you use normal rounding principles, it would be 55 and AB?

When comparing the timing of the delay column vs a mathematically perfect triplet that is precisely 1 beat divided by 3, then you end up with slightly imperfect timings either way:

The delay 55 will arrive 0.166~ ms too soon, while 56 will arrive 0.333~ ms too late.

The delay AA will arrive 0.333~ ms too soon, while AB will arrive 0.166~ ms too late.

So it really just comes down to personal preference in the end. For me personally, the values 55 and AA are just nice and “clean” and very easy to remember.

But you’re quite right: the delay value AB results in a slightly more accurate timing with an error/deviation of just 0.166~ ms vs AA @ 0.333~ ms.




(lettuce) #8

@OopIFly :

Thankyou for putting in the effort to come up with that lua function there. Much appreciated.

I tried your 60% swung triplets alongside 60% swung 16ths, like this :

00 C-4 00 – -- ----

01 C-4 00 – 34 ----

02 C-4 00 – -- ----

03 C-4 00 – 34 ----

your swung triplets were alongside :

00 C-4 00 – --

01 C-4 00 – 78

02 C-4 00 – CD

03 — – -- –

04 C-4 00 – --

05 C-4 00 – 78

06 C-4 00 – CD

07 — – -- –

Just by listening to it I’m not sure if it sounds right or not.

I would like to compare it to the perfect swinging of triplets that the global groove device can create but I think in the global groove device the percentages are worked out differently to the roger linn swing variation percentages.

Normally swing percentage describes the ratio between the first and second sixteenth notes, that is, it describes the percentage of the first sixteenth note, the lengthened sixteenth note.

Using this way to describe swing, 50% swing is ‘no swing’, straight 16ths.

But in renoise global groove device the percentage starts from 0% where you would it expect it to start from 50%.

By listening it seems like it is inactive until 50% is breached. I’m not sure.

Like dBlue was saying the percentages will never be completely accurate because its applying decimal to hexadecimal. Using 100 to describe a percentage of 512, or 24, or 48 or whatever. None of the swing variations can be perfect percentages except for 50% and 75%.

For the rest of them rounding up or rounding down a bit. I wonder whether Roger linn decided to round up or down for some of them?

I wonder how the percentage swing variations were worked out in the global groove device?

God, these swung triplets are a headache to work out.

I just want to be able to swing sunvox patterns with traditional delay commands, use triplets and sample my work into reniose later so I can add vsti bass and breakbeat sample based drums ( sunvox doesnt have the high resolution delay units, 256ths of a line ).

I have no idea how to use lua and am a total noob with it.

Your lua function looks like a great idea for a tool with an interface.

I would certainly find it useful to work out how to swing triplets the traditional way ( without using global groove device or 256ths of a line delay units). With that tool I could achieve interoperability of groove / swing across all my tracker programs ( sunvox, milkytracker and renoise ). It would be a great tool and could even go further and produce values for swung quintuplets and so on.

The interoperabiity would also apply to all roger linn hardware ( The whole MPC series, tempest etc. ).

I have another program I would like to use, G-stomper. It has a swing slider with swings described by percentage. The thing is, if tick per line or PartsPerQuarterNote details are not known its impossible to achieve the cross compatibility of swing, or interoperability for sampling swung patterns from multiple sources into renoise.

(Zer0 Fly) #9

yes sorry, my function would maybe be useful for writing a tool to apply shuffle to pattern data. sorry, that is much more work than that silly function. it is not perfect btw. it won’t properly reset shuffle after each bar on non power of two lpb values, but that can be easily fixed by modulo lines the number of lines the bar has. I will keep this up, I want to make a tool that will process/mirror pattern data to be shifted by groove presets, but before it is ready it might be uninteresting for normal users.

I just uploaded this, because I think one Idea to handle fractional notes might be to interpolate the delay for positions in between. Then, when I think how a tight real player would act, I’d think he’d try to keep triplets straight among each of the three notes, just the total length of the whole triplet sequence might depend on the groove.

And I think I understand your pursuit now, I didn’t first, it is wildly different from just grooving up renoise pattern data. and also the shuffle percentages with so many fractions, to try to match exact delay values. I think you shouldn’t go overboard, and you can never expect perfect alignment between programs etc. Like a live band will never have perfect timing among the members, software, and especially hardware, might also always have sligtly own feel, unless it was designed to interoperate in a tight way.

(dblue) #10

sunvox doesnt have the high resolution delay units, 256ths of a line

I was just taking a quick look at the Sunvox Manual and it does seem to have a fractional delay command that might be more useful.

You can delay note events in steps of 1/32nd of a pattern line by entering 40 - 5F in the effect column.

40 = 0%
48 = 25%
50 = 50%
58 = 75%
5F = 96%

Still not quite as granular as Renoise of course, but it’s a lot more flexible than using ticks, I reckon.

(lettuce) #11


Thanks for taking the time to help me try to work out this problem.

I would love to see that tool if it does get made someday but I understand its a lot of work.

These swung triplets are quite a complex thing to try and work out.

A little bit of swing in electronic music makes all the difference between sounding quite static and computery and being something that makes you nod your head.

I’m pretty stuck with this problem for now so I guess until I or someone else figures it out I can still align the swing of each program, just not for triplets.

Also, if I need swung triplets doing an entire project in renoise without the other programs is also no problem as I can just use the global groove device which sounds funky as hell and swings all triplets and tuplets perfectly somehow. dBlues triplet example sounded great when using global groove device with all sliders at 90%…It gave all the triplets quite extreme swing.

I have one question, Is the renoise global groove device inactive until 50%? That would make sense to me. If not how is the renoise global groove percentage description different to 50% = no swing?


Thaks for your help.

Yes, there might be a way to swing the triplets perfectly in sunvox and align the samples produced with renoise swung triplets using that delay by fraction of a line command. I think it might be possible with the usual traditional tracker delay command that sunvox and all trackers, including milkytracker have, but without as much resolution.

This is the command you suggested:

40…5F - delay an event for selected fraction of the line (from 40 (0%) to 5F (100%)).

This is the traditional tracker delay that is also available in sunvox:

1D - Delay. This effect delays the start of a note until tick XXYY in the current line. For example, if note C2 is played, with effect 1D and argument XXYY = 3 when the speed is 6. The note C2 will be triggered at the 3rd tick after the start of the line. Purpose: to delay the start of a sample for a VERY short amount of time.

Its pretty much the same delay command as in renoise (0Qxx) :

-Qxx - Delay playback of the line by xx ticks (00 - TPL).

And the delay command in milkytracker :

EDx : Delays a note x ticks. Like with ECx note cut, possible x values are 0 – (song speed - 1). Higher values prevent the note from playing altogether.

It must be possible to get swung triplets out of these commands as Roger Linn explained in that interview he only had a resolution of 48 ticks or 48 PartsPerQuarterNote for his first set of drum machines, then 96 ticks / 96 PartsPerQuarterNote for the next line of more modern drum machines, including the MPC series and the Tempest ( possibly even the new MPC 2.0 software ).

Roger Linn swing explation article :

There must be a way to do it. Roger Linn can do it, Renoise global groove does it ( although with more resolution ).

All the programs with a swing slider ( such as G-stomper for example ) can do it.

But with the old style tracker delay commands its necessary to know whats going on ‘under the hood’ if you know what I mean.

And also with the higher resolution delay that renoise has ( 256ths of a line ).

This problem is probably some kind of ‘trade secret’ among drum machine and DAW programmers.

(pat) #12

Another approach you could try is import a hat loop from sunvox and slice it. Render slices to phrase (I forget if that’s built-in or a tool). Then you’ll have a phrase with the exact delay offsets.

(lettuce) #13

This one?

(pat) #14

No turns out it’s built in.

  1. Slice your sample
  2. Right-click sample -> Slices -> Render Slices Options (you can set LPB and quantize here)
  3. Right-click sample -> Slices -> Render Slices to Phrase

Set quantize to none and the phrase will have values in the delay column that you can use.

(lettuce) #15

O.K, thanks. i understand now.

That is a cool function but the problem I have is that I also dont have the correct values for swung triplets in sunvox.

I can swing 16ths in the same way in renoise and sunvox but I cant apply that swing to triplets ( using delay by ticks commands ).

I suppose that method could work for swung triplet hats from G-stomper though.

(Zer0 Fly) #16

I wanted to suggest the same - slice a sample of a beat with swing, and use the phrase extraction function to find the groove formulas. You can find out how exactly the groove sliders in renoise shift notes … and if you sample sunvox or other programs, we can find out their groove settings.

I had tested it, it works fine if you take some care. The autoslice is not exact enough…you need to manually place the slice markers at exactly the same place of the sample or sound you recorded. I used hihat sample or pitched up snare sample, at slow speeds, and placed the markers at the transients. Make sure the first slice marker is at the very start, and the sample is exactly 2,4,8 beats long after cutting.

So…sample some swung triplets from sunvox? Sample all variations you would need in renoise, and just use the delay values extracted from the sample. And I doubt using tick delays will be exact enough for the task.

(lettuce) #17

Hey, thanks for the phrase extraction suggestion.

I know its possible to do swung triplets with just delay by ticks commands.

In the Roger Linn article about swing variations which I linked above he mentioned that all his early drum machines could do all the swing variations and that he only had a resolution of 48 parts per quarter note for those drum machines, in other words 12 ticks per line, 4 lines per beat. One beat is one quarter note or crotchet.

I cant sample swung triplets from sunvox because I need the delay by ticks command values to swing them in the first place.

O.K, so if I can extract swung triplet delay values by using renoise global groove device and phrase extraction they will be in 256ths of a line?

That wont help in sunvox or milkytracker because those two trackers dont have the 256ths of a line delay column.

I need them in delay by ticks commands.

Sorry, I dont want to come across as annoying and picky about it.

There must be some way to work out swung triplets using delay by ticks commands?

Then I can have swung triplets in all the trackers : Milkytracker ( portable on PDA ), Sunvox ( has native modular synths, portable on android tablet ) and of course renoise ( final stage, better sampler for adding chopped breaks, hosts vsti for bass ).

Also, one last thing…does the renoise global groove device only become active after 50%? That would make sense as usually groove / swing sliders start at 50%, with 50% swing being ‘no swing’ ( both first and second sixteenth notes equal length ).

(Zer0 Fly) #18


You could just sample and do the slice thing…then calculate tick delay from the 256 bases. Divide by 256, multiply the fractional value by the number of ticks per line you’re using (i.e. lpb) - then you just need some rounding, and you have the delays ready to use. The lines thing can be configured in the menu where you render to slice…it’s in the right click on sample menu -> slices -> render slice options - lines per beat.

Renoise does very well effect from 0-20%, it is just a rather subtle effect. My favourite groove setting goes like 10 15 10 20 or so, and sounds very organig, but I tune it for each song until it sounds “right”. Using the render to phrase thing we could also find out how the groove sliders actually work, and try to remap them to match other program’s or device’s groove slider! I’ll try and chime back in. It works like 0% = no swing, and then gradually until 100% which is hard but not extreme swing…it is different than the 50…75% stuff. I belive 100% in renoise is more extreme swing than 75% using the traditional values. But we can find out!

(lettuce) #19

O.K that sounds like a good idea.

I’ll try the phrase extraction and conversion of 256ths of a line values into ticks.

I’ll try the two other programs I have with swing on something with a hard attack and silence inbetween each hit, probably just hi-hat tripets.

MPC2.0 software ( should be classic roger linn MPC swing ) and G-stomper.

It would be good to know what the percentages in the renoise global groove sliders actually represent.

Maybe 0% is like 50% ( no swing ) and 100% is like 75% ( dotted 16ths? ).

62.5% swing is a good swing to start with on this.

I’ll report back if I have any luck with it.

(lettuce) #20

I rendered some swung hi hats from G-stomper, with swing slider set at 62%.

I rendered straight beats and triplets ( both with swing slider at 62% ).

I added sample slice markers and rendered slices to phrase, LPB 4, Quantize NONE.

How would I convert the results I got, which added 256ths of a line delay column delays into delay by ticks delays?

Sounds like they all line up nicely to me ( when they are placed alongside each other as a rhythm in a pattern ).

Maybe not exactly perfect

How do I attach the song file as an example?

Here are the results :


[total = 2048, 1st = 1269, 2nd = 779]
[62% on G-stomper swing slider for 16ths, converted to renoise 256ths of a line = 61.962890625]

00 C-4
04 C-4 F5
08 C-4
12 C-4 F5
16 C-4
20 C-4 F5
24 C-4
28 C-4 F5


[total = 1024, 1st = 634, 2nd = 390]
[62% on G-stomper swing slider for 32nds, converted to renoise 256ths of a line = 61.9140625]

00 C-4
02 C-4 7A
04 C-4
06 C-4 7A
08 C-4
10 C-4 7A
12 C-4
14 C-4 7A


[total = 512, 1st = 317, 2nd = 195]
[62% on G-stomper swing slider for 64ths, converted to renoise 256th of a line = 61.9140625]

00 C-4
01 C-4 3D
02 C-4
03 C-4 3D
04 C-4
05 C-4 3D
06 C-4
07 C-4 3D
08 C-4
09 C-4 3D
10 C-4
11 C-4 3D
12 C-4
13 C-4 3D
14 C-4
15 C-4 3D


[triplets individual note lengths, 1st = 1693, 2nd = 1037, 3rd = 1366]

00 C-4
06 C-4 9D
10 C-4 AA


[triplets individual note lengths, 1st = 846, 2nd = 519, 3rd = 683]

00 C-4
03 C-4 4E
05 C-4 55
08 C-4
11 C-4 4E
13 C-4 55


[triplets individual note lengths, 1st = 423, 2nd = 259, 3rd = 342]

00 C-4
01 C-4 A7
02 C-4 AA
04 C-4
05 C-4 A7
06 C-4 AA
08 C-4
09 C-4 A7
10 C-4 AA
12 C-4
13 C-4 A7
14 C-4 AA