Page 3 of 3
Re: Sound volume wrong on first PlaySound()
Posted: Sat Oct 25, 2014 11:00 pm
by netmaestro
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.
Re: Sound volume wrong on first PlaySound()
Posted: Sat Oct 25, 2014 11:07 pm
by RASHAD
I just added another snippet

Re: Sound volume wrong on first PlaySound()
Posted: Sun Oct 26, 2014 12:55 am
by netmaestro
Same. Equal but volume too low.
Re: Sound volume wrong on first PlaySound()
Posted: Mon Oct 27, 2014 12:24 am
by Thunder93
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.

Re: Sound volume wrong on first PlaySound()
Posted: Mon Oct 27, 2014 12:27 am
by netmaestro
Yup that's what happened. Definitely nothing to do with PB.
Re: Sound volume wrong on first PlaySound()
Posted: Mon Oct 27, 2014 12:30 am
by Thunder93
I wish I was with Windows 8.1. I would see if this issue is shared.
Re: Sound volume wrong on first PlaySound()
Posted: Mon Oct 27, 2014 12:35 am
by Thunder93
I'm grasping at straws... Have you tried with another set of speakers or even with an headset?
Re: Sound volume wrong on first PlaySound()
Posted: Mon Oct 27, 2014 12:36 am
by netmaestro
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.
Re: Sound volume wrong on first PlaySound()
Posted: Mon Oct 27, 2014 12:41 am
by Thunder93
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.
Wait couple of seconds and test.
Re: Sound volume wrong on first PlaySound()
Posted: Fri Dec 11, 2015 4:25 pm
by SeregaZ
i have some file mono, 8 bit wav. how i can make some change volume of it? i try to make some like this:
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)
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?
Re: Sound volume wrong on first PlaySound()
Posted: Fri Dec 11, 2015 5:09 pm
by kenmo
Code: Select all
Number.a = ReadAsciiCharacter(0)
Number = (Number - 127.5) * 0.25 + 127.5 ; scaling = 0.25
WriteAsciiCharacter(1, Number)
Re: Sound volume wrong on first PlaySound()
Posted: Fri Dec 11, 2015 5:38 pm
by SeregaZ
thanks. no any hiss

Re: Sound volume wrong on first PlaySound()
Posted: Fri Dec 11, 2015 7:18 pm
by kenmo
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)
Re: Sound volume wrong on first PlaySound()
Posted: Fri Dec 11, 2015 8:02 pm
by SeregaZ
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.