Archive for February, 2010

Exploring Exponential Attack & Decay Envelope

Tuesday, February 23rd, 2010

Last week I came across the Exponential Attack & Decay Envelop (ead~) object in Pd. At first I did not understand how this object worked so I decided to create a simple patch that provides both visual and audio feedback of the signal that it generates. You can download the patch here.

The ead~ object creates an envelope that increases amplitude of a signal logarithmically by a specified attack rate, then brings it back down at a specified decay rate. As you would expect from this description, it requires two input parameters. Both the attack and decay rate are set in milliseconds. This object is often used to create beat like sounds.

The patch is designed to allow you to easily control the attack and delay parameter using two horizontal sliders. The resulting envelope is displayed on the graph underneath. To hear the sound generated by an oscillator coupled with the ead~ envelope turn on the sound at the bottom of the patch. Make sure to switch on the “dsp” as well click on the green toggle button. Lastly, also check that the oscillator frequency is somewhere north of 440.

You can download the patch here.


Exploring Filter Order with Pd

Tuesday, February 23rd, 2010

In this post I want to share a Pure Data (Pd) patch that I recently created to explore filters of different orders. I used low-pass filter objects (lop~) connected together serially in parallel chains. Each chain contains a different number of filters, resulting in filter effects of different orders.

If you want to learn more about filter order then read the overview below the image of the Pd patch. This text is an excerpt from a previous entry that provides an overview about filters.

There are other ways to create filters with steep roll-off curves. Pd’s biquad~ object provides much more flexible and complex filter capabilities. However, at this point in time they are beyond my scope of knowledge.

This patch features several controls. The first set of controls is a row of toggle switches that serve as filter order selectors. They allow users to easily switch between filters of different orders by turning on and off each filter chain. The next control is a slider that sets the oscillator frequency. The last control sets the cut-off frequency of the low-pass filter.

Here is the link to download the patch.

Do a little test to see the effect of increasing the filter order. First, set the oscillating frequency to slightly above the filter cut-off frequency. Then increase the filter order, one by one (remember to turn off the lower order filter). You should be able to notice a clear decrease in the signal amplitude in the visual and audio representations.

Here is the link to download the patch above.

Here is an excerpt from a previous entry that provides an overview about the concept of filter order:

“The order of a filter determines the steepness of its roll-off curve. The higher the order the steeper the curve, and the faster the roll-off. Roll-off is usually a logarithmic value that is expressed in dB of attenuation per octave or decade of frequency (decade is a logarithmic quantity that represents a factor of 10 difference of between two numbers).

A first-order filter, for example, will reduce the signal amplitude by half (equivalent to a power reduction of 6 dB) every time the frequency doubles (equivalent to going up one octave). The Bode plot for a first-order low-pass filter (featured above) looks like a horizontal line to the left of the cut-off frequency, to the right of the cut-off frequency a diagonal line slopes downward. There is also a “knee curve” at the boundary between these two lines, which creates a smooth transition between the two straight line regions.

It is important to keep in mind that people will often use the terms “above” and “below” to refer to the areas on the right and left of the cut-off frequencyin a Bode plot. The reason being, higher frequencies are mapped to the right and lower frequencies are mapped to the left on this type of graph. Note that the filter on the Bode plot above is of the first order. The reason being roll-off of 20dB per decade is equivalent to one of 6dB per octave.

A second-order filter attenuates higher frequencies more steeply. The Bode plot for this type of filter resembles that of a first-order filter, except that it falls off more quickly. A second-order filter will usually reduce the signal amplitude twice as fast as a first-order filter. Resulting in a reduction of one fourth of the signal’s level every time the frequency doubles. In other words, the power decreases by 12 dB per octave or 40dB per decade.

Third- and higher-order filters are defined similarly. In general, the final rate of power rolloff for an order-n all-pole filter is 6n dB per octave, or 20n dB per decade.

