Music Releases…

I’m trying to release some of my old and new music I’ve been keeping for myself for no apparent reason. Still a work in progress… 2 new releases for now, check them out here: http://www.earslap.com/music

Not much info is available at this time, I’ll try to add some and even release my tools as I go…

  • StumbleUpon
  • del.icio.us
  • Digg
  • Facebook
  • Twitter
  • Reddit
Tagged
Leave a comment

sc140 Album Featured in New Scientist and The Wire

Our sc140 album is featured in New Scientist and The Wire. Check out the articles:

http://thewire.co.uk/articles/3177/

http://www.newscientist.com/article/dn18173-best-of-twitter-tunes-album-released.html

And there is some new music, on the way… Stay (de)tuned.

  • StumbleUpon
  • del.icio.us
  • Digg
  • Facebook
  • Twitter
  • Reddit
Tagged , ,
2 Comments

New Quark: MultiTouchPad

I’ve added a new Quark to SuperCollider Quarks repository that allows you to access the multitouch data from supported MacBook (and MacBook Pro) touchpads. It needs the tongsengmod application I’ve forked from the tongseng project, but once tongsengmod is installed, integration is seamless. The details can be found in the help file. Here is a rudimentary example (the example code for this can also be found in the help file):

I’ve only tested this under Leopard 10.5.8 with a (late 2008) unibody MacBook Pro. Your mileage may vary under Snow Leopard and older MacBooks (I’m pretty sure that the latest MacBooks before the unibody models are also capable of using this), so please let me know if you encounter any problems, or get it to run on other systems.

  • StumbleUpon
  • del.icio.us
  • Digg
  • Facebook
  • Twitter
  • Reddit
Tagged ,
5 Comments

Get sc140, The Just Released SCtweet Album!

Dan Stowell curated an excellent compilation of the SCtweet pieces as an album. SCtweets are (little) pieces composed in the SuperCollider environment with at most 140 characters in size (a limit employed by the Twitter service for posts). The album (which includes 22 tracks) and the source code is available to anyone for free, and can be obtained under the CC BY-NC-SA 3 license.

I’m happy to have 4 of my pieces included (one of them was refactored by Charles Celeste Hutchins, he reduced the number of characters from 140 to 104!) in the compilation.

You can listen to sc140 online, or download the album (in MP3 format) and it’s source code by clicking here.

To access more code from various contributors, click here.

  • StumbleUpon
  • del.icio.us
  • Digg
  • Facebook
  • Twitter
  • Reddit
Tagged , , ,
6 Comments

Combination Tones and the Non-Linearities of the Human Ear.

Last week, one of my students brought me a composition he made, which was using combination tones in an interesting compositional context, and that gave me a nudge to do some experimenting on the issue, here I’ll share what I’ve found interesting.

This is a psychoacoustic phenomenon in which, when at least two tones with close fundamental frequencies are sounded together, another tone whose frequency is the sum or difference of the original two tones is heard. This “ghost” tone is purely made up by the human ear and brain. That is, if you inspect the spectrum of the two tones with a spectrogram, this ghost tone simply isn’t there. However, this tone is usually quite faint (unless the amplitude of the original tones are high) so one needs to concentrate to get it, but it’s not very hard either.

Here is an example, this is a 200 Hz sine tone:

{ SinOsc.ar(200).dup }.play

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

And here it is in the spectrogram:

200hz

And here is 1000Hz and 1200Hz sine tones mixed together. The difference of their frequencies (200Hz) is also audible, if you pay attention (works best with headphones, but also audible with speakers. If you can’t hear it, turn the volume up):

{ SinOsc.ar([1000, 1200]).mean.dup }.play

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

If you can hear it, great. Here is the spectral decomposition:

combined

Notice that there is nothing below 1000Hz here, the 200Hz tone you’ve just heard isn’t really there. As I said, this is a well known phenomenon in which the non-linearities of the inner ear causes this difference tone to be heard. Wikipedia states (although without citing a source) that, giving the two tones with different frequencies separately to each ear with headphones also create the effect but I was unable to experience this that way.

