AutoHotkey Community

It is currently May 26th, 2012, 11:48 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: August 31st, 2008, 11:25 am 
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)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2008, 4:45 pm 
Offline

Joined: March 11th, 2008, 11:36 pm
Posts: 291
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2008, 6:43 pm 
Someone might extract something usefull from this: [audio-input-output-level], hopefully.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2008, 7:44 pm 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2249
Location: switzerland
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.



Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thank you
PostPosted: September 1st, 2008, 12:49 pm 
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...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 12th, 2011, 2:07 pm 
Offline

Joined: April 12th, 2011, 1:51 pm
Posts: 1
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!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey and 26 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group