Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- // put together by @S0phieH http://pastebin.com/epcCxrAE
- // pitch frequencies from:
- // http://www.phy.mtu.edu/~suits/notefreqs.html
- public class Pitches {
- public static double GetPitch(Notes note){
- switch (note){
- case Notes.C0:
- return 16.35;
- case Notes.CSHARP0:
- return 17.32;
- case Notes.D0:
- return 18.35;
- case Notes.DSHARP0:
- return 19.45;
- case Notes.E0:
- return 20.60;
- case Notes.F0:
- return 21.83;
- case Notes.FSHARP0:
- return 23.12;
- case Notes.G0:
- return 24.50;
- case Notes.GSHARP0:
- return 25.96;
- case Notes.A0:
- return 27.50;
- case Notes.ASHARP0:
- return 29.14;
- case Notes.B0:
- return 30.87;
- case Notes.C1:
- return 32.70;
- case Notes.CSHARP1:
- return 34.65;
- case Notes.D1:
- return 36.71;
- case Notes.DSHARP1:
- return 38.89;
- case Notes.E1:
- return 41.20;
- case Notes.F1:
- return 43.65;
- case Notes.FSHARP1:
- return 46.25;
- case Notes.G1:
- return 49.00;
- case Notes.GSHARP1:
- return 51.91;
- case Notes.A1:
- return 55.00;
- case Notes.ASHARP1:
- return 58.27;
- case Notes.B1:
- return 61.74;
- case Notes.C2:
- return 65.41;
- case Notes.CSHARP2:
- return 69.30;
- case Notes.D2:
- return 73.42;
- case Notes.DSHARP2:
- return 77.78;
- case Notes.E2:
- return 82.41;
- case Notes.F2:
- return 87.31;
- case Notes.FSHARP2:
- return 92.50;
- case Notes.G2:
- return 98.00;
- case Notes.GSHARP2:
- return 103.83;
- case Notes.A2:
- return 110.00;
- case Notes.ASHARP2:
- return 116.54;
- case Notes.B2:
- return 123.47;
- case Notes.C3:
- return 130.81;
- case Notes.CSHARP3:
- return 138.59;
- case Notes.D3:
- return 146.83;
- case Notes.DSHARP3:
- return 155.56;
- case Notes.E3:
- return 164.81;
- case Notes.F3:
- return 174.61;
- case Notes.FSHARP3:
- return 185.00;
- case Notes.G3:
- return 196.00;
- case Notes.GSHARP3:
- return 207.65;
- case Notes.A3:
- return 220.00;
- case Notes.ASHARP3:
- return 233.08;
- case Notes.B3:
- return 246.94;
- case Notes.C4:
- return 261.63;
- case Notes.CSHARP4:
- return 277.18;
- case Notes.D4:
- return 293.66;
- case Notes.DSHARP4:
- return 311.13;
- case Notes.E4:
- return 329.63;
- case Notes.F4:
- return 349.23;
- case Notes.FSHARP4:
- return 369.99;
- case Notes.G4:
- return 392.00;
- case Notes.GSHARP4:
- return 415.30;
- case Notes.A4:
- return 440.00;
- case Notes.ASHARP4:
- return 466.16;
- case Notes.B4:
- return 493.88;
- case Notes.C5:
- return 523.25;
- case Notes.CSHARP5:
- return 554.37;
- case Notes.D5:
- return 587.33;
- case Notes.DSHARP5:
- return 622.25;
- case Notes.E5:
- return 659.25;
- case Notes.F5:
- return 698.46;
- case Notes.FSHARP5:
- return 739.99;
- case Notes.G5:
- return 783.99;
- case Notes.GSHARP5:
- return 830.61;
- case Notes.A5:
- return 880.00;
- case Notes.ASHARP5:
- return 932.33;
- case Notes.B5:
- return 987.77;
- case Notes.C6:
- return 1046.50;
- case Notes.CSHARP6:
- return 1108.73;
- case Notes.D6:
- return 1174.66;
- case Notes.DSHARP6:
- return 1244.51;
- case Notes.E6:
- return 1318.51;
- case Notes.F6:
- return 1396.91;
- case Notes.FSHARP6:
- return 1479.98;
- case Notes.G6:
- return 1567.98;
- case Notes.GSHARP6:
- return 1661.22;
- case Notes.A6:
- return 1760.00;
- case Notes.ASHARP6:
- return 1864.66;
- case Notes.B6:
- return 1975.53;
- case Notes.C7:
- return 2093.00;
- case Notes.CSHARP7:
- return 2217.46;
- case Notes.D7:
- return 2349.32;
- case Notes.DSHARP7:
- return 2489.02;
- case Notes.E7:
- return 2637.02;
- case Notes.F7:
- return 2793.83;
- case Notes.FSHARP7:
- return 2959.96;
- case Notes.G7:
- return 3135.96;
- case Notes.GSHARP7:
- return 3322.44;
- case Notes.A7:
- return 3520.00;
- case Notes.ASHARP7:
- return 3729.31;
- case Notes.B7:
- return 3951.07;
- case Notes.C8:
- return 4186.01;
- case Notes.CSHARP8:
- return 4434.92;
- case Notes.D8:
- return 4698.63;
- case Notes.DSHARP8:
- return 4978.03;
- case Notes.E8:
- return 5274.04;
- case Notes.F8:
- return 5587.65;
- case Notes.FSHARP8:
- return 5919.91;
- case Notes.G8:
- return 6271.93;
- case Notes.GSHARP8:
- return 6644.88;
- case Notes.A8:
- return 7040.00;
- case Notes.ASHARP8:
- return 7458.62;
- case Notes.B8:
- return 7902.13;
- }
- return 440.00; //A
- }
- }
- public enum Notes{
- C0 = 0,
- CSHARP0 = 1,
- DFLAT0 = 1,
- D0 = 2,
- DSHARP0 = 3,
- EFLAT0 = 3,
- E0 = 4,
- F0 = 5,
- FSHARP0 = 6,
- GFLAT0 = 6,
- G0 = 7,
- GSHARP0 = 8,
- AFLAT0 = 8,
- A0 = 9,
- ASHARP0 = 10,
- BFLAT0 = 10,
- B0 = 11,
- C1 = 12,
- CSHARP1 = 13,
- DFLAT1 = 13,
- D1 = 14,
- DSHARP1 = 15,
- EFLAT1 = 15,
- E1 = 16,
- F1 = 17,
- FSHARP1 = 18,
- GFLAT1 = 18,
- G1 = 19,
- GSHARP1 = 20,
- AFLAT1 = 20,
- A1 = 21,
- ASHARP1 = 22,
- BFLAT1 = 22,
- B1 = 23,
- C2 = 24,
- CSHARP2 = 25,
- DFLAT2 = 25,
- D2 = 26,
- DSHARP2 = 27,
- EFLAT2 = 27,
- E2 = 28,
- F2 = 29,
- FSHARP2 = 30,
- GFLAT2 = 30,
- G2 = 31,
- GSHARP2 = 32,
- AFLAT2 = 32,
- A2 = 33,
- ASHARP2 = 34,
- BFLAT2 = 34,
- B2 = 35,
- C3 = 36,
- CSHARP3 = 37,
- DFLAT3 = 37,
- D3 = 38,
- DSHARP3 = 39,
- EFLAT3 = 39,
- E3 = 40,
- F3 = 41,
- FSHARP3 = 42,
- GFLAT3 = 42,
- G3 = 43,
- GSHARP3 = 44,
- AFLAT3 = 44,
- A3 = 45,
- ASHARP3 = 46,
- BFLAT3 = 46,
- B3 = 47,
- C4 = 48,
- CSHARP4 = 49,
- DFLAT4 = 49,
- D4 = 50,
- DSHARP4 = 51,
- EFLAT4 = 51,
- E4 = 52,
- F4 = 53,
- FSHARP4 = 54,
- GFLAT4 = 54,
- G4 = 55,
- GSHARP4 = 56,
- AFLAT4 = 56,
- A4 = 57,
- ASHARP4 = 58,
- BFLAT4 = 58,
- B4 = 59,
- C5 = 60,
- CSHARP5 = 61,
- DFLAT5 = 61,
- D5 = 62,
- DSHARP5 = 63,
- EFLAT5 = 63,
- E5 = 64,
- F5 = 65,
- FSHARP5 = 66,
- GFLAT5 = 66,
- G5 = 67,
- GSHARP5 = 68,
- AFLAT5 = 68,
- A5 = 69,
- ASHARP5 = 70,
- BFLAT5 = 70,
- B5 = 71,
- C6 = 72,
- CSHARP6 = 73,
- DFLAT6 = 73,
- D6 = 74,
- DSHARP6 = 75,
- EFLAT6 = 75,
- E6 = 76,
- F6 = 77,
- FSHARP6 = 78,
- GFLAT6 = 78,
- G6 = 79,
- GSHARP6 = 80,
- AFLAT6 = 80,
- A6 = 81,
- ASHARP6 = 82,
- BFLAT6 = 82,
- B6 = 83,
- C7 = 84,
- CSHARP7 = 85,
- DFLAT7 = 85,
- D7 = 86,
- DSHARP7 = 87,
- EFLAT7 = 87,
- E7 = 88,
- F7 = 89,
- FSHARP7 = 90,
- GFLAT7 = 90,
- G7 = 91,
- GSHARP7 = 92,
- AFLAT7 = 92,
- A7 = 93,
- ASHARP7 = 94,
- BFLAT7 = 94,
- B7 = 95,
- C8 = 96,
- CSHARP8 = 97,
- DFLAT8 = 97,
- D8 = 98,
- DSHARP8 = 99,
- EFLAT8 = 99,
- E8 = 100,
- F8 = 101,
- FSHARP8 = 102,
- GFLAT8 = 102,
- G8 = 103,
- GSHARP8 = 104,
- AFLAT8 = 104,
- A8 = 105,
- ASHARP8 = 106,
- BFLAT8 = 106,
- B8 = 107,
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement