pitch.d.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. export declare enum NoteEnum {
  2. C = 0,
  3. D = 2,
  4. E = 4,
  5. F = 5,
  6. G = 7,
  7. A = 9,
  8. B = 11,
  9. }
  10. export declare enum AccidentalEnum {
  11. DOUBLEFLAT = -2,
  12. FLAT = -1,
  13. NONE = 0,
  14. SHARP = 1,
  15. DOUBLESHARP = 2,
  16. }
  17. export declare class Pitch {
  18. static pitchEnumValues: NoteEnum[];
  19. private static halftoneFactor;
  20. private static octXmlDiff;
  21. private octave;
  22. private fundamentalNote;
  23. private accidental;
  24. private frequency;
  25. private halfTone;
  26. static getNoteEnumString(note: NoteEnum): string;
  27. /**
  28. * @param the input pitch
  29. * @param the number of halftones to transpose with
  30. * @returns ret[0] = the transposed fundamental.
  31. * ret[1] = the octave shift (not the new octave!)
  32. * @constructor
  33. */
  34. static CalculateTransposedHalfTone(pitch: Pitch, transpose: number): {
  35. value: number;
  36. overflow: number;
  37. };
  38. static WrapAroundCheck(value: number, limit: number): {
  39. value: number;
  40. overflow: number;
  41. };
  42. static calcFrequency(obj: Pitch | number): number;
  43. static calcFractionalKey(frequency: number): number;
  44. static fromFrequency(frequency: number): Pitch;
  45. static fromHalftone(halftone: number): Pitch;
  46. static ceiling(halftone: number): NoteEnum;
  47. static floor(halftone: number): NoteEnum;
  48. constructor(fundamentalNote: NoteEnum, octave: number, accidental: AccidentalEnum);
  49. Octave: number;
  50. FundamentalNote: NoteEnum;
  51. Accidental: AccidentalEnum;
  52. Frequency: number;
  53. static OctaveXmlDifference: number;
  54. getHalfTone(): number;
  55. getTransposedPitch(factor: number): Pitch;
  56. DoEnharmonicChange(): void;
  57. ToString(): string;
  58. OperatorEquals(p2: Pitch): boolean;
  59. OperatorNotEqual(p2: Pitch): boolean;
  60. private getHigherPitchByTransposeFactor(factor);
  61. private getLowerPitchByTransposeFactor(factor);
  62. private getNextFundamentalNote(fundamental);
  63. private getPreviousFundamentalNote(fundamental);
  64. }