Hi Jack, this can work also in 64 bit. I run and wrote it in QB64 ver 2.0.2 (none Phoenix edition), 32 bit.
Edit:
@Jack - My program above does not work in Phoenix QB64 due to changes with MemSound that I found out about today. It works correctly in QB64 2.02, but here I am attaching a modified version for Phoenix, so far with support for only one audio format - 32 bit. I will gradually patch the other programs so that they work in Phoenix.
Edit:
@Jack - My program above does not work in Phoenix QB64 due to changes with MemSound that I found out about today. It works correctly in QB64 2.02, but here I am attaching a modified version for Phoenix, so far with support for only one audio format - 32 bit. I will gradually patch the other programs so that they work in Phoenix.
Code: (Select All)
'small sound equalizing example writed by Petr Preclik 03-08-2022 (dd-mm-yyyy)
$NoPrefix
Dim a As MEM, j As Offset, Eq As Double
Dim As Single Il, Ir, Il2, Ir2
s = SndOpen("b.mp3") 'insert your music file name here
a = MemSound(s, 0)
If a.ELEMENTSIZE <> 8 Then Print "This program is now designed just for 32 bit sound": Sleep 2: End
Eq = 1.7
Print "Use the mouse wheel to reduce/add the treble of the sound!"
Do Until j = a.SIZE - a.ELEMENTSIZE * 2
MemGet a, a.OFFSET + j, Il
MemGet a, a.OFFSET + j + a.ELEMENTSIZE, Ir
MemGet a, a.OFFSET + j + a.ELEMENTSIZE / 2, Il2
MemGet a, a.OFFSET + j + a.ELEMENTSIZE * 1.5, Ir2
j = j + a.ELEMENTSIZE
frL = Il * EqS + (Il - Ir) * EqH 'create new silent empty signal. Volume in our new empty signal is drived by volume in original sound file.
frR = Ir * EqS + (Il2 - Ir2) * EqH
SndRaw frL * slevel, frR * slevel
Do Until SndRawLen < 0.01
Mouse Mw
Eq = Eq + Mw
Eq = MINMAX(1, 2, Eq)
EqS = Eq - 1
EqH = 1 - EqS
Locate 3
slevel = Int((2 - Eq) * 100)
slevel = MINMAX(1, 100, slevel)
Print "Eq level:"; slevel; "% " ', EqS, EqH
Loop
Loop
Function MINMAX (Minimum_Value, Maximum_Value, Current_Value)
MINMAX = Current_Value
If Current_Value > Maximum_Value Then MINMAX = Maximum_Value
If Current_Value < Minimum_Value Then MINMAX = Minimum_Value
End Function
Sub Mouse (Mw)
Mw = 0
While MouseInput
Mw = MouseWheel / 25
Wend
End Sub