{"id":77,"date":"2015-01-10T13:19:45","date_gmt":"2015-01-10T13:19:45","guid":{"rendered":"http:\/\/johnwarburton.net\/blog\/?p=77"},"modified":"2015-08-09T16:38:11","modified_gmt":"2015-08-09T15:38:11","slug":"real-time-visual-pitch-display","status":"publish","type":"post","link":"https:\/\/johnwarburton.net\/blog\/?p=77","title":{"rendered":"Real-time visual pitch display"},"content":{"rendered":"<p>Here&#8217;s a hypnotic (or nausea-inducing) way of watching and listening to BBC radio programmes. You&#8217;ll need a modern version of FFplay, the multi-media player that&#8217;s part of the FFmpeg suite, and the open-source &#8220;get_iplayer&#8221; program. The filter that does the work is called &#8220;showcqt&#8221;.<\/p>\n<p>For this example, I&#8217;m using BBC Radio 3. You will, no doubt, see how the command line can be modified to accept any audio source.<\/p>\n<p>Just type this. This is from a Cygwin command line, rather similar to Unix. Windows won&#8217;t be much different.<\/p>\n<p><code>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]\"<\/code><\/p>\n<p>Or, as another example, here&#8217;s one of my favourite on-line streams, &#8220;The Departure Lounge&#8221;:<\/p>\n<p><code>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]\"<\/code><\/p>\n<p>&#8230;and, after waiting a few seconds for buffering, you&#8217;ll get this:<\/p>\n<figure id=\"attachment_78\" aria-describedby=\"caption-attachment-78\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/johnwarburton.net\/blog\/wp-content\/uploads\/2015\/01\/audio-spectrum.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/johnwarburton.net\/blog\/wp-content\/uploads\/2015\/01\/audio-spectrum-300x177.png\" alt=\"Audio spectrum of a fragment of a song for soprano and piano, with turntable rumble visible in the lower frequencies\" width=\"300\" height=\"177\" class=\"size-medium wp-image-78\" srcset=\"https:\/\/johnwarburton.net\/blog\/wp-content\/uploads\/2015\/01\/audio-spectrum-300x177.png 300w, https:\/\/johnwarburton.net\/blog\/wp-content\/uploads\/2015\/01\/audio-spectrum.png 976w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-78\" class=\"wp-caption-text\">Audio spectrum of a fragment of a song for soprano and piano, with turntable rumble visible in the lower frequencies<\/figcaption><\/figure>\n<p>The backslash in the &#8220;pipe\\:0&#8221; is because colons must be escaped with a backslash in FFmpeg\/FFplay filters.<\/p>\n<p>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: <a href=\"https:\/\/github.com\/Warblefly\/FFmpeg-Scope\/\" title=\"FFmpeg-Scope code\" target=\"_blank\">https:\/\/github.com\/Warblefly\/FFmpeg-Scope\/<\/a><\/p>\n<p>The scope&#8217;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.<\/p>\n<p>This is the kind of output it gives:<\/p>\n<figure id=\"attachment_83\" aria-describedby=\"caption-attachment-83\" style=\"width: 291px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/johnwarburton.net\/blog\/wp-content\/uploads\/2015\/01\/scope-screenshot.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/johnwarburton.net\/blog\/wp-content\/uploads\/2015\/01\/scope-screenshot-291x300.png\" alt=\"Screenshot of FFmpeg scope\" width=\"291\" height=\"300\" class=\"size-medium wp-image-83\" srcset=\"https:\/\/johnwarburton.net\/blog\/wp-content\/uploads\/2015\/01\/scope-screenshot-291x300.png 291w, https:\/\/johnwarburton.net\/blog\/wp-content\/uploads\/2015\/01\/scope-screenshot.png 828w\" sizes=\"auto, (max-width: 291px) 100vw, 291px\" \/><\/a><figcaption id=\"caption-attachment-83\" class=\"wp-caption-text\">Screenshot of FFmpeg scope<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a hypnotic (or nausea-inducing) way of watching and listening to BBC radio programmes. You&#8217;ll need a modern version of FFplay, the multi-media player that&#8217;s part of the FFmpeg suite, and the open-source &#8220;get_iplayer&#8221; program. The filter that does the work is called &#8220;showcqt&#8221;. For this example, I&#8217;m using BBC Radio 3. You will, no &hellip; <a href=\"https:\/\/johnwarburton.net\/blog\/?p=77\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Real-time visual pitch display<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,3],"tags":[],"class_list":["post-77","post","type-post","status-publish","format-standard","hentry","category-encoding","category-film-making"],"_links":{"self":[{"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/77","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=77"}],"version-history":[{"count":17,"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/77\/revisions"}],"predecessor-version":[{"id":26367,"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/77\/revisions\/26367"}],"wp:attachment":[{"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=77"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=77"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/johnwarburton.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}