How to listen to a microphone and detect sound volume in Delphi 7

I need a program to catch an event when the microphone input becomes louder than a certain threshold value. So, probably, I need to constantly listen to the microphone and somehow measure the amplitude of the sound? Is it possible to do this in Delphi 7?

+1
source share
3 answers

I recommend you watch AudioLab

+1
source

I recommend you use the BASS Audio Library http://www.un4seen.com/bass.html

BASS - -.., (MP3.. OGG..). DLL, 100 .

, . BASS Record Test Delphi, , BASS. . .

.

program rec;
uses Windows, Bass;

(* This function called while recording audio *)
function RecordingCallback(h:HRECORD; b:Pointer; l,u: DWord): boolean; stdcall;
 var level:dword; 
 begin
  level:=BASS_ChannelGetLevel(h);
  write(''#13,LoWord(level),'-',HiWord(level),'         ');
  Result := True;
 end;

begin
  BASS_RecordInit(-1);
  BASS_RecordStart(44100, 2, 0, @RecordingCallback, nil);
  Readln;
  BASS_RecordFree;
end.
+4

, . - , . afaik RMS ( ) .

-, , . , ( RMS).

Delphi 7 does a great job of this and comes with mmsystem headers. More advanced components are available (I sometimes used the lakeofsoft lib program), but this may be redundant if this is your only audio operation.

+2
source

Source: https://habr.com/ru/post/1659321/


All Articles