Wednesday, August 07, 2013

After finishing the hex guide and then playing with emscripten I decided to collect all the techniques I used for html5 visualizations. I wanted to see what there was in common among the articles I had written so that I could turn it into a library that I could use for future articles. Unfortunately there wasn’t much. That left me a bit disappointed. I also tried to solve some performance woes with my hex guide when viewed on an iPad. I got some improvement but not as much as I had hoped. That also left me disappointed.

I’m also finding myself spending more of my time helping people privately, over email, and am trying to decide how much time to spend there. I’d rather be helping thousands of people with an article than helping one person with an email, but maybe I can turn some of the emails into short articles, less polished than the ones I’ve been writing.

When I was a kid I spent most of my time on schoolwork. I seemed to learn slower than my friends did, so I was the one reading and re-reading the book while they were out playing. I learned to value 16 weeks of summer break and 3 weeks of winter break as the times when I could learn new things in unstructured time, with no expectation of doing something useful.

So I thought back on those times as a kid when I just learned something without a specific goal in mind, and decided to take a break from writing articles for the rest of the summer. I pulled out my list of things I’ve always been curious about, and decided to study sound & music. That’s a pretty big area, so I explored a little bit and ended up looking at digital audio signal processing.

I’m reading David Cottle’s tutorial to learn about procedurally generated music. I’m also reading Andy Farnell’s Designing Sound to learn about procedurally generated sound effects. I’m also reading Steven W. Smith’s The Scientist and Engineer’s Guide to Digital Signal Processing to understand the math and algorithms.

SuperCollider is an app that lets you program sound and music. Cottle’s tutorial uses it. Here’s an example of using one sine wave to set the frequency of another sine wave, and then removing the high frequency sounds using a filter:

{ LPF.ar(
    in: SinOsc.ar(
       freq: SinOsc.kr(freq: 70, mul: 100, add: 440)
    ),
    freq: 300
  ) }.play

Pure Data is a more visual way to program sound and music. Farnell’s book uses Pure Data for its examples. Here’s a Pure Data example of the same thing as above:

Screenshot of Pure Data

It’s not as compact (especially every add and multiply having to be a box with connections) but you can click on numbers and change them easily. That makes it easier to explore the space of values; the space of structures is still inconvenient to explore. My programmer background makes me lean towards SuperCollider, which is why I’m trying to spend more time in Pure Data to learn a different way of approaching problems.

Will I do anything with this? I don’t know. It doesn’t matter. I’m just learning it because it’s interesting!

Labels:

6 comments:

Nelson wrote at August 08, 2013 9:27 AM

Fun! An interesting related topic is software defined radio. There's some $35 USB tuners you can buy now that can tune any radio transmission from 100–2000 MHz or so. Lots of open source hacker activity, but I don't really understand it all because I lack the DSP background. Some links: https://pinboard.in/search/u:nelson?query=sdr

Amit wrote at August 08, 2013 10:25 AM

Thanks Nelson! It looks like black magic ;-)

I've run across lots of things so far that make me say “Woah!” or “that's impossible”, and I'm only studying beginner level material.

Anonymous wrote at August 09, 2013 8:55 PM

Nodal may interest you:
" Nodal is generative software for composing music, interactive real-time improvisation, and a musical tool for experimentation and fun."
http://www.csse.monash.edu.au/~cema/nodal/

Note that I've never used it but just seen it in passing.

Cheers
Sam

Anonymous wrote at August 14, 2013 8:25 AM

if you're interested in the nitty-gritty mathematics of DSP, check out Orfanidi's resources. specifically the directories intro2sp and hpeq: a book in pdf format with included C/matlab code, and a matlab library for high order filters. both are free and invaluable to me.

Christopher Lightfoot wrote at September 02, 2013 1:55 AM

I started writing my own DSP much like Pure Data in Unity3d with a nice visual interface; Trying to get a decent sounding engine noise at any RPM/load without having to resort to pre-sampled sounds.

Amit wrote at September 08, 2013 8:47 AM

Christopher — cool! The "Designing Sound" book has some examples of making gun / rocket / explosion sounds with Pure Data so that might be worth a look. The code examples are available here (see the Code Examples link on the left).