Sound Command problem

rbw152

Member
Licensed User
Longtime User
Hi

don't know if this has been answered elsewhere but I am having a problem getting the Sound command to do anything.

I use the code as follows:
Sound(AppPath & "\badscan.wav")

This only works on the desktop, never on the numerous types of mobile devices (Scanners) I have tried. If I tap the file in File Explorer it plays in the media player but it does not respond to code, except when running in desktop mode.

Any ideas anyone? Thanks in advance.
 

agraham

Expert
Licensed User
Longtime User
This is a guess, but are these scanners WinCE devices rather than Windows Mobile? Because Windows Mobile devices must conform to a Microsoft specification they will all include the multi-media API. Do you get any error when you try to play the sound from Basic4ppc on the device? As WinCE devices do not have to conform to a specification it is possible the scanner manufacturers didn't include the Multi-media APIs as they might not think them relevant to a scanner. However in that case I would expect to get a MissingMethod error.

Neil Cowburn - OpenNETCF - HOWTO: Determine whether or not a library exports a function
 

rbw152

Member
Licensed User
Longtime User
Hi agraham

thanks for your reply. The scanner in question is running Windows Mobile 6.5 Professional. However, it says just below that 'CE OS 5.2.23152 (Build 23152.5.3.12)', which is confusing.

Anyway, it's the first one with multiple desktops that can be slid back and forth if that helps.

I don't get any errors, it just doesn't play the file.
 

agraham

Expert
Licensed User
Longtime User
Windows Mobile is a tightly defined build of Windows CE so if it says Windows Mobile it is. Windows Mobile 6.5 is documented to include the PlaySound function that Basic4ppc uses so I can't think why it is not working. Even if the path to Sound() isn't found it should make some noise as it defaults to a standard system sound. You can try

Sound()

or

Sound("")

which should play the default sound but I am afraid I have no idea why it might not be working on your devices. Have you tried any other wav files?
 

rbw152

Member
Licensed User
Longtime User
Interesting. Thanks for that.

What I found was that if I call Sound("") it produces a short beep but if I call Sound(AppPath & "\badscan.wav") it makes no sound at all.

I'll keep playing with this to see what else I can find but in the meantime I think a short beep will be sufficient for our purposes, so thank you very much for your help. At least we can get some sort of audio cue from the device, even if it's not as fancy as our 'badscan' wav file!
 

Basic4Life

Member
Licensed User
From my experience with working/non-working wav files, the issue might be the wav encoding. There are a couple of them and some seem to be not supported.

I'd suggest you reencode them using a supported encoding, like microsoft signed 16bit PCM.
I can recommend Audacity to encode them, which you can download here
Audacity: Windows

Just open your wav file and then export it as a signed 16bit PCM wav.
 
Top