Here comes the fun part of this post, you can play several tricks with pure tones and use this ghost tone in creative ways. Here is a glissando of two pure sine tones. One oscillator starts from 4000Hz and goes down to 1000Hz, the other starts from 4200Hz and ends at 1200Hz. So the difference of their frequencies throughout is always 200Hz, so you should hear a constant (although sometimes fluctuating) 200Hz tone while the high frequencies are doing their gliss:

(
{
var freqSweep = Line.ar(4000, 1000, 10);
SinOsc.ar([freqSweep, freqSweep + 200]).mean!2;
}.play
)

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Look at the spectral decomposition, and the 200Hz tone isn’t there again:

sweep

You can even go to the extremes! Here, the frequencies of the sine tones change randomly 8 times a second, but the difference of 200Hz is preserved, so you are still able to hear the constant 200Hz (not very pleasant to listen to but hey, it’s a cool effect!):


(
{
var baseFreq = TRand.ar(1000, 2000, Impulse.ar(8)).lag(0.01);
SinOsc.ar([baseFreq, baseFreq + 200]).mean!2;
}.play
)

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Here they are changing 32 times a second randomly, but preserving the 200Hz separation, this is harder to hear, and fluctuates a bit, but the effect is there:

(
{//best through headphones
var baseFreq = TRand.ar(1000, 2000, Impulse.ar(32)).lag(0.01);
SinOsc.ar([baseFreq, baseFreq + 200]).mean!2;
}.play
)

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

-

And here is the grand finale of combination tones for this post. In the previous examples, we always kept a 200Hz separation between two oscillators and heard a constant difference tone. What if we craft the separation frequency in a way that the difference frequency plays a melody while the upper frequencies change randomly, even at 32 times a second? Can you hear the “bottom” melody here? Any guesses what it might be?

(
{
var times = Dseq(((1!12 ++ [1.5, 0.5, 2])!2).flat / 2, 1);
var pitchBase = [55, 55, 56, 58, 58, 56, 55, 53, 51, 51, 53, 55];
var pitches = Dseq((pitchBase ++ [55, 53, 53] ++ pitchBase ++ [53, 51, 51]).midicps, 1);
var freqs = Duty.ar(times, 0, pitches, doneAction: 2);
var baseRandFreq = TRand.ar(1000, 2000, Impulse.ar(32)).lag(0.01);

SinOsc.ar([baseRandFreq, baseRandFreq + freqs]).mean!2;
}.play;
)

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Not the most beautiful thing to listen, but try to hear the ghost melody at the bottom. Your ears and brain are playing tricks on you, and observing it is worth the suffering, in my opinion. Use the comment box if you can hear it and want to hazard a guess…

  • StumbleUpon
  • del.icio.us
  • Digg
  • Facebook
  • Twitter
  • Reddit
Tagged , , ,
23 Comments

Recreating the THX Deep Note

If you’ve ever watched a movie in a movie theater, chances are that you are familiar with the “Deep Note”, the audio logo of THX. That sound is one of the first sounds we hear at the beginning of movie trailers in a THX-certified venue. I’ve always been fascinated with that great distinctive crescendo, starting from an eerie cluster of tones and ending with a full range bright and grand finale. What an ear treat!

Yesterday, (probably) out of nowhere, the origins of that sound tickled my curiosity and I did some little research. I’m deeply moved by the history behind it, and I want to share what I’ve learned with you. Then we will move on to create that sound ourselves, get your scissors ready, and some glue!

The best source of information I could find about the sound, which I think is a complete electro-acoustic composition, is from the great Music Thing blog. It is from a blog post from 2005. The link to the post is here.

