Sound volume wrong on first PlaySound()
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Sound volume wrong on first PlaySound()
That snippet (with "SetAudio" changed to "Set Audio") has the volume the same for both plays - too low. It doesn't go up to normal for the second play like the PB code does.
BERESHEIT
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Sound volume wrong on first PlaySound()
Just encase there's some doubt regarding it not being PB fault.
If you played that file with your associated media player, and the playback begins with the low volume and increases. We know PureBasic isn't responsible then.
If you played that file with your associated media player, and the playback begins with the low volume and increases. We know PureBasic isn't responsible then.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Sound volume wrong on first PlaySound()
Yup that's what happened. Definitely nothing to do with PB.
BERESHEIT
Re: Sound volume wrong on first PlaySound()
I wish I was with Windows 8.1. I would see if this issue is shared.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Re: Sound volume wrong on first PlaySound()
I'm grasping at straws... Have you tried with another set of speakers or even with an headset?
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Sound volume wrong on first PlaySound()
Nah I don't really care. As long as my code doesn't have a bug and PB doesn't have a bug I'm fine.
BERESHEIT
Re: Sound volume wrong on first PlaySound()
It might be a problem with one of the sound affects faulting.
- 1) Right-click on Volume systray Icon
2) Select "Playback devices"
3) Double click on "Speakers"
4) Click the 'Enhancements' tab
5) Check "Disable all sound effects"
6) Click OK.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
-
SeregaZ
- Enthusiast

- Posts: 628
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Sound volume wrong on first PlaySound()
i have some file mono, 8 bit wav. how i can make some change volume of it? i try to make some like this:
when limit is 5 - it give just little sound down, but when i set to more value 30 for more silence - it play more silence, but add some hiss effect. how to correct make this lower or louder sound?
Code: Select all
Number.a = ReadAsciiCharacter(0)
limit = 5
if Number > $80+limit
Number - limit
elseif Number < $80-limit
Number + limit
endif
WriteAsciiCharacter(1, Number)Re: Sound volume wrong on first PlaySound()
Code: Select all
Number.a = ReadAsciiCharacter(0)
Number = (Number - 127.5) * 0.25 + 127.5 ; scaling = 0.25
WriteAsciiCharacter(1, Number)-
SeregaZ
- Enthusiast

- Posts: 628
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Sound volume wrong on first PlaySound()
thanks. no any hiss 
Re: Sound volume wrong on first PlaySound()
Visualized, for fun:
Code: Select all
Procedure Update()
Value1 = GetGadgetState(1)
Value2 = GetGadgetState(2)
ShowSine = GetGadgetState(3)
If StartDrawing(CanvasOutput(0))
Box(0, 0, OutputWidth(), OutputHeight(), $FFFFFF)
Box(256, 0, 1, OutputHeight(), $e0e0e0)
For i = 0 To 255
If (ShowSine)
x = 255.0 * (0.5 + 0.5 * Sin(2 * #PI * i / 256))
Else
x = i
EndIf
If (x > $80 + Value1) ; Method 1
y = x - Value1
ElseIf (x < $80 - Value1)
y = x + Value1
Else
y = x
EndIf
Box(i, 255-y, 1, 512, $f0f0FF)
Box(i, 255-y, 1, 1, $0000FF)
scale.f = 1.0 - Value2 / 255.0
y = (x - 127.5) * scale + 127.5 ; Method 2
Box(i + 256, 255-y, 1, 512, $f0FFf0)
Box(i + 256, 255-y, 1, 1, $00c000)
Next i
StopDrawing()
EndIf
GadgetToolTip(1, "Limit = " + Str(Value1))
GadgetToolTip(2, "Reduce = " + Str(Value2) + "/255")
EndProcedure
OpenWindow(0, 0, 0, 256*2, 256 + 30 + 25, "Test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CanvasGadget(0, 0, 0, 256*2, 256)
TrackBarGadget(1, 0, 256, 256, 30, 0, 255)
SetGadgetState(1, Value1)
TrackBarGadget(2, 256, 256, 256, 30, 0, 255)
SetGadgetState(2, Value2)
CheckBoxGadget(3, 256, 256 + 30, 256, 20, "Show as Sine waves")
SetGadgetState(3, ShowSine)
BindEvent(#PB_Event_Gadget, @Update())
Update()
Repeat : Until (WaitWindowEvent() = #PB_Event_CloseWindow)-
SeregaZ
- Enthusiast

- Posts: 628
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Sound volume wrong on first PlaySound()
i have old PB... not see how it work
but my looks like this:

green borders it is sample cut borders. soon i will plug your volume control. it will be converter for midi music to sega mega drive games with sample recording tab.

green borders it is sample cut borders. soon i will plug your volume control. it will be converter for midi music to sega mega drive games with sample recording tab.
