Page 1 of 1

TWaveAudio Play File

PostPosted: July 10th, 2007, 5:09 pm
by Marius0188
Dear Friends,

I am using Delphi 7, TStockAudioRecorder, TStockAudioPlayer and TWaveStorage.

My application records to a file and then stores the avi file in a database.
To replay a recording I save the the Blob field to file and use TStockAudioPlayer and TWaveStorage to play it.

The recording side is working 100%. I can also save a recording from DB to file and play it with the normal Windows Media Player, it's working but when trying the replay the recording with the TStockAudioPlayer there is no sound.

Here is the code for replaying:
Code: Select all

  trView.Active := True;
  qView.SQL.Text := 'SELECT RecordingTitle, Recording, FileExtention FROM tblRecordings WHERE RecordingID = ' + IntToStr(Integer(lsvRecordings.Selected.Data));
  qView.Open;
  FWavFile := FTempPath + qView.FieldByName('RecordingTitle').AsString +
    qView.FieldByName('FileExtention').AsString;

  (qView.FieldByName('Recording') AS TBlobField).SaveToFile(FWavFile);

  waStorage.Wave.LoadFromFile(FWavFile);
  trackProgress.Position := 0;
  trackProgress.Max := waStorage.Wave.Length;
  waStockPlayer.PlayStock(0);


Can Someone please advise me.

Thanks in advance.

PostPosted: July 10th, 2007, 9:24 pm
by Kambiz
  • Are you sure the recording process is correct?
  • Did you try to saved file (from the above code) using Windows Sound Recorder or Windows Media Player?
  • Are you sure the blob field doesn't see data as text to try to automatically convert its character encoding?

In other hand, you do not need to use TWaveStorage as an intermediate storage. Use TStockAudioRecorder and TStockAudioPlayer to record and play audio directly from a file.

Even you do not need to use a temporary file. You can use TStockAudioRecorder and TStockAudioPlayer to record and play audio directly from a stream. In your case, the stream is a TBlobStream.