So here is some trivia:

  • It was made by Dr. James Andy Moorer in 1982.
  • At one point in history, it was being played 4000 times a day, almost every 20 seconds!
  • A quote from Mr. Moorer: “I like to say that the THX sound is the most widely-recognized piece of computer-generated music in the world. This may or may not be true, but it sounds cool!”
  • It was generated in a mainframe computer called ASP (Audio Signal Processor) which was able to synthesize the sound in real-time.
  • It took 20000 lines of C code to write a program that generated the score for the ASP to play. The generated score was consisting of 250000 lines of statements which were to be obeyed by the ASP.
  • The oscillators used as the voices are using a digitized cello tone as a waveform. Mr. Moorer recalls the waveform as having something around 12 audible harmonics.
  • The ASP was able to run 30 oscillators of this sort in real-time. (In comparison, the notebook computer I happen to be using right now can handle more than 1000 of them without a glitch).
  • The sound itself is copyrighted, but here is a problem: The code Mr. Moorer wrote has generative characteristics (i.e. it relies on random number generators), so each time you generate a score and feed the resulting statements to the ASP, the generated sound is somewhat different. So I don’t really think that it is safe to say that the process itself is or can be “copyrighted”. The sound itself, yeah that one is covered.
  • It debuted in the THX trailer of the “Return of the Jedi” before its premiere in 1983.
  • The generative characteristics of the process became troublesome at some point. After the release of the piece with “Return of the Jedi”, the original recording of the Deep Note was lost. Mr. Moorer recreated the piece for the company but they kept complaining that it wasn’t sounding the same as the original one. Eventually, the original recording was found and kept in a safer place from then.
  • Dr. Dre asked for permission to sample the sound for his music but was turned down. He used it anyway and got sued.
  • Metastasis which is an Iannis Xenakis composition (1954) has a very similar opening crescendo (among other works by various composers). It starts with a single tone instead, and lands on a semi dissonant tone cluster instead of a consonant one as in Deep Note.

The sound recording used for the patent application can be listened from here:

http://www.uspto.gov/go/kids/soundex/74309951.mp3

Be sure to listen the sound because we will be referring to that particular recording when we have a go at recreating the Deep Note. You may also listen other instances of this piece: http://www.thx.com/cinema/trailers.html

Here is some technical/theoretical trivia before we start synthesizing:

  • This is my observation: The original recording at United States Patent and Trademark Office website has a fundamental pitch which just stands between D and Eb, but the newer renditions on more recent features has a fundamental between E and F. I’ll use the original D/Eb fundamental in my recreation attempt. The newer stuff is usually shorter if I’m not mistaken. It’s clearly obvious that I like the one submitted to the patent office better.
  • According to Mr. Moore (and also confirmed by my ears) the piece starts with oscillators tuned to random frequencies between 200Hz and 400Hz. But the oscillators are not simply buzzing their sounds, their frequencies are modulated randomly, and they use smoothers to smooth out the random pitch transitions. This goes on until the crescendo is initiated later in the piece.
  • Inside the crescendo and in the final landing sound, the randomizers are still modulating the frequencies of the oscillators, so no oscillator is stable at any given moment. But the random sweep range is narrow so it merely adds an organic / chorusy feel to the sound sources.
  • Mr. Moorer recalls the digitized cello sound had around 12 audible harmonics in its spectrum.
  • To my knowledge, the written score (which was used to get the copyright) was never released, but Mr. Moorer says he can supply the score if we can get permission from THX, though I think that is not really necessary for an attempt at recreating the piece.
  • The final landing sound (technically not a chord) is just stacked up octaves of the fundamental, to my ears. So when recreating the piece, we will start with randomly tuned (between 200Hz and 400Hz) oscillators, make a semi-sophisticated sweep and land at stacked up octaves on a fundamental that sits between low D/Eb.

So let’s get going. SuperCollider is my tool of choice here. I start with a simple waveform. I want to use a sawtooth wave as the oscillator source, it has a rich and harmonic spectrum consisting of even and odd partials. I’ll want to filter the upper partials later on. Here is some beginning code:

