Florin Andrei
Member
- Joined
- Feb 21, 2019
- Messages
- 40
- Likes
- 44
Years ago, I posted here an app I wrote, called soundspec, that could take an audio file, or many files, and creates a spectrogram PNG image from each file. That app is old, and was never very portable.
I re-wrote that app recently in Go. It now runs on many operating systems (macOS, Windows, Linux) and CPU architectures (Intel-compatible AMD64, ARM64). You may find it here:
github.com
The Go version is quite fast. It spawns a worker for each CPU core you have (you can optionally dial that down), and processes files in parallel. ffmpeg is a prerequisite (install it first), the app uses it to convert any file format to a PCM stream, which then gets processed via the Fourier transform, and the spectrogram PNG file is generated. No temporary files are ever made.
Using the app is dead simple. When in doubt, generate the help text via
Single file mode:
Recursive mode (many files):
And here's the spectrogram of the song 'Why So Serious?' by Hans Zimmer and James Newton Howard, from the movie 'The Dark Knight':
It is sometimes believed that this song has some "very deep bass", etc. People hear the sound, and begin guessing. But this is the objective reality check. The song has a powerful bass line in the middle, but it's mostly 30 ... 40 Hz, which is not really that deep. Any decent subwoofer will crank it out, no problem.
Trying it out with your favorite songs is quite addictive. Post spectrograms here if you find something interesting!
I re-wrote that app recently in Go. It now runs on many operating systems (macOS, Windows, Linux) and CPU architectures (Intel-compatible AMD64, ARM64). You may find it here:
GitHub - FlorinAndrei/soundspec-go: Generate the spectrogram of any audio file and visualize it.
Generate the spectrogram of any audio file and visualize it. - FlorinAndrei/soundspec-go
The Go version is quite fast. It spawns a worker for each CPU core you have (you can optionally dial that down), and processes files in parallel. ffmpeg is a prerequisite (install it first), the app uses it to convert any file format to a PCM stream, which then gets processed via the Fourier transform, and the spectrogram PNG file is generated. No temporary files are ever made.
Using the app is dead simple. When in doubt, generate the help text via
soundspec -hSingle file mode:
soundspec -i file.mp3Recursive mode (many files):
soundspec -i /path/to/music/folderAnd here's the spectrogram of the song 'Why So Serious?' by Hans Zimmer and James Newton Howard, from the movie 'The Dark Knight':
It is sometimes believed that this song has some "very deep bass", etc. People hear the sound, and begin guessing. But this is the objective reality check. The song has a powerful bass line in the middle, but it's mostly 30 ... 40 Hz, which is not really that deep. Any decent subwoofer will crank it out, no problem.
Trying it out with your favorite songs is quite addictive. Post spectrograms here if you find something interesting!
Last edited: