{"id":1307,"date":"2009-12-15T21:43:40","date_gmt":"2009-12-16T03:43:40","guid":{"rendered":"http:\/\/earbirding.com\/blog\/?p=1307"},"modified":"2009-12-15T21:43:40","modified_gmt":"2009-12-16T03:43:40","slug":"on-spectrogram-settings","status":"publish","type":"post","link":"http:\/\/earbirding.com\/blog\/archives\/1307","title":{"rendered":"On Spectrogram Settings"},"content":{"rendered":"<p>Today&#8217;s post is the promised follow-up to my post on the <a title=\"http:\/\/earbirding.com\/blog\/archives\/1229\" href=\"http:\/\/earbirding.com\/blog\/archives\/1229\" target=\"_blank\">history of spectrograms<\/a>.  I want to explain some basic concepts of spectrographic analysis so that I can clear up some common misconceptions and explain why some things may not always look quite the way you expected.<\/p>\n<p>In &#8220;A Brief History of Spectrograms&#8221; I mentioned that the original <a title=\"http:\/\/jproc.ca\/rrp\/sonagraph.html\" href=\"http:\/\/jproc.ca\/rrp\/sonagraph.html\" target=\"_blank\">Kay Electric Co. Sona-Graph<\/a> had two settings: narrow-band and wide-band.  Nowadays, spectrograms are produced from digital recordings on computer software that allows much more control over the width of the &#8220;band.&#8221;  But our control over how spectrograms look isn&#8217;t complete, and here&#8217;s why.<\/p>\n<h4>The Trade-off: Frequency Resolution vs. Time Resolution<\/h4>\n<p>The first thing every student of spectrograms should understand is that <strong>the more accurately you measure the frequency of a sound, the less accurately you can know when it begins and ends &#8211; and vice versa<\/strong>.  The <a title=\"http:\/\/en.wikipedia.org\/wiki\/Short-time_Fourier_transform#Resolution_issues\" href=\"http:\/\/en.wikipedia.org\/wiki\/Short-time_Fourier_transform#Resolution_issues\" target=\"_blank\">reason for this<\/a> is a fundamental part of the mathematics behind our spectrographic analysis, and I won&#8217;t attempt to explain it here.<\/p>\n<p>The main effect of this principle is that modern spectrograms are broken up into small rectangles called &#8220;windows&#8221; which are the basic &#8220;pixels&#8221; of the image.  As anyone familar with digital images knows, tiny pixels make for a sharp, clear image, and big pixels make for a blocky, poorly defined image.  Unfortunately, spectrographic windows are necessarily rather big and blocky.  You can shorten them in one dimension, but if you do, they automatically get longer in the other dimension. Depending on your settings, you can end up with &#8220;pixels&#8221; that are long, thin rectangles, instead of squares.<\/p>\n<p>Modern spectrographic analysis software generates these &#8220;windows&#8221; behind the scenes and then automatically &#8220;smooths&#8221; the resulting spectrograms so that they seem to have higher resolution than they actually do.  This smoothing algorithm is basically an after-the-fact Photoshop trick, and although it&#8217;s very helpful in making visual sense of a spectrogram, it&#8217;s important to realize that the smoothing doesn&#8217;t actually increase the amount of information in the spectrogram; it&#8217;s just the computer&#8217;s best guess at what the spectrogram would look like if the resolution were higher.<\/p>\n<p>Here&#8217;s a series of spectrograms of the exact same recording (an American Tree Sparrow call).  On the left is the raw, unsmoothed spectrogram.  On the right is the smoothed version.  From top to bottom, the time resolution increases and the the frequency resolution decreases.<\/p>\n<h4>Window size: 23.2 mS \u00d7 61.9 Hz<\/h4>\n<figure id=\"attachment_1310\" aria-describedby=\"caption-attachment-1310\" style=\"width: 660px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-1024.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1310\" title=\"atsp1c-1024\" src=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-1024.jpg\" alt=\"American Tree Sparrow call, Minnehaha County, SD, 12\/13\/2009.  Left: raw (unsmoothed) spectrogram; right: smoothed version.\" width=\"660\" height=\"260\" srcset=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-1024.jpg 660w, http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-1024-300x118.jpg 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-1310\" class=\"wp-caption-text\">American Tree Sparrow call, Minnehaha County, SD, 12\/13\/2009.  Left: raw; right: smoothed.<\/figcaption><\/figure>\n<h4>Window size: 11.6 mS \u00d7 124 Hz<\/h4>\n<figure id=\"attachment_1311\" aria-describedby=\"caption-attachment-1311\" style=\"width: 660px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-512.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1311\" title=\"atsp1c-512\" src=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-512.jpg\" alt=\"Same recording.\" width=\"660\" height=\"260\" srcset=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-512.jpg 660w, http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-512-300x118.jpg 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-1311\" class=\"wp-caption-text\">Same recording as above. Left: raw; right: smoothed.<\/figcaption><\/figure>\n<h4>Window size: 5.8 mS \u00d7 248 Hz<\/h4>\n<figure id=\"attachment_1313\" aria-describedby=\"caption-attachment-1313\" style=\"width: 660px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-256.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1313\" title=\"atsp1c-256\" src=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-256.jpg\" alt=\"Same recording as above.\" width=\"660\" height=\"260\" srcset=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-256.jpg 660w, http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-256-300x118.jpg 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-1313\" class=\"wp-caption-text\">Same recording as above. Left: raw; right: smoothed.<\/figcaption><\/figure>\n<h4>Window size: 2.9 mS \u00d7 496 Hz<\/h4>\n<figure id=\"attachment_1314\" aria-describedby=\"caption-attachment-1314\" style=\"width: 660px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-128.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1314\" title=\"atsp1c-128\" src=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-128.jpg\" alt=\"Same recording as above.\" width=\"660\" height=\"260\" srcset=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-128.jpg 660w, http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-128-300x118.jpg 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-1314\" class=\"wp-caption-text\">Same recording as above. Left: raw; right: smoothed.<\/figcaption><\/figure>\n<h4>Window size: 1.45 mS \u00d7 991 Hz<\/h4>\n<figure id=\"attachment_1315\" aria-describedby=\"caption-attachment-1315\" style=\"width: 660px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-64.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1315\" title=\"atsp1c-64\" src=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-64.jpg\" alt=\"Same recording as above.\" width=\"660\" height=\"260\" srcset=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-64.jpg 660w, http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/atsp1c-64-300x118.jpg 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/a><figcaption id=\"caption-attachment-1315\" class=\"wp-caption-text\">Same recording as above. Left: raw; right: smoothed.<\/figcaption><\/figure>\n<p>Note that I am not &#8220;zooming&#8221; in or out on these calls; the time and frequency axes remain precisely the same in all of the above spectrograms.\u00a0 All I&#8217;ve done is decrease the width of the analysis windows, which automatically increases their height.<\/p>\n<p>See how tremendously different the smoothed spectrograms look from one another?\u00a0 The difference between the second and fifth is particularly striking.\u00a0 In the second, we clearly see a series of horizontal sidebands in the call.\u00a0 In the fifth, we see only an extremely rapid series of vertical, click-like notes.\u00a0 How can these possibly be spectrograms of the same call?\u00a0 Which one is right?<\/p>\n<p>They&#8217;re both right.\u00a0 All the spectrograms above are accurate, in that they&#8217;re all displaying different (accurate) interpretations of the same data.\u00a0 A complex tone comprised of whistled partials (like in the second spectrogram) and a rapid series of clicks (like in the fifth spectrogram) can be the same sound.\u00a0 <strong>Once a series of clicks becomes fast enough, we hear it as a harmonically complex tone<\/strong>.\u00a0 This shouldn&#8217;t be surprising when you consider that the human vocal cords are just making a series of very fast clicks, but the result is a wonderfully rich, harmonically complex sound: the human voice.<\/p>\n<p>Here&#8217;s a spectrogram that shows basically the same phenomenon.\u00a0 Artificially generated for demonstration purposes, it&#8217;s the spectrogram of a decelerating series of groups of clicks.\u00a0 When the groups of clicks are closely spaced, at the beginning of the spectrogram, they don&#8217;t show up as groups of clicks, but as a single pure tone with sidebands.\u00a0 Only later, when the distance between clicks reaches a certain threshold determined by the window size, does the spectrogram begin to resolve them separately:<\/p>\n<figure id=\"attachment_1328\" aria-describedby=\"caption-attachment-1328\" style=\"width: 443px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/watkins1968_fig4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1328\" title=\"watkins1968_fig4\" src=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/watkins1968_fig4.jpg\" alt=\"caption\" width=\"443\" height=\"258\" srcset=\"http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/watkins1968_fig4.jpg 443w, http:\/\/earbirding.com\/blog\/wp-content\/uploads\/2009\/12\/watkins1968_fig4-300x174.jpg 300w\" sizes=\"auto, (max-width: 443px) 100vw, 443px\" \/><\/a><figcaption id=\"caption-attachment-1328\" class=\"wp-caption-text\">From Watkins (1968).<\/figcaption><\/figure>\n<p>There&#8217;s been some debate in the technical literature over whether sidebands like these are a &#8220;real&#8221; phenomenon, or just an &#8220;artefact&#8221; of spectrographic analysis.\u00a0 For anyone interested in the debate, <a title=\"https:\/\/darchive.mblwhoilibrary.org\/bitstream\/handle\/1912\/2726\/WHOI-68-13.pdf?sequence=1\" href=\"https:\/\/darchive.mblwhoilibrary.org\/bitstream\/handle\/1912\/2726\/WHOI-68-13.pdf?sequence=1\" target=\"_blank\">Watkins (1968)<\/a> is required reading.\u00a0 If you&#8217;d like more information on where the debate went after 1968, <a title=\"mailto:npieplow@indra.com\" href=\"mailto:npieplow@indra.com\" target=\"_blank\">email me<\/a>.\u00a0 Suffice it to say that, for all intents and purposes, the winners were those who argued that sidebars were real.<\/p>\n<p>Although this post was on the technical side, I hope it was useful to you.\u00a0 Comments are welcome (including those telling me I&#8217;ve gotten something horribly wrong).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today&#8217;s post is the promised follow-up to my post on the history of spectrograms. I want to explain some basic concepts of spectrographic analysis so that I can clear up some common misconceptions and explain why some things may not always look quite the way you expected.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-1307","post","type-post","status-publish","format-standard","hentry","category-spectrograms"],"_links":{"self":[{"href":"http:\/\/earbirding.com\/blog\/wp-json\/wp\/v2\/posts\/1307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/earbirding.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/earbirding.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/earbirding.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/earbirding.com\/blog\/wp-json\/wp\/v2\/comments?post=1307"}],"version-history":[{"count":23,"href":"http:\/\/earbirding.com\/blog\/wp-json\/wp\/v2\/posts\/1307\/revisions"}],"predecessor-version":[{"id":1337,"href":"http:\/\/earbirding.com\/blog\/wp-json\/wp\/v2\/posts\/1307\/revisions\/1337"}],"wp:attachment":[{"href":"http:\/\/earbirding.com\/blog\/wp-json\/wp\/v2\/media?parent=1307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/earbirding.com\/blog\/wp-json\/wp\/v2\/categories?post=1307"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/earbirding.com\/blog\/wp-json\/wp\/v2\/tags?post=1307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}