[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] convert audio files tempo/dur to globol tempo



Hia all

I'm trying to work out a scaling function which would offset a sample
players rate arg in order to compensate for the file's duration in relation
to that of a global tempo's duration.

I am trying to get a grip on the pattern functionality in SC so the global
tempo factor could be accessed from a Pbind
s.boot;
(
Pbind(\tempo,Pseq([
                  Pseq([180/60],8),
                  Pseq([150/60],8),
                  Pseq([120/60],8),
                  Pseq([90/60],8)],inf),
      \dur,1,
      \amp,0.08,
      \legato,0.2).play;

Pbind(\midinote,Prand([70,80,85,65],inf),
      \dur,0.5,
      \amp,0.03,
      \legato,0.041).play
) 

I am working with a bunch of recorded tempo driven audio files which all
have different tempos.
as an example i have been working with the audio files from BBCut2.
The main problem is that a loaded files tempo/dur is different in relation
to the global tempo/duration. one way to solve this is to scale the file's
duration viva Rate to that of the global tempo duration.
But I'm really having problems with the math. As i can see it the main
factors would be

//MAIN FACTORS

//sound file tempo BPM
//sound file tempo BPS
//global tempo in [BPS,BPM] for default TEMPOClock 
//PlayBuf play back speed. RATE 1.0 - 2.0 raise One octave = double playBack
speed = fileDur / 2; 
//                         RATE 1.0 - 0.5 drop One Octave = half playBack
speed = fileDur * 2;
// scaleRatio ???

//soundfiles
s.boot;
(" cd sounds/; ls").unixCmd;
a = Buffer.read(s,"sounds/break");   //8 beats
b = Buffer.read(s,"sounds/break2");  //4 beats

//gain info from sound files (BPM,BPS,Dur)

(8/(a.numFrames/a.sampleRate))*60; //file1 BPM  (8 beats long)
(4/(b.numFrames/b.sampleRate))*60; //file2 BPM  (4 beats long)
8/a.duration;  //file1 BPS
4/b.duration;  //file2 BPS
a.duration/2;     //2 bar file; one bar length in seconds at 161.75324377608
BPM 
b.duration;       //1 bar file; one bar length in seconds at 161.4990234375
BPM
(a.duration/2)/4; //1 1/4 beat in seconds 
b.duration/4;     //1 1/4 beat in seconds

//global tempo - length of one 1/4 beat in seconds
(60/150.00);

//global tempo - number of beats in one second
(150/60)

//global tempo - Duration in seconds per 4/4 bar
//seconds / BPM * numBeatsInBar(s)
((60/150.00)*4)*2

// the difference in seconds between buffer A and global tempo is
((60/150.00)*4)-b.duration 

as i can see it you would want to give the same values you would normal give
Rate/stretch
(PlayBuf,Warp0,PV_PlayBuf) but have them scaled according to the global
tempo. So 2 would be double and 0.5 would be half the global tempo.

I have played around(in the dark) with these numbers but i'm getting very
confused.
Unfortunately this is as far as i can take it.
if anyone has the time to explain this further that would be great.


Thanks in advance 

d.shoes
-- 
View this message in context: http://www.nabble.com/convert-audio-files-tempo-dur-to-globol-tempo-tp22337935p22337935.html
Sent from the Supercollider - User mailing list archive at Nabble.com.


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/