Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ no audio/sound from mushclient (sound or Playsound)
no audio/sound from mushclient (sound or Playsound)
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Arana
(20 posts) Bio
|
Date
| Mon 11 Oct 2010 04:48 PM (UTC) Amended on Mon 11 Oct 2010 09:47 PM (UTC) by Arana
|
Message
| i get no audio from sound function, i am trying to find the reason. PC Volume is ok (tested with 3 players)
File exists and is the exact name and the root path of drive c:
i get no error but no sound either.
if i play the sound using any sound player it works fine.
wav specs are as following:
Size 90 KB (0% Compressed)
Original Size 90 KB
Length 2.1 seconds
Channels 1 (mono)
Sample Rate 22 KHz;
Sample Size 16 bit
Bit Rate 352 kbps
Encoder
Encoder Settings PCM
Audio Quality Perfect (Lossless)
Contains
Channel Mapping Center
File bombalarm
Type BSplayer file [.wav]
<aliases>
<alias
match="test"
enabled="y"
send_to="12"
sequence="100"
>
<send>PlaySound (1, "c:\bombalarm.wav", false, 0, 0)
Sound("c:\bombalarm.wav")</send>
</alias>
</aliases>
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 11 Oct 2010 08:07 PM (UTC) |
Message
| When something like that happens it helps to put "check" around the function to see what the error message is, eg.
check (PlaySound (1, "c:\bombalarm.wav", false, 0, 0))
check (Sound("c:\bombalarm.wav"))
In your case I'm guessing you would see:
Run-time error
World: xxxxxx
Immediate execution
[string "Command line"]:1: Cannot open the specified file
The reason is the lack of backslashes. First, inside a Lua string you need to change \ to \\. Second, inside "send to script" you have to double them again because MUSHclient also converts backslashes. So assuming the file is there and is the right format, you at least need:
PlaySound (1, "c:\\\\bombalarm.wav", false, 0, 0)
Or save yourself some effort and use forward slashes:
PlaySound (1, "c:/bombalarm.wav", false, 0, 0)
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Arana
(20 posts) Bio
|
Date
| Reply #2 on Mon 11 Oct 2010 10:13 PM (UTC) |
Message
| thanks Nick, that did it this is not for me but for a hard headed pal lol, so forward slashes it is, trying to explain him about escaping backslashes and parsing would be very very hard :P | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Mon 11 Oct 2010 10:35 PM (UTC) Amended on Mon 11 Oct 2010 10:38 PM (UTC) by Nick Gammon
|
Message
| What might be simpler for your friend is, put the sounds in the MUSHclient "sounds" folder. See here:
http://www.gammon.com.au/scripts/doc.php?function=PlaySound
To quote from that page:
If the file name is a fully-qualified path name (ie. it starts with a slash, or a drive letter, colon, slash like "C:/") then it is used "as is".
Otherwise, MUSHclient prepends the MUSHclient execution directory + "sounds" subdirectory to the name
For example, the file name "swordhit.wav" would be looked for at: C:/Program Files/MUSHclient/sounds/swordhit.wav
You can use forward slashes in the file name (for convenience in typing strings in scripts), they are converted to backslashes.
So if you use the sounds folder then you don't need slashes of any kind. That is:
PlaySound (0, "bombalarm.wav")
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
14,149 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top