Skip to main content

Code sample - Audio capture to WAV file with or without compression

Delphi and C# (ActiveX) sample code.

Get a list of available audio codecs

for I := 0 to VideoCapture1.Audio_Codecs_GetCount - 1 do
cbAudioCodec2.Items.Add(VideoCapture1.Audio_Codecs_GetItem(i));
for (int i = 0; i < VideoCapture1.Audio_Codecs_GetCount(); i++)
cbAudioCodecs2.Items.Add(VideoCapture1.Audio_Codecs_GetItem(i));

Select audio codec

VideoCapture1.Audio_Codec := cbAudioCodec2.Items[cbAudioCodec2.ItemIndex];
VideoCapture1.Audio_Codec = cbAudioCodecs2.Text;

Set audio settings

VideoCapture1.Audio_Channels := strtoint(cbChannels2.Items[cbChannels2.ItemIndex]);
VideoCapture1.Audio_BPS := strtoint(cbBPS2.Items[cbBPS2.ItemIndex]);
VideoCapture1.Audio_SampleRate := strtoint(cbSamplerate2.Items[cbSamplerate2.ItemIndex]);
VideoCapture1.Audio_Channels = Convert.ToInt32(cbChannels2.Text);
VideoCapture1.Audio_BPS = Convert.ToInt32(cbBPS2.Text);
VideoCapture1.Audio_SampleRate = Convert.ToInt32(cbSampleRate2.Text);

Use PCM/ACM format for output

VideoCapture1.OutputFormat := Format_PCM_ACM;
VideoCapture1.OutputFormat = VisioForge_Video_Capture_5.TxVFOutputFormat.Format_PCM_ACM;

Set audio capture mode

VideoCapture1.Mode := Mode_Audio_Capture;
VideoCapture1.Mode = VisioForge_Video_Capture_3.TxVFMode.Mode_Audio_Capture;

Start capture

VideoCapture1.Start;
VideoCapture1.Start();

Please get in touch with support to get help with this tutorial. Visit our GitHub page to get more code samples.