Jump to content

Speech Recognition... Well, Voice Tag Comparison


Recommended Posts

I was wondering how I can compare the numbers recieved from the mic to numbers prerecorded, like

10 20

30 30

60 50

60 60

60 60

60 50

20 30

40 40

40 40

10 10

The first numbers could be the heard volume stats, while the second could be the prerecorded volume stats, The stats would be of the same word or phrase

I want to be able to adjust the sencitivity ratio of the comarison, this is the code. you speak then exit. Then it graphs the heard volume stats and displays them to you should understand what I mean. I want to use this a simple sound recognition tool, like a clapper or a script that recognizes beats from music.

Please help, Thanks

CODE
#Include <string.au3>

#Include <GUIConstants.au3>

#include <misc.au3>

#include <Array.au3>

Dim $lpszDevice

Dim $lpszDeviceID

Dim $lpszOpenFlags

Dim $lpszRequest

Dim $lpszFlags

Dim $lpszCommand

Dim $lpszReturnString

Dim $cchReturn

Dim $mciError

$lpszDevice = "new type waveaudio"

$lpszOpenFlags = "alias mywave"

$lpszFlags = ""

$lpszCommand = StringFormat( "open %s %s %s", $lpszDevice, $lpszOpenFlags, $lpszFlags);

$lpszReturnString = _StringRepeat( " ", 100)

$cchReturn = StringLen($lpszReturnString)

$mciError = _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, 0);

If $mciError[0] <> 0 Then _mciShowError($mciError[0])

$lpszDeviceID = "mywave"

$lpszRequest = "level"

$lpszFlags = ""

$lpszCommand = StringFormat( "status %s %s %s", $lpszDeviceID, $lpszRequest, $lpszFlags)

GUICreate("MCI wave level test", 200, 130)

$VolumeLabel = GUICtrlCreateLabel("Initializing...", 14, 8, 200, 20)

$ProgressBar = GUICtrlCreateProgress(14, 25, 180, 20)

$ExitButton = GUICtrlCreateButton(" Exit ", 80, 60)

GUISetState()

$hear = _ArrayCreate ( 1 )

While 1

$mciError = _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, 0);

If $mciError[0] <> 0 Then _mciShowError($mciError[0])

$mciError[2] = Round($mciError[2], -1)

If $mciError[2] > 30 Then

_ArrayAdd ( $hear, $mciError[2] )

Sleep(50)

EndIf

GUICtrlSetData($VolumeLabel, "Current wave level is: " & $mciError[2])

GUICtrlSetData($ProgressBar, $mciError[2])

$msg = GUIGetMsg()

Select

Case $msg = $ExitButton

GUICreate("")

For $i = 0 To UBound( $hear )-1

GUICtrlCreateLabel("-------", $i * 20, $hear[$i])

Next

GUISetState(@SW_SHOW)

_ArrayDisplay( $hear, "")

Exit

Case $msg = $GUI_EVENT_CLOSE

Exit

EndSelect

WEnd

GUIDelete()

Exit

Func _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, $hwndCallback)

Return DllCall("winmm.dll", "long", "mciSendStringA", "str", $lpszCommand, "str", $lpszReturnString, "long", $cchReturn, "long", 0)

EndFunc ;==>_mciSendString

Func _mciShowError($mciError)

$errStr = _StringRepeat( " ", 100)

$Result = DllCall("winmm.dll", "long", "mciGetErrorStringA", "long", $mciError, "string", $errStr, "long", StringLen($errStr))

MsgBox(0, "MCI test", "MCI Error Number " & $mciError & ":" & $Result[2])

EndFunc ;==>_mciShowError

Edited by zerocool60544

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...