Re: Beats Per Minute Conversion

*To*: mathgroup at smc.vnet.net*Subject*: [mg8508] Re: [mg8471] Beats Per Minute Conversion*From*: Paulo Mouat <mouat at mail.telepac.pt>*Date*: Thu, 4 Sep 1997 02:19:52 -0400*Sender*: owner-wri-mathgroup at wolfram.com

Benjamin R. Tubb wrote: > Determine the MIDI Coarse and Fine Tuning values for converting to any > BPM playback from a given Sample Rate, MIDI Note and BPM (beats per > minute) rate. > > GIVEN: > SampleRate = 44100 kHz > Orginal BPM = 52 (beats per minute) > MIDI Note = C4 (i.e. Middle C) > Coarse Tuning = 0 (from a range, in semitones, of +/- 48) > Fine Tuning = 0 (from a range, in cents, of +/- 50) Determine Coarse and Fine Tuning for the given SampleRate and MIDI Note but depending on the intended BPM: cf[bpm_]:=Module[{c,f, t, u}, t=1200*Log[bpm/52]/Log[2]; u=Quotient[t,100]; c=u+Quotient[t-100*u+50,100]; f=Round[Mod[t-100*u + 50,100]-50]; {c,f}//N] (returns a list of tuning values in the form {coarse, fine}) To calculate BPM according to Coarse and Fine Tuning: bpm[c_,f_]:=N[52*2^(c/12 + f/1200)] These functions assume C4 as the MIDI Note. For any other notes, just add (or subtract) the number of semitones up (or down) from C4 to the Coarse Tuning value. Assuming C4 = MIDI Note 0, notebpm[midinote_]:=52*2^(midinote/12)//N gives the BPM of other MIDI notes, where notes lower than C4 have negative note numbers. For different SampleRates (in Hz), NewBPM = BPM*SampleRate/44100 where BPM is calculated using bpm[]. -- __|__ ___\_/___ Paulo Mouat, ___ mouat at mail.telepac.pt |___| http://www.geocities.com/Vienna/8804/ |___|