Mychadu's Music Analyzer

Choose a sound file from your device storage and visualize its sheet music with the A, B and S sliders.

This is no file upload to a server. The file remains on your device.




A
2

A
0
H
2

B
0
C
1

C
1
D
1

D
1
E
1

E
1
F
1

F
1
G
1

G
1
A
1

A
1
H
1

B
1
C


C
2
D


D
2
E


E
2
F


F
2
G


G
2
A


A
2
H


B
2
c


C
3
d


D
3
e


E
3
f


F
3
g


G
3
a


A
3
h


B
3
c
1

C
4
d
1

D
4
e
1

E
4
f
1

F
4
g
1

G
4
a
1

A
4
h
1

B
4
c
2

C
5
d
2

D
5
e
2

E
5
f
2

F
5
g
2

G
5
a
2

A
5
h
2

B
5
c
3

C
6
d
3

D
6
e
3

E
6
f
3

F
6
g
3

G
6
a
3

A
6
h
3

B
6
c
4

C
7
d
4

D
7
e
4

E
7
f
4

F
7
g
4

G
7
a
4

A
7
h
4

B
7
c
5

C
8
C
#b
D
#b
E
F
#b
G
#b
A
#b
H/B
04 | 32.7032 | (22)
05 | 34.6478 | (23)
06 | 36.7081 | (25)
07 | 38.8909 | (26)
08 | 41.2034 | (28)
09 | 43.6535 | (29)
10 | 46.2493 | (31)
11 | 48.9994 | (33)
12 | 51.9131 | (35)
13 | 55.0000 | (37)
14 | 58.2705 | (39)
15 | 61.7354 | (42)
16 | 65.4064 | (44)
17 | 69.2957 | (47)
18 | 73.4162 | (50)
19 | 77.7817 | (53)
20 | 82.4069 | (56)
21 | 87.3071 | (59)
22 | 92.4986 | (63)
23 | 97.9989 | (66)
24 | 103.826 | (70)
25 | 110.000 | (75)
26 | 116.541 | (79)
27 | 123.471 | (84)
28 | 130.813 | (89)
29 | 138.591 | (94)
30 | 146.832 | (100)
31 | 155.563 | (106)
32 | 164.814 | (112)
33 | 174.614 | (119)
34 | 184.997 | (126)
35 | 195.998 | (133)
36 | 207.652 | (141)
37 | 220.000 | (150)
38 | 233.082 | (159)
39 | 246.942 | (168)
40 | 261.626 | (178)
41 | 277.183 | (189)
42 | 293.665 | (200)
43 | 311.127 | (212)
44 | 329.628 | (225)
45 | 349.228 | (238)
46 | 369.994 | (252)
47 | 391.995 | (267)
48 | 415.305 | (283)
49 | 440.000 | (300)
50 | 466.164 | (318)
51 | 493.883 | (337)
52 | 523.251 | (357)
53 | 554.365 | (378)
54 | 587.330 | (400)
55 | 622.254 | (424)
56 | 659.255 | (450)
57 | 698.456 | (476)
58 | 739.989 | (505)
59 | 783.991 | (535)
60 | 830.609 | (567)
61 | 880.000 | (600)
62 | 932.328 | (636)
63 | 987.767 | (674)
64 | 1046.50 | (714)
65 | 1108.73 | (756)
66 | 1174.66 | (801)
67 | 1244.51 | (849)
68 | 1318.51 | (900)
69 | 1396.91 | (953)
70 | 1479.98 | (1010)
71 | 1567.98 | (1070)
72 | 1661.22 | (1134)
73 | 1760.00 | (1201)
74 | 1864.66 | (1272)
75 | 1975.53 | (1348)
76 | 2093.00 | (1428)
77 | 2217.46 | (1513)
78 | 2349.32 | (1603)
79 | 2489.02 | (1699)
80 | 2637.02 | (1800)
81 | 2793.83 | (1907)
82 | 2959.96 | (2020)
83 | 3135.96 | (2140)
84 | 3322.44 | (2268)
85 | 3520.00 | (2402)
86 | 3729.31 | (2545)
87 | 3951.07 | (2697)

A0: 01 | 27.5000 Hz | (18)       Bb0: 02 | 29.1352 | (19)       B0: 03 | 30.8677 | (21) ------------------------------------------------------------------------------------- C8: 88 | 4186.01 (2857)

keyNo | frequency (Hz) | dataArray[No]

How it works (JavaScript)

  1. Web Audio API
  2. sampleRate = 48000 Hz
    => frequency range = 0 ... 24000 Hz   (half of the sampleRate)
    => dataArray[ i ] range = 0 ... 24000 Hz
  3. analyser.fftSize = 32768   (2**5 ... 2**15, default 2048)
    => frequencyBinCount ("bufferLength") = 16384   (half of the analyser.fftSize)
    => dataArray[ i ] range = 0 ... 16383 bin   (data values for the visualization)
  4. so each bin of the dataArray[ i ] represents
    24000 Hz / 16384 bin = 1.4648 Hz/bin
    That is just enough to address the lower notes of a piano:
    f(Bb0) - f(A0) = (29,1352 - 27,5000) Hz = 1.6352 Hz
  5. frequency of the piano key No j   (j = 1, 2, 3, ... ):
    f(j) = Math.floor( Math.pow(2, (j-49)/12) ) * 440 Hz
    e.g., key A0 (this is key No1): f(A0) = 27.5000 Hz
  6. corresponding dataArray-cell i of this frequency j resp. key j
    (i = j-1 = 0, 1, 2, ...):
    dataArray[ ](key j) = Math.floor( Math.pow(2, (i-48)/12) * 440 * 16384/24000 )
    e.g., dataArray[ ](key No1) = dataArray[ ](A0) = Math.floor(18.7733) = 18
    e.g., dataArray[ ](key No49) = dataArray[ ](A4) = Math.floor(300.000) = 300
    e.g., dataArray[ ](key No88) = dataArray[ ](C8) = Math.floor(2857.65) = 2857
  7. Volume of the note j = dataArray [ i ] = 0 ... 255, so
    vol(key j) = dataArray[ Math.floor(Math.pow(2,(i-48)/12) * 440*16384/24000) ]
  8. cut resounding frequencies with "B", amplify the remainder with "A":
    volCut(key j) = A * ( dataArray[... i ...] - (255*B) ) = barHeight(key j)
    (0 ≤ B ≤ 1)
  9. "S" (smoothing-time-constant)
    makes the transition between values over time smoother.

About

Check browser compatibility.
This website (once loaded) works offline.

For some zoom factors, the piano keyboard may not be displayed correctly
(zoom factor should be a multiple of 10%).

Start with A = 1 and B = 0:
With "B" the less loud frequencies (the smaller bars) are cut off.
With "A" you boost the remaining frequencies.
"S" makes the transition between values over time smoother.
Test it with A = 10, B = approx 0.9, S = 0 and this test-mp3.

Watch dataArray on the browsers console
(F12, CTRL + SHIFT + I, ..., then choose "console" tab).

All scripts on this website were written by me with love.
Reference: MDN web docs.

Mychadu's Music | Impressum | Datenschutzerklärung

© 2017 Michael Duttge
    
Mychadu's QR-Code

♫ a mobile-friendly website ♫