GLBasic forum

Main forum => Bug Reports => Topic started by: Hemlos on 2009-Nov-26

Title: Playsound
Post by: Hemlos on 2009-Nov-26
Playsound seems to be broken?
I even tried the playsound sample project...not working.


Edit:
@Gernot:
I didnt realize i needed to click the mouse to start the sound  in the sample :x
Also, thanks to nik and ian they helped me figgure out my .wav i needed to convert it to pcm 44khz 16 bit to get it working.

Summary of this entire thread is, you dont need to read all this...youve been gone a few days and probably dont have time for alot of reading.

Title: Re: Playsound
Post by: MrTAToad on 2009-Nov-26
I here the IMAX sound in the Playsound example...
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-26
Well i tried mp3's and wav's and nothing is playing

plasymusic plays my files....what the heck is going on here
Title: Re: Playsound
Post by: MrTAToad on 2009-Nov-26
Got any example code ?
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-26
Quote from: Hemlos on 2009-Nov-26

I even tried the playsound sample project...not working.

Sample in samples/media/Playsound.gbap
Title: Re: Playsound
Post by: MrTAToad on 2009-Nov-26
Both the PlayMusic and PlaySound demos are fine here - If you've been using your own MP3's, can you make one available ?
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-26
I used the sample wav, im just trying to get sound going, and im using what is basic.

What platform os are you using your sample on?
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-26
I built a new sample....i think it should work....it loads but it wont play.

Here:


[attachment deleted by admin]
Title: Re: Playsound
Post by: MrTAToad on 2009-Nov-26
I'm using Windows 7 x64

I presume you're on XP - so I'll try it on that too.
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-26
yes xp
im in the process of reinstalling my sound drivers....sigh

Let me how my sample works for you.....by the way i added GETLASTERROR$() to my project here, and it returns 0000 success
Title: Re: Playsound
Post by: MrTAToad on 2009-Nov-26
Yes, it wont play here.

It looks like the WAV isn't in the required format - need to get it converted to (probably) PCM format...

But first, will need to find an appropriate program to do so :)
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-26
Just replace it with one you know works....like the glbasic sample.
The glbasic sample wont play on my xp.....

compile the glbasic sample on your xp and try that wav/exe
Title: Re: Playsound
Post by: Ian Price on 2009-Nov-26
I think it's the audio format that has a problem here - I couldn;t hear anything until I re-coded the .WAV to PCM 22.050 Mhz, 8Bit Stereo. GLB then played it properly.

Hope that helps.
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-26

Awesome thank you two.

I really appreciate your help.
Title: Re: Playsound
Post by: MrTAToad on 2009-Nov-26
wHat program did you use to recode it?
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-26
sndrec32.exe in c:/windows/system32/

If you open any wav in that program, you select "file", then click "properties".
It has a converter builtin to your operating system.
I selected the PCM 44khz 16 bit stereo..which is the same format as Sensaura.wav in the glbasic samples directory.

EDIT: Windows XP
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-26
By the way, a note about sound and compression.

Sound is similiar to images when it comes to compression and reducing the resolution.

If you crush it down to a small format, you will lose information.
Its a good idea to keep a high resolution copy of your sound, so you can make a new sound at any lower compression rate.
Title: Re: Playsound
Post by: Ian Price on 2009-Nov-26
Be aware that Windows7 does NOT come with SNDREC32 - it comes with a new version called SOUNDRECORDER which doesn't have ANY of the features of SNDREC32. It's only purpose is to save sfx and it only saves in .WMA format "out of the box" - you can use a commandline to force saving in .WAV though.

I recommend that everyone that upgrades to Windows7 to get either a decent sound editing software or grab your old copy of SNDREC32 from Windows Xp or 98. It works, but on initially running it it states that there's a registry issue. If you can find and copy the registry info it should work properly.

MS really stuffed up by not including SNDREC32 as standard. Sure it's basic and there are better apps available, but what it does, it does well.
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-26
I agree Ian, having better software is good.
And ms definetly messed up if they didnt add sndrec32.
Anyway, I wonder if its legal to copy sndrec32.exe and use it in windows7(assuming its compatible)

I have a creative soundblaster 24 bit 7.1 sound card. and it comes with a complete creative software sound package which works rather well too.