To create second and third order filters using puredate, you need to connect multiple filter objects in a serial arrangement. This can be done with low-pass, high-pass, and band-pass filters.”


Band-Stop, High- and Low-Shelf Filters

Tuesday, February 23rd, 2010

Before reading this entry consider taking a look at this previous post that provides a basic overview regarding sound wave filters.

Band-Stop Filter
Band-stop filters provide the inverse impact of the band-pass filter. It attenuates or restricts all frequencies within the stopband, which is defined by two cut-off frequencies. The frequencies beyond these edges are allowed to pass unchanged. These filters are also referred to as band-reject or band-cut filters.

Band-stop filters required the two same input parameters that are used in band-pass filters. First, the center frequency parameter defines the middle-point of the stopband. The second parameter is named “Q” or bandwidth. It determines the upper and lower cut-off frequencies by specifying how far from the center frequency the edge of the passband will reach.

High- and Low-Shelf Filters
High- and low-shelf filters enable all frequencies to pass while increasing or attenuating frequencies above (if high-shelf) or below (if low-shelf) the cut-off frequencies. Other frequencies are able to pass unchanged.

These filters require at least two separate input parameters: a cut-off frequency and slope. The cut-off frequency defines what frequencies will be targeted by the filter, while the slope determines the extent to which those frequencies will be attenuated or increased.

In Pure Data (Pd) the biquad~ object is used to create these types of filters and many others. I have little knowledge of, or experience with the biquad~ filter, though I know it is more complex, flexible and powerful than the standard filter objects from Pd (such as the high-pass hip~, low-pass lop~, and band-pass bp~ filters).


Band-Pass Filters

Tuesday, February 23rd, 2010

Before reading this entry consider taking a look at this previous post that provides a basic overview regarding sound wave filters.

A band-pass filter is designed to pass all frequencies within a “passband” while attenuating or removing frequencies outside of that band.

These types of filters feature two important parameters: the center frequency and the bandwidth, which is sometimes controlled via a variable called “Q”. The bandwidth of the filter specifies how far from the center frequency the edge of the passband will reach.

It is important to keep in mind that “Q” is inversely proportional to the bandwidth. Therefore a high “Q” value is equivalent to a small bandwidth. Not all band-pass filters use “Q” to control bandwidth, some filters use controls that are directly proportional to the bandwidth.

The slope of the rate at which the frequencies below and above the cut-off frequencies are attenuated and removed varies depending on the order of the filter. Filters of higher order have steeper slopes. This means they are more effective at removing frequencies below and above the cut-off. To generated higher order filter effects, you can join multiple filters together in a serial configuration.

Here is a pd patch that I created to better understand how a low-pass filter works. This patch enables you to explore the interaction between sound waves of different frequencies with a low-pass filter. You can download it here.

Play around with this patch you will see how the amplitude of the sound continually decreases as the oscillator frequency is brought up further above the cut-off frequency. You can download it here.


Understanding Filters

Monday, February 22nd, 2010

Over the past few weeks I’ve started to become well acquainted Pure Data (Pd) and its dataflow programming paradigm. During this time I have realized that in order to produce interesting sound-based experiences with Pd I needed to gain a basic understanding regarding the physics of sound waves.

This is the second post that documents my process of learning about the nature of sound, its behavior, and how we perceive it. Last week I shared some notes regarding general digital music concepts. Today I am going to focus on describing how filters work (without getting into any of the math, since I don’t understand it). Then I will follow-up with a few specific posts featuring pd patches that I created to illustrate how these various filters work in Pd.

What Is a Filter?
Filters are devices that attenuate and/or remove specific frequencies of sound waves. Usually the frequency response of a filter is represented using a Bode plot, such as the one featured below. Filters are usually characterized by one or two cut-off frequencies, which define the edges of the filter. Another important characteristic of filters is the rate of frequency roll-off, which refers to the slope (or rate) of attenuation of the frequencies above or below the cut-off frequencies.

