Wave Audio Recorder Component — sgcAI | eSeGeCe

Audio Recorder (Wave)

TsgcAudioRecorderWave captures the microphone through the Windows Wave API and delivers the audio as a live stream rather than a file. You control the sample rate, channel count and bit depth, which is what streaming and realtime scenarios need.

TsgcAudioRecorderWave

Streaming microphone capture. A worker prepares and queues buffers continuously, measures the level of each block and closes a segment after a configurable period of silence.

Component class

TsgcAudioRecorderWave

Purpose

Streaming microphone capture

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.

Capture audio as a stream

Choose the sample format, set the silence thresholds, start. Audio arrives as a stream, not a file on disk.

uses
  sgcAI, sgcAI_AudioRecorder_Wave;

var
  oRecorder: TsgcAudioRecorderWave;
begin
  oRecorder := TsgcAudioRecorderWave.Create(nil);
  oRecorder.WaveOptions.SampleRate    := 16000;
  oRecorder.WaveOptions.Channels      := 1;
  oRecorder.WaveOptions.BitsPerSample := 16;

  // Silence detection on the measured block level.
  oRecorder.WaveOptions.LevelMin     := 300;
  oRecorder.WaveOptions.StopAfter    := 1200;
  oRecorder.WaveOptions.WaitForAudio := 100;

  oRecorder.Start;   // Stop ends capture
end;
// includes: sgcAI.hpp, sgcAI_AudioRecorder_Wave.hpp

TsgcAudioRecorderWave *oRecorder = new TsgcAudioRecorderWave(NULL);
oRecorder->WaveOptions->SampleRate    = 16000;
oRecorder->WaveOptions->Channels      = 1;
oRecorder->WaveOptions->BitsPerSample = 16;

oRecorder->WaveOptions->LevelMin  = 300;
oRecorder->WaveOptions->StopAfter = 1200;

oRecorder->Start();

Key properties & methods

The members you reach for most often.

WaveOptions format

SampleRate, Channels and BitsPerSample set the capture format exactly, so you can match whatever the downstream model or codec expects.

WaveOptions gating

LevelMin is the RMS level below which a block counts as silence, StopAfter is how long that silence closes the segment, and WaitForAudio is how long each buffer is given to fill.

Streamed output

Audio is delivered as a stream while capture runs, so it can be forwarded to a realtime endpoint or encoded on the fly instead of waiting for a file to close.

Session

Start begins capture and Stop ends it. The capture loop runs on its own worker, so the UI thread is never blocked.

Versus the MCI recorder

Use this one when you need a specific sample format or a live stream. Use TsgcAudioRecorderMCI when a WAV file per utterance is all you need.

Level metering

The RMS level is computed per block from the 16 bit samples, which is also what you would drive a level meter with in the UI.

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 audio in the exact format your pipeline expects.
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 stream microphone audio from your application.