Sound auslesen
Moderator: jNizM
Sound auslesen
Hi,
vielen Programmen kann man eigene Sounddateien (*.wav) zuordnen. Ich würde gerne, wenn einer dieser Sounds abgespielt wurde, eine Aktion ausführen. Z.B. das Programm in den Vordergrund holen.
Kann AKH unterschiedliche Sounds auslesen / erkennen?
Vielen Dank
vielen Programmen kann man eigene Sounddateien (*.wav) zuordnen. Ich würde gerne, wenn einer dieser Sounds abgespielt wurde, eine Aktion ausführen. Z.B. das Programm in den Vordergrund holen.
Kann AKH unterschiedliche Sounds auslesen / erkennen?
Vielen Dank
Re: Sound auslesen
Da sehe ich relativ wenig Hoffnung...
viewtopic.php?f=76&t=75153&hilit=sound+recognition
viewtopic.php?f=76&t=21350&hilit=sound+recognition
Hiermit lässt sich wohl "sound" erkennen, doch ob dies auch auf sound variations zutrifft?
viewtopic.php?p=183523#p183523
Event_System_Sound lässt darauf schließen ...
viewtopic.php?p=131838#p131838
viewtopic.php?f=76&t=75153&hilit=sound+recognition
viewtopic.php?f=76&t=21350&hilit=sound+recognition
Hiermit lässt sich wohl "sound" erkennen, doch ob dies auch auf sound variations zutrifft?
viewtopic.php?p=183523#p183523
Event_System_Sound lässt darauf schließen ...
viewtopic.php?p=131838#p131838
Re: Sound auslesen
Danke für deine Hilfe und Mühe.
Die andere und bestimmt auch einfachere Möglichkeit wäre:
Wenn Programm XY irgendeine Soundausgabe hat, mache ...
Hat jemand schon von dieser Funktion gehört?
Die andere und bestimmt auch einfachere Möglichkeit wäre:
Wenn Programm XY irgendeine Soundausgabe hat, mache ...
Hat jemand schon von dieser Funktion gehört?
Re: Sound auslesen
https://www.nch.com.au/action/misc.html#TONEDET
Vielleicht kann auch @just me (& friends) hier einen Ansatz zur 'system sound detection' herauslesen?? (vll falls man/frau der Anwendung einen eigenen Sound statt eines Systemsounds zuweist?)
Re: Sound auslesen
from first principles:
- load the sample u want to match
- load the sample u want to match against or if ure going to be reading from a stream, buffer enough data to match the length of ur "needle" sample
- then, if ur computer is fast enough:
- precompute the FFT of the needle sample once at the start
- compute the FFT of the haystack sample / compute the FFT of whatever data u currently have stored in ur buffer
- cross-correlate both FFTs
- if a threshold u specify is exceeded, u probably have a match
- if ur computer isnt fast:
- chunk the needle sample several times
- precompute the FFT of each chunk once at the start
- set ur buffer size to match the size of one chunk
- compute the FFT of whatever data u currently have stored in ur buffer
- cross-correlate the FFT of the first chunk with the FFT of the buffer
- if a threshold u specify is exceeded, load more data into the buffer and repeat the same process with the second chunk. and so on
- if u managed to iterate through all chunks, u probably have a match(this isnt going to be very accurate though)
Re: Sound auslesen
Das scheint wirklich schwieriger umzusetzen zu sein, als gedacht.
Vll fällt mir noch eine andere Lösung ein, um die Programme in den Vordergrund zu holen. Wäre halt schön universell gewesen
Danke für eure Mühe
Vll fällt mir noch eine andere Lösung ein, um die Programme in den Vordergrund zu holen. Wäre halt schön universell gewesen
Danke für eure Mühe
Re: Sound auslesen
Code: Select all
#SingleInstance Force
mmedia = "%1%"
DetectHiddenWindows, On
Process, Exist
hAHK := WinExist("ahk_pid " . ErrorLevel)
OnMessage(MM_MCINOTIFY := 0x03B9, "MM_MCINOTIFY")
;OnMessage(MM_MCISIGNAL := 0x03CB, "MM_MCISIGNAL")
DllCall("winmm\mciSendStringA", "str", "open " . mmedia . "alias mmedia type mpegvideo style overlapped shareable", "Uint", 0, "Uint", 0, "Uint", 0)
DllCall("winmm\mciSendStringA", "str", "play mmedia notify", "Uint", 0, "Uint", 0, "Uint", hAHK)
MM_MCINOTIFY(wParam, lParam)
{
/*
MCI_NOTIFY_SUCCESSFUL = 0x1
MCI_NOTIFY_SUPERSEDED = 0x2
MCI_NOTIFY_ABORTED = 0x4
MCI_NOTIFY_FAILURE = 0x8
*/
DllCall("winmm\mciSendStringA", "str", "close mmedia", "Uint", 0, "Uint", 0, "Uint", 0)
ExitApp
}
Re: Sound auslesen
Moin @BoBo,
das sieht für mich danach aus, dass das Skript vom Windows Media Player nach Abspielen des Mediums eine Nachricht erhalten will.
das sieht für mich danach aus, dass das Skript vom Windows Media Player nach Abspielen des Mediums eine Nachricht erhalten will.