An ideal filter would completely eliminate all frequencies above and/or below the cutoff frequency. Ideal filters do not exist. The rolloff, which I just mentioned above, is an artifact inherent in all filters that is a result of these limitations. Roll-offs are areas beyond the cut-off where frequencies have been attenuated but not repressed altogether. Perfect filters would not have a roll-off.

Filter Order
The order of a filter determines the steepness of the roll-off. The higher the order the steeper the curve, and the faster the roll-off. Roll-off is usually a logarithmic value that is expressed in dB of attenuation per octave or decade of frequency (decade is a logarithmic quantity that represents a factor of 10 difference of between two numbers). Here is a link to a Pd patch that enables you to play around with the order of a low-pass filter to explore this concept.

A first-order filter, for example, will reduce the signal amplitude by half (equivalent to a power reduction of 6 dB) every time the frequency doubles (equivalent to going up one octave). The Bode plot for a first-order low-pass filter (featured above) looks like a horizontal line to the left of the cut-off frequency, to the right of the cut-off frequency a diagonal line slopes downward. There is also a “knee curve” at the boundary between these two lines, which creates a smooth transition between the two straight line regions.

It is important to keep in mind that people will often use the terms “above” and “below” to refer to the areas on the right and left of the cut-off frequencyin a Bode plot. The reason being, higher frequencies are mapped to the right and lower frequencies are mapped to the left on this type of graph. Note that the filter on the Bode plot above is of the first order. The reason being roll-off of 20dB per decade is equivalent to one of 6dB per octave.

A second-order filter attenuates higher frequencies more steeply. The Bode plot for this type of filter resembles that of a first-order filter, except that it falls off more quickly. A second-order filter will usually reduce the signal amplitude twice as fast as a first-order filter. Resulting in a reduction of one fourth of the signal’s level every time the frequency doubles. In other words, the power decreases by 12 dB per octave or 40dB per decade.

Third- and higher-order filters are defined similarly. In general, the final rate of power rolloff for an order-n all-pole filter is 6n dB per octave, or 20n dB per decade.

To create second and third order filters using puredate, you need to connect multiple filter objects in a serial arrangement. This can be done with low-pass, high-pass, and band-pass filters.

Types of Filters
There are many types of filters. Some of the most prominent types include: Butterworth filter, Chebyshev filter, Bessel filter. The difference between these filters is that they have different-looking “knee curves”.

Many filters are designed to have “peaking” or resonance, causing their frequency response at the cutoff frequency to be above the horizontal line. I will soon write a post about the concept of resonance in relation to sound. This effect can often be controlled and used one’s benefit, though it can also cause unwanted noise and volume jumps.

Most filters are linear time-invariant systems. What this means is that the relationship between input and output is linear and that the the response of the system is identical regardless of when a signal is introduced into it. For example, whether you add input now or N seconds from now the output will be the same expect for a delay of N seconds.

Here is a list of different types of filters, along with links to posts with additional information and Pd code examples (where availalble):


Low-Pass Filters

Monday, February 22nd, 2010

Before reading this entry consider taking a look at this previous post that provides a basic overview regarding sound wave filters.

A low-pass filter is designed to allow low-frequencies to pass, while attenuating and removing higher frequencies. This filter is sometimes called a high-cut filter, or treble cut filter. Low-pass filters feature one important parameter: the cut-off frequency. All frequencies above the cut-off frequency are reduced or removed, while frequencies below it are able to pass mostly unchanged.

The slope of the rate at which the frequencies above the cut-off frequency are removed varies depending on the order of the filter. Filters of higher order have steeper slopes. This means they are more effective at removing frequencies above the cut-off. To generated higher order filter effects, you can join multiple filters together in a serial configuration.

Here is a pd patch that I created to better understand how a low-pass filter works. This patch enables you to explore the interaction between sound waves of different frequencies with a low-pass filter. You can download it here.

Play around with this patch you will see how the amplitude of the sound continually decreases as the oscillator frequency is brought down further below the cut-off frequency. You can download it here.


