Monday, 19 March 2007
MIDI Power glove, toward live performance
Introduced distortion and location-controlled bandpass filters. It's really more alienish now. There's a little jitter I can't explain - gotta remove it.
My excuses for the overall quality of the video, but SBlive's converters are really poor: I used to route the signal into the M-delta, but this time I had to capture on the shitty one.
Last week I tried the glove in studio with my band, and the results are promising. I do think it needs only two more refinements: a better bounds detection routine and some kind of instant silencer gesture. :)
Friday, 16 March 2007
Poledouris 1 Al Bano 0
Let's play "find the 10 differences"!
P.s.: Basil Poledouris is the greates film scorer EVER.
Wednesday, 14 March 2007
Fractal food
Another fractals-related post: I found this very nice website which shows how fractals and caothic math surround us in Nature. What you see in the photo is a simple broccoli; in Italy we refer to it as "cavolfiore": a well known vegetable that hides interesting secrets.
By zooming the surface you'll discover that it shows a complete autosimilarity just like any other fractal: you'll always find smaller, identical broccoli in every scale.
The recurrence stops at atomic level, but it's stunning anyway.
Monday, 12 March 2007
Sierpinsky tattoo?
Fractals are very fascinating objects, because mathematically speaking they have got infinite perimeter and no area. Sierpinsky's triangle is even more important to me, for it is the first fractal I programmed by myself. I thought "man, this could be the coolest tatoo ever! And I'll be the first having it!".
False. A guy tattoo'd the "Menger's Sponge" moved by similar reasons.
Well, who cares. I will own the second one! But only if I will graduate.
One day.
Who knows.
I hope.
Tuesday, 6 March 2007
Climax
The death-week is over, I got the third exam score: last slice of cybernetics is achieved with a juicy 30 cum laude, so the final score is 28! Yeah!!
It has been a wonderful, unforgettable experience; four months of mind-expanding sufference.
Next step: record new minicd with the band and... computer graphics!
It has been a wonderful, unforgettable experience; four months of mind-expanding sufference.
Next step: record new minicd with the band and... computer graphics!
Thursday, 1 March 2007
OpenAL hello world!
OpenAL are for audio what OpenGL are for video: a cross-platform, and open source, set of API useful for creating a realistic tridimensional audio environment.
Exactly like OpenGL, they're easy to learn and well documented. They don't handle MIDI yet, therefore I used them only to play samples, triggered by the numerical pad on the wrist of powerglove.
I quit using playsound() Windows primitive for it is too cheap: no multibuffering, no pitch control, no positioning... just playing. Instead, I wanna play several alien-related noise at a time, launch drum loops and so on.
So, let's see how to play something. First, you have to download OpenAL SDK, libraries and documentations from the official site. Once installed, link libraries to your project and put the headers in your code (al.h, alc.h, alut.h).
Then, simply:
alutInit(NULL, NULL);
to erase any pending AL process. Now, we have to open a sound device and, for any device, we must define a "context" to place the sounds in. We can make this by coding:
ALCdevice* device;
ALCcontext* context;
device = alcOpenDevice(NULL);
context = alcCreateContext(device, NULL);
alcMakeContextCurrent(context);
alGetError();
alGetError() returns AL_NO_ERROR if opening procedure went ok. If it happened, we have correctly initialized OpenAL. Done this, it's time to place a listener (imagine Doom - it's the spacemarine!); listener has 3 important features: a position, a velocity and an orientation. Every parameters help OpenAL to render sounds, as it happens in OpenGL environment. They're very similar as approach.
ALfloat ListenerPos[] = { 0.0, 0.0, 0.0 };
ALfloat ListenerVel[] = { 0.0, 0.0, 0.0 };
ALfloat ListenerOri[] = { 0.0, 0.0, -1.0, 0.0, 0.0, 0.0 };
alListenerfv(AL_POSITION, ListenerPos);
alListenerfv(AL_VELOCITY, ListenerVel);
alListenerfv(AL_ORIENTATION, ListenerOri);
Check out documentation for the meaning of every floating-point value. Now it's time to load a wave file in memory, decant it into a buffer to be used by OpenAL routines and launch it.
ALuint Buffer;
ALenum formato;
ALsizei dimensione;
ALvoid* dati;
ALsizei frequenza;
ALboolean loop;
alGenBuffers(1, &Buffer);
alutLoadWAVFile(percorso, &formato, &dati, &dimensione, &frequenza, &loop);
alBufferData(Buffer, formato, dati, dimensione, frequenza);
alutUnloadWAV(formato, dati, dimensione, frequenza);
It's very clear what happens: we generate a buffer, load the wave into the buffer catching informations, load the wave into the generated buffer, and unload wave from memory.
Finally, we have to bind the buffer to a source and play it:
/* generate source */
alGenSources(1, &Source);
/* place it */
ALfloat SourcePos[] = { 0.0, 0.0, 0.0 };
ALfloat SourceVel[] = { 0.0, 0.0, 0.0 };
/* options */
alSourcei (Source, AL_BUFFER, Buffer );
alSourcef (Source, AL_PITCH, 1.0f );
alSourcef (Source, AL_GAIN, 1.0f );
alSourcefv(Source, AL_POSITION, SourcePos);
alSourcefv(Source, AL_VELOCITY, SourceVel);
alSourcei (Source, AL_LOOPING,
loop
);
/* riproduco sorgente */
alSourcePlay(Source);
You're done. It's really that simple. Amazing!
Subscribe to:
Posts (Atom)