{"id":27,"date":"2014-12-01T14:11:00","date_gmt":"2014-12-01T14:11:00","guid":{"rendered":"http:\/\/www.celesteh.com\/blog\/2014\/12\/01\/glitching-sound-how-to-data-bend-wi\/"},"modified":"2015-06-19T00:22:54","modified_gmt":"2015-06-18T23:22:54","slug":"glitching-sound-how-to-data-bend-wi","status":"publish","type":"post","link":"https:\/\/www.celesteh.com\/blog\/2014\/12\/01\/glitching-sound-how-to-data-bend-wi\/","title":{"rendered":"Glitching Sound: how to data bend with imagemagick"},"content":{"rendered":"<p>Inspired by Antonio Roberts&#8217;s excellent tutorial on how to <a href=\"http:\/\/www.hellocatfood.com\/databending-using-audacity\/\">databend with Audacity<\/a>, and following on from my previous <a href=\"http:\/\/www.celesteh.com\/blog\/2009\/12\/29\/how-to-data-bend\/\">tutorial on how to data bend audio<\/a>, this post explores how to glitch audio using image software. Many of the required tools use the command line. This will work with linux, unix and mac. If you want to use windows, you will need to edit the autobmp.sh bash script so that it does not use the \/tmp directory.<\/p>\n<h3>You will need<\/h3>\n<ul>\n<li><a href=\"https:\/\/github.com\/celesteh\/autobmp\">The autobmp.sh script<\/a>\n<li><a href=\"http:\/\/www.imagemagick.org\/\">Imagemagick<\/a> (You probably already have this if you use linux.)\n<li><a href=\"http:\/\/www.gnu.org\/software\/bash\/\">BASH<\/a> (you already have this if you use linux or if you have a terminal on your mac)\n<li>A utility to convert between audio formats that supports the .au format. I use <a href=\"http:\/\/sox.sourceforge.net\/\">sox<\/a>, which is cross-platform and available via apt-get.\n<li><a href=\"http:\/\/audacity.sourceforge.net\/\">Audacity<\/a>\n<\/ul>\n<h3>Why these formats?<\/h3>\n<p>.au and .bmp are both uncompressed formats, so every sample of audio becomes the R, G or B value of a pixel. AIFF and WAV files are also uncompressed, but the files have more structure to them that is not sound data, so .au seems easier.<\/p>\n<h3>Getting Started<\/h3>\n<div class=\"separator\" style=\"clear: both; text-align: center;\"><a href=\"http:\/\/2.bp.blogspot.com\/-K-AeCyLMXy4\/VHu7pDVhxvI\/AAAAAAAABGA\/8y5rM_qK5Uw\/s1600\/saw.au.bmp\" imageanchor=\"1\" style=\"clear: right; float: right; margin-bottom: 1em; margin-left: 1em;\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/2.bp.blogspot.com\/-K-AeCyLMXy4\/VHu7pDVhxvI\/AAAAAAAABGA\/8y5rM_qK5Uw\/s200\/saw.au.bmp\" \/><\/a>10 seconds of a sawtooth wave<\/div>\n<p>Using sox to convert between uncompressed audio formats is really easy. To convert a file called foo.wav to an au file, you would just type: sox foo.wav foo.au&nbsp; It looks at the extension and does the right thing.<br \/>\nPut the script in a directory in your path, OR just put it in your current working directory.<br \/>\nOnce you&#8217;ve got foo.au, to convert it to a bmp, you&#8217;d type: .\/autobmp.sh foo.au foo.bmp&nbsp; This will give you a file called foo.bmp, which is the bmp image of your audio.<br \/>\nLet&#8217;s say, you&#8217;ve done a bunch of transformations and now have a file called bar.bmp. To turn that back into audio, you would type: convert -depth 16 bar.bmp rgb:bar.pcm&nbsp; It is now back in an audio format, but the header has gotten slightly tweaked, so we&#8217;re not done. Open Audacity, and under the File mean, select, &#8216;import&#8217; and then &#8216;raw audio&#8217;. Pick bar.pcm in the file chooser. On the popup window, tell it that the file is &#8217;16-bit linear&#8217; and &#8216;little endian&#8217;.  There will be a few samples of crap at the beginning of the imported audio. That&#8217;s what&#8217;s left of your old .au header. you can delete it if you want. there will also be a bit of silence at the end of the file. This was padding added to make the image rectangular. To convert this into AIFF or WAV or MP3 or whatever, select &#8216;Export&#8217; from the file menu.<br \/>\nIf you have ended up with a different image format, such as jpeg or whatever, you don&#8217;t need to first convert back to bmp. To get from baz.jpeg back to audio, use convert directly and carry on as above. convert -depth 16 baz.jpeg rgb:baz.pcm<\/p>\n<h3>What to do while it&#8217;s a graphics file?<\/h3>\n<p>This is the creative bit! Converting to a lossy graphics format, such as jpeg adds some noise, so that might be fun. If you do that, you can glitch the jpeg by opening it in a text editor and doing a bit of typing at various points in the file. This causes weird visual distortions, which will become audio distortions when you convert back.<br \/>\nYou can also try opening the graphics file in a graphics program. Some of the graphics effects may make interesting sound changes, although many won&#8217;t. Experimentation is needed. You can also try drawing on the image. Wide lines of a solid colour will create weird DC offsets, so if you want to avoid that, consider either using very thin lines or else setting an opacity of under 100%.<br \/>\nHave fun!<\/p>\n<div class=\"separator\" style=\"clear: both; text-align: center;\">\n    <a href=\"https:\/\/www.etsy.com\/shop\/celesteh\"><br \/>\n        <img decoding=\"async\" border=\"0\" data-src=\"http:\/\/www.celesteh.com\/blog\/wp-content\/uploads\/2014\/12\/bammer4.png\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 400px; --smush-placeholder-aspect-ratio: 400\/52;\"><\/img><br \/>\n    <\/a>\n<\/div>\n<p><i>Music commissions make great gifts. <a href=\"http:\/\/celesteh.etsy.com\">Order now<\/a> for this holiday season!<\/i><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Inspired by Antonio Roberts&#8217;s excellent tutorial on how to databend with Audacity, and following on from my previous tutorial on how to data bend audio, this post explores how to glitch audio using image software. Many of the required tools use the command line. This will work with linux, unix and mac. If you want &hellip; <a href=\"https:\/\/www.celesteh.com\/blog\/2014\/12\/01\/glitching-sound-how-to-data-bend-wi\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Glitching Sound: how to data bend with imagemagick<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[1],"tags":[30,31,32,33],"class_list":["post-27","post","type-post","status-publish","format-standard","hentry","category-uncategorised","tag-audacity","tag-data-bending","tag-glitch","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/posts\/27","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/comments?post=27"}],"version-history":[{"count":2,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/posts\/27\/revisions"}],"predecessor-version":[{"id":4410,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/posts\/27\/revisions\/4410"}],"wp:attachment":[{"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/media?parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/categories?post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.celesteh.com\/blog\/wp-json\/wp\/v2\/tags?post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}