Hi SierraKen,
You can program the visualization of the sound with QB64. For the function of the program I highly recommend first to write a program that without visualization plays the sound in uncompressed WAV format. This music format is very easy to read and play, unlike compressed MP3 music for example. (Playing WAV is as easy as changing a bulb in a chandelier, playing MP3 is fundamentally, much more complicated.)
For visualization, you need detailed knowledge of the internal structure of the WAV file and the _SNDRAW, _SNDRAWLEN commands. Nothing more. But, at the outset, I have two important things to point out to you. First: There is an unknown, uncorrected bug that causes SNDRAW to play very strange stereo, rather mono sound, and that SNDRAW contains an internal buffer that you have to watch for audio and video synchronization, and that is not easy if you want precise visualization . If you look at my YouTube channel, there are some visuals written in QB64.
Another thing to note before writing a visualization is that the 16-bit stereo record contains 44100 samples (numbers). If you write the program incorrectly and want to display each sample, then the program will hang. It is necessary to take the mathematical average for the time period and use it for visualization.
To load a WAV music file, I recommend wikipedia to find the internal structure of the WAV file (it's not complicated, really) and then you'll read it using the GET command.
I also wrote MP3 playback, but I used a third-party decoder that can save MP3 to RAW format. The RAW format is the same as the WAV format, but without the file header, which is absolutely essential for proper file content playback. This program works only with some MP3 formats, it decodes the MP3 header, which is written so that individual bits of specific bytes carry the necessary information. MP3 is a compression format, so even the header is written in the smallest possible way. The header of the program must be read to know how the content in the RAW file is decompressed (is it mono or stereo sound ?, is it 8 bit, 16 bit, 24 bit sound?) Each such file is read differently, according to this information. After decoding, playback is the same as WAV format.
Unfortunately, there is no function in QB64 that allows direct access to music samples that are sent to the sound card. MEM commands are used only for graphical and array operations, they cannot be used to obtain RAW audio data, so to visualize you need this path to read data from a file + or write your own audio decoder. Apparently this is because QB64 uses third-party music decoders and does not allow licenses. Or, no one thought anyone wanted access to RAW audio data.
This is my audio PLAYER for WAV files WITHOUT visualization:
wav "7.wav" 'insert uncompressed wav audio filename here
subchunksize
AS LONG ' 4 bytes (lo / hi), $00000010 for PCM audio format
AS STRING * 2 ' 2 bytes (0001 = standard PCM, 0101 = IBM mu-law, 0102 = IBM a-law, 0103 = IBM AVC ADPCM) channels
AS INTEGER ' 2 bytes (1 = mono, 2 = stereo) rate
AS LONG ' 4 bytes (sample rate, standard is 44100) ByteRate
AS LONG ' 4 bytes (= sample rate * number of channels * (bits per channel /8)) Block
AS INTEGER ' 2 bytes (block align = number of channels * bits per sample /8) Bits
AS INTEGER ' 2 bytes (bits per sample. 8 = 8, 16 = 16) subchunk2
AS STRING * 4 ' 4 bytes ("data") contains begin audio samples
block = H.Block
RATE = H.rate
chan = H.channels
bits = H.Bits
lef = lefi / RATE
righ = righi / RATE
lef = leftMono / RATE
righ = leftMono / RATE
lef = lleft8 / 256
righ = rright8 / 256
lef = mono8 / 256
righ = lef
IF RATE
> 44100 THEN frekvence
= RATE
ELSE frekvence
= 44100 FOR plll
= 1 TO frekvence
/ RATE
Also see here:
https://www.qb64.org/forum/index.php?topic=1399.msg105829#msg105829