### Author Topic: Pitch/tempo?  (Read 3277 times)

#### cooly

• Guest
##### Pitch/tempo?
« on: 20 May '03 - 16:44 »
Hi, how can i set the tempo (pitch) of one song? How to speed it up or down?

#### Chris

• Posts: 2210
##### Re: Pitch/tempo?
« Reply #1 on: 20 May '03 - 16:55 »
Code: [Select]
`function TPlayerA.MinMaxR(x, min, max: extended): extended;begin   if x < min then Result := min   else if x > max then Result := max   else Result := x;end;procedure TPlayerA.SetPitch (value : float);varfreq : Integer;s : single;begin    s := ((Value*(wavefreq / 100) )+ wavefreq);    freq :=Trunc( MinMaxr(s,100,100000));  BASS_ChannelSetAttributes(Channel, freq, -1, -1);end;/////////////////////////////////////////////////////function TPlayerA.GetPitch  : float;varhandle, freq, volume : DWORD; Pan : Integer;s: Integer;beginBASS_ChannelGetAttributes(Channel, freq, volume, Pan);Result := (freq - wavefreq)/(wavefreq / 100);end;`

Chris
« Last Edit: 20 May '03 - 16:58 by Chris »

#### cooly

• Guest
##### Re: Pitch/tempo?
« Reply #2 on: 20 May '03 - 17:11 »
Thanx, it works. But i dont know whereis center. Minimum is 100, maximum is 100000. Logically center would be 49950 but it is not. Maybe do you know where is musing playing with the same tempo as default?

#### Chris

• Posts: 2210
##### Re: Pitch/tempo?
« Reply #3 on: 20 May '03 - 17:33 »
The MinMaxR function will check if you try to Pitch a Result that isn`t possible.
Max and Min on a soundcard is 100 hz /100000 hz....

Pitch 0.0 = Frequenz of your song (normaly 44100)

Chris

#### cooly

• Guest
##### Re: Pitch/tempo?
« Reply #4 on: 20 May '03 - 17:36 »
uhh,sure,how didnt i thought it.i'm so stupid:)

thanx for your help a lot !