cjong75
asked on
Create new wav file
I did a program in delphi 3.0 to record a wav file. I manage to record using media player. the file i create was saved in c:\sound.wav.
The problem is, I can't save in a new file. the sound I recorded keep on append to the c:\sound.wav
Thank you.
The problem is, I can't save in a new file. the sound I recorded keep on append to the c:\sound.wav
Thank you.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
If the file c:\sound.wav didn't exist, then i can't save the file i've recorded.(an error message appear .. something to do with EMCI error).The program halted.
Then, i create a fail name sound.wav in c:\ to solve the problem.
The program can run and the recorded voice can be saved in c:\sound.wav
But, each time i record my voice it does not overwrite the existing file(sound.wav).
Thank you.
"""If the file c:\sound.wav didn't exist, then i can't save the file i've recorded
""""
do this:
Var fl: TFileStream;
fl:= TFileStream.Create('c:\sou nd.wav',fm OpenWrite) ;
fl.Free;
"""But, each time i record my voice it does not overwrite the existing file(sound.wav).
""""
do this then:
if FileExists('c:\sound.wav') then DeleteFile('c:\sound.wav);
before recording..
you can use both things together.. first check if file exists, if so, delete it..
""""
do this:
Var fl: TFileStream;
fl:= TFileStream.Create('c:\sou
fl.Free;
"""But, each time i record my voice it does not overwrite the existing file(sound.wav).
""""
do this then:
if FileExists('c:\sound.wav')
before recording..
you can use both things together.. first check if file exists, if so, delete it..
mediaplayer1.filename:= newfilename;
mediaplayer1.open;