{"id":744,"date":"2018-03-04T12:55:50","date_gmt":"2018-03-04T12:55:50","guid":{"rendered":"http:\/\/starrydave.com\/?p=744"},"modified":"2018-03-04T14:45:27","modified_gmt":"2018-03-04T14:45:27","slug":"3d-spectrogram-tutorial","status":"publish","type":"post","link":"http:\/\/starrydave.com\/?p=744","title":{"rendered":"3D Spectrogram Tutorial"},"content":{"rendered":"<p>This tutorial shows you how to easily make interactive 3D Spectrogams like <a href=\"http:\/\/starrydave.com\/3d\/birds03\/birds03.html\">this<\/a> using <a href=\"http:\/\/www.audacityteam.org\/\">Audacity<\/a>. The source files are <a href=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/spectrogram.zip\">zipped up here<\/a>\u00a0which includes the &#8220;spectrogram.html&#8221; file you will need for your own spectrogram.<\/p>\n<div id=\"attachment_737\" style=\"width: 705px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/starrydave.com\/3d\/birds03\/birds03.html\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-737\" class=\"wp-image-737 size-large\" src=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/screenshotbirds3-1024x522.png\" alt=\"\" width=\"695\" height=\"354\" srcset=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/screenshotbirds3-1024x522.png 1024w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/screenshotbirds3-300x153.png 300w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/screenshotbirds3-768x391.png 768w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/screenshotbirds3.png 1227w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/a><p id=\"caption-attachment-737\" class=\"wp-caption-text\">Click image for interactive 3D version<\/p><\/div>\n<p>The 3D graphics are powered by the <a href=\"https:\/\/www.babylonjs.com\/\">Babylon.js framework<\/a> which does all the hard stuff for you.<\/p>\n<p><strong>1. Select Your Audio:-<\/strong> Choose the audio you want to display, optimise it and save it to &#8220;original.wav&#8221;.<\/p>\n<p><strong>2. Grab Audacity Screenshots:-<\/strong> Load &#8220;original.wav&#8221; and show its color spectrogram. Hide all toolbars and zoom in to fill track with audio information. Use Audacity&gt;Help&gt;Tools&gt;Screenshot Tools to take a color screenshot. Change spectrogram to monochrome and take another screenshot.<\/p>\n<p><a href=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/window001.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-747 size-medium\" src=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/window001-300x158.png\" alt=\"\" width=\"300\" height=\"158\" srcset=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/window001-300x158.png 300w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/window001-768x406.png 768w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/window001-1024x541.png 1024w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/window001.png 1920w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/window002.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-748 size-medium\" src=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/window002-300x158.png\" alt=\"\" width=\"300\" height=\"158\" srcset=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/window002-300x158.png 300w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/window002-768x406.png 768w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/window002-1024x541.png 1024w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/window002.png 1920w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><!--more--><\/p>\n<p><strong>3. Edit Monochrome Screenshot:-<\/strong> Use <a href=\"https:\/\/www.getpaint.net\/index.html\">Paint.Net<\/a> or <a href=\"https:\/\/www.gimp.org\/\">GIMP<\/a> to remove borders around spectrogram panel(s) using background color of spectrogam. To do this, use the eyedropper color selector to pick a color on a quiet part of the spectrogram. Then draw borderless, filled rectangles to hide the audacity window borders like so and save as &#8220;mono.png&#8221;.<\/p>\n<div id=\"attachment_746\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/mono.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-746\" class=\"wp-image-746 size-medium\" src=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/mono-300x158.png\" alt=\"\" width=\"300\" height=\"158\" srcset=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/mono-300x158.png 300w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/mono-768x406.png 768w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/mono-1024x541.png 1024w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/mono.png 1920w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-746\" class=\"wp-caption-text\">mono.png<\/p><\/div>\n<p><strong>4. Edit Color Screenshot (Optional):-<\/strong> Use Paint.Net or GIMP to add grid lines and text if required and save as &#8220;color.png&#8221; (otherwise rename color screenshot to &#8220;color.png&#8221;).<\/p>\n<div id=\"attachment_745\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/color.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-745\" class=\"wp-image-745 size-medium\" src=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/color-300x158.png\" alt=\"\" width=\"300\" height=\"158\" srcset=\"http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/color-300x158.png 300w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/color-768x406.png 768w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/color-1024x541.png 1024w, http:\/\/starrydave.com\/wordpress\/wp-content\/uploads\/color.png 1920w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-745\" class=\"wp-caption-text\">color.png<\/p><\/div>\n<p><strong>5. Save Audio to MP3:-<\/strong> I edited &#8220;original.wav&#8221; to add a 5 second silence followed by a half speed copy of the audio followed by another 5s silence. Whatever you do, export the audio to &#8220;audio.mp3&#8221;.<\/p>\n<p><strong>6. Show and Share Spectrogram:-<\/strong> Make a folder containing &#8220;color.png&#8221;, &#8220;mono.png&#8221;, &#8220;audio.mp3&#8221; and &#8220;spectrogram.html&#8221;. Clicking on &#8220;spectrogram.html&#8221; will display the 3D spectrogram in your browser. Zoom in with your mouse wheel and click-drag to rotate the view. You can also upload the folder to a web site and if you do, please link back to this tutorial so others can try it out.<\/p>\n<p><strong>7. Advanced Options:-<\/strong> The above steps will let you create a 3D spectrogram without any coding. It will be in 16&#215;9 format which you can change by editing &#8220;spectrogram.html&#8221; in a text editor like NotePad. Edit the following line as needed<\/p>\n<p>var ground = BABYLON.Mesh.CreateGroundFromHeightMap(&#8220;ground&#8221;, heightmap, 500, 264, 1000, 40, -40, scene, false);<\/p>\n<p>where:-<\/p>\n<p>500 = width of spectrogram<\/p>\n<p>264 = height of spectrogram<\/p>\n<p>1000 = level of detail, increase for more detail but slower model<\/p>\n<p>40 and -40 = minimum and maximum elevations of data points<\/p>\n<p>Make sure you save your file as &#8220;spectrogram.html&#8221; rather than with a &#8220;.txt&#8221; extension.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows you how to easily make interactive 3D Spectrogams like this using Audacity. The source files are zipped up here\u00a0which includes the &#8220;spectrogram.html&#8221; file you will need for your own spectrogram. The 3D graphics are powered by the Babylon.js framework which does all the hard stuff for you. 1. Select Your Audio:- Choose <a href='http:\/\/starrydave.com\/?p=744' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[11],"tags":[],"class_list":["post-744","post","type-post","status-publish","format-standard","hentry","category-birds","category-11-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"http:\/\/starrydave.com\/index.php?rest_route=\/wp\/v2\/posts\/744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/starrydave.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/starrydave.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/starrydave.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/starrydave.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=744"}],"version-history":[{"count":13,"href":"http:\/\/starrydave.com\/index.php?rest_route=\/wp\/v2\/posts\/744\/revisions"}],"predecessor-version":[{"id":762,"href":"http:\/\/starrydave.com\/index.php?rest_route=\/wp\/v2\/posts\/744\/revisions\/762"}],"wp:attachment":[{"href":"http:\/\/starrydave.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/starrydave.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=744"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/starrydave.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}