High-Pass Filters

Monday, February 22nd, 2010

Before reading this entry consider taking a look at this previous post that provides a basic overview regarding sound wave filters.

A high-pass filter is designed to allow high-frequencies to pass, while attenuating and removing lower frequencies. This filter is sometimes called a low-cut filter, bass-cut filter or rumble filter.

High-pass filters feature one important parameter: the cut-off frequency. All frequencies below the cut-off frequency are reduced or removed, while frequencies above it are able to pass mostly unchanged.

The slope of the rate at which the frequencies below the cut-off frequency are removed varies depending on the order of the filter. Filters of higher order have steeper slopes. This means they are more effective at removing frequencies below the cut-off. To generated higher order filter effects, you can join multiple filters together in a serial configuration.

Here is a pd patch that I created to better understand how a high-pass filter works. This patch enables you to explore the interaction between sound waves of different frequencies with a high-pass filter. You can download it here.

Play around with this patch you will see how the amplitude of the sound continually decreases as the oscillator frequency is brought down further below the cut-off frequency. You can download it here.


Understanding and Creating Noise

Monday, February 22nd, 2010

For a long time I’ve wanted to understand what differentiates different types of noises. I had often heard terms such as “white noise” and “brown noise” but I never knew what they meant.

Noise comes in many flavor. Different types of noises have different distributions of frequency bands. For example, white noise, which is the most common variety of noise, has an even distribution of all frequencies. This means that at any moment white noise is as likely to contain frequencies at 1,000Hz as it is to contain frequencies at 20Hz or 12,000Hz.

The likelyhood of finding a specific frequency band within a noise signal at any moment in time is usually referred to as the energy of that specific band. Therefore, we could say that all frequency bands feature equal energy in white noise. The noise~ object in Pure Data generates white noise when it is not modified by low-pass, high-bass, and band-pass filters.

Noises that feature distribution of frequencies which are limited to specific ranges within the overall spectrum are usually referred to using color analogies. There are no hard and fast rules about mapping color names to noise, but the analogy to light is generally observed so that blue noise has a higher frequency band than yellow noise which has a higher frequency band than red noise and so forth.

Here is an overview of the approximate color spectrum for different types of noise:

  • Black Noise:  0Hz – 50Hz;  explosion rumble, near infrasonic, sub bass
  • Brown Noise:  50Hz – 250Hz; thunder, distant plane or rocket, large moving objects
  • Red Noise:  250Hz – 500Hz; airplane cabin, train or car interior
  • Orange Noise: 500Hz – 1kHz; river, city ambiance
  • Yellow Noise:  1kHz – 3kHz;  rain, distant waterfall
  • Green Noise:  3kHz – 7kHz;  bacon frying, acid on concrete
  • Blue Noise:  7kHz – 15kHz; light breeze, aerosol, hihats
  • Violet Noise:  15kHz – 30kHz; gas escaping, angry snake

Some types of noise are characterized by other features. For example, pink noise has an equal distribution of energy across all octaves (but not across all individual frequencies). This means that there is the same likelyhood of finding a frequency in one octave interval (such as 500Hz to 1000Hz) as in the octave interval above it (such as 1000Hz to 2000Hz) or that one above that (such as 2kHz to 4kHz).

Other types of noise include Gaussian noise, which features a bell-shaped distribution curve; and power law noise, which features a distribution that looks like a steeply descending curve with a long tail.

Below is a screenshot of the pure data patch that I developed to investigate the sound of these different types of noises (you can download the patch here). I got most of this information from a tutorial featured on the obiwannabe website. Here is a link to the tutorial that featured this pd patch.

Download the patch here and play around with it on your own machine.


Will Wright: Gaming and Learning

Thursday, February 18th, 2010