//30 oscillators together, distributed across the stereo field
(
{
    var numVoices = 30;
    //generating initial random fundamentals:
    var fundamentals = {rrand(200.0, 400.0)}!numVoices;
    Mix
    ({|numTone|
        var freq = fundamentals[numTone];
        Pan2.ar
        (
            Saw.ar(freq),
            rrand(-0.5, 0.5), //stereo placement of voices
            numVoices.reciprocal //scale the amplitude of each voice
        )
    }!numVoices);
}.play;
)

I chose to have 30 oscillators for sound generation, congruent with the capabilities of the ASP computer as reported by Mr. Moorer. I’ve created an array of 30 random frequencies between 200Hz and 400Hz, distributed them randomly across the stereo field with Pan2.ar and with the argument rrand(-0.5, 0.5), assigned the freqs to the sawtooth oscillators (30 instances). Here is how it sounds:

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Now if we examine the info provided by Mr. Moorer, and/or listen closely to the original piece, we can hear that the pitches of the oscillators drift up and down randomly. We want to add this for a more organic feel. The frequency scale is logarithmic, so lower frequencies should have narrower wobbling ranges than higher frequencies. We can implement it by sorting our randomly generated frequency values, and assigning LFNoise2 (which generates quadratically interpolated random values) mul arguments in order inside our Mix macro. And I also added a lowpass filter for the oscillators whose cutoff frequencies are 5 * freq of oscilator with moderate 1/q:

//adding random wobbling to freqs, sorting randoms, lowpassing
(
{
    var numVoices = 30;
    //sorting to get high freqs at top
    var fundamentals = ({rrand(200.0, 400.0)}!numVoices).sort;

    Mix
    ({|numTone|

        //fundamentals are sorted, so higher frequencies drift more.
        var freq = fundamentals[numTone] + LFNoise2.kr(0.5, 3 * (numTone + 1));
        Pan2.ar
        (
            BLowPass.ar(Saw.ar(freq), freq * 5, 0.5),
            rrand(-0.5, 0.5),
            numVoices.reciprocal
        )
    }!numVoices);
}.play;
)
)

Here is how it sounds with the latest tweaks:

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

This sounds like a good starting point, so let’s start implementing our sweep, initially in a very crude way. To implement the sweep, we first need to define our final landing pitches for each of the oscillator. This is not very straightforward, but not very hard either. The fundamental tone should be the pitch that is right in between low D and Eb, so the midi pitch for that tone would be 14.5 (0 is C, count up chromatically, I’m skipping the first octave). So we need to map our freq arguments for 30 oscillators from random frequencies between 200Hz and 400Hz to 14.5 and to its octaves. By ear, I’ve chosen to use the first 6 octaves. So our final array of destination frequencies will be:

(numVoices.collect({|nv| (nv/(numVoices/6)).round * 12; }) + 14.5).midicps;

We’ll be using a sweep that goes from 0 to 1. The random frequencies will be multiplied by (1 – sweep), and the destination frequencies will be multiplied by sweep itself. So when sweep is 0 (beginning) freq will be the random one, when it is 0.5, it will be ((random + destination) / 2), and when it is 1, the freq will be our destination value. Here is our modified code:

//creating the initial sweep (crude), creating final pitches
(
{
var numVoices = 30;
var fundamentals = ({rrand(200.0, 400.0)}!numVoices).sort;
var finalPitches =
	(numVoices.collect({|nv| (nv/(numVoices/6)).round * 12; }) + 14.5).midicps;
var sweepEnv = EnvGen.kr(Env([0, 1], [13]));

Mix
({|numTone|

	var initRandomFreq = fundamentals[numTone] + LFNoise2.kr(0.5, 3 * (numTone + 1));
	var destinationFreq = finalPitches[numTone];
	var freq = ((1 - sweepEnv) * initRandomFreq) + (sweepEnv * destinationFreq);

	Pan2.ar
	(

		BLowPass.ar(Saw.ar(freq), freq * 5, 0.5),
		rrand(-0.5, 0.5),
		numVoices.reciprocal //scale the amplitude of each voice
	)
}!numVoices);
}.play;
)

