12-06-2025, 11:39 PM
Such a small thing. Try listening to the audio if you wrote it uncompressed to a lower bit depth than 8 bits:
Code: (Select All)
_Title "Listening to music in 2 to 8 bites"
Dim p As _MEM
s = _SndOpen("slunce.mp3") ' <---- change mp3 file here
p = _MemSound(s)
Dim As Long d
Dim As Integer R, L, B
B = 8 'emulate 3 bit sound...
Do Until _KeyHit = 27
d = 0
Do Until d >= p.SIZE
left = _MemGet(p, p.OFFSET + d, Single)
right = _MemGet(p, p.OFFSET + d + 4, Single)
Locate 4: Print "press 'q' or 'a' for change maximal amplitude value"
Locate 5: Print "Maximal amplitude value is:"; B; "this can be writed to"; _Ceil(Log(B) / Log(2)); "bits! "
c = B / 2
L = (c * left + c)
R = (c * right + c)
lmin = _Min(lmin, L): rmin = _Min(rmin, R)
lmax = _Max(lmax, L): rmax = _Max(rmax, R)
_SndRaw L / B, R / B
Do Until _SndRawLen < .1
Locate 2
Print "Left:"; L; "Right:"; R; " "
Print "Center (zero):"; c; "Lmin"; lmin; "Lmax"; lmax; "Rmin"; rmin; "Rmax"; rmax; " "
i$ = LTrim$(InKey$)
Select Case i$
Case "q": B = B - 1: lmin = 0: rmin = 0: lmax = 0: rmax = 0
Case "a": B = B + 1: lmin = 0: rmin = 0: lmax = 0: rmax = 0
End Select
B = _IIf(B < 2, 255, B)
B = _IIf(B > 255, 2, B)
Loop
d = d + 8
Loop
Loop

