| View previous topic :: View next topic |
| Author |
Message |
Guest2 Guest
|
Posted: Sun Aug 31, 2008 10:25 am Post subject: How to detect if a sound was played |
|
|
I want to activate AHK-functions, triggered when my soundcard plays any sound.
There is no other way to detect if a special event takes place. The one and only indicator is a "build in" sound from another program.
PLEASE can anybody help me to solve this problem?
Tank you!
(regards from Germany) |
|
| Back to top |
|
 |
heresy
Joined: 11 Mar 2008 Posts: 291
|
Posted: Sun Aug 31, 2008 3:45 pm Post subject: |
|
|
as far as i know, there's no neat way to do this unless dealing in the driver level.
here's the trick.
1) capture sound by using MixMP3
2) record with silence filter (read help of mixmp3)
3) check output file size consistently.
4) if it's over 16.1kb (16.0kb is minimal) sound is playing.
Example (Mixmp3.exe need to be in same directory)
| Code: | #Persistent
Run, Mixmp3.exe -s -50 -ql -mm,,,PID
SetTimer, SizeCheck, 100
Return
SizeCheck:
FileGetSize, Size, out.mp3, K
if (Size > 16) ;larger than 16KB
{
ControlSend,, {ESC}, ahk_pid %PID%
SetTimer, SizeCheck, Off
GoTo, DoSomething
}
Return
DoSomething:
MsgBox, Sound is Playing
Exitapp |
_________________ Easy WinAPI - Dive into Windows API World
Benchmark your AutoHotkey skills at PlayAHK.com |
|
| Back to top |
|
 |
BoBo˛ Guest
|
Posted: Sun Aug 31, 2008 5:43 pm Post subject: |
|
|
| Someone might extract something usefull from this: [audio-input-output-level], hopefully. |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Sun Aug 31, 2008 6:44 pm Post subject: |
|
|
thank you heresy the script about mixmp3
a freeware tonedet
http://www.nch.com.au/action/misc.html#TONEDET
but you need a soundcard
| Quote: | ToneDet is used to monitor an audio signal a for specific frequency tone or multiple tones and run other software when it detects the tones. Althrough it can detect any audio frequency, ToneDet is usually used to detect very low frequency tones that cannot be heard by humans.
Typical Applications
~ Radio Network Broadcasts (to automatically trigger commercial breaks).
~ Control Systems. To control remove systems over an audio system.
~ Remote Audio Switches. To switch signals on and off using tones.
~ Sub-band information transmission. To transmit information over an audio transmission.
~ Many more related applications.
|
|
|
| Back to top |
|
 |
Guest2 Guest
|
Posted: Mon Sep 01, 2008 11:49 am Post subject: Thank you |
|
|
Thank you very much indeed!
@garry - ToneDet is exactly what I need.
@heresy - MixMP3 solves another problem for me. Thank´s a lot for link and code.
@BoBo˛ - could be really helpfull for someone, who is able to understand the code. Thank you!
This community is not less awesome than AHK... |
|
| Back to top |
|
 |
bvladimirpl
Joined: 12 Apr 2011 Posts: 1
|
Posted: Tue Apr 12, 2011 1:07 pm Post subject: |
|
|
I have a question... how to do the inverse with the "mixmp3.exe"? when there is no audio and the pc do something...?
Thank's! |
|
| Back to top |
|
 |
|