Display wave file

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

Display wave file

Postby Mixware » 18/09/11 16:27

Hi
I have used something like this code to display a wavefile while it is playing.

procedure TMainForm.StockAudioPlayerLevel(Sender: TObject; Level: Integer);
var Leftpoint:integer;
begin
Leftpoint := Round(Image1.Width * (StockAudioPlayer.Position/WaveStorage1.Wave.Length));
Image1.Canvas.Pen.Style := psSolid;
Image1.Canvas.Pen.Width := 1;
Image1.Canvas.Pen.Color := clGreen;
Image1.Canvas.MoveTo(Leftpoint,Image1.Height);
Image1.Canvas.LineTo(Leftpoint,Image1.Height - Round(Image1.Height * (Level/100)));
end;


Is there a way to display the whole wavefile when loaded without playing it, just liken other wave editors like Cool Edit or Audacity .

Kind regards
Erik
Mixware
Member
Member
 
Posts: 1
Joined: 18/09/11 08:05

Re: Display wave file

Postby dec » 19/09/11 05:39

Hello,

Is there a way to display the whole wavefile when loaded without playing it, just liken other wave editors like Cool Edit or Audacity .


You cannot use the "Length" property once the Wave is loaded? I think so...
dec
Active Member
Active Member
 
Posts: 9
Joined: 17/07/11 00:33

Re: Display wave file

Postby Kambiz » 23/09/11 18:21

Mixware,
For drawing graph of the wave, you have to use value of audio samples of each channel as the Y axis of the curve. The value of samples depends on the audio format. This value For 8-bit PCM is in range 0 to 255 and for 16-bit PCM is in range -127 to 127.

dec,
There is no problem in using Length property.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2152
Joined: 07/03/03 19:10
Location: Tehran, Iran


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 0 guests