Pitch/tempo?

Started by cooly, 20 May '03 - 16:44

cooly

Hi, how can i set the tempo (pitch) of one song? How to speed it up or down?

Thanx for answer !

Chris

#1

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);
var
freq : 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;
var
handle, freq, volume : DWORD; Pan : Integer;s: Integer;
begin
BASS_ChannelGetAttributes(Channel, freq, volume, Pan);
Result := (freq - wavefreq)/(wavefreq / 100);
end;


Chris

cooly

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

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

uhh,sure,how didnt i thought it.i'm so stupid:)

thanx for your help a lot !

Quick Reply

Warning: this topic has not been posted in for at least 365 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:
Shortcuts: ALT+S post or ALT+P preview