如何用声卡向内存录音并且确保录成的是WAV或PAM格式 的实例(100分)

  • 主题发起人 主题发起人 wgd2001
  • 开始时间 开始时间
W

wgd2001

Unregistered / Unconfirmed
GUEST, unregistred user!
我要的不是用声卡录成WAV或PCM文件。我想当声卡录音到内存以后(如1024个字节大小)用
其他的设备去读取内存块里面的数据再放出来。我写了一点但它录出来的并不是真真的WAV格式的大家看一看。
procedure TFormMain.FormCreate(Sender: TObject);
var
n,i:Int64;
begin

Self.Caption:=Application.Title;
mpVocData:=nil;
mVocDataSize:=0;

Button2.Enabled:=False;
Button3.Enabled:=True;
Button4.Enabled:=False;
lpc10:=UTSpeechCodec.Create(8);
PChRecMem:=nil;
PChRecMem1:=nil;
ChRecMemLen:=192;
PChRecMem:=GetMemory(ChRecMemLen);
PChRecMem1:=GetMemory(ChRecMemLen);

WaveIn:=UTWaveIN.Create(1, 8000,
8,WAVE_FORMAT_1M08, Self.Handle);
WaveOut:=UTWaveOut.Create(1, 8000,
8,WAVE_FORMAT_1M08, Self.Handle);




n:=1024+512;
mpVocData:=GetMemory(n);
mVocDataSize:=n;
WaveIn.addBuffer(n);
// WaveIn.addBuffer(n);
ProgressInBarVal.Min:=0;
ProgressBarOutVal.Min:=0;
case (lpc10.getBitsPerSample div 8) of
1:
begin

ProgressInBarVal.Max:=MAXBYTE;
ProgressBarOutVal.Max:=MAXBYTE;
end;

2,3:
begin

ProgressInBarVal.Max:=MAXSHORT;
ProgressBarOutVal.Max:=MAXSHORT;
end;

4,5,6,7:
begin

ProgressInBarVal.Max:=MAXLONG;
ProgressBarOutVal.Max:=MAXLONG;
end;

8:
begin

ProgressInBarVal.Max:=MAXLONG;
ProgressBarOutVal.Max:=MAXLONG;
end;

end;

MemoTip.Clear;
if InitVociceCard<0 then

begin

MemoTip.Lines.Add('ERROR: Synway VocCard driver not installed.'#7);
end
else

begin

MemoTip.Lines.Add('System Installed.'#7);
end;

ng:=SsmCreateConfGroup(64,24,10,5);
MemoTip.Lines.Add(Format('alloc group %d .',[ng]));
SsmHangup(MicInCh);
n:= SsmJoinConfGroup(ng,MicInCh,1,0,False,False);
if n>=0 then

begin

MemoTip.Lines.Add(Format('channel %d join return %d .',[MicInCh,n]));
end
else

begin

MemoTip.Lines.Add(Format('channel %d join fail return %d !',[MicInCh,n]));
end;



isAddToCong:=False;
TimerMix.Enabled:=True;

end;


请多指教
 
后退
顶部