Real-time visual pitch display

Here’s a hypnotic (or nausea-inducing) way of watching and listening to BBC radio programmes. You’ll need a modern version of FFplay, the multi-media player that’s part of the FFmpeg suite, and the open-source “get_iplayer” program. The filter that does the work is called “showcqt”.

For this example, I’m using BBC Radio 3. You will, no doubt, see how the command line can be modified to accept any audio source.

Just type this. This is from a Cygwin command line, rather similar to Unix. Windows won’t be much different.

get_iplayer --stream --type=liveradio "BBC Radio 3" | ffplay -f lavfi "amovie='pipe\:0',asplit[a][b];[a]showcqt=fullhd=0:timeclamp=0.3:fps=30[out0]; [b]anull[out1]"

Or, as another example, here’s one of my favourite on-line streams, “The Departure Lounge”:

ffplay.exe" -f lavfi "amovie='http\://listen64.radionomy.com/TheDepartureLounge',asplit[a][b];[a]showcqt=fullhd=0:timeclamp=0.3:fps=30[out0]; [b]anull[out1]"

…and, after waiting a few seconds for buffering, you’ll get this:

Audio spectrum of a fragment of a song for soprano and piano, with turntable rumble visible in the lower frequencies
Audio spectrum of a fragment of a song for soprano and piano, with turntable rumble visible in the lower frequencies

The backslash in the “pipe\:0” is because colons must be escaped with a backslash in FFmpeg/FFplay filters.

Just out of interest, I have a Python project that outputs a handy video and audio scope that needs a little refinement, but you can download it here: https://github.com/Warblefly/FFmpeg-Scope/

The scope’s on-screen display includes a waveform monitor showing superimposed YUV levels with 16-235 markers to check BT601/709 broadcast limits, an EBU R128 loudness chart, a stereo audio sum/difference display, a colour vectorscope, a full-range video check monitor and timecode.

This is the kind of output it gives:

Screenshot of FFmpeg scope
Screenshot of FFmpeg scope

One thought on “Real-time visual pitch display”

  1. showcqt is an awesome effect, but I can’t figure out how to make the font not show or completely transparent. Being able to do this would yield the effect as a filter rather than a chord display. Any ideas?

Leave a Reply

Your email address will not be published. Required fields are marked *