MCI Audio Recorder Component — sgcAI | eSeGeCe

Audio Recorder (MCI)

TsgcAudioRecorderMCI records microphone audio to a WAV file through the Windows MCI API. It watches the input level and closes the segment automatically after a period of silence, which is what makes hands-free voice interaction possible.

TsgcAudioRecorderMCI

File-based microphone capture with silence detection. It is the recorder the chatbot, translator and assistant components expect by default.

Component class

TsgcAudioRecorderMCI

Purpose

Microphone capture to file

Platforms

Win32 and Win64

sgcAI is self-contained. This component ships inside sgcAI together with the sgcWebSockets Core runtime it is built on, so there is no base license to buy.

Record until the speaker stops

Set a level threshold and a silence window, then start. The component decides when the sentence ended.

uses
  sgcAI, sgcAI_AudioRecorder_MCI;

var
  oRecorder: TsgcAudioRecorderMCI;
begin
  oRecorder := TsgcAudioRecorderMCI.Create(nil);
  oRecorder.RecorderOptions.Filename := 'question.wav';
  oRecorder.RecorderOptions.Mode     := camoAuto;

  // Stop after 1500 ms below the level threshold.
  oRecorder.MCIOptions.LevelMin  := 100;
  oRecorder.MCIOptions.StopAfter := 1500;

  oRecorder.Start;   // Stop ends capture immediately

  // Usually you just hand it to a voice component:
  sgcAIOpenAIChatBot1.AudioRecorder := oRecorder;
end;
// includes: sgcAI.hpp, sgcAI_AudioRecorder_MCI.hpp

TsgcAudioRecorderMCI *oRecorder = new TsgcAudioRecorderMCI(NULL);
oRecorder->RecorderOptions->Filename = "question.wav";
oRecorder->RecorderOptions->Mode     = camoAuto;

oRecorder->MCIOptions->LevelMin  = 100;
oRecorder->MCIOptions->StopAfter = 1500;

oRecorder->Start();

sgcAIOpenAIChatBot1->AudioRecorder = oRecorder;

Key properties & methods

The members you reach for most often.

RecorderOptions

Filename is where the WAV is written. Mode chooses camoManual, where you call Start and Stop yourself, or camoAuto, where capture restarts after each answer has been spoken.

MCIOptions

LevelMin is the input level below which the signal counts as silence, and StopAfter is how long that silence must last before the segment is closed.

Session

Start begins capture and Stop ends it immediately. In automatic mode the silence detector calls Stop for you.

Recording format

Audio is captured as 16 bit mono at 22050 Hz, which is what the speech to text endpoints expect and keeps the uploaded file small.

Concurrent instances

Each recorder allocates a unique MCI alias, so two recorders can run in the same process without interfering with each other.

Wiring

Assign it to AudioRecorder on a chatbot, translator or assistant component and the whole capture, transcribe and answer loop is handled for you.

Keep exploring

Online HelpFull API reference and usage guide for the sgcAI components.
All sgcAI ComponentsBrowse the full feature matrix of all 15 components.
Download Free TrialCapture microphone input and feed it to a speech to text model.
PricingSingle, Team and Site licenses, full source code, no base product required.
Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Ready to Get Started?

Download the free trial and add hands-free voice input to your application.