Earlier today I had the chance to hear Will Wright talk about games and education. This event was organized at NYU, and sponsored by Microsoft, as part of the Games for Learning Institute. I have to admit that I was blown away by him – his presentation was insightful, concise and best of all, entertaining. Unfortunately, due to technical difficulties we were only able to get about 2/3 of the way through his presentations.

I will not attempt to provide a comprehensive overview of his talk, here are a few highlights regarding what stood out most to me:

  • Story telling and playing games are crucial activities that support human learning and development.
  • Unlike stories told via video or books, games tend to allow people to explore multiple different possibilities.
  • Games are currently looked down upon by other media – this is always the case for emerging media.
  • Future of media will need to include play, story and branding as core elements (also described as agency, empathy and identity).
  • The “magic circle” continues to evolve and expand as new platforms for gaming, such as mobile, become commonplace.

Here is a list of six trends that Will identified, which will drive the future of the gaming industry:

  • Fractal entertainment: refers to the ever expanding world of gaming, which now includes mobile devices and more.
  • Non-immersive games: casual games continues to grow in importance and change the way people thing about games.
  • Bandwidth symmetry: unfortunately, I don’t have notes regarding this point so let me know if you know what Will was talking about here.
  • Expressive play: people are increasingly using games as a context in which they can (and want to) express themselves.
  • Psychological profiling: in the future games will be tailored to specific individuals, rather than groups of people.
  • Relevance: by entering into the social realm and gaining social relevance games will become more relevant in general, and have a greater impact on the world.

Registration Roulette: The Game

Tuesday, February 16th, 2010

On Friday my team finished designing our first big game for the appropriately named Big Games class. Over the past week I worked closely with Morgen, Rune, and Sean to update the dynamics and mechanics of our game, which has earned the name “Registration Roulette”. Here is a link to the original rules that we shared with our class last week.

Though the game remained largely unchanged we made some important revisions to the mechanics. First we added a timer to the game in order to expedite the game-play. Next, we removed the bluffing element since it seemed to only confuse things. Then we added dynamic scoring to the game so that the preferences of the players from each game impacts the scores. Lastly, we focused on improving logistical elements of the game by creating playing cards and using other props (here some images of the cards).

Here is an updated version of the game rules and mechanics.

Game Resources: Overview
The game is played with a game-specific deck of cards containing about 110 cards, a large piece of paper, permanent markers, a timer (such as the one from the screenshot below), game chips and a game master. The game can be played with up to 25 or so people.

Game Mechanism: Phase I, Set-up and Class Selection
The game starts when the game master assigns each player to one of two teams: 1st and 2nd year teams. Players are then arranged around a table with 1st-year players sitting next to 2nd-year players.

Next the game master shares a list of 12 courses, assuming 20 players, by writing them on a large piece of paper. These courses are equally divided between the following categories: atoms, pixels, and networks. The large piece of paper is then placed in the center of the table.

Each player selects one from each category, three in total. They make their selections known by placing their chips on their selected courses.

Game Mechanism: Phase II, Competing for Classes
This game is focused on the team competition. The game ends after 5 people have been able to “register”, which means put down their cards (assuming 20 people). In order to “register” a player has to have one course from each category in his his/her hand, including the proper required course, which is thesis for 2nd year team players, and intro physical computing for 1st year team players. The score for each team is determined by adding only the hands of that team’s players who have “registered”.

The timer is another important aspect of the game that can lead to a team winning or loosing the game. Each team has a total of 5:00 minutes of play time. The play time alternates every time that a player puts down the face-up card. If a given team’s time ends before five players are able to register then that team looses.

The game master distributes 4 cards to each player, and then creates two stacks on a small tray – one face-down, the other face-up. The game starts with the person to the left of the game master.

On each turn a player must take the top card from either of the two stacks on the tray, and discard one card to the tray face-up. The player can also choose to share a card with his/her team mates by making a card available (by putting it down a card on the table face-up) or by picking up a “shared” card from a team mate.

Game Mechanism: Scoring
Points for each team are calculated by adding up the value of the course cards from the first seven players who are able to “register”.