Title: Re: Playsound
Post by: Ian Price on 2009-Nov-26
QuoteI wonder if its legal to copy sndrec32.exe and use it in windows7

That's a good question, but honestly I don't really care :P I purchased the license to use that software when I bought Win98 and WinXP, so I'm using it. I can no longer use the laptop that it came from, so it's not being used on two machines.
Title: Re: Playsound
Post by: erico on 2009-Nov-26
hi there,

Don't know the answer to your question, for one thing, my encoding goes on an old version of sound forge, so far no problem. I have an issue with the volume though but it is just me(1 works fine, less doesn't work), did not mess with it enough. I will try your sound file and let you know how it goes...
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-26
Ian pointed out it was the file format, i was ignorant to which compression rate glbasic expects.
Title: Re: Playsound
Post by: MrTAToad on 2009-Nov-26
Its one advantage of using FMOD - unfortunately, if you want to use the latest version, you cant with Linux...
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-27
Found another problem here...this time i think it isnt me  :S

The volume must be higher than 0.5 to hear it at all.
Volume is unproportional to the input.
if you play the sound at 50%...   0.5 volume then the sound is almost impossible to hear it.
can anyone else confirm this?

Test it with GLBasic samples:
You can use the GLBasic 'Playsound.gbap' sample to see what i mean....
BTW, You must click the mouse to start the sound in that sample.
Move the mouse to control the panning and the volume.
It shows % of volume there.
Title: Re: Playsound
Post by: Ian Price on 2009-Nov-27
With ear-phones I can hear the sound below 50% - at around 30% I can just about hear something. At under 25% my old ears hear nothing.

Have you had your hearing checked lately? :P
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-27
Hmm im 37, i didnt expect to need to having a hearing test so soon.
Title: Re: Playsound
Post by: Ian Price on 2009-Nov-27
I'm 38 and not quite deaf yet :P
Title: Re: Playsound
Post by: erico on 2009-Nov-27
opa! that's the problem I have, so 30% and 50% (.3 and .5) works, nice, thanks.
I was waiting to check the sound commands latter.
Title: Re: Playsound
Post by: Moru on 2009-Nov-27
Last time I played around with sounds (midi and other) I was getting so different valued depending on what other sound programs I was running earlier and if I had run GLBasic already. I didn't realy figure out in what order I had to start programs I just gave up with sound totally. Volume was never the same no matter what I set it to.
Title: Re: Playsound
Post by: Hemlos on 2009-Nov-27
Quote from: Moru on 2009-Nov-27
Last time I played around with sounds (midi and other) I was getting so different valued depending on what other sound programs I was running earlier and if I had run GLBasic already. I didn't realy figure out in what order I had to start programs I just gave up with sound totally. Volume was never the same no matter what I set it to.

First, midi is electronic code for a computer to read and synthesize to the speakers.
The volume in a midi file is coded in, and it might be adjustable with the proper software.
So for midi it is system dependant for volume.

For wav, you have a wav form pattern, and you can increase or decrease this wav size in most audio applications. I played a sound.wav in windows and it plays at a different level of volume in glbasic for some reason.

And i found a fast and dirty solution, and here it is with a warning:
I opened the file in sndrec32.exe in windows...it has an option to increase or decrease volume by 25%, which is additive, you can do it a few times.
Be careful though...you can make it too loud and it causes the wav form to "square" at the top and bottom of the wav forms....you want to increase the volume right before it hits the top of the wave display region. Dont square your sound, or itll rip your speakers apart. Be certain you dont square your waves, as this is unprofessional, and dangerous to your electronics, sndrec32.exe might not be the best way, but it is decent.

Squared patterns will remain square, you must start over if you end up with it like this.
Increase volume slow, and dont let the wave hit the top or bottom of the indicator.
The square is a resolution, just like an image file...if you decrease the resolution, you are messing up the data, and you have to start over.


Title: Re: Playsound
Post by: MrTAToad on 2009-Nov-27
Dont forget its also relative to Windows volume as well...
Title: Re: Playsound
Post by: erico on 2009-Nov-28
sure shot. Some programs have a normalization for sound so it keeps a reasonable wave that is not square. But like you said, don't blow up the volume or else you blow the data all together.
Title: Re: Playsound
Post by: Kitty Hello on 2009-Nov-30
I use audacity a lot. Mayinly because cooledit97 can't work with mp3..