Jump to content

oMBRa

Active Members
  • Posts

    818
  • Joined

  • Last visited

About oMBRa

  • Birthday 10/29/1992

Profile Information

  • Location
    italy
  • Interests
    Warcraft III, AutoIt

oMBRa's Achievements

Universalist

Universalist (7/7)

2

Reputation

  1. That's not totally true, it's possible to take a screenshot of a minimized window (or in background but I'm not totally sure) and then check the pixel, have a look here:
  2. Try something like this: $sTime = _MemoryRead(0x020c6600, $handle, 'char[16]') ; this will strip any non digit,(e.g "3m 50s" ---> 350) ; making simpler the comparison $iTime = StringRegExpReplace($sTime, "[^0-9]", "") If $iTime <= 350 Then _Myfunc()
  3. You could register a function for a known message ID. In the main script add GUIRegisterMsg(0x8000, "FuncToCall"), inside "media.exe" use _SendMessage($YourGuiHandle, 0x8000) If you want to pass additional information you might want to use wParam and lParam parameters
  4. Unfortunately it doesn't work, I can't hear anything, here is the script: #include "Bass.au3" #include "BassAsio.au3" #include "BassFx.au3" #include "BassExt.au3" #include "BassMix.au3" #include <Array.au3>OnAutoItExitRegister("_Exit") HotKeySet("{ESC}", "_Exit")Global $iFreq = 44100 Global $iChans = 2 _BASS_Startup() _BASS_ASIO_Startup()_BASS_FX_Startup() _BASS_EXT_Startup() _BASS_MIX_Startup() _BASS_ASIO_Init(0)$iSampleRate = _BASS_ASIO_GetRate() _BASS_Init(0, -1, $iSampleRate, 0, "")$aInfo = _BASS_ASIO_GetInfo() $hStream = _BASS_StreamCreate($iSampleRate, $iChans, BitOR($BASS_ASIO_FORMAT_FLOAT, $BASS_STREAM_DECODE), $STREAMPROC_PUSH, 0) $hTempo = _BASS_FX_TempoCreate($hStream, 0);$BASS_STREAM_DECODE) ;~ _BASS_ChannelPlay($hTempo, 1) _BASS_ChannelSetAttribute($hTempo, $BASS_ATTRIB_TEMPO_PITCH, -7) ;~ $hMixer = _BASS_Mixer_StreamCreate($iSampleRate, $iChans, BitOR($BASS_STREAM_DECODE, $BASS_SAMPLE_FLOAT)) ;~ _BASS_Mixer_StreamAddChannel($hMixer, $hTempo, $BASS_MIXER_MATRIX) ;~ _BASS_Mixer_StreamAddChannel($hMixer, $hStream, $BASS_MIXER_MATRIX) $aPipeIn = _BASS_EXT_StreamPipeCreate($hStream, $BASS_EXT_STREAMPROC_PUSH)$aPipeOut = _BASS_EXT_StreamPipeCreate($hTempo, $BASS_EXT_STREAMPROC_PUSH) _BASS_ASIO_ChannelEnable(False, 0, $BASS_EXT_AsioProc, $aPipeIn[0]) _BASS_ASIO_ChannelEnable(True, 0, $BASS_EXT_AsioProc, $aPipeOut[0]) _BASS_ASIO_ChannelJoin(False, 1, 0) _BASS_ASIO_ChannelJoin(True, 1, 0) _BASS_ASIO_ChannelSetFormat(0, 0, $BASS_ASIO_FORMAT_FLOAT) _BASS_ASIO_ChannelSetFormat(1, 0, $BASS_ASIO_FORMAT_FLOAT) _BASS_ASIO_Start($aInfo[5]) _BASS_ASIO_ChannelSetVolume(True, 0, 0.2) _BASS_ASIO_ChannelSetVolume(True, 1, 0.2)_BASS_ASIO_ChannelSetVolume(False, 0, 1) _BASS_ASIO_ChannelSetVolume(False, 1, 1) While 1 Sleep(10) WEnd Func _Exit()_BASS_StreamFree($hStream) _BASS_ASIO_Free() _BASS_Free() Exit EndFunc It looks like that the resampled data from Tempo is not copied to the bassasio output buffer
  5. Thanks for the answer, with little modification to your script I have managed to play in "real time" the recorded data, however the latency is quite high (around 2 secs). Thus I have tried to do the same using bassasio: #include "Bass.au3" #include "BassAsio.au3" #include "BassFx.au3" #include "BassExt.au3" ;~ #include "BassMix.au3" #include <Array.au3> OnAutoItExitRegister("_Exit") HotKeySet("{ESC}", "_Exit") Global $iFreq = 44100 Global $iChans = 2 _BASS_Startup() _BASS_ASIO_Startup() _BASS_FX_Startup() _BASS_EXT_Startup() ;~ _BASS_MIX_Startup() _BASS_ASIO_Init(0) $iSampleRate = _BASS_ASIO_GetRate() _BASS_Init(0, -1, $iSampleRate, 0, "") $aInfo = _BASS_ASIO_GetInfo() $aBuffer = _BASS_EXT_MemoryBufferCreate() _BASS_ASIO_ChannelEnable(True, 0, $BASS_EXT_AsioProc, $aBuffer[0]) _BASS_ASIO_ChannelJoin(True, 1, 0) _BASS_ASIO_ChannelSetFormat(1, 0, $BASS_ASIO_FORMAT_16BIT) $hStream = _BASS_StreamCreate($iSampleRate, $iChans, $BASS_STREAM_DECODE, $BASS_EXT_StreamProc, $aBuffer[0]) $hTempo = _BASS_FX_TempoCreate($hStream, 0) _BASS_ChannelSetAttribute($hStream, $BASS_ATTRIB_TEMPO_PITCH, -7) $aPipe = _BASS_EXT_StreamPipeCreate($hStream, $BASS_EXT_STREAMPROC_PUSH) _BASS_ASIO_ChannelEnable(False, 0, $BASS_EXT_AsioProc, $aPipe[0]) _BASS_ASIO_ChannelJoin(False, 1, 0) _BASS_ASIO_ChannelSetFormat(0, 0, $BASS_ASIO_FORMAT_16BIT) _BASS_ASIO_Start($aInfo[5]) _BASS_ASIO_ChannelSetVolume(True, 0, 0.2) _BASS_ASIO_ChannelSetVolume(True, 1, 0.2) _BASS_ASIO_ChannelSetVolume(False, 0, 1) _BASS_ASIO_ChannelSetVolume(False, 1, 1) While 1 Sleep(10) WEnd Func _Exit() _BASS_StreamFree($hStream) _BASS_ASIO_Free() _BASS_Free() Exit EndFunc It works fine except for the pitch effect. (using bassasio only for the input and bass for the output works, however I would like to do this only with bassasio)
  6. How to record audio for 5 seconds and then play it ?(without saving it to disk)
  7. I think I have solved the problem, I had to disable the UAC, (in case you ask me, yes, I was running the installers as administrator). @trancexx Thanks for reminding me that easy solution, however I prefer to find what causes the problem first rather than applying a solution that partially solves it.
  8. When I double click on an au3 file, it is not opened nor ran, a window is displayed and it asks me to choose either a program to open the file or to search through the web a program to open it. I can not even create an au3 file right-clicking on desktop-->New-->New autoit, infact this last voice is missing. However I have run your script, at the first messagebox (Your current "Default" action for au3 is: "Open" Do you want to change that?) I have chosen Yes, then at the second one (Click Yes for "Edit" or No for "Run") I have clicked on Yes, but the problem is still here. I think some registry's entries are missing...
  9. Yes, I have already done it
  10. I have recently installed Windows 7 Ultimate 32 bit, today I have installed the latest version of Autoit and all went fine (I used the installer). Then I have tried to create a new script (as I was used to do), Right-Click on desktop--->New--->??, the "New Autoit" voice was missing, so I have created an au3 file on desktop manually and the extension wasn't even associated with SciTE. I have already tried installing Autoit running the installer in compatibilty mode for Windows XP SP2 & SP3. Thanks in advance
  11. Try this: #include <GDIPlus.au3> Global $sImage = @ScriptDir & '\IrD9C.png' 'Path to the image $hGui = GUICreate('', 500, 500) GUISetState() _GDIPlus_Startup() $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) $hBitmap = _GDIPlus_BitmapCreateFromFile($sImage) _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 20, 20) $tGDIPBITMAPDATA = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, _GDIPlus_ImageGetWidth($hBitmap), _ _GDIPlus_ImageGetHeight($hBitmap), $GDIP_ILMWRITE, $GDIP_PXF32RGB ) $iWidth = DllStructGetData($tGDIPBITMAPDATA, 'Width') $iHeight = DllStructGetData($tGDIPBITMAPDATA, 'Height') $iStride = DllStructGetData($tGDIPBITMAPDATA, 'Stride') $iScan0 = DllStructGetData($tGDIPBITMAPDATA, 'Scan0') For $x = 0 To $iWidth-1 For $y = 0 To $iHeight-1 $tPixel = DllStructCreate('byte[3]', $iScan0 + ($x * 4) + ($y * $iStride)) $bPixel = DllStructGetData($tPixel, 1) $iRed = BitAND(BitShift($bPixel, 16), 0xFF) $iGreen = BitAND(BitShift($bPixel, 8), 0xFF) $iBlue = BitAND($bPixel, 0xFF) If (($iRed + $iGreen + $iBlue) / 3) > 100 Then DllStructSetData($tPixel, 1, 0xFFFFFF) Else DllStructSetData($tPixel, 1, 0x000000) EndIf Next Next _GDIPlus_BitmapUnlockBits($hBitmap, $tGDIPBITMAPDATA) _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 20, 20 + $iHeight + 10) While 1 $iMsg = GUIGetMsg() If $iMsg = -3 Then _Free() EndIf WEnd Func _Free() _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() Exit EndFunc
  12. wakillon's code doesnt seem to work properly ( at least to me ) if you try the code below you will notice that it changes the background of the wrong label Func __CapClick() $mouseX = MouseGetPos(0) $mouseY = MouseGetPos(1) ;~ ConsoleWrite($mouseX & ", " & $mouseY & @CRLF) For $j = 0 To UBound($Array) - 1 If ($mouseX >= $X[$j] And $mouseX <= $X[$j] + 32 And $mouseY >= $Y[$j] And $mouseY <= $Y[$j] + 32) Then GUICtrlSetBkColor($Array[$j], 0x000000) EndIf Next EndFunc however this code seems to work well Func __CapClick() $mouseX = MouseGetPos(0) $mouseY = MouseGetPos(1) ;~ ConsoleWrite($mouseX & ", " & $mouseY & @CRLF) $iX = Floor(($mouseX-24)/32) $iY = Floor(($mouseY-24)/32) $iArrayIndex = $Array[0]+ 10 * $iY + $iX ConsoleWrite('Array Index: ' & $iArrayIndex & @CRLF) GUICtrlSetBkColor($iArrayIndex, 0x000000) EndFunc
  13. maybe something like this? Func __CapClick() $mouseX = MouseGetPos(0) $mouseY = MouseGetPos(1) ConsoleWrite($mouseX & ", " & $mouseY & @CRLF) ConsoleWrite('X Index: ' & Floor(($mouseX-24)/32) & @CRLF) ConsoleWrite('Y Index: ' & Floor(($mouseY-24)/32) & @CRLF) ;~ For $j = 0 To UBound($Array) - 1 ;~ If ($mouseX >= $X[$j] & $mouseX <= $X[$j] + 32 & _ ;~ $mouseY >= $Y[$j] & $mouseY <= $Y[$j] + 32) Then ;~ ConsoleWrite($Array[$j] & @CRLF) ;~ EndIf ;~ Next EndFunc
  14. Below there is a little example. In order to use it you obviously need the SAPI SDK 5.1. Just say at the microphone "run notepad" and if the phrase is recognized, notepad should open. $oRecoContext = ObjCreate('SAPI.SpSharedRecoContext') If @error Then MsgBox(0, '', 'Object Creation Failed') Exit EndIf ConsoleWrite('You can speak now' & @CRLF) ObjEvent($oRecoContext, 'RecoContext_') Global $oVBS = ObjCreate("ScriptControl") $oVBS.Language = "VBScript" Global Const $oNothing = $oVBS.Eval("Nothing") $oGrammar = $oRecoContext.CreateGrammar() $oTopRule = $oGrammar.Rules.Add('RUN', 1, 0) $oWordsRule = $oGrammar.Rules.Add('WORDS', BitOR(1, 32), 1) $oAfterCmdState = $oTopRule.AddState() $oTopRule.InitialState.AddWordTransition($oAfterCmdState, 'run') $oAfterCmdState.AddRuleTransition($oNothing, $oWordsRule) $oWordsRule.InitialState.AddWordTransition($oNothing, 'notepad') ;~ $oWordsRule.InitialState.AddWordTransition($oNothing, 'whatever') $oGrammar.Rules.Commit() $oGrammar.CmdSetRuleState('RUN', 1) While 1 Sleep(10) WEnd Func RecoContext_FalseRecognition($iStreamNumber, $vStreamPosition, $iResult) ConsoleWrite("(no recognition)" & @CRLF) EndFunc ;==>RecoContext_FalseRecognition Func RecoContext_Recognition($iStreamNumber, $vStreamPosition, $iRecognitionType, $iResult) ConsoleWrite($iResult.PhraseInfo.GetText() & @CRLF) If $iResult.PhraseInfo.Elements.Item(1).DisplayText = 'notepad' Then Run('notepad.exe') EndIf EndFunc ;==>RecoContext_Recognition
  15. wow, it worked, nice workaround... thx
×
×
  • Create New...