electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
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 
go to the radio page Live at electro-music.com radio 1 Please visit the chat
poster
 Forum index » DIY Hardware and Software » Supercollider
TempoClock and changing meters
Post new topic   Reply to topic Moderators: v-un-v
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
dewdrop_world



Joined: Aug 28, 2006
Posts: 858
Location: Guangzhou, China
Audio files: 4

PostPosted: Sun Apr 27, 2008 8:26 pm    Post subject: TempoClock and changing meters Reply with quote  Mark this post and the followings unread

Sometimes it depresses me that there's so little activity on the supercollider board here... but no sense in complaining, the only way to deal with it is to start something! I don't have much free time, but I'm sure I can think of some topics here and there, things that I've been working on, that might be useful. Actually there is quite a lot lately that is generally useful -- right now I'm working on a piece for violin and computer that is mostly through-composed, though it will have some aleatoric sections. That means devising structures to represent the form and keep the computer in sync with the score.

Lately I've been working on TempoClock and meter changes. Believe it or not, in five years of working with supercollider I haven't done anything that requires a single meter change! Either it's been closely related enough to dance music to stay in 4/4 the whole time, or it's unmetered (that is, beats are simply a time reference with no larger organization).

TempoClock uses a couple of numbers to represent the meter:

- beatsPerBar, assuming 1 is one beat
- baseBarBeat = the beat number from which bar lines will be measured
- baseBar = the bar number when the meter was last changed

For instance, starting from beat 0, if you have 4 bars of 4/4 and 4 bars of 3/4, it would break down like this:

beatsPerBar = 4, baseBarBeat = 0, baseBar = 0
^^ representing bars 0-3 with barlines at 0, 4, 8, 12

beatsPerBar = 3, baseBarBeat = 16, baseBar = 4
^^ representing bars 4-7 with barlines at 16, 19, 22, 25 etc.

You're not limited to integers for beatsPerBar -- 5/8 would be represented by 2.5, with some bar lines occurring at *.5 -- but the bar line is really arbitrary, just a calculation, doesn't need to be tied to integers.

You can identify any point in time relative to the meter using several methods:

Code:
clock.nextTimeOnGrid(-1, 0) -- next barline
clock.nextTimeOnGrid(-2, 0) -- 2 barlines from now -- -3 = 3 barlines etc.

clock.nextTimeOnGrid(-1, 1) -- next barline + 1 beat, etc.

clock.nextTimeOnGrid(4, 0) -- next multiple of 4 beats above baseBarBeat

clock.bars2beats(barNumber) + beatWithinBar


nextTimeOnGrid is called automatically by myClock.play(thing, quant), where the quant parameters are passed into nextTimeOnGrid. So all this is transparent.

This all depends on supplying the right time for the meter change. You could set beatsPerBar using regular setter syntax -- myClock.beatsPerBar = 3.5 -- but weird things happen if that action is scheduled for any time other than the exact bar line when the meter should change. So I prefer this addition, which is custom for now but I hope to be able to check it into svn soon.

Code:
+ TempoClock {
   setMeterNextBar { arg beatsPerBar;
      if(this.beats <= (this.nextBar - beatsPerBar)) {
         this.schedAbs(this.nextBar, { this.setMeterAtBeat(beatsPerBar, this.nextBar) });
      } {
         this.setMeterAtBeat(beatsPerBar, this.nextBar);
      }
   }
}


Using that method, you can be sure that the 3 meter parameters are always valid.

For the piece, I have in mind a conductor process that will do the meter changes automatically. For some rhythm-generator processes, I will also need a representation of the accent structure within the bar, but I haven't decided yet what that should look like. I'm writing these processes using my chucklib extensions.

Hope this piques some interest --
James

_________________
ddw online: http://www.dewdrop-world.net
sc3 online: http://supercollider.sourceforge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address
v-un-v
Janitor
Janitor


Joined: May 16, 2005
Posts: 8932
Location: Birmingham, England, UK
Audio files: 11
G2 patch files: 1

PostPosted: Mon Apr 28, 2008 1:22 am    Post subject: Re: TempoClock and changing meters Reply with quote  Mark this post and the followings unread

dewdrop_world wrote:
Sometimes it depresses me that there's so little activity on the supercollider board here...


It's finding the time to apply oneself, however it is great that you are still posting Very Happy

Keep up the good work!

_________________
ACHTUNG!
ALLES TURISTEN UND NONTEKNISCHEN LOOKENPEEPERS!
DAS KOMPUTERMASCHINE IST NICHT FÜR DER GEFINGERPOKEN UND MITTENGRABEN! ODERWISE IST EASY TO SCHNAPPEN DER SPRINGENWERK, BLOWENFUSEN UND POPPENCORKEN MIT SPITZENSPARKSEN.
IST NICHT FÜR GEWERKEN BEI DUMMKOPFEN. DER RUBBERNECKEN SIGHTSEEREN KEEPEN DAS COTTONPICKEN HÄNDER IN DAS POCKETS MUSS.
ZO RELAXEN UND WATSCHEN DER BLINKENLICHTEN.
Back to top
View user's profile Send private message Send e-mail
dewdrop_world



Joined: Aug 28, 2006
Posts: 858
Location: Guangzhou, China
Audio files: 4

PostPosted: Tue Apr 29, 2008 8:35 pm    Post subject: Reply with quote  Mark this post and the followings unread

I realize I'll probably be talking mostly to myself for awhile at least... I think the concern remains that somebody comes here, looks at the SC board and the ChucK board and reaches the erroneous conclusion that SC is dead. A quick glance over the mailing list mirror at nabble.com should dispel that notion... but how would someone know that just by looking here? Smile

The only way to deal with it is to start something...
James

_________________
ddw online: http://www.dewdrop-world.net
sc3 online: http://supercollider.sourceforge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic Moderators: v-un-v
Page 1 of 1 [3 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 » Supercollider
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