06-08-2010, 06:29 PM
I see that portaudio declares how many number of frames totalFrames = numSeconds * sampleRate; to give the length of file
and then to record:
I guess I don't know where I would put this in the dlg_wave_meter to get output a wav file.
Thanks,
Jimmy Vig
and then to record:
/* Write recorded data to a file. */
#if 1
type WAVFILEHEADER _RIFF size _WAVE _fmt_ size1 @audioFormat @nChannels sampleRate byteRate @blockAlign @bitsPerSample _data size2
WAVFILEHEADER h
memcpy &h._RIFF "RIFF" 4
memcpy &h._WAVE "WAVE" 4
memcpy &h._fmt_ "fmt " 4
memcpy &h._data "data" 4
h.size1=16
h.size2=totalFrames*numChannels*sizeof(word)
h.size=36+h.size2
h.audioFormat=1
h.nChannels=numChannels
h.sampleRate=sampleRate
h.byteRate=h.sampleRate*h.nChannels*sizeof(word)
h.blockAlign=h.nChannels*sizeof(word)
h.bitsPerSample=sizeof(word)*8
FILE* fid;
fid = fopen(_s.expandpath("$desktop$\recorded.wav"), "wb");
if(fid == 0)
,out("Could not open file.");
else
,fwrite(+&h sizeof(WAVFILEHEADER) 1 fid)
,fwrite(+data.recordedSamples, numChannels*sizeof(word), totalFrames, fid);
,fclose(fid);
,out("<>Saved to <link>$desktop$\recorded.wav</link>");
#endifI guess I don't know where I would put this in the dlg_wave_meter to get output a wav file.
Thanks,
Jimmy Vig
