Determine Musical note

Get help using Construct 2

Post » Tue Oct 01, 2013 7:29 am

Hey all. I could use some assistence.

I'm looking for a solution or a resource to translate Audio to a musical note. I want to create a typing like game, but instead use an electric violin.

So more like Rock Smith. The problem is that sound numbers boggle my mind. So I'm looking for an answer or at least some place I can try and put all these numbers in the Audio/UserMedia plugin to use.

I appreciate the reply in advance.
B
92
S
18
G
9
Posts: 2,455
Reputation: 15,113

Post » Tue Oct 01, 2013 8:21 am

Probably not what you are looking for

I don't understand what it is you are trying to achieve exactly, but it sounds interesting nonetheless..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Oct 01, 2013 12:58 pm

@jayderyu : the answer to what you are looking for is in the Fast Fourier Transform operation. Using that mathematical algorithm, you can divide an audio sample in frequency bands. Each of those band can then be checked to see if there's something in it (usually a given note, C, D#, and so on...).
You can't do that in pure javascript, it's too slow. But there are nodes in the WebAudio API that let you use it. I don't know if @Ashley already exposed those nodes to the C2's interface.
B
33
S
9
G
6
Posts: 708
Reputation: 6,704

Post » Tue Oct 01, 2013 1:03 pm

[QUOTE=Pode]I don't know if @Ashley already exposed those nodes to the C2's interface.[/QUOTE] Yes, the analyzer effect provides you with FFT and access to individual frequency bins.
Image
B
24
S
8
G
10
Posts: 1,821
Reputation: 8,279

Post » Tue Oct 01, 2013 4:15 pm

@pode
thanks for the start. Appreciate. Got up to displaying the bands. I think. There is a sample in one of the web audio api's. I managed to link the mic to Audio using the analyzer effect. Using the sample I now have an effect array of frequency. however i'm not sure how to yank from a large number of frequency samples to determine which not is playing.

But your insight did give me some ideas to test out.

@LittleStain
That's a helpful end point once I can determine the frequency currently being played :)
B
92
S
18
G
9
Posts: 2,455
Reputation: 15,113

Post » Wed Oct 02, 2013 8:27 am

@jayderyu : in theory, each note has a pure frequency, you can get those in lists like the one provided by @LittleStain. In practice, no instrument or human voice is pure, so you'll get frequencies leaking in near bands. Furthermore, each note produced by an instrument has some harmonics, with are multiples of the base frequency, in different bands. To determine which bands are the base of the note, you need also to check the power (intensity) of the frequency.
B
33
S
9
G
6
Posts: 708
Reputation: 6,704


Return to How do I....?

Who is online

Users browsing this forum: John Cutter and 7 guests