Audacity 3.2.0
PitchName.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4 Audacity(R) is copyright (c) 1999-2013 Audacity Team.
5 License: GPL v2 or later. See License.txt.
6
7 PitchName.h
8 Vaughan Johnson, Dominic Mazzoni
9
10******************************************************************//*******************************************************************/
16
17
18#ifndef __AUDACITY_PITCHNAME__
19#define __AUDACITY_PITCHNAME__
20
22
23// FreqToMIDInote takes a frequency in Hz (exponential scale relative to
24// alphabetic pitch names) and returns a pitch ID number (linear
25// scale), such that A440 (A4) is 69, middle C (C4) is 60, etc.
26// Each register starts with C (e.g., for middle C and A440,
27// it's register 4).
28// MIDI note number 0 is C-1 in Scientific pitch notation.
29UTILITY_API double FreqToMIDInote(const double freq);
30
31UTILITY_API double MIDInoteToFreq(const double dMIDInote);
32
33// PitchIndex returns the [0,11] index for a double MIDI note number,
34// per result from FreqToMIDInote, corresponding to modulo 12
35// of the integer part of (dMIDInote + 0.5), so 0=C, 1=C#, etc.
36UTILITY_API unsigned int PitchIndex(const double dMIDInote);
37
38// PitchOctave returns the octave index for a double dMIDInote note number,
39// per result from FreqToMIDInote.
40// MIDI note number 0 is C-1 in Scientific pitch notation.
41UTILITY_API int PitchOctave(const double dMIDInote);
42
44
45// PitchName takes dMIDInote (per result from
46// FreqToMIDInote) and returns a standard pitch/note name [C, C#, etc.).
48 const double dMIDInote,
50
51// PitchName_Absolute does the same thing as PitchName, but appends
52// the octave number, e.g., instead of "C" it will return "C4"
53// if the dMIDInote corresponds to middle C, i.e., is 60.
55 const double dMIDInote,
57
58UTILITY_API
59double PitchToMIDInote(const unsigned int nPitchIndex, const int nPitchOctave);
60
61UTILITY_API
62double PitchToFreq(const unsigned int nPitchIndex, const int nPitchOctave);
63
64#endif // __AUDACITY_PITCHNAME__
PitchNameChoice
Definition: PitchName.h:43
UTILITY_API double FreqToMIDInote(const double freq)
Definition: PitchName.cpp:23
UTILITY_API double MIDInoteToFreq(const double dMIDInote)
Definition: PitchName.cpp:29
UTILITY_API double PitchToMIDInote(const unsigned int nPitchIndex, const int nPitchOctave)
Definition: PitchName.cpp:155
UTILITY_API TranslatableString PitchName(const double dMIDInote, const PitchNameChoice choice=PitchNameChoice::Sharps)
Definition: PitchName.cpp:54
UTILITY_API double PitchToFreq(const unsigned int nPitchIndex, const int nPitchOctave)
Definition: PitchName.cpp:160
UTILITY_API TranslatableString PitchName_Absolute(const double dMIDInote, const PitchNameChoice choice=PitchNameChoice::Sharps)
Definition: PitchName.cpp:148
UTILITY_API unsigned int PitchIndex(const double dMIDInote)
Definition: PitchName.cpp:34
UTILITY_API int PitchOctave(const double dMIDInote)
Definition: PitchName.cpp:47
Holds a msgid for the translation catalog; may also bind format arguments.