Page 1 of 1

Display wave file

PostPosted: September 18th, 2011, 4:27 pm
by Mixware
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

Re: Display wave file

PostPosted: September 19th, 2011, 5:39 am
by dec
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...

Re: Display wave file

PostPosted: September 23rd, 2011, 6:21 pm
by Kambiz
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.