Image file of Frequency Analyisis

Thank you for the clarification! I sensed this distinction but didn’t have any terminology for it.

That being said, these single cycle waveforms do have a length. So, while it’s not a spectrum plot of a single DFT, I’m imagining that they may look pretty similar regardless? Or am I way off there?

I guess one way to find out is to either write some code, or use yours (which I would personally appreciate greatly!)

they’re not really the same plots, though they show the same information (sort of.)

ffmpeg is using some fixed window size that i don’t know, call it N.

with the default orientation, each vertical slice of the image (one pixel? i dunno) represents the spectrum of a chunk of N samples.

to render the next vertical slice it looks at the next N samples, probably with some overlap factor (to improve time resolution without sacrificing frequency resolution.) additionally, it will be applying some kind of windowing function to eliminate artifacts arising from the truncation at the window boundaries. (the choice of the windowing function is a tradeoff between resolution and bin leakage.)

if your input signal happens to be N samples long, then yes, you should get a single vertical slice that has the same information as a spectrum plot, but the amplitude dimension is mapped to pixel color value (using some arbitrary palette) instead of to the Y axis. not as easy to read.

i’ll make a little thingy while i happen to be on this task


Sweet, thanks! And thanks for the explanation.

Yeah, I was trying to figure out the terminology of how to say I only wanted an axis for amplitude and an axis for frequency and show results for the length of entire, tiny file. And then not have them expressed in gradients for clarity. Thanks @zebra for that explanation and for your assistance, looking forward to the thingy!

In the meantime @jasonw22 I tweaked your script with the following arguments:


Then I stopped at the script that desaturated things as it basically wiped everything to black. I instead used batch processing in photoshop that used a levels curve to make a decent non-gradient version. Looks pretty close to what the other AK images look like. I imagine it’s not very accurate, but at least gives an approximation of what to expect from the single-cycles.

Curious to see the results from @zebra in comparison

1 Like

Cool! Yeah, I’m enjoying this, curious to see where it leads (and also still thinking about how I’d maybe do this with Python…)

1 Like

ok, i made a thing:

i think this does what you want, more or less.

note that the frequency scale is linear; this is not ideal. i’ll spend a few more minutes on a lin-log interpolator (need to do this anyway.)

i used JUCE to produce mac/win/linux targets, but so far have only tested the mac target.

shouldn’t have any external dependencies (builds for me from a fresh clone.)

more details in readme


Very slick! Keen to compare the outputted PNGs in the morning.

About to pass out, but entering a third argument for the height keeps giving me:

$ ./wavespecter 0195.wav test666.png 200
Segmentation fault: 11
$ ./wavespecter 0195.wav test666.png 200px
Segmentation fault: 11

Works great with just the first two arguments. Apologies, noob over here. :wink:

yeah sorry, that is a bug. actually fixed now, but not in the binary

i’ll finish up lin/log scaling and upload another. though on looking i think the AKWF images are using linear frequency scaling. i guess that makes it easier to identify harmonic series, but maybe a little harder to grok the spectral distribution as a whole - particularly without labels on the frequency axis.

1 Like

okey dokey.

logarithmic frequency scaling is now the default and the height argument works. NB that the order of arguments has changed.

to force linear scaling, enter “lin” in the 3rd argument (case sensitive)
for example, with lin scale and height=120px:

wavespecter input.wav output.png lin 120

if you want log scaling and also want to specify a height, put whatever in the 3rd argument:

wavespecter input.wav output.png logabloobloo 120

PS. i know this argument parsing system is stupid. on *nix i would usually use getopt. but i don’t know a good/easy way of doing that for windows as well, didn’t want to look too hard, and definitely don’t want to roll my own. (anyone have an idea?)

PS.2. i had a moment of self-inflicted mindf*ckery trying to decide how people deal with DC in a log frequency scale. i decided not to worry about it, assume that zero in = zero out, and start interpolating from the first non-zero index. copious code commenting ensued. (anyone have another idea?)

PS.3. if you want to do a lot of batch image processing (say, rescaling) it could be worth learning a bit of imagemagick (fair warning - that shit gets deep.) but whatever works of course.


I just wanted to pick up on this comment, and point out that the easy way to get a Python install with support for numerical/scientific computing these days is to grab a build from

1 Like

totally true, but that’s exactly what i mean - anaconda is an absolutely massive environment, installs hundreds of packages, takes multiple GB of drive space, and i’ve seen its installer do very rude things to the bash environment. (at one place of work, i’ve taken to wrapping conda installs with docker to avoid linker problems later.)

yea, if you want to develop scientific programs in python that’s absolutely the easiest way to set it up, but i don’t recommend it for an end-user who just wants to run a program to do a thing, if the thing is pretty simple (and not some heavy machine-learning stuff that actually needs pytorch or something.)


This isn’t deep already??? Ha! :wink:

Man, all this makes me want to redo everything I’ve done in the reference file, ha! But first I’m gonna clean up these new versions for the stereo folder, share it, then go from there.

Fun stuff! Many thanks everyone!

1 Like

If you’re gonna play with conda, might as well mess with Jupyter while you’re at it. Really nice REPL that can play nice with viz libs. Can also work with music21 for some algorithmic composition, with nice staff printing, etc. (that’s where I hope to merge musical and machine learning interests when I can find the time).

Shit gets deep any direction you look if you stare at it long enough :wink:


5 posts were split to a new topic: Plugin frameworks (JUCE, &c)

Finally found a free moment to run @zebra 's app on the stereo section’s waveforms and redo the layout for those pages. Turned out really sharp, almost makes me want to redo all the other sections the same way, but gotta get back to the music making side of things, haha.

Here’s the PDF if anybody is interested in it. It’s formatted to be printed single-sided on three hole punch paper because everyone has a reference notes binder, right? Right??

Oops, it’s too big for upload here, so here’s a WeTransfer link, I’ll find a permanent home for it later:

If anyone wants to play with it I can throw up a packaged InDesign file too, just say the word.

1 Like

thread recategorized to Tech

Those are some sexy looking spectrum plots! Will come in handy next time I’m AKWFing

1 Like

Hello !

Unfortunately the link to SingleCycleWaveforms_20171030.pdf is now obsolete.

Please, could you reupload it ?

And if you want, I can upload it for you on my webspace and publish here what will be the permanent URL for this file.


I’ll get it up on github at some point. Give me a week or so, swamped in day job life at the moment.

Yes, no problem.

Once done, the link will be permanent.
It will be on a domain that I have named and that I’m currently building. For now it contains only a small gallery of pictures as test. It will be a website shared by a friend and I who are both hobby musicians quite known on KVR and Audiofanzine.

Take your time, there is no hurry. I’ll recall you… hmm… at the end of the next week for example.

Jacques (aka BlackWinny)