mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-19 17:11:12 +02:00
Improvements in Change Pitch effect.
* from and to octave spin controls and cross-updating * new conversion utilities in PitchName.* * code simplification, new documentation * stop a few compiler warnings in FreqWindow.cpp on unused params
This commit is contained in:
@@ -1,56 +1,55 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
Audacity: A Digital Audio Editor
|
||||
Audacity(R) is copyright (c) 1999-2013 Audacity Team.
|
||||
License: GPL v2. See License.txt.
|
||||
|
||||
PitchName.h
|
||||
PitchName.h
|
||||
Vaughan Johnson, Dominic Mazzoni
|
||||
|
||||
Copyright 2005-9, Vaughan Johnson and Dominic Mazzoni.
|
||||
All rights reserved.
|
||||
******************************************************************//**
|
||||
|
||||
Utilities for converting from frequency to pitch
|
||||
and from pitch to absolute (e.g., C4 for middle C)
|
||||
or nominal (A through G#) pitch name.
|
||||
utilities for converting among frequency, MIDI note number,
|
||||
pitch index, pitch name
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_PITCHNAME__
|
||||
#define __AUDACITY_PITCHNAME__
|
||||
|
||||
#include <wx/defs.h>
|
||||
|
||||
// FreqToMIDInoteNumber takes a frequency in Hz (exponential scale relative to
|
||||
// FreqToMIDInote takes a frequency in Hz (exponential scale relative to
|
||||
// alphabetic pitch names) and returns a pitch ID number (linear
|
||||
// scale), such that A440 (A4) is 69, middle C (C4) is 60, etc.
|
||||
// Each register starts with C (e.g., for middle C and A440,
|
||||
// it's register 4).
|
||||
double FreqToMIDInoteNumber(double freq);
|
||||
// MIDI note number 0 is C-1 in Scientific pitch notation.
|
||||
double FreqToMIDInote(const double freq);
|
||||
|
||||
// PitchIndex returns the [0,11] index for a double pitchNum,
|
||||
// as per result from FreqToMIDInoteNumber, corresponding to modulo 12
|
||||
// of the integer part of (pitchNum + 0.5), so 0=C, 1=C#, etc.
|
||||
unsigned int PitchIndex(double pitchNum);
|
||||
// PitchIndex returns the [0,11] index for a double MIDI note number,
|
||||
// per result from FreqToMIDInote, corresponding to modulo 12
|
||||
// of the integer part of (dMIDInote + 0.5), so 0=C, 1=C#, etc.
|
||||
unsigned int PitchIndex(const double dMIDInote);
|
||||
|
||||
// PitchName takes pitchNum (as per result from
|
||||
// FreqToMIDInoteNumber) and returns a standard pitch/note name [C, C#, etc.).
|
||||
// PitchOctave returns the octave index for a double dMIDInote note number,
|
||||
// per result from FreqToMIDInote.
|
||||
// MIDI note number 0 is C-1 in Scientific pitch notation.
|
||||
int PitchOctave(const double dMIDInote);
|
||||
|
||||
// PitchName takes dMIDInote (per result from
|
||||
// FreqToMIDInote) and returns a standard pitch/note name [C, C#, etc.).
|
||||
// Sharps are the default, unless, bWantFlats is true.
|
||||
wxChar * PitchName(double pitchNum, bool bWantFlats = false);
|
||||
wxChar * PitchName(const double dMIDInote, const bool bWantFlats = false);
|
||||
|
||||
// PitchName_Absolute does the same thing as PitchName, but appends
|
||||
// the register number, e.g., instead of "C" it will return "C4"
|
||||
// if the pitchNum corresonds to middle C.
|
||||
// Sharps are the default, unless, bWantFlats is true.
|
||||
wxChar * PitchName_Absolute(double pitchNum, bool bWantFlats = false);
|
||||
// the octave number, e.g., instead of "C" it will return "C4"
|
||||
// if the dMIDInote corresonds to middle C, i.e., is 60.
|
||||
wxChar * PitchName_Absolute(const double dMIDInote, const bool bWantFlats = false);
|
||||
|
||||
double PitchToMIDInote(const unsigned int nPitchIndex, const int nPitchOctave);
|
||||
|
||||
double PitchToFreq(const unsigned int nPitchIndex, const int nPitchOctave);
|
||||
|
||||
#endif // __AUDACITY_PITCHNAME__
|
||||
|
||||
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
|
||||
// version control system. Please do not modify past this point.
|
||||
//
|
||||
// Local Variables:
|
||||
// c-basic-offset: 3
|
||||
// indent-tabs-mode: nil
|
||||
// End:
|
||||
//
|
||||
// vim: et sts=3 sw=3
|
||||
// arch-tag: 1cd2b819-63b6-4051-9991-37165f236037
|
||||
|
||||
|
Reference in New Issue
Block a user