MCPcopy Create free account
hub / github.com/audacity/audacity / PitchIndex

Function PitchIndex

libraries/lib-math/PitchName.cpp:34–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34unsigned int PitchIndex(const double dMIDInote)
35{
36 // MIDI numbers can be negative. Round in the right direction.
37 double dRound = (dMIDInote < 0.0) ? -0.5 : 0.5;
38 int nPitchIndex = ((int)(dMIDInote + dRound) % 12);
39
40 // Because of the modulo, we know we're within 12 of positive, if dMIDInote is negative.
41 if (nPitchIndex < 0)
42 nPitchIndex += 12;
43
44 return nPitchIndex;
45}
46
47int PitchOctave(const double dMIDInote)
48{

Callers 3

PitchNameFunction · 0.85
DeduceFrequenciesMethod · 0.85
OnText_FromFrequencyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected