{"id":51,"date":"2015-01-14T04:55:55","date_gmt":"2015-01-14T04:55:55","guid":{"rendered":"http:\/\/www.bourbonandcoffee.com\/?p=51"},"modified":"2015-01-14T12:42:40","modified_gmt":"2015-01-14T17:42:40","slug":"im-a-bit-new-to-waveforms-or-how-i-learned-to-stop-worrying-and-love-the-pwm","status":"publish","type":"post","link":"http:\/\/www.bourbonandcoffee.com\/?p=51","title":{"rendered":"I&#8217;m a Bit New to Waveforms, or: How I Learned to Stop Worrying and Love the PWM"},"content":{"rendered":"<p>When I was a kid, my brothers and I played the fuck out of some Commodore 64, and later NES, games. We were forced to take turns (sharing sucks), and since some games were quick (<em><a href=\"https:\/\/www.youtube.com\/watch?v=EkslCLMX8qA\">Green Beret<\/a><\/em>) while others were not (<em><a href=\"https:\/\/archive.org\/details\/msdos_African_Adventure_1984\">African Adventure<\/a><\/em>), my brothers and I somehow agreed on 30 minute turns. That way, if we were playing a quick game (or died too quickly), we could try again without worrying about a brother playing a long-ass turn of Dragon Warrior. I was a software pirate then,\u00a0getting pirated games from friends who&#8217;d learned to copy games, and to <a href=\"https:\/\/archive.org\/stream\/1981-03-compute-magazine\/Compute_Issue_010_1981_Mar#page\/n69\/mode\/2up\">use a hole-punch to turn a single-sided floppy disc into a double-sided one<\/a>\u00a0so we could save money on blank discs.<\/p>\n<p>One game that my brothers and I all agreed on, though, was <em>World Karate Championship<\/em>, or <a href=\"http:\/\/en.wikipedia.org\/wiki\/International_Karate\"><em>International Karate<\/em><\/a> as it was known\u00a0before being licensed by Epyx. It was quite playable, and posed a decent challenge without being too difficult. Additionally, it boasted a <a href=\"https:\/\/www.youtube.com\/watch?v=Js2mcVVJpnA\">killer score<\/a>:<\/p>\n<p><iframe loading=\"lazy\" title=\"International Karate Theme - Rob Hubbard - Best of C64 Music\" width=\"627\" height=\"470\" src=\"https:\/\/www.youtube.com\/embed\/Js2mcVVJpnA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>Before I go any further, let me just say that although I love this tune to this day, I do recognize it&#8217;s inherently problematic, as\u00a0Rob Hubbard relied heavily on a stereotypical &#8220;<a href=\"http:\/\/www.metafilter.com\/142319\/The-origins-of-that-stereotypical-Chinese-nine-note-riff\">Oriental riff<\/a>&#8220;-type feel in its melody (which\u00a0he did even more egregiously in the score to Mastertronic&#8217;s\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=oPHlG8B_2sQ\"><em>Ninja<\/em><\/a>). I&#8217;ll have more to say on this specific facet of music in an upcoming post about guilty pleasures, but for now, try to grit your teeth and bear it for now.<\/p>\n<p>At this point, I&#8217;ve been delighted by this song for nearly three decades. It rolls along unchanged for a few\u00a0minutes, then a drum fill heralds the coming of an uptempo section at about four minutes. This new section was exciting, as it meant the game was going particularly well. And whoa boy, if you got six minutes into the game, you were treated to a total shredding lead solo. Exciting! Only once, that I can remember, did I last long enough in the game to get to the coda, a reprise of the initial melody and feel, with extra &#8220;Oriental&#8221; bits added (challenging the blush response of the\u00a0Progressive I have become in my old age).<\/p>\n<p>Today, in a discussion with <a href=\"https:\/\/www.facebook.com\/riiites\">Evan<\/a>, I was\u00a0poking around youtube looking for\u00a0this tune and others to paste into FB when I discovered a\u00a0copy of the above tune with some actual video content beyond game screengrabs:<\/p>\n<p><iframe loading=\"lazy\" title=\"C64 Rob Hubbard&#039;s International Karate oscilloscope view\" width=\"627\" height=\"353\" src=\"https:\/\/www.youtube.com\/embed\/dvmSpZWW45k?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>This video is a combined view of the Commodore 64&#8217;s <a href=\"http:\/\/en.wikipedia.org\/wiki\/MOS_Technology_SID#Features\">SID chip<\/a>&#8216;s three oscillators, each rendered oscilloscope-style, but centered in the middle of the screen. Initially, there are three flat lines, and then the middle line begins oscillating with a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Sawtooth_wave\">sawtooth<\/a> waveform. After a few seconds, the other two oscillators come in, as <a href=\"http:\/\/en.wikipedia.org\/wiki\/Square_wave\">square<\/a>\u00a0(or pulse) waves. You can see all three\u00a0stretch and shrink as the pitches\u00a0down and up (the number of &#8220;squares&#8221; on the screen increases with pitch).<\/p>\n<p>The SID chip only had three oscillators, so when you needed, for example, drums, in addition to the three voices already going strong, you had to get creative. Hubbard, on this track, did that by sneaking the drums (as filtered white noise) into the bassline track, the bottom line in this video. (Watch for when the line gets all crazy, then goes back to squares &#8212; those are the drum sounds).<\/p>\n<p style=\"text-align: left;\">All this was interesting to me, not just because I grew up playing this game and hearing this song on a loop for 30 minutes at a time in the 80s, but because I recently bought an actual oscilloscope to use with my modular synthesizer. I&#8217;d not used an oscilloscope since the 90s, when I was working toward my (useless) Physics degree, but I figured I&#8217;d retained enough to be able to get some use out of my new Craigslist find. I brought it home, secured the right cables on ebay, and pointed my <a href=\"http:\/\/mutable-instruments.net\/modules\/braids\">Braids<\/a> into the oscilloscope.<\/p>\n<p style=\"text-align: left;\">Now, Braids is a gorgeous\u00a0<em>sounding<\/em> synth, but looking at it on an oscilloscope was a whole new experience:<\/p>\n<blockquote class=\"instagram-media\" style=\"background: #FFF; border: 0; border-radius: 3px; box-shadow: 0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width: 658px; padding: 0; width: calc(100% - 2px);\" data-instgrm-captioned=\"\" data-instgrm-version=\"4\">\n<div style=\"padding: 8px;\">\n<div style=\"line-height: 0; margin-top: 40px; padding: 50% 0px; width: 100%; text-align: center; background: #f8f8f8;\"><\/div>\n<p style=\"margin: 8px 0px 0px; padding: 0px 4px; text-align: center;\"><a style=\"color: #000; font-family: Arial,sans-serif; font-size: 14px; font-style: normal; font-weight: normal; line-height: 17px; text-decoration: none; word-wrap: break-word;\" href=\"https:\/\/instagram.com\/p\/xVCs-YSYVl\/\" target=\"_top\">Braids is beautiful even without hearing it. #modularsynth<\/a><\/p>\n<p style=\"color: #c9c8cd; font-family: Arial, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 0px; margin-top: 8px; overflow: hidden; padding: 8px 0px 7px; text-align: center; text-overflow: ellipsis; white-space: nowrap;\">A photo posted by dj empirical (@dj_empirical) on <time style=\"font-family: Arial,sans-serif; font-size: 14px; line-height: 17px;\" datetime=\"2015-01-01T22:53:00+00:00\">Jan 1, 2015 at 2:53pm PST<\/time><\/p>\n<\/div>\n<\/blockquote>\n<p><script src=\"\/\/platform.instagram.com\/en_US\/embeds.js\" async=\"\" defer=\"defer\"><\/script><\/p>\n<p>Of course,\u00a0Braids is quite complex, far more so than the C64&#8217;s SID chip was.<\/p>\n<p>This new C64 video intrigued me, and I watched it a few times, listening along to the sounds, realizing that I could\u00a0already kinda\u00a0tell the difference between square, triangle, and sawtooth waveforms by ear, which is cool. Something else, though, caught my ear\/eye.<\/p>\n<p>Play that video at about the 1:31 point, right when the new melody comes in (on the top line). You&#8217;ll see the square wave not just grow and shrink relative to the center point, but the width to the square relative to the gap between squares changes as well; i.e., it&#8217;ll go from a thin square to a thick one. This is called <a href=\"http:\/\/en.wikipedia.org\/wiki\/Pulse-width_modulation\">pulse width modulation<\/a>\u00a0(PWM), and is something I qualitatively understood from my modular synth experimentation, but had never really connected directly with a sound so clearly than as shown in this vid.<\/p>\n<p>I decided to take a look at this user&#8217;s other oscilloscope vids, to see whether I could hear that\u00a0same sound in another oscillator with changing PWM. I found &#8220;<a href=\"https:\/\/www.youtube.com\/watch?v=YIA_0cvS2gQ\">Monty on the Run<\/a>&#8220;, by the same composer, and wow, is the PWM ever visible here!<\/p>\n<p><iframe loading=\"lazy\" title=\"C64 Rob Hubbard&#039;s &quot;Monty on the run&quot; oscilloscope view\" width=\"627\" height=\"353\" src=\"https:\/\/www.youtube.com\/embed\/YIA_0cvS2gQ?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>At 10 seconds in, the top two oscillators are both playing static notes, so their pitches are not changing (same number of square waves in the screen). However, the width of their square waves is varying in a regular fashion, and it&#8217;s audible! At 1:52, the uppermost line hits a point where the pulse width is very short, giving the oscillator a new, sharper sound for a few bars<\/p>\n<p>This is a bit of a breakthrough for me. I&#8217;ve been kind of &#8220;academically&#8221; aware of waveforms and what they do (cf. that Physics degree I mentioned), but haven&#8217;t <em>really<\/em> paid enough attention to what they sounds like (you know, the most important part).\u00a0As a relatively new synth player, this stuff is fascinating, and understanding it will go a long way toward enhancing my own compositions.<\/p>\n<p>Another\u00a0disclaimer to all of this is that I&#8217;m very new to all this, plus I know there are things going on in the C64 SID chip that aren&#8217;t necessarily readily apparent (phasing, ring modulator, etc.). Hubbard, I think, is notorious for using the chip in ways to get crazy chorus-y, phase-y sounds.<\/p>\n<p>Please do leave a comment if you have anything to add or clarify.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I was a kid, my brothers and I played the fuck out of some Commodore 64, and later NES, games. We were forced to take turns (sharing sucks), and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[25,22,23,26,24,27],"class_list":["post-51","post","type-post","status-publish","format-standard","hentry","category-sounds","tag-80s","tag-commodore-64","tag-modular-synth","tag-rob-hubbard","tag-synth","tag-video-games"],"_links":{"self":[{"href":"http:\/\/www.bourbonandcoffee.com\/index.php?rest_route=\/wp\/v2\/posts\/51","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.bourbonandcoffee.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.bourbonandcoffee.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.bourbonandcoffee.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.bourbonandcoffee.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=51"}],"version-history":[{"count":8,"href":"http:\/\/www.bourbonandcoffee.com\/index.php?rest_route=\/wp\/v2\/posts\/51\/revisions"}],"predecessor-version":[{"id":64,"href":"http:\/\/www.bourbonandcoffee.com\/index.php?rest_route=\/wp\/v2\/posts\/51\/revisions\/64"}],"wp:attachment":[{"href":"http:\/\/www.bourbonandcoffee.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.bourbonandcoffee.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.bourbonandcoffee.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}