Research in Game Music: The difference between pulse waves and square waves

So, a couple of the readers of this blog asked me (in lieu of my current 2 part series on Dr. Mario across the NES and Game Boy) to explain the difference between square waves and pulse waves.  Let’s see if I can shed some light on how this works.

Pulse waves:

So pulse waves use pulse width modulation (PWM).  Basically, this assigns a “duty cycle” to the activators that make the pulse wave different shapes.  This is manifested in rectangular wave formats:

The image above shows the duty cycle as it grows from 0% to 100%.  Duty cycle, literally interpreted, refers to how long something receives power or is activated.  We use duty cycle related devices all the time.  Say you have a blender with varying speeds from slow to fast.  The blender, off, has a duty cycle of 0% or 0/100.  Say you set the blender to Speed 1.  The blender activates and a duty cycle is assigned for 10/90, that is 10% of the time, the device is activated and 90% of the time it is not.  If you pressed Speed 6, it would adjust the duty cycle to 60/40, that is the device is active 60% of the time and inactive 40% of the time.  The duty cycle is essentially how all variable speed motors work.

So what does this have to do with the NES?  Well, the NES’s pulse waves have the ability to change from duty cycles 12.5%, 25%, 50% and 75%.  Each one of these duty cycles has a different timbre.  Here’s a great example by fellow game music blogger, explod2a03:

Important fact:  most oscillators have duty cycle modulation between 0-50% and not higher.  This is because these particular kinds of waves are reflexive.  5/95 sounds the same as 95/5 to us.  We can’t tell the difference.  Listen to the example by explod2a03 carefully.  Can you tell the difference between 25% duty cycle and 75% duty cycle on the 2a03?  Sounds identical to me.  So why include duty cycle 75%?  I’m not sure.  If they had included say, duty cycle 33.3%, the NES would have 4 distinct timbres to draw from instead of 3.

This is the real trick behind making the NES sound like it has multiple instruments.  Using duty cycle, the NES goes from 2 pulse waves to 2 pulse waves with 3 different timbres each and while the 20a3 is only capable, out of the box, of producing 3 melodic lines, this gives composers MANY more options.  It’s also allows for cool effects, like the Bad Dudes example.

Square waves:

Okay, square waves have a square waveform.  And that’s why uh… they’re called square waves.  This is accomplished by using PWM and changing the duty cycle to be 50%.

When you set the duty cycle to 50%, you get waves that are equal in length.  This means that the function is “active” 50/100 of the time or 50% or, on an oscillator, 50/50.  This essentially means that a square wave is a TYPE of pulse wave.

What this means for the NES/Game Boy:

The GameBoy is able to produce 2 “quadrangular wave patterns”.  While I believe I’ve been perhaps a bit confused as to what that means in the past, a pulse wave IS a quadrangular wave pattern.

So!  Since LR35902 is ALSO capable of 4 duty cycles (12.5%, 25%, 50%, 75%) which means the GameBoy can ALSO make pulse waves.  Essentially (not counting the sweeps and other features of the GameBoy), the 2a03’s pulse waves and the LR35902’s “quandrangular wave pattern” are identical.  Interesting!

I’m a bit infuriated at the misinformation regarding the wave formats of both of these systems.  So many people report the GameBoy’s sound as being square waves and it’s not true, not true at all.  Someone needs to go through all the Wikis on NES/Game Boy and correct these issues or at least explain the fact that the duty cycle allows for the same timbres.  I hope my attempt here will clear up some of the confusion without requiring a degree in electrical engineering!

Last thing (and maybe someone out there can help me on this), it would seem that pulse waves and square waves, even applied with duty cycles, have different output functions.  That is, if something is a “stock” pulse wave or a “stock” square wave with duty cycle modulation, the sound is different or are coded different or something.  I cannot really ascertain how this works as I’m not an EE.  If anyone out there can help, I’d be grateful!

Okay, hope that clears that up for you guys!

About Classical Gaming

Steve Lakawicz holds an MM in Music Performance from Temple University as well as a BM in Tuba Performance from Rutgers University . His teachers include Paul Scott, Scott Mendoker, and Jay Krush. His love of video game music has lead him to form a blog, Classical Gaming, to promote discussion both casual and academic about the music of video games. He is the co-founder of the video game/nerd music chamber ensemble, Beta Test Music and regularly composes/performs chiptune music as Ap0c. He currently resides in Philadelphia where he teaches college statistics at Temple University. View all posts by Classical Gaming

One response to “Research in Game Music: The difference between pulse waves and square waves

  • Matt

    The 25% and 75% cycles will sound identical when only considering a single channel, but remember that the 2A03 is providing four oscillators on independent channels, two of which are pulse wave generators. The difference is observed after multiple oscillator channels have been combined into a composite signal by the mixer.
    Suppose you have both pulse channels outputting at the same frequency, but ch1 is set to 50% duty, and ch2 is set to either 25% or 75%. When the channels are mixed, the shape of the output sent to the DAC actually has three distinct levels instead of two, and resembles a sawtooth shape (the resulting analog signal sent by the DAC to your audio receiver is smoothed out and really does look like a sawblade). The difference between 25% and 75% on ch2 pulse is seen in the mixer & DAC outputs by observing the diagonal portion of the sawtooth; you will see that it changes to resemble either a forward-slash, or a back-slash.
    The combining of individual waveforms in a mixer to produce a uniquely-shaped output waveform is known as Additive Synthesis, and it is used to create a wide variety of sounds by varying the relative frequencies as well as the duty-cycles of the component oscillators.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: