electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
Adding swing timing to rhythm...
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [23 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Wed Sep 12, 2007 9:35 am    Post subject: Adding swing timing to rhythm... Reply with quote  Mark this post and the followings unread

This may be a little off topic but I figured that there would be some folks around these parts that know a fair deal about rhythm and more specifically what effect swing timing has on a rhythm.

Does anyone know of any sites or books that deal in depth with such a topic or even give some small insight into the matter.

So far all I know is that swing timing can be achieved by delaying or bringing forward the playback of a drum sample by a fraction of a beat.

Thanks, and apologies if I'm posting this in the wrong area but its all part of my ChucK project so I thought I'd start here.

Rhys
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Sep 12, 2007 10:06 am    Post subject: Reply with quote  Mark this post and the followings unread

Sure. Let's say we have a simple rhythm;

kick, h.hat, snare, h.hat

Let's say these are spaced evenly. To make it "swing" you basically have to delay the "off beat" hits, in this case the highhats. How far to delay them is now the question... A good place to start is to make the time between the kick and the hat twice as long as the time between the hat and the snare.

Let's say your loop is 16 counts long, the code in this case would look like this;

int step;
dur some_time;
dur the_rest;

while(true)
{
//your stuff goes here

//increase the step counter and make it wrap around
++step%16 => step;

//advance time by a different amount for odd and even beats
if ( step % 2) the_rest => now; //duration of a off-beat
else some_time => now; //duration of a on-beat
}

here "some_time" and "the_rest" should add up to two beats and probably "some_time" will be about twice as long as "the_rest", longer values can work for lower BPM's, at higher BPM's it sounds better if they are more similar.

Hope that gets you started. There was a really good page with interesting research on this that I just consulted a few days ago but now it seems to have disappeared. Also; what sounds good in practice depends a lot on the sounds used but 2:1 as a ratio is a good place to start.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
moudi



Joined: Oct 07, 2006
Posts: 63
Location: Bern Switzerland

PostPosted: Wed Sep 12, 2007 2:22 pm    Post subject: Reply with quote  Mark this post and the followings unread

hi

i can explain the theory which i learned at the jazz school.
it's quit easy to understand (if i'm able to explain it correctly in english) Wink

the swing comes from the correct phrasing of the eights.
they are played as triplets where an eight on the beat counts 2 of the triplets and the eight off the beat counts 1 of the triplets.
that's all - theoretically.
of course there's a lot about personal interpretation and styling which makes the swing unique by each musician.

hope this helps
/moudi
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Thu Sep 13, 2007 3:02 am    Post subject: Reply with quote  Mark this post and the followings unread

That page is back!

http://www.speech.kth.se/music/performance/performance_rules.html

