Functional sound equalization live!
#3
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.

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


Reply


Messages In This Thread
Functional sound equalization live! - by Petr - 08-03-2022, 03:56 PM
RE: Functional sound equalization live! - by Jack - 08-03-2022, 04:12 PM
RE: Functional sound equalization live! - by Petr - 08-03-2022, 04:19 PM
RE: Functional sound equalization live! - by Petr - 08-03-2022, 04:23 PM
RE: Functional sound equalization live! - by Petr - 08-06-2022, 01:23 PM
RE: Functional sound equalization live! - by Pete - 08-06-2022, 03:27 PM
RE: Functional sound equalization live! - by Pete - 08-06-2022, 05:37 PM
RE: Functional sound equalization live! - by Petr - 02-18-2023, 03:38 PM
RE: Functional sound equalization live! - by Petr - 02-18-2023, 08:05 PM
RE: Functional sound equalization live! - by Petr - 02-18-2023, 09:52 PM
RE: Functional sound equalization live! - by Petr - 02-19-2023, 12:40 PM
RE: Functional sound equalization live! - by Petr - 02-19-2023, 03:39 PM
RE: Functional sound equalization live! - by Petr - 02-22-2023, 07:25 PM
RE: Functional sound equalization live! - by Petr - 03-03-2023, 11:53 PM
RE: Functional sound equalization live! - by Petr - 03-04-2023, 04:21 PM
RE: Functional sound equalization live! - by Petr - 03-24-2023, 08:35 PM



Users browsing this thread: 7 Guest(s)