04-07-2024, 09:07 AM
Next version - Here you can hold the automatically changing audio frequency by tapping the space bar. The program reads the harmonic frequencies to the selected frequency (if I understood the theory correctly) to make the sound more detailed.
So, now for equalization. When this program is taken and the individual bands are read, one should (probably) just set their volume and then via SNDOPENRAW, so that there is no mixing of the signals, the equalizer should be assembled. However, it is still necessary to solve the removal of higher frequencies from the signal with depths.
So, now for equalization. When this program is taken and the individual bands are read, one should (probably) just set their volume and then via SNDOPENRAW, so that there is no mixing of the signals, the equalizer should be assembled. However, it is still necessary to solve the removal of higher frequencies from the signal with depths.
Code: (Select All)
$NoPrefix
Screen _NewImage(600, 600, 32)
S = SndOpen("10.mp3")
Dim m As MEM
Dim As Single L(5), R(5), L2(5), R2(5), L, R
Dim As Long f, Y(5)
Dim As Single X(5)
m = MemSound(S, 0)
If m.ELEMENTSIZE <> 8 Then
Print "Try another music file, program required SINGLE array. Try MP3."
Sleep
SndClose S
MemFree m
System
End If
For a = 1 To 5
Y(a) = 1 ' increase / decrease frequency (1 / -1)
X(a) = a * 2 'frequency indicator. So, if the number is 2, the signal value is read from the MEMSOUND field
' by 32 bytes further than the start of the signal
Next
'The program (if written correctly) should read two harmonic frequencies above and two below the selected frequency
'to make the sound denser
FreqChange = -1
Do Until n& >= m.SIZE - SndRate
If KeyHit = 32 Then FreqChange = Not FreqChange
If FreqChange Then
If n& Mod SndRate / 2 = 0 Then
a = 1
Do Until a = 5
X(a) = X(a) + Y(a)
If X(a) > 300 Then Y(a) = -1 'higher number here = lower minimal frequency
If X(a) < 2 Then Y(a) = 1 '2 is maximal value for high frequency (1/2 SndRate)
a = a + 1
Loop
End If
End If
a = 1
Do Until a = 5
'get freqency in samples
f& = _SndRate \ 2 \ X(a)
So& = n& + 8 * X(a)
MemGet m, m.OFFSET + n&, L(a)
MemGet m, m.OFFSET + n& + 4, R(a)
MemGet m, m.OFFSET + So&, L2(a)
MemGet m, m.OFFSET + So& + 4, R2(a)
L = L - (L(a) - L2(a))
R = R - (R(a) - R2(a))
a = a + 1
Loop
SndRaw L, R
L = 0
R = 0
Do Until SndRawLen <= .01
Locate 2
Print "Antiphase Freqency:"; f&; "Hz "
Print "Press space for hold / autochange frequency"
Loop
n& = n& + 8
Loop
SndClose S
MemFree m
System