Display wave file

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

Display wave file

Postby Mixware » September 18th, 2011, 4:27 pm

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: September 18th, 2011, 8:05 am

Re: Display wave file

Postby dec » September 19th, 2011, 5:39 am

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
Senior Member
Senior Member
 
Posts: 56
Joined: July 17th, 2011, 12:33 am

Re: Display wave file

Postby Kambiz » September 23rd, 2011, 6:21 pm

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: 2429
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 4 guests

cron