12.15.2008

Flash Chromatic Scale

Hey, I've been playing with flash & fourier, and some other random Music-Related Math... Check this out:






This SWF Generates notes in the chromatic scale, in the range of about 2 or 3 octaves... The sound wave is seven degrees of fourier series saw-tooth, and it has a little decay added to it so it's more bleepy than ambient.


If you wanna peep at the source code, here it is.



12.12.2008

Email From Wellons

I just got back in touch with a life-long friend, and asked him a technical question about sound and mathematics, now, I know a little about FFT (Fast Fourier Transform) Just from my musical self-training... BUT now he's pointed me to a little more knowledge, which I will share with you, dear reader.
Any periodic function, like those saw-tooth, triangle, square waves,
can be produced by summing up a series of sine waves. I.e. the Fourier
series,

http://mathworld.wolfram.com/FourierSeries.html

http://en.wikipedia.org/wiki/Fourier_series

And, if you spend a couple years studying a series of numbers between
-1 and 1 (or any arbitrary bounds, really), you have almost earned
yourself an electrical engineering degree. What I am saying is, this
is a field called signal processing, and is a gigantic field of study
which some people have devoted their entire lives to, so you should
have no shortage of interesting things to see playing with this. ;-)

Your basic .wav file is the same thing: just an uncompressed series of
samples. If you write a program to dump these samples to a file in
binary form, then add the proper header, you have a .wav file. Also
see Fourier transforms and frequency domain filters.

Just as audio is a 1-dimensional signal, images are 2-dimensional
signals. Videos are 3-dimensional signals. The same theory applies to
them as well.
You can check out his blog @ http://nullprogram.com/

CPSIA: FAIL

I'm not usually upping personal politics, but this is nuts... The Consumer Product Safety Improvement Act (CPSIA) Is putting restrictions on what can be sold in the United States. They're doing this under the guise of protecting children from faulty, mostly chinese-manufactured, products. However they're not taking into consideration that this covers ALL manufactured, up-cycled, assembled, crafted, and DIY products too. Meaning that if Grandma knits shawls, she can't sell them to support her bingo addiction. And if "Joe the Plumber" builds toy cars in his garage, he'll have to pay thousands of dollars to test them to see if they're fit to sell at the Crafters Convention, in fact, there won't BE a crafters convention.
All of these changes will be fairly easy for large, multinational toy manufacturers to comply with. Large manufacturers who make thousands of units of each toy have very little incremental cost to pay for testing and update their molds to include batch labels.  

For small American, Canadian, and European toymakers, however, the costs of mandatory testing will likely drive them out of business.
...
If this law had been applied to the food industry, every farmers market in the country would be forced to close while Kraft and Dole prospered.
(via Handmade Toy Alliance)

This is insane, Why would any intelligent person vote for this? In fact only one congress-man voted against it, Ron Paul. I don't know why he couldn't beat out McCain for a rebublican nod this fall, Just kidding, it was the Media the same people who arn't reporting on THIS story.

If you want to find more you can do about this, try:

11.25.2008

Javascript Audio Generation

I haven't looked into the actual source code of this ... But javascript just joined the audio-generation racket, check this out:
http://ajaxian.com/archives/generating-and-playing-sound-in-javascript

And a couple of days ago somebody made a drum machine with (only) javascript:

That comes complete with an audio visualizer built in JS, but I suspect it gets the hits etc. from the switches themselves instead of the audio generated.

I love this renesaince of coding that's making music production much more easy to experiment with...

11.24.2008

Adobe Flash cs4

Well, finally some cross-over ... Flash CS4 (Flash Player 10) has the ability to generate sound using math. So naturally a sine wave is a function of sine...

Here's a bit of code I put together to show this off:
import flash.events.*;
import flash.media.*;
var sound:Sound = new Sound();
sound.addEventListener(SampleDataEvent.SAMPLE_DATA, onCallback);
var channel = sound.play();
function onCallback(e:SampleDataEvent):void {
var noise:Number = Math.round(Math.random()*100)/100;
for (var i:int = 0; i <>
var sample:Number=Math.sin((Number(i/Math.PI/2)/6)));
e.data.writeFloat(sample * noise);
e.data.writeFloat(sample * noise);
}}
My noise variable in there makes the tone jump from pitch to pitch in an aleatoric fashion. John Cage in 12 lines of code.

My goal with this process is to create a fully-functional synth in flash, or at least some sort of drum machine clone with all the data derived by math.

Oh, if you modify this so that sample = math.random() you get some decent white noise. I'm still working on controlling the volume of the sound before being generated, and some filtering. But right now I'm just focusing on emulating the waves.