Archive for Math

Gesture Source

So, here is the source for the Gesture Test I posted before.
http://labs.hellokeita.com/files/gesture/gesture.zip

As I said, it’s really simple, it’s not the best code but it gives you some ideas of how it’s made.

Inside the “tags” folder, I have three pngs for each shape (triangle, square and circle).
You draw the shape you want, I trim it, and compare to each png.
The comparisson is, get the drawn image, stretch it to the size of each png, and apply threshold. The BitmapData.threshold returns you an uint, the number of pixels that has been changed. With this number, divide it to the area of the png, and than, you choose the one that returns you tha smallest number.

and… that’s it. simple simple…

actually, it’s a technique used for some facial/object recognition softwares, but in a simplified way.

Vote in HexoSearch Vote

Comments (1)

LFPUG Presentation and Sources

As promissed, here is the presentation I made at LFPUG in PDF format.

http://www.hellokeita.in/presentations/LFPUG/20090827/MakingMusicFP10.pdf

And the source files zipped with the demos I showed.

http://www.hellokeita.in/presentations/LFPUG/20090827/examples.zip
The contents are:
Example01-SineWaveExample: Simple example generating a sine wave
Example02-KeyboardExample: Example of a piano keyboard
Example03-WaveformExample: Changing the waveform of a sound
Example04-TimePitchExample: Changing pitch and tempo of a mp3
Example05-HeliumBalloon: Real time pitch shifting using Java

Enjoy!

UPDATE
LFPUG website uploaded the video of my presentation
http://www.lfpug.com/flash-10-making-music/

Vote in HexoSearch Vote

Comments (1)

Fake Pitch Shifting

Pitch shifting is the method to change the frequency or the height of a sound.
And why it’s fake? Because, I’m really not using the correct algorithm, actually I just made one for demo purpose. If you listen carefully, you can hear some clippings when you change the slider position.

There is a difference between my previous post about pitch Controlling Pitch and Tempo.
The previous one I was using a dynamically generated sine wave and changing the pitch. It’s much easier because I already have the samples for each sound.


On this example I’m using an MP3 file (Daft Punk, please don’t sue me…If you want, I can change it) and changing the pitch on runtime.

Well it’s working, and as you can see no FPS loss.

Get Adobe Flash player

The source… well, I’m preparing for my LFPUG presentation so, I’ll try to explain about it there, and than release some kind of source.

There is a post from my friend Li http://www.lidev.com.ar/?p=237 where he is using more accurate algorithm to change the pitch. There’s not much loss on quality and no clips.

Vote in HexoSearch Vote

Comments (1)

MathUtils Class

Hi,

After a long time, I uploaded a class in my SVN.
http://code.hellokeita.in/public/trunk/as3/br/hellokeita/utils/MathUtils.as

It’s a small class br.hellokeita.utils.MathUtils.
Inside, there are few methods: combination, factorial, solveCramer and squareMatrixDeterminant.
I think method name tells what it does, so please check it out and comment about it.

cheers,
k

Vote in HexoSearch Vote

Comments