Page 2 of 3

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 9:16 pm
by netmaestro
@RASHAD:

Here's a snippet to try, you should hear two soft clicks and then two loud clicks:

Code: Select all

InitNetwork()
file$ = GetTemporaryDirectory()+"click.wav"
If FileSize(file$) = -1
  Debug "downloading test file"
  If Not ReceiveHTTPFile("http://lloydsplace.com/click.wav", file$)
    Debug "could not download sound"
    End
  EndIf
Else
  Debug "test file found"
EndIf

InitSound()
LoadSound(0,file$)

SoundVolume(0, 10) 
Delay(1000)

PlaySound(0) 
Delay(1000) 

PlaySound(0) 
Delay(1000)

SoundVolume(0, 100) 

PlaySound(0) 
Delay(1000) 

PlaySound(0) 
Delay(1000)

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 9:18 pm
by Thade
@thunder
That saves the problem for the ones who are able to do it. But the majority of Win 8 users will not be able to use your program because they will not go through that hassle ... that's why I decided not to use wavs anymore ...

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 9:25 pm
by RASHAD
Yes it is OK
So maybe a small delay time after SoundVolume() will solve the conflict
It looks like a puzzle
I am out of here :mrgreen:

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 9:30 pm
by Thunder93
It is called troubleshooting. If a person is willing to install / update codec packages, especially K-Lite.. be prepared to encounter problems at some point ... and be prepared to troubleshoot. Unless you willing to workaround like you have with your issue by now always converting all wav files which does seem like more of a hassle to me... than to take a few minutes to address the problem.

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 9:35 pm
by netmaestro
@Thunder93:

Ok, I followed the steps you outlined:

Before taking steps: Short sound plays softly the first time, full volume thereafter.

-uninstall k-lite package and MPClassic
-restart computer
-check for updates
-windows update says there's a broken codec, this is an important update
-windows update downloads/installs all available updates
-restart computer, it is perfectly up to date

After taking steps: Short sound plays softly the first time, full volume thereafter.

-shit. Thade has it right...

Thanks for the assistance though, it's been quite helpful and instructive.

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 9:48 pm
by Thunder93
Then it might be a bad driver install. Upgrading to the latest sound driver package, or re-installing the latest package (first uninstalling and rebooting). ... this would be different than to simply run a broken codec repair utility.

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 9:54 pm
by netmaestro
I went into Device Manager and found the following devices under 'Sound, video and game controllers':

AMD High Definition Audio Device
Bluetooth Hands-free Audio
IDT High Definition Audio CODEC

For all three items, I clicked on 'Update Driver Software' and chose the 'Check internet and computer for updated drivers'. In all three cases I was told 'Windows has determined that the driver software for your device is up to date.' So I'm out of ideas...

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 9:56 pm
by Thunder93
There was a small handful of cases that those with the latest Microsoft offered NIC drivers was causing crashes with use of a firewall. When they updated to the latest NIC drivers offered by the manufacture, the problem was addressed. This is just one of a very large list of examples I can give.

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 10:00 pm
by Thunder93
Often enough newer drivers can be found from the computer manufacturer site. If you give me the manufacturer name and model number for that computer, I can point you easily enough directly to the official site and to the official page for your product.

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 10:03 pm
by netmaestro
HP Envy 700-059c

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 10:04 pm
by Thunder93
If your package happens to be the latest, then completely uninstalling the existing sound driver package via 'Programs and Features' and rebooting. Then installing the same package may also address the anomaly you experiencing.

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 10:06 pm
by Thunder93
HP Envy 700-059c http://h10025.www1.hp.com/ewfrf/wc/soft ... g=en&cc=ca
netmaestro wrote:HP Envy 700-059c

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 10:09 pm
by Thunder93
The latest Audio package for Windows 8.1 x64


Released: 2013-10-16

File name: sp63932.exe [1/1, 20.69M]

Version: 6.10.6486.0 Rev. A

Compatibility: Microsoft Windows 8.1 (64-bit)

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 10:27 pm
by netmaestro
I downloaded and ran that file, it said it installed successfully and asked for a restart. After restarting, behavior is unchanged. I'm convinced it's a setting somewhere in Windows 8.1 or possibly a bug in the OS. A longer .wav file plays at full volume and after several careful tests I'm sure it isn't starting out low, it seems to be at full volume for the whole duration. Which suggests it's a bug in Windows as something deliberate would probably start a longer .wav out low for the first part of a second and then go to full volume. I guess, anyway. Just casting around for things that seem to make sense.

Re: Sound volume wrong on first PlaySound()

Posted: Sat Oct 25, 2014 10:50 pm
by RASHAD
@NM
Try the next snippet and tell the difference if any
It is exact as your first post but using MCI

Code: Select all

InitNetwork()
file$ = GetTemporaryDirectory()+"click.wav"
If FileSize(file$) = -1
  Debug "downloading test file"
  If Not ReceiveHTTPFile("http://lloydsplace.com/click.wav", file$)
    Debug "could not download sound"
    End
  EndIf
Else
  Debug "test file found"
EndIf

mciSendString_("OPEN "+Chr(34)+file$ +Chr(34)+" Type MPEGVIDEO ALIAS "+Str(1),0,0,0) 
mciSendString_("SetAudio "+Str(1)+" volume to "+Str(100),0,0,0) 
mciSendString_("Play "+Str(1),0,0,0)
Delay(1000)

mciSendString_("Play "+Str(1)+" from "+Str(0),0,0,0) 
Delay(1000)
Edit :
There was as I remember another discussion about WAV files and PlaySound()
Will you try the next snippet as well

Code: Select all

InitNetwork()
file$ = GetTemporaryDirectory()+"click.wav"
If FileSize(file$) = -1
  Debug "downloading test file"
  If Not ReceiveHTTPFile("http://lloydsplace.com/click.wav", file$)
    Debug "could not download sound"
    End
  EndIf
Else
  Debug "test file found"
EndIf

InitMovie()
LoadMovie(0,file$)
MovieAudio(0, 100, 0)
PlayMovie(0,0)
Delay(1000)

PlayMovie(0,0)
Delay(1000)