{"id":10,"date":"2008-05-15T13:46:13","date_gmt":"2008-05-15T12:46:13","guid":{"rendered":"http:\/\/freesound.iua.upf.edu\/blog\/?p=10"},"modified":"2009-02-17T13:16:15","modified_gmt":"2009-02-17T12:16:15","slug":"wav2pngpy-child-of-wav2png","status":"publish","type":"post","link":"https:\/\/blog.freesound.org\/?p=10","title":{"rendered":"wav2png.py, son of wav2png"},"content":{"rendered":"<p>Last week I decided that for nightingale we need a new wav2png, and preferably one written in python, using the awesome <a href=\"http:\/\/www.pythonware.com\/products\/pil\/\">python image library<\/a>. After talking a bit to <a href=\"http:\/\/www.ricardmarxer.com\/\">Ricard<\/a> it was clear that using <a href=\"http:\/\/numpy.scipy.org\/\">numpy<\/a> and <a href=\"http:\/\/www.ar.media.kyoto-u.ac.jp\/members\/david\/softwares\/audiolab\/\">audiolab<\/a> it would be a piece of cake. Well, a big piece of cake, but still. Once I got going, I went a bit overboard and decided that it would be nice to have a spectrogram of the sound as well, perhaps displayed when you move the mouse over the large image in the sound page.<\/p>\n<p>It took me about 2 and a half days of coding and testing to make it robust (it needs to work for 5-sample wave files and 5-million-samples wave files) and looking good. Some sensible feedback from the guys at <a href=\"http:\/\/www.onedotonly.be\/\">oneDot.only<\/a> made me decide that we had to cut back on the number of colors in the waveform view. The current one looks really ugly in my opinion, so&#8230; that was changes as well. It&#8217;ll take a while for people to become accustomed to the new colors, but it makes sense to me. I threw in some vertical anti-aliasing for that extra slick look.<\/p>\n<p>For those who don&#8217;t know what a spectrogram is, have a look at the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Spectrogram\">wikipedia entry<\/a> for it.<\/p>\n<p>Without further ado, I present you some results. First of all my own &#8220;test&#8221; file, a <a href=\"http:\/\/freesound.iua.upf.edu\/samplesViewSingle.php?id=11\">sinusoid sweep<\/a>:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/media.freesound.org\/files\/wav2png\/11_Bram_sweep_log_w.png\" \/><\/p>\n<p>and its spectrogram:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/media.freesound.org\/files\/wav2png\/11_Bram_sweep_log_s.png\" \/><\/p>\n<p>An <a href=\"http:\/\/freesound.iua.upf.edu\/samplesViewSingle.php?id=1162\">FM percussion loop<\/a> from <a href=\"http:\/\/freesound.iua.upf.edu\/usersViewSingle.php?id=674\">walkerbelm<\/a>:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/media.freesound.org\/files\/wav2png\/1162_walkerbelm_so_fmperc_w.png\" \/><\/p>\n<p>and its spectrogram:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/media.freesound.org\/files\/wav2png\/1162_walkerbelm_so_fmperc_s.png\" height=\"170\" width=\"500\" \/><\/p>\n<p>A <a href=\"http:\/\/freesound.iua.upf.edu\/samplesViewSingle.php?id=38660\">bell sequence<\/a> from <a href=\"http:\/\/freesound.iua.upf.edu\/usersViewSingle.php?id=215874\">ERH<\/a>:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/media.freesound.org\/files\/wav2png\/38660_ERH_bell_sequence_5b_w.png\" \/><\/p>\n<p>and  its spectrogram:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/media.freesound.org\/files\/wav2png\/38660_ERH_bell_sequence_5b_s.png\" \/><\/p>\n<p>You can find the full source code to generate these images in the nightingale repository ( <a href=\"http:\/\/github.com\/bram\/freesound\/tree\/master\" rel=\"nofollow\">http:\/\/github.com\/bram\/freesound\/tree\/master<\/a> ), in particular look in the directory \/freesound\/utils\/audioprocessing\/<\/p>\n<p>You&#8217;ll need to install python, numpy, PIL and audiolab to make it work. See above for the links.<\/p>\n<p>Let me know what you think!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week I decided that for nightingale we need a new wav2png, and preferably one written in python, using the awesome python image library. After talking a bit to Ricard it was clear that using numpy and audiolab it would &hellip; <a href=\"https:\/\/blog.freesound.org\/?p=10\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[10],"class_list":["post-10","post","type-post","status-publish","format-standard","hentry","category-nightingale","category-techtalk","tag-wav2png-images-generation"],"_links":{"self":[{"href":"https:\/\/blog.freesound.org\/index.php?rest_route=\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.freesound.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.freesound.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.freesound.org\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.freesound.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10"}],"version-history":[{"count":0,"href":"https:\/\/blog.freesound.org\/index.php?rest_route=\/wp\/v2\/posts\/10\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.freesound.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.freesound.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.freesound.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}