A basic spectrogram engine. ☛ Adjust the "window size" slider to change the frequency resolution. Lower values render faster. On TurboWarp, you can run it at full window size. https://turbowarp.org/1326169852 ☛ Check the Instructions sprite to learn how to import your own sound files.
The sound used here is a collection of sounds from the Scratch library. Thanks to Claude (Anthropic's AI) for helping me understand how to make this, and, more importantly, how this all works. I used my oscilloscope project as a basis, because the data reading and sound playing parts are the same. https://scratch.mit.edu/projects/1325936501/ However, an oscilloscope simply renders the WAV data values, so it requires nothing more than basic arithmetic. But in order to draw a spectrogram, we need to convert that data into frequencies. This is done using DFT (discrete Fourier transform), which takes a sequence of samples (values changing over time) and transforms them to a sequence of frequency values for that entire time period. It is the same data, but viewed from another perspective, so to speak. Learn more here: https://en.wikipedia.org/wiki/Spectrogram https://en.wikipedia.org/wiki/Mel_scale https://en.wikipedia.org/wiki/Discrete_Fourier_transform I also used the free audio editor Audacity's spectrogram view and its settings as a reference. https://manual.audacityteam.org/man/spectrogram_view.html