Click on "ensemble swing" for a lot of info on swing, including even a formula that could be copied straight into ChucK. (I'm linking to the main page because the rest is interesting as well).

This covers a lot more then is normally covered on this topic, like different amounts of swing for drums and soloists, the effect of BPM and it also shows that you can have *more* swing then triplet timing, at least for drums and at lower tempos.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Thu Sep 13, 2007 4:05 am    Post subject: Reply with quote  Mark this post and the followings unread

This is some truly-eye opening stuff and I now have a lot of reading/research to do!

I like the idea of delayed triplet timing as that should be easy enough to implement mathematically as fractions of a beat/bar.

Thanks guys.

Rhys
Back to top
View user's profile Send private message
robin746



Joined: Sep 02, 2007
Posts: 26
Location: Eire

PostPosted: Wed Sep 19, 2007 5:36 am    Post subject: Reply with quote  Mark this post and the followings unread

Brilliant reference Kassen!

One question for you, to be sure I've got this right. I am referring to this page.

It defines swing ratio is the ratio between the long and short notes on consecutive eighth notes. Do they mean the note durations? I assume so, since later on the same page they talk about the note delays as something different. But this confuses me because I would have reserved the term for the delays of the offbeats -- when we talk about swing that is generally the effect we are going on about.

Or are both of the graphs about delay, but in different ways? Colour me confused.
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Sep 19, 2007 6:50 am    Post subject: Reply with quote  Mark this post and the followings unread

Well, asuming a static BPM and so keeping all the first counts of the bar in place the delay of the off-beat follows directly from the ratio between the length of time between the kick and the highhat (to simplify towards house-music terminology) and the time from that highhat to the next snare (or kick).

I believe they count the length of a beat there as the length between it's attack and the the attack of the next beat.

This would likely be a different interpretation of note-length then the one used in their analysis of melodic playing; this refers to where the note starts sounding and when the next one starts which is subtly different from their actual length (particularly with cymbals that might be sounding nearly non-stop yet still be struck at discrete and variable moments.

At least that's how I read it. I just took their equation, performed some math on it to translate the ratio given and the duration of a "straight" beat at that BPM, then extracted two durations. I use either one, depending on "step%2" like in my example above. This works and sounds nice and isn't too hard.

I didn't try to translate their research into lengths of melodic notes to ChucK yet, I'd love to hear what people come up with there.

I hope that answers the question?

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
robin746



Joined: Sep 02, 2007
Posts: 26
Location: Eire

PostPosted: Wed Sep 19, 2007 7:07 am    Post subject: Reply with quote  Mark this post and the followings unread

Kassen wrote:
here "some_time" and "the_rest" should add up to two beats and probably "some_time" will be about twice as long as "the_rest", longer values can work for lower BPM's, at higher BPM's it sounds better if they are more similar.


So if x = "the_rest" and y = "some_time" your statements translate as:
x + y = 2 beats
y = 2x

So x = 2/3 beat.

I guess we are talking about simple triplets here!

Kassen wrote:
I believe they count the length of a beat there as the length between it's attack and the the attack of the next beat.


Fair enough.

Kassen wrote:
I hope that answers the question?


Not really. Smile But I assume from this that both graphs are in fact dealing with delay and not duration.
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Sep 19, 2007 8:38 am    Post subject: Reply with quote  Mark this post and the followings unread

The top graph, if we are talking about the same two graphs, plots ratio against BPM. The ratio here is the number of times you can fit the duration of the shorter upbeat into the longer downbeat.

So, if a certain measured groove has a ratio of two that means the downbeat is twice as long as the upbeat so that's triplet timing.

Since the measured ratio is higher then that at "house/dance/techno bpm's" we now know that by jazz standards we can safely use a lot more swing in those styles then consumer applications let us.

The second plot is just a different way of plotting the same data, the interesting bit is the formula and that one takes BPM as a input and the ratio as a output. So; if the number 3.5 comes out of that it means that the downbeat lasts

(3.5 / 4.5) * 2::straight_beat => dur downbeat; //the 4.5 is just 3.5 + 1

and the upbeat lasts

(1 / 4.5) * 2::straight_beat

At least if you follow that formula.

The delay would be "straight_beat - upbeat" in that case but for us working with durations is both cleaner and cheaper on the CPU then using delay.

At least that's how I read it.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Wed Sep 19, 2007 12:02 pm    Post subject: Reply with quote  Mark this post and the followings unread

I'd just thought I'd upload where I've got to with the swing side of things....

I wouldnt be able to have done it without the help from you guys so its only fair. I've a long way to go but its taking shape.

Thanks

Rhys

PS. Its a generative cutter at the moment and I've no idea where this project is going to lead just yet but I am v. keen on implementing some live coding using Chucks "On The Fly" programming library.


Cuts2.wav
 Description:

Download
 Filename:  Cuts2.wav
 Filesize:  2.75 MB
 Downloaded:  472 Time(s)

Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Sep 19, 2007 1:21 pm    Post subject: Reply with quote  Mark this post and the followings unread

Sounds great! Would you share a little about the technique behind some of those more "elastic" sounding passages? I like those a lot.

At any rate I'd like to hear where this is going, both technologically and musically.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Wed Sep 19, 2007 2:19 pm    Post subject: Reply with quote  Mark this post and the followings unread

Its essentially taking a lot of beats and cutting them up in ChucK, as opposed to something like Recycle.

The beauty of ChucK, as you know, is its ability to almost stop time whilst you can have a whole list of commands happening before telling time restart again...

In other words I can replay a drum pattern from various different points in a buffer whilst having different patterns spanning multiple buffers. Each drum pattern can be played at a very specific point during a set bar of varying time signatures*.

In other words I can play the drum loop sample from Buffer1 (played from beat 1) for the first half of the bar then follow that up with the loop stored in Buffer2 (played from beat 3) for the second half of the bar.

The difficulty arises in matching all the BPMs of each beat and putting an algorithm in place to make it sound interesting and not too messy.

I hope to be able to write some interesting music live enventually but as I'm doing this for my final year project at uni I cant share the code just yet.

Thanks

Rhys

*In the case of this uploaded wav it is all 4/4 time and at 176 BPM.
Back to top
View user's profile Send private message
drooler



Joined: Aug 23, 2007
Posts: 3
Location: california

PostPosted: Wed Sep 19, 2007 5:03 pm    Post subject: re:elastic beats Reply with quote  Mark this post and the followings unread

To get the elastic... or "bouncing ball" sound just vary timing of the drum hits by a factor. ie;

"400=>int timing;
for(int i=1;...)

timing=>now;
timing*.8=>timing;}"

You can also do the same thing with just about any other component of the sound and get some pretty interesting results.

Go to youtube... search for aphex twin. The technique is used in alot of his music.
Back to top
View user's profile Send private message
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Thu Sep 20, 2007 2:51 am    Post subject: Reply with quote  Mark this post and the followings unread

Yes but varying drum hits by a factor is essentially a mathematical way of explaining how to play any drum within a given time signature?!

For example if I were to have a 4/4 bar length of time and divide that by 4 that would mean that I could get the drum to hit by a factor of a crotchet each time. By 12 would be a triplet, by 8 a quaver etc.

That would be no different to writing it in a drum sequencer and would sound either fussy or not quite right.....
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Thu Sep 20, 2007 4:16 am    Post subject: Reply with quote  Mark this post and the followings unread

Ah, lovely.

If you guys haven't yet; there are some papers online by Nick Collins who did a lot of stuff with breaks and SuperColider and was kind enough to document a lot of his process.

Here you go;
http://www.cus.cam.ac.uk/~nc272/publications.html

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
robin746



Joined: Sep 02, 2007
Posts: 26
Location: Eire

PostPosted: Sat Sep 22, 2007 3:21 am    Post subject: aside: more on bouncing ball Reply with quote  Mark this post and the followings unread

Aphex Twin most famously used the "bouncing ball" sound in "Bucephalus Bouncing Ball", though I was never that impressed by how this was integrated into the composition. I mean, it's cool and all, but not up his usual standards of brilliance.

You should check out "In the Musicals" from Bjork's incredible Selmasongs. Each track on this album integrates found sounds into a rich composition.

A ball bouncing changes speed by a factor known as its "coefficient of restitution" which tends to be constant. So one can get a pretty good simulation, as stated earlier, by using a simple factor like 0.8. Decrease the pause between beats by this much each time and the beats will get faster and faster.

What you also want to do for "realism" is adjust the timbre as well for each subsequent beat, say by changing a low-cut filter cutoff point.
Back to top
View user's profile Send private message Visit poster's website
renderful



Joined: Apr 18, 2007
Posts: 29
Location: Boulder, Co

PostPosted: Sat Sep 22, 2007 7:00 pm    Post subject: Reply with quote  Mark this post and the followings unread

I have been learned. Great thread, thanks all of you. Hope to be able to contribute soon.
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Sep 23, 2007 3:50 am    Post subject: Re: aside: more on bouncing ball Reply with quote  Mark this post and the followings unread

robin746 wrote:

What you also want to do for "realism" is adjust the timbre as well for each subsequent beat, say by changing a low-cut filter cutoff point.


Or you can pitch down the whole sample by some fraction. AFX's track sounds to me like that's what he does.

I kinda agree with the lack of integration there; it could've been better but I still like that track a lot.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Sep 23, 2007 5:28 am    Post subject: Reply with quote  Mark this post and the followings unread

BTW, there is even more complicated stuff going on in real ensembles. A friend of mine studied musicology at the university of Utrecht and studied timing in Jazz and Baroque ensembles. According to his research the rest of the ensemble will follow the timing of one of the musicians but which one is being followed at any given moment depends on the context. I could look up the details but the paper is in Dutch and I only have a hard-copy of it. If anyone is interested I can look up the details and summarise them. Sadly the budget and time didn't allow for more and more in-depth research but there were some interesting points there.
_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
robin746



Joined: Sep 02, 2007
Posts: 26
Location: Eire

PostPosted: Sun Sep 23, 2007 7:29 am    Post subject: Reply with quote  Mark this post and the followings unread

Oh yes, in real ensembles things are definitely more complicated. Having played in classical orchestras (in my youth) and watched a lot of jazz (in my adulthood) I can be sure of that! I think the conductor is primarily responsible for changing both dynamics and tempo to give a piece an emotional resonance beyond what the score lays out.

It might be intriguing to model a jazz group as a flock of birds. Each has a certain centre-point and a different tendency to wander, but a simple rule means they travel together, as each looks towards the centre to be sure they are not straying too far, and each follows the leader to be sure they are not too far away.

Maybe that's why they called it Birdland! Charlie Parker would approve!

Smile
Back to top
View user's profile Send private message Visit poster's website
Low Note



Joined: Jul 20, 2007
Posts: 146
Location: New Jersey
Audio files: 2

PostPosted: Sun Sep 23, 2007 8:02 am    Post subject: Reply with quote  Mark this post and the followings unread

what's also interesting is in chamber music groups how the anchor point for pitch, dynamics, and tempo change from section to section, or sometimes even between sections. Trying to work it out so we were conscious of it was where a lot of my rehearsal time went in my years of playing in brass quintets.
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Sep 23, 2007 9:01 am    Post subject: Reply with quote  Mark this post and the followings unread

Ha! At this rate dr.S will end up with a beat-cutter the size of a phonebook!
_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Sun Sep 23, 2007 9:19 am    Post subject: Reply with quote  Mark this post and the followings unread

Its 45 pages long and counting....

I'm working on ways to make the code more concise whenever possible but all this extra useful information from you lot is very welcoming and gives me plenty of roads to go down and more interesting areas in which I can do some research.

Thankyou.

Rhys
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [23 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use