Here is the sound:

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

As I said earlier, this is a very crude sweep. It goes linearly from 0 to 1, which is not congruent with the original composition. Also you should have noticed that the final octaves sounds AWFUL because they are tuned to perfect octaves, and fuse into each other, having fundamental-overtone relationships between them. We will fix this by adding random wobbling to the final pitches, just as we did with the initial random pitches, and it wil sound much much more organic.

So we should fix the frequency sweep envelope first. The earlier envelope was just for trying the formulas (and the final landing) out. If we observe the original piece, we can see that there is very little change in organization for the first 5-6 seconds. After that there is a fast and exponential sweep that lands the oscillators to the final octave spaced destinations. Here is the envelope I’ve chosen:

sweepEnv = EnvGen.kr(Env([0, 0.1, 1], [5, 8], [2, 5]));

It takes 5 seconds to go from 0 to 0.1, and 8 seconds to go from 0.1 to 1. The curvatures for the segments are 2 and 5. We’ll see how that worked out, but we also need to fix the final sound spacings. Just as we did with the random frequencies, we will add random wobbles with LFNoise2 whose range will be proportional to the final frequency of the oscillator. This will make the finale sound much more organic. Here is the modified code:

//tweaking the envelope, detuning the final chord
(
{
var numVoices = 30;
var fundamentals = ({rrand(200.0, 400.0)}!numVoices).sort;
var finalPitches = (numVoices.collect({|nv| (nv/(numVoices/6)).round * 12; }) + 14.5).midicps;
var sweepEnv = EnvGen.kr(Env([0, 0.1, 1], [5, 8], [2, 5]));

Mix
({|numTone|

	var initRandomFreq = fundamentals[numTone] + LFNoise2.kr(0.5, 3 * (numTone + 1));
	var destinationFreq = finalPitches[numTone] + LFNoise2.kr(0.1, (numTone / 4));
	var freq = ((1 - sweepEnv) * initRandomFreq) + (sweepEnv * destinationFreq);

	Pan2.ar
	(

		BLowPass.ar(Saw.ar(freq), freq * 8, 0.5),
		rrand(-0.5, 0.5),
		numVoices.reciprocal
	)
}!numVoices);
}.play;
)

Here, I’ve also tweaked the cutoff frequency of the lowpass filter to my liking. I like tweaking stuff, until it alienates me from what I’ve been working on… Anyway. Here is the resulting sound:

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

I’m not really happy with this envelope either. It needs a longer initialization and faster finish. Or wait… Do I have to have the same envelope for every oscillator? Absolutely not! Each oscillator should have its own envelope with slightly different time and curve values, and I bet it will be more interesting. And the high frequency overtones of the random sawtooth cluster is a bit annoying, so I’m adding a lowpass to the sum, whose cutoff is controlled by a global “outer” envelope that has nothing to do with the envelopes of the oscillators. Here is the modified code:

//custom envelopes. lowpass at end
(
{
var numVoices = 30;
var fundamentals = ({rrand(200.0, 400.0)}!numVoices).sort;
var finalPitches = (numVoices.collect({|nv| (nv/(numVoices/6)).round * 12; }) + 14.5).midicps;
var outerEnv = EnvGen.kr(Env([0, 0.1, 1], [8, 4], [2, 4]));

var snd = Mix
({|numTone|

	var initRandomFreq = fundamentals[numTone] + LFNoise2.kr(0.5, 3 * (numTone + 1));
	var destinationFreq = finalPitches[numTone] + LFNoise2.kr(0.1, (numTone / 4));
	var sweepEnv =
		EnvGen.kr(
			Env([0, rrand(0.1, 0.2), 1], [rrand(5.0, 6), rrand(8.0, 9)],
				[rrand(2.0, 3.0), rrand(4.0, 5.0)]));
	var freq = ((1 - sweepEnv) * initRandomFreq) + (sweepEnv * destinationFreq);

	Pan2.ar
	(
		BLowPass.ar(Saw.ar(freq), freq * 8, 0.5),
		rrand(-0.5, 0.5),
		numVoices.reciprocal
	)
}!numVoices);

BLowPass.ar(snd, 2000 + (outerEnv * 18000), 0.5);
}.play;
)

The slightly out of phase envelopes rendered the sweep slightly more interesting. Lowpass at 2000Hz at the beginning helps to tame the initial cluster. Here is what it sounds like:

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

I have one more thing that will make the process sound more interesting. You remember we’ve sorted the random oscillators at the beginning right? Well we can now reverse-sort them and make sure oscillators running in higher random frequencies will end up in bottom voices after the crescendo and vice versa. This will add more “movement” to the crescendo and is quite congruent with the way the original piece is structured. I’m not sure if Mr. Moorer programmed it specifically in this way, but at least, the chosen recording demonstrates this process and it sounds cool, be it a random product of the generative process itself, or a compositional choice (oh, did I say that? If the process covers it, it IS a choice… or is it?). So I’ll reverse the sorted values and the way we structured our code will make sure that the higher pitched sawtooths will end up in the lower voices in the finale and vice versa.

Another thing: We need a louder bass. In the way it is now, all voices have equal amplitude. I want to have the lower voices to have slightly higher amplitude and decay proportionally as the frequency goes up. So I’ll change the mul argument of Pan2 to take this into account. I’ll re-tweak the cutoff frequencies of the lowpass filters governing the individual oscillators. And I am going to add a global amplitude scaling envelope that will fade the piece in, and fade out when the piece ends, and free the synth from scserver. Also some more numeric tweaks here and there, here is our final code:

//inverting init sort, louder bass, final volume envelope, some little tweaks
(
{
var numVoices = 30;
var fundamentals = ({rrand(200.0, 400.0)}!numVoices).sort.reverse;
var finalPitches = (numVoices.collect({|nv| (nv/(numVoices/6)).round * 12; }) + 14.5).midicps;
var outerEnv = EnvGen.kr(Env([0, 0.1, 1], [8, 4], [2, 4]));
var ampEnvelope = EnvGen.kr(Env([0, 1, 1, 0], [3, 21, 3], [2, 0, -4]), doneAction: 2);

var snd = Mix
({|numTone|

	var initRandomFreq = fundamentals[numTone] + LFNoise2.kr(0.5, 6 * (numVoices - (numTone + 1)));
	var destinationFreq = finalPitches[numTone] + LFNoise2.kr(0.1, (numTone / 3));
	var sweepEnv =
		EnvGen.kr(
			Env([0, rrand(0.1, 0.2), 1], [rrand(5.5, 6), rrand(8.5, 9)],
				[rrand(2.0, 3.0), rrand(4.0, 5.0)]));
	var freq = ((1 - sweepEnv) * initRandomFreq) + (sweepEnv * destinationFreq);

	Pan2.ar
	(
		BLowPass.ar(Saw.ar(freq), freq * 6, 0.6),
		rrand(-0.5, 0.5),
		(1 - (1/(numTone + 1))) * 1.5
	) / numVoices
}!numVoices);

Limiter.ar(BLowPass.ar(snd, 2000 + (outerEnv * 18000), 0.5, (2 + outerEnv) * ampEnvelope));
}.play;
)

And here is the final recording of the piece:

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

You may want to compare it with this original one:

http://www.uspto.gov/go/kids/soundex/74309951.mp3

So this is my rendition. Of course it can be further tweaked to death, envelopes, frequencies, distribution, everything… Nevertheless, I think mine is a decent attempt at keeping the legacy alive. And I’d love to hear your comments and/or hear your shots at interpreting this piece.

——————–

Oh and here is one more thing I did for fun. You know, I told you about how it took 20000 lines of C code to generate the original piece. I’m pretty sure Mr. Moorer had to create almost everything by hand so that is not very awkward. But you know, we’ve been sctwitting for some time, trying to fill stuff into 140 characters of code. So for the fun of it, I tried to replicate the essential elements of the composition in 140 characters of code. I think it still sounds cool, here is the code (this one uses an F/E fundamental):

play{Mix({|k|k=k+1/2;2/k*Mix({|i|i=i+1;Blip.ar(i*XLine.kr(rand(2e2,4e2),87+LFNoise2.kr(2)*k,15),2,1/(i/a=XLine.kr(0.3,1,9))/9)}!9)}!40)!2*a}

And here is the sound this version generates:

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

All the code in this page is in this document for you to experiment: - get from here -

Happy sweeping…

  • StumbleUpon
  • del.icio.us
  • Digg
  • Facebook
  • Twitter
  • Reddit
Tagged , , ,
57 Comments

TwitNoise

I’ve previously blogged about the sctwitting concept. Well, I still find the process interesting, fun and educating so I’m still contributing. Today, I was compiling my twits into a file to keep them locally on my computer, and the compressed look of the whole chunk looked pleasing:

alltweets

And just for the fun of it, I wanted to see how all sounded together, when played simultaneously. I’m not claiming that it is really “musical” or something, but I had fun listening to their chaotic bashing against each other:

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

So there I go…

  • StumbleUpon
  • del.icio.us
  • Digg
  • Facebook
  • Twitter
  • Reddit
Tagged , ,
Leave a comment

New Hadron Update and New HadronPlugins

I’ve updated Hadron again and added the HadronPlugins Quark to the SuperCollider Quarks database. Full change log is here again:
http://quarks.svn.sourceforge.net/viewvc/quarks/Hadron/Help/Hadron-Changelog.html

hrpresetmorph

HadronPlugins right now consists of two plugins. The first one is HrPresetMorph that provides two-to-many preset/state interpolation on a 2D surface to the Hadron system (much like the MetaSurface of the great AudioMulch). The other one is HrCodeSequencer that basically is a code sequencer which helps you experiment with generative form and time manipulation, so it is kind-of a framework for composition, and a time-grid sequencer for SuperCollider code. I’ve recorded two screencasts for them and you can see them (currently) at the bottom of Hadron project page.


hrcodesequencer

  • StumbleUpon
  • del.icio.us
  • Digg
  • Facebook
  • Twitter
  • Reddit
Tagged , , ,
Leave a comment

Accessing the FreeSound Database From Your Own Programs

I’ve received a couple of mails asking me about the details of the facilities freesound provides for easy sample search and retrieval from programs one can write in different languages to incorporate the system in ones own programs. When I first started looking at this some months ago, I found it hard to find info about this, and I had to dissect other peoples codes that do the job, I can’t really remember what they were but there were 2 source files (one in python and one in C++), both were not functioning correctly but with countless trial and error I managed to get things right. I’ve coded the freesound class for SuperCollider last week, and figured things were changed by then, so I’ve searched for the changes in the freesound forum, and found info about the little changes. Anyway, I’ll summarize the whole thing for anyone who is interested.

We’ll be using cURL for the examples, you can deal with the URL’s using the faciliites your programming language provides, or just pipe through cURL. Here we go…

Freesound uses a login system, so you need a username and password that can be obtained for free from the freesound website. Once you have your username and password ready, your program needs to login to the system, and store the cookie freesound provides for you. You’ll be using this cookie for your future queries. The way to go with this using cURL is:

curl -c cookie.txt -d "username=<username>&password=<password>&redirect=../index.php&login=login&autologin=0" http://www.freesound.org/forum/login.php

You should change the <username> and <password> with your own username and password. Once you run this, you will get a cookie from the freesound site called cookie.txt. We’ll need that cookie to make queries. But first we need to check if login was successful. A way to find it out is trying to fetch this page: http://www.freesound.org/searchTextXML.php and see if the header for the returned page lists text/xml as content type. The way to do this with cURL is:

curl -b cookie.txt -I http://www.freesound.org/searchTextXML.php

Parse the returning response. If you see Content-Type: text/xml; somewhere, that means your login was successful.

Once you make sure you have a valid login, you can make searches. There are many parameters available for directing search results. This is an example:

curl -b cookie.txt -d "search=train&start=0&searchDescriptions=1&searchTags=1&searchFilenames=0&searchUsernames=0&durationMin=0&durationMax=20&order=0&limit=100" http://www.freesound.org/searchTextXML.php

This searches for the samples with keyword train in descriptions, tags but not in filenames and usernames, which has a duration between 0 and 20 seconds, and limits the maximum number of resulting samples to 100. The “order”, according to the info I found at the freesound forum means this:

ORDER_DEFAULT = 0;
ORDER_DOWNLOADS_DESC = 1;
ORDER_DOWNLOADS_ASC = 2;
ORDER_USERNAME_DESC = 3;
ORDER_USERNAME_ASC = 4;
ORDER_DATE_DESC = 5;
ORDER_DATE_ASC = 6;
ORDER_DURATION_DESC = 7;
ORDER_DURATION_ASC = 8;
ORDER_FILEFORMAT_DESC = 9;
ORDER_FILEFORMAT_ASC = 10;

You can tweak the other search options for your own liking. When you make this query, the freesound server will return you an XML file with the list of sample ids matching your criteria. It may look something like this:

<freesound nresults="335">
<sample id="74054" />
<sample id="74053" />
<sample id="74052" />
<sample id="74051" />
<sample id="74050" />
<sample id="74049" />
<sample id="74048" />
<sample id="74047" />
<sample id="74046" />
...
...
....
.....
<sample id="71687" />
<sample id="71686" />
</freesound>

Although number of found samples are 335 here, you will get 100 id numbers as dictated by your limit=100 choice above. You’ll need to get the sample ids from this XML file. If you need more info about a sample, you should do this:

curl -b cookie.txt http://www.freesound.org/samplesViewSingleXML.php?id=<id number for your sample>

You should put the id you want at the place of <id number for your sample> above. This will return some useful info about the sample you’ve chosen like duration, samplerate, bitrate, bitdepth, filesize, extension, geotag etc. in XML format.

If you find a sample that seems fit for you, you might want to download it.

Freesound redirects download requests so we need the get the exact URL of the file first, parse the header response from this to get the URL:

curl -b cookie.txt -I http://www.freesound.org/samplesDownload.php?id=<my sample id>

When you parse the URL (let me know if there is an easy way to get this when there are redirects) store it somewhere, and use this to download the file:

curl -b cookie.txt URL > filename

Where URL is the URL of the file you want to download and filename is the name of the file you want to download. When cURL finishes, you should have the file ready to be used in your programs.

  • StumbleUpon
  • del.icio.us
  • Digg
  • Facebook
  • Twitter
  • Reddit
Tagged , ,
Leave a comment

FreeSound class for SuperCollider released as a Quark

Some of you might know about the Freesound project ( http://www.freesound.org ). The website is a collaborative database of Creative Commons licensed “sounds”. By “sounds”, they mean “samples only”, that are snippets of recorded stuff which are not to be identified as “songs”. It has a quite big community and they provide an API for software developers to access and get sounds from the database, which I think is great!

Last year when I was coding deQuencher, I made a freesound agent for it, which grabbed a random sample from the freesound database (based on a provided keyword) that would make it readily available for usage in a live performance / improvisation situation. Today I released a SC Quark which provides similar functionality for the sclang environment. Choose a keyword, set your search options, the quark handles the necessary searching and downloading operations for you, and you can use the downloaded file right away in a live performance. Yummy. You can get it from the official Quarks repository.

  • StumbleUpon
  • del.icio.us
  • Digg
  • Facebook
  • Twitter
  • Reddit
Tagged ,
1 Comment
  • What

    I am Batuhan Bozkurt.

    Things involving computational (sound) art, and my work swirling around the subject are here.

    Follow my RSS feed if you care.

  • Find me