Hello. ✌
I am.using soundplay for mp3 files inside my scripts.
I discover several.times some issues in the sound plays.
Like delays, sometimes just reacting on second push or loading when another threat starts.
Is it possible to preload the files with "FileRead" somehow?
Is there any possibility that, recode em to .wav files is better in performance then using .mp3 ?
If I got errors and delays can I somehow put a command in front to ensure its usage ?
Like Critical "On" or something?
I read a lot about AHKv1 stuff but I cant transfer it into v2 language.
Please help!.
Sound Play Questions: Delay, Preloading, mp3 or wav? Topic is solved
Re: Sound Play Questions: Delay, Preloading, mp3 or wav?
Hello,
In many cases, adding the Wait command parameter helps, though it will then wait as commanded.
You could try an ActiveX GUI control. viewtopic.php?p=345201#p345201
I think that WAV is unlikely to help, but running your script with WAV is the way to answer the question.
Heavy CPU usage could interfere with playback.
In many cases, adding the Wait command parameter helps, though it will then wait as commanded.
You could try an ActiveX GUI control. viewtopic.php?p=345201#p345201
I think that WAV is unlikely to help, but running your script with WAV is the way to answer the question.
Heavy CPU usage could interfere with playback.
Re: Sound Play Questions: Delay, Preloading, mp3 or wav?
@mikeyww
FileRead A_ScriptDir ("\Data\Sounds\Say Hello.mp3" && "\Data\Sounds\Joker.mp3") got no effect
wav didnt tried yet
cant get the wait param into your code
Note: as always i tried severall combinations wich seem logic for me
like
splitt the filereads, add a "and" or & or &&
wrote filename.mp3", 1
wrote filename.mp3", wait
wrote filename.mp3", wait := True & false
and more... sorry i still do not understand enough of this language
this is th part wich makes the error somehow since days
explanation: it is "Rapidfire and normal fire for the xbox controller using left mouse button
if i push D-Pad to the right it should toggle the mode between the else (normal fire) and the Functtion SetTimer(XboxRapidFire, 15 * on := !on)
usually when we pushed D-Pad to the right it gave the sound Say Hello, and did Rapidfire, and if we used to play normal we pushed again and did get the Joker sound
somehow the sounds get delayed or interrupted or play after a second or 3 after we pushed the fire button 1-2 times
FileRead A_ScriptDir ("\Data\Sounds\Say Hello.mp3" && "\Data\Sounds\Joker.mp3") got no effect
wav didnt tried yet
cant get the wait param into your code
Code: Select all
SoundPlay A_ScriptDir (on ? '\Say Hello.mp3' : '\Joker.mp3')
like
splitt the filereads, add a "and" or & or &&
wrote filename.mp3", 1
wrote filename.mp3", wait
wrote filename.mp3", wait := True & false
and more... sorry i still do not understand enough of this language
this is th part wich makes the error somehow since days
Code: Select all
XboxToggleFunction() {
POV := GetKeyState("JoyPOV")
if POV >= 4501 and POV <= 13500 { ; 45, 90 and 135 degrees: Right
Static on := False
Critical "On"
SetTimer(XboxRapidFire, 15 * on := !on)
SoundPlay A_ScriptDir (on ? '\Say Hello.mp3' : '\Joker.mp3')
} else {
JoyZ := GetKeyState("JoyZ")
if GetKeyState("JoyZ") < 40 {
SetKeyDelay 15, 15
Send "{Blind}{LButton Down}"
while GetKeyState("JoyZ") < 40
Sleep 10
Send "{Blind}{LButton Up}"
}}}
if i push D-Pad to the right it should toggle the mode between the else (normal fire) and the Functtion SetTimer(XboxRapidFire, 15 * on := !on)
usually when we pushed D-Pad to the right it gave the sound Say Hello, and did Rapidfire, and if we used to play normal we pushed again and did get the Joker sound
somehow the sounds get delayed or interrupted or play after a second or 3 after we pushed the fire button 1-2 times
Re: Sound Play Questions: Delay, Preloading, mp3 or wav?
I do not have a way to debug your script. One simple strategy is to shorten the script until your playback works. You can then add one new line at a time, testing iteratively. You will then know exactly when the script breaks.
Re: Sound Play Questions: Delay, Preloading, mp3 or wav?
Would be a great idea but it went hella big in a short time
I need a help from you with the wait command you suggested.
The line "( on? Sound 1 : sound 2 )" was from you and I cant put any parameters into it without errors.
The docs tell me I shall do SoundPlay "sound1.mp3" , wait
But I cant add a wait a 1 or anything else without errors on that part of the code.
I need a help from you with the wait command you suggested.
The line "( on? Sound 1 : sound 2 )" was from you and I cant put any parameters into it without errors.
The docs tell me I shall do SoundPlay "sound1.mp3" , wait
But I cant add a wait a 1 or anything else without errors on that part of the code.
Re: Sound Play Questions: Delay, Preloading, mp3 or wav?
Code: Select all
#Requires AutoHotkey v2.0
soundDir := A_ScriptDir '\t'
F2:: {
Static on := False
on := !on
SoundPlay soundDir (on ? '\test1.wav' : '\test2.mp3'), WAIT := True
}
Re: Sound Play Questions: Delay, Preloading, mp3 or wav?
THANKS A LOT again ✌mikeyww wrote: ↑29 Apr 2023, 07:28Code: Select all
#Requires AutoHotkey v2.0 soundDir := A_ScriptDir '\t' F2:: { Static on := False on := !on SoundPlay soundDir (on ? '\test1.wav' : '\test2.mp3'), WAIT := True }
Re: Sound Play Questions: Delay, Preloading, mp3 or wav? Topic is solved
So fileread soundfilename.mp3 did not make any difference. I'm.not even sure if I done it correctly...
Convert / (change) .mp3 into .wav made it slightly better.
Because it does not need a codec for wav so it seems to run better with wav files.
The wait solution interrupts the script while the music is playing BUT it makes the performance better and the issues are gone with the ``` ), wait := true ``` Command
So using a shorter sound might be an option now but it is acceptable to wait for the file to play if the command after it works now flawlessly
mikeyww lead to a success as usuall
Convert / (change) .mp3 into .wav made it slightly better.
Because it does not need a codec for wav so it seems to run better with wav files.
The wait solution interrupts the script while the music is playing BUT it makes the performance better and the issues are gone with the ``` ), wait := true ``` Command
So using a shorter sound might be an option now but it is acceptable to wait for the file to play if the command after it works now flawlessly
mikeyww lead to a success as usuall
Who is online
Users browsing this forum: No registered users and 24 guests