Recognizing the frequencies of sound?

TDonnally

  • Posts: 235
Is it possible to make some sort of behavior that recognizes the frequencies of a sound being played?

My goal right now is just to recognize notes lower and higher than middle C .

gamegirlxl

  • Posts: 713
I think this would really only be possible if those frequencies were neatly mentioned (maybe by an assigned number) on the name of its sound file, where they could be played one by one.

But I would guess that you want basically a perfect pitch computer-so you can play and id the notes of any random mp3.

I have looked deeply into the capabilities of sound on flash and it really is lacking.  I can't even figure out how much time has elapsed from the start of a sound file through said file (regardless of lag).

With a bit of calculus and mapping the pitch as a curve, you may be able to determine the amount of relative maximums per second, or Hz, which can be taken back into a letter note.  (If my knowledge of music is as sound as my knowledge of calc...Since I am not musical...)

I think the variety of chords and effects that change the structure of sound would make it extraordinarily difficult to use it with a variety of songs.

I think it can be done, just not with nice Stencyl blocks, simple math, or simple custom codes.  You'd have to dig very deep to find what you need for this.

gamecorp

  • Posts: 39
i found something similar to what you talk ! and found it just not in stencyl! and it can be done with native flash coding or javascript from here! if you guys manage to insert this code into stencyl i give you a beer!

http://www.badlogicgames.com/wordpress/?s=onset+detection


it has 7 parts! people are sayng this works on flash or java! but dont know how to add it to stencyl! will be great to have beat analyzer inside stencyl! as extension or something!


i did the tutorial above but in construct 2 cause already has plugin for analyze effect built in! so i dont have to use! the problem is how to add advanced audio for analyze effect thing!


if you guys manage to resolve this give me a bip!
Selling Games in flash its like eating a Donut. Selling them In Mobile its like eating a Donut with Jetpack!.

gamegirlxl

  • Posts: 713
 :'( I can only see half the page because the "cross" doesn't close anything.  I can't read it all, and I'm not even old enough to have beer legally.

Anyways, I know that each sound is some sort of graph (usually some form of trig), and the height/frequency of each maximum I think would contain the information you need to find the note (I'm not musical enough, and I don't remember the physics, but I think I can find any aspect of a function if I knew what I was looking for...I know calculus).  The question is: how do you FIND or otherwise GET this information?  If I knew how to get the information about the sound wave (meaning what height is the line at a certain time, where time is very precise), I might be able to write some form of algorithm that does math things (estimate slope between a relative min and max, maybe several times to get an average) and gets a value that tells you things about the pitch or whatever.  You could then compare that value (hertz, maybe?) to one you get from that 'C'.

I'm also unsure how to deal with chords, because I don't know how those "look" compared with normal notes.  They'd probably look like several trig's added together, and although some people can distinguish all the notes that are being played, a computer would have to do complex subtraction and other math that I don't want to think about right now.  I would hope nobody wants to go that far yet.