mutwo.parameters.pitches¶
Submodule for the parameter pitch.
‘Pitch’ is defined as any object that knows a frequency attribute.
The two major modern tuning systems Just intonation and Equal-divided-octave
are supported by the JustIntonationPitch and EqualDividedOctavePitch classes.
For using Western nomenclature (e.g. c, d, e, f, …) mutwo offers the
WesternPitch class (which inherits from EqualDividedOctavePitch).
For a straight frequency-based approach one may use DirectPitch.
If desired the default concert pitch can be adjusted after importing mutwo:
>>> from mutwo.parameters import pitches_constants
>>> pitches_constants.DEFAULT_CONCERT_PITCH = 443
All pitch objects with a concert pitch attribute that become initialised after overriding the default concert pitch value will by default use the new overridden default concert pitch value.
Classes:
|
A simple pitch class that gets directly initialised by its frequency. |
|
Pitch that is tuned to an Equal divided octave tuning system. |
|
Pitch that is defined by a frequency ratio and a reference pitch. |
|
Pitch with a traditional Western nomenclature. |
- class DirectPitch(frequency)[source]¶
Bases:
mutwo.parameters.abc.PitchA simple pitch class that gets directly initialised by its frequency.
- Parameters
frequency (Union[float, fractions.Fraction]) – The frequency of the
DirectPitchobject.
May be used when a converter class needs a pitch object, but there is no need or desire for a complex abstraction of the respective pitch (that classes like
JustIntonationPitchorWesternPitchoffer).Example:
>>> from mutwo.parameters import pitches >>> my_pitch = pitches.DirectPitch(440)
Methods:
cents_to_ratio(cents)Converts a cent value to its respective frequency ratio.
hertz_to_cents(frequency0, frequency1)Calculates the difference in cents between two frequencies.
hertz_to_midi_pitch_number(frequency)Converts a frequency in hertz to its respective midi pitch.
ratio_to_cents(ratio)Converts a frequency ratio to its respective cent value.
Attributes:
The frequency of the pitch.
The midi pitch number (from 0 to 127) of the pitch.
- static cents_to_ratio(cents)¶
Converts a cent value to its respective frequency ratio.
- Parameters
cents (Union[float, fractions.Fraction]) – Cents that shall be converted to a frequency ratio.
- Return type
quicktions.Fraction
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.cents_to_ratio(1200) Fraction(2, 1)
- static hertz_to_cents(frequency0, frequency1)¶
Calculates the difference in cents between two frequencies.
- Parameters
frequency0 (Union[float, fractions.Fraction]) – The first frequency in Hertz.
frequency1 (Union[float, fractions.Fraction]) – The second frequency in Hertz.
- Returns
The difference in cents between the first and the second frequency.
- Return type
float
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.hertz_to_cents(200, 400) 1200.0
- static hertz_to_midi_pitch_number(frequency)¶
Converts a frequency in hertz to its respective midi pitch.
- Parameters
frequency (Union[float, fractions.Fraction]) – The frequency that shall be translated to a midi pitch number.
- Returns
The midi pitch number (potentially a floating point number if the entered frequency isn’t on the grid of the equal divided octave tuning with a = 440 Hertz).
- Return type
float
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.hertz_to_midi_pitch_number(440) 69.0 >>> abc.Pitch.hertz_to_midi_pitch_number(440 * 3 / 2) 75.98044999134612
- static ratio_to_cents(ratio)¶
Converts a frequency ratio to its respective cent value.
- Parameters
ratio (quicktions.Fraction) – The frequency ratio which cent value shall be calculated.
- Return type
float
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.ratio_to_cents(fractions.Fraction(3, 2)) 701.9550008653874
- property frequency: float¶
The frequency of the pitch.
- property midi_pitch_number: float¶
The midi pitch number (from 0 to 127) of the pitch.
- class EqualDividedOctavePitch(n_pitch_classes_per_octave, pitch_class, octave, concert_pitch_pitch_class, concert_pitch_octave, concert_pitch=None)[source]¶
Bases:
mutwo.parameters.abc.PitchPitch that is tuned to an Equal divided octave tuning system.
- Parameters
n_pitch_classes_per_octave (int) – how many pitch classes in each octave occur (for instance 12 for a chromatic system, 24 for quartertones, etc.)
pitch_class (Union[float, fractions.Fraction]) – The pitch class of the new
EqualDividedOctavePitchobject.octave (int) – The octave of the new
EqualDividedOctavePitchobject (where 0 is the middle octave, 1 is one octave higher and -1 is one octave lower).concert_pitch_pitch_class (Union[float, fractions.Fraction]) – The pitch class of the reference pitch (for instance 9 in a chromatic 12 tone system where a should be the reference pitch).
concert_pitch_octave (int) – The octave of the reference pitch.
concert_pitch (Union[float, fractions.Fraction, mutwo.parameters.abc.Pitch]) – The frequency of the reference pitch (for instance 440 for a).
>>> from mutwo.parameters import pitches >>> # making a middle `a` >>> pitches.EqualDividedOctavePitch(12, 9, 4, 9, 4, 440)
Methods:
add(n_pitch_classes_difference)Transposes the
EqualDividedOctavePitchby n_pitch_classes_difference.cents_to_ratio(cents)Converts a cent value to its respective frequency ratio.
hertz_to_cents(frequency0, frequency1)Calculates the difference in cents between two frequencies.
hertz_to_midi_pitch_number(frequency)Converts a frequency in hertz to its respective midi pitch.
ratio_to_cents(ratio)Converts a frequency ratio to its respective cent value.
subtract(n_pitch_classes_difference)Transposes the
EqualDividedOctavePitchby n_pitch_classes_difference.Attributes:
The referential concert pitch for the respective pitch object.
The pitch class of the referential concert pitch.
The frequency in Hertz of the pitch.
The midi pitch number (from 0 to 127) of the pitch.
This property describes how many cents are between two adjacent pitches.
Defines in how many different pitch classes one octave get divided.
The pitch class of the pitch.
The factor with which to multiply a frequency to reach the next pitch.
- add(n_pitch_classes_difference)[source]¶
Transposes the
EqualDividedOctavePitchby n_pitch_classes_difference.- Parameters
n_pitch_classes_difference (Union[float, fractions.Fraction]) –
- Return type
Union[None, mutwo.parameters.pitches.EqualDividedOctavePitch]
- static cents_to_ratio(cents)¶
Converts a cent value to its respective frequency ratio.
- Parameters
cents (Union[float, fractions.Fraction]) – Cents that shall be converted to a frequency ratio.
- Return type
quicktions.Fraction
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.cents_to_ratio(1200) Fraction(2, 1)
- static hertz_to_cents(frequency0, frequency1)¶
Calculates the difference in cents between two frequencies.
- Parameters
frequency0 (Union[float, fractions.Fraction]) – The first frequency in Hertz.
frequency1 (Union[float, fractions.Fraction]) – The second frequency in Hertz.
- Returns
The difference in cents between the first and the second frequency.
- Return type
float
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.hertz_to_cents(200, 400) 1200.0
- static hertz_to_midi_pitch_number(frequency)¶
Converts a frequency in hertz to its respective midi pitch.
- Parameters
frequency (Union[float, fractions.Fraction]) – The frequency that shall be translated to a midi pitch number.
- Returns
The midi pitch number (potentially a floating point number if the entered frequency isn’t on the grid of the equal divided octave tuning with a = 440 Hertz).
- Return type
float
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.hertz_to_midi_pitch_number(440) 69.0 >>> abc.Pitch.hertz_to_midi_pitch_number(440 * 3 / 2) 75.98044999134612
- static ratio_to_cents(ratio)¶
Converts a frequency ratio to its respective cent value.
- Parameters
ratio (quicktions.Fraction) – The frequency ratio which cent value shall be calculated.
- Return type
float
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.ratio_to_cents(fractions.Fraction(3, 2)) 701.9550008653874
- subtract(n_pitch_classes_difference)[source]¶
Transposes the
EqualDividedOctavePitchby n_pitch_classes_difference.- Parameters
n_pitch_classes_difference (Union[float, fractions.Fraction]) –
- Return type
Union[None, mutwo.parameters.pitches.EqualDividedOctavePitch]
- property concert_pitch: mutwo.parameters.abc.Pitch¶
The referential concert pitch for the respective pitch object.
- property concert_pitch_pitch_class: Union[float, fractions.Fraction]¶
The pitch class of the referential concert pitch.
- property frequency: float¶
The frequency in Hertz of the pitch.
- property midi_pitch_number: float¶
The midi pitch number (from 0 to 127) of the pitch.
- property n_cents_per_step: float¶
This property describes how many cents are between two adjacent pitches.
- property n_pitch_classes_per_octave: int¶
Defines in how many different pitch classes one octave get divided.
- property pitch_class: Union[float, fractions.Fraction]¶
The pitch class of the pitch.
- property step_factor¶
The factor with which to multiply a frequency to reach the next pitch.
- class JustIntonationPitch(ratio_or_exponents='1/1', concert_pitch=None)[source]¶
Bases:
mutwo.parameters.abc.PitchPitch that is defined by a frequency ratio and a reference pitch.
- Parameters
ratio_or_exponents (Union[str, quicktions.Fraction, Iterable[int]]) – The frequency ratio of the
JustIntonationPitch. This can either be (A) a string that indicates the frequency ratio (for instance: “1/1”, “3/2”, “9/2”, etc.), or (B) afractions.Fraction(orquicktions.Fraction) object that indicates the frequency ratio (for instance:fractions.Fraction(3, 2),fractions.Fraction(7, 4)) or (C) an Iterable that is filled with integer that represents the exponents of the respective prime numbers of the decomposed frequency ratio. The prime numbers are rising and start with 2. Therefore the tuple(2, 0, -1)would return the frequency ratio4/5because(2 ** 2) * (3 ** 0) * (5 ** -1) = 4/5.concert_pitch (Union[float, fractions.Fraction, mutwo.parameters.abc.Pitch]) – The reference pitch of the tuning system (the pitch for a frequency ratio of 1/1). Can either be another
Pitchobject or any number to indicate a particular frequency in Hertz.
The resulting frequency is calculated by multiplying the frequency ratio with the respective reference pitch.
>>> from mutwo.parameters import pitches >>> # 3 different variations of initialising the same pitch >>> pitches.JustIntonationPitch('3/2') >>> import fractions >>> pitches.JustIntonationPitch(fractions.Fraction(3, 2)) >>> pitches.JustIntonationPitch((-1, 1)) >>> # using a different concert pitch >>> pitches.JustIntonationPitch('7/5', concert_pitch=432)
Methods:
add(other)cents_to_ratio(cents)Converts a cent value to its respective frequency ratio.
get_closest_pythagorean_pitch_name([reference])hertz_to_cents(frequency0, frequency1)Calculates the difference in cents between two frequencies.
hertz_to_midi_pitch_number(frequency)Converts a frequency in hertz to its respective midi pitch.
inverse([axis])move_to_closest_register(reference)normalize([prime])Normalize JustIntonationPitch.
ratio_to_cents(ratio)Converts a frequency ratio to its respective cent value.
register(octave)Register a virtual subclass of an ABC.
subtract(other)Attributes:
Return the denominator of a JustIntonationPitch - object.
Return factorised / decomposed version of itsef.
The frequency in Hertz of the pitch.
Return the nth - harmonic / subharmonic the pitch may represent.
Calculate the barlow-harmonicity of an interval.
Return the 'gradus suavitatis' of euler.
Calculate a simplified barlow-harmonicity of an interval.
Calculate Tenneys harmonic distance of an interval
Commas of JustIntonationPitch.
The midi pitch number (from 0 to 127) of the pitch.
Return the numerator of a JustIntonationPitch - object.
Return all occurring prime numbers of a JustIntonationPitch object.
Return ascending list of primes, until the highest contained Prime.
Return the JustIntonationPitch transformed to a Ratio.
Return the tonality (bool) of a JustIntonationPitch - object.
- static cents_to_ratio(cents)¶
Converts a cent value to its respective frequency ratio.
- Parameters
cents (Union[float, fractions.Fraction]) – Cents that shall be converted to a frequency ratio.
- Return type
quicktions.Fraction
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.cents_to_ratio(1200) Fraction(2, 1)
- get_closest_pythagorean_pitch_name(reference='a')[source]¶
- Parameters
reference (str) –
- Return type
str
- static hertz_to_cents(frequency0, frequency1)¶
Calculates the difference in cents between two frequencies.
- Parameters
frequency0 (Union[float, fractions.Fraction]) – The first frequency in Hertz.
frequency1 (Union[float, fractions.Fraction]) – The second frequency in Hertz.
- Returns
The difference in cents between the first and the second frequency.
- Return type
float
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.hertz_to_cents(200, 400) 1200.0
- static hertz_to_midi_pitch_number(frequency)¶
Converts a frequency in hertz to its respective midi pitch.
- Parameters
frequency (Union[float, fractions.Fraction]) – The frequency that shall be translated to a midi pitch number.
- Returns
The midi pitch number (potentially a floating point number if the entered frequency isn’t on the grid of the equal divided octave tuning with a = 440 Hertz).
- Return type
float
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.hertz_to_midi_pitch_number(440) 69.0 >>> abc.Pitch.hertz_to_midi_pitch_number(440 * 3 / 2) 75.98044999134612
- inverse(axis=None)[source]¶
- Parameters
axis (Optional[mutwo.parameters.pitches.JustIntonationPitch]) –
- Return type
- move_to_closest_register(reference)[source]¶
- Parameters
reference (mutwo.parameters.pitches.JustIntonationPitch) –
- Return type
- static ratio_to_cents(ratio)¶
Converts a frequency ratio to its respective cent value.
- Parameters
ratio (quicktions.Fraction) – The frequency ratio which cent value shall be calculated.
- Return type
float
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.ratio_to_cents(fractions.Fraction(3, 2)) 701.9550008653874
- register(octave)[source]¶
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
- Parameters
octave (int) –
- Return type
- property blueprint: Tuple[Tuple[int, ...], ...]¶
- property cents: float¶
- property closest_pythagorean_interval: mutwo.parameters.pitches.JustIntonationPitch¶
- property concert_pitch: mutwo.parameters.abc.Pitch¶
- property denominator: int¶
Return the denominator of a JustIntonationPitch - object.
>>> jip0 = JustIntonationPitch((0, 1,)) >>> jip0.denominator 1
- property exponents: tuple¶
- property factorised: tuple¶
Return factorised / decomposed version of itsef.
>>> jip0 = JustIntonationPitch((0, 0, 1,)) >>> jip0.factorised (2, 2, 5) >>> jip1 = JustIntonationPitch("7/6") >>> jip1.factorised (2, 3, 7)
- property factorised_numerator_and_denominator: tuple¶
- property frequency: float¶
The frequency in Hertz of the pitch.
- property harmonic: int¶
Return the nth - harmonic / subharmonic the pitch may represent.
May be positive for harmonic and negative for subharmonic pitches. If the return - value is 0, the interval may occur neither between the first harmonic and any other pitch of the harmonic scale nor between the first subharmonic in the and any other pitch of the subharmonic scale.
>>> jip0 = JustIntonationPitch((0, 1)) >>> jip0.ratio fractions.Fraction(3, 2) >>> jip0.harmonic 3 >>> jip1 = JustIntonationPitch((-1,), 2) >>> jip1.harmonic -3
- property harmonicity_barlow: float¶
Calculate the barlow-harmonicity of an interval.
This implementation follows Clarence Barlows definition, given in ‘The Ratio Book’ (1992).
A higher number means a more harmonic interval / a less complex harmony.
barlow(1/1) is definied as infinite.
>>> jip0 = JustIntonationPitch((0, 1,)) >>> jip1 = JustIntonationPitch() >>> jip2 = JustIntonationPitch((0, 0, 1,)) >>> jip3 = JustIntonationPitch((0, 0, -1,)) >>> jip0.harmonicity_barlow 0.27272727272727276 >>> jip1.harmonicity_barlow # 1/1 is infinite harmonic inf >>> jip2.harmonicity_barlow 0.11904761904761904 >>> jip3.harmonicity_barlow -0.10638297872340426
- property harmonicity_euler: int¶
Return the ‘gradus suavitatis’ of euler.
A higher number means a less consonant interval / a more complicated harmony. euler(1/1) is definied as 1. >>> jip0 = JustIntonationPitch((0, 1,)) >>> jip1 = JustIntonationPitch() >>> jip2 = JustIntonationPitch((0, 0, 1,)) >>> jip3 = JustIntonationPitch((0, 0, -1,)) >>> jip0.harmonicity_euler 4 >>> jip1.harmonicity_euler 1 >>> jip2.harmonicity_euler 7 >>> jip3.harmonicity_euler 8
- property harmonicity_simplified_barlow: float¶
Calculate a simplified barlow-harmonicity of an interval.
This implementation follows Clarence Barlows definition, given in ‘The Ratio Book’ (1992), with the difference that only positive numbers are returned and that (1/1) is defined as 1 instead of infinite.
>>> jip0 = JustIntonationPitch((0, 1,)) >>> jip1 = JustIntonationPitch() >>> jip2 = JustIntonationPitch((0, 0, 1,)) >>> jip3 = JustIntonationPitch((0, 0, -1,)) >>> jip0.harmonicity_simplified_barlow 0.27272727272727276 >>> jip1.harmonicity_simplified_barlow # 1/1 is not infinite but 1 1 >>> jip2.harmonicity_simplified_barlow 0.11904761904761904 >>> jip3.harmonicity_simplified_barlow # positive return value 0.10638297872340426
- property harmonicity_tenney: float¶
Calculate Tenneys harmonic distance of an interval
A higher number means a more consonant interval / a less complicated harmony.
tenney(1/1) is definied as 0.
>>> jip0 = JustIntonationPitch((0, 1,)) >>> jip1 = JustIntonationPitch() >>> jip2 = JustIntonationPitch((0, 0, 1,)) >>> jip3 = JustIntonationPitch((0, 0, -1,)) >>> jip0.harmonicity_tenney 2.584962500721156 >>> jip1.harmonicity_tenney 0.0 >>> jip2.harmonicity_tenney 4.321928094887363 >>> jip3.harmonicity_tenney -0.10638297872340426
- property harmonicity_vogel: int¶
- property harmonicity_wilson: int¶
- property helmholtz_ellis_just_intonation_notation_commas: mutwo.parameters.commas.CommaCompound¶
Commas of JustIntonationPitch.
- property level: int¶
- property midi_pitch_number: float¶
The midi pitch number (from 0 to 127) of the pitch.
- property numerator: int¶
Return the numerator of a JustIntonationPitch - object.
>>> jip0 = JustIntonationPitch((0, -1,)) >>> jip0.numerator 1
- property occupied_primes: tuple¶
Return all occurring prime numbers of a JustIntonationPitch object.
- property octave: int¶
- property primes: tuple¶
Return ascending list of primes, until the highest contained Prime.
>>> jip0 = JustIntonationPitch((0, 1, 2)) >>> jip0.exponents (2, 3, 5) >>> jip1 = JustIntonationPitch((0, -1, 0, 0, 1), 1) >>> jip1.exponents (2, 3, 5, 7, 11)
- property primes_for_numerator_and_denominator: tuple¶
- property ratio: quicktions.Fraction¶
Return the JustIntonationPitch transformed to a Ratio.
>>> jip0 = JustIntonationPitch((0, 0, 1,)) >>> jip0.ratio fractions.Fraction(5, 4) >>> jip0 = JustIntonationPitch("3/2") >>> jip0.ratio fractions.Fraction(3, 2)
- property tonality: bool¶
Return the tonality (bool) of a JustIntonationPitch - object.
The tonality of a JustIntonationPitch - may be True (otonality) if the exponent of the highest occurring prime number is a positive number and False if the exponent is a negative number (utonality).
>>> jip0 = JustIntonationPitch((-2. 1)) >>> jip0.tonality True >>> jip1 = JustIntonationPitch((-2, -1)) >>> jip1.tonality False >>> jip2 = JustIntonationPitch([]) >>> jip2.tonality True
- class WesternPitch(pitch_class_or_pitch_class_name=0, octave=4, concert_pitch_pitch_class=None, concert_pitch_octave=None, concert_pitch=None)[source]¶
Bases:
mutwo.parameters.pitches.EqualDividedOctavePitchPitch with a traditional Western nomenclature.
- Parameters
pitch_class_or_pitch_class_name (Union[float, fractions.Fraction, str]) – Name or number of the pitch class of the new
WesternPitchobject. The nomenclature is English (c, d, e, f, g, a, b). It uses an equal divided octave system in 12 chromatic steps. Accidentals are indicated by (s = sharp) and (f = flat). Further microtonal accidentals are supported (seemutwo.parameters.pitches_constants.ACCIDENTAL_NAME_TO_PITCH_CLASS_MODIFICATIONfor all supported accidentals).octave (int) – The octave of the new
WesternPitchobject. Indications for the specific octave follow the MIDI Standard where 4 is defined as one line.concert_pitch_pitch_class (Union[float, fractions.Fraction]) –
concert_pitch_octave (int) –
concert_pitch (Union[float, fractions.Fraction, mutwo.parameters.abc.Pitch]) –
>>> from mutwo.parameters import pitches >>> pitches.WesternPitch('cs', 4) # c-sharp 4 >>> pitches.WesternPitch('aqs', 2) # a-quarter-sharp 2
Methods:
add(n_pitch_classes_difference)Transposes the
EqualDividedOctavePitchby n_pitch_classes_difference.cents_to_ratio(cents)Converts a cent value to its respective frequency ratio.
hertz_to_cents(frequency0, frequency1)Calculates the difference in cents between two frequencies.
hertz_to_midi_pitch_number(frequency)Converts a frequency in hertz to its respective midi pitch.
ratio_to_cents(ratio)Converts a frequency ratio to its respective cent value.
subtract(n_pitch_classes_difference)Transposes the
EqualDividedOctavePitchby n_pitch_classes_difference.Attributes:
The referential concert pitch for the respective pitch object.
The pitch class of the referential concert pitch.
The frequency in Hertz of the pitch.
The midi pitch number (from 0 to 127) of the pitch.
This property describes how many cents are between two adjacent pitches.
Defines in how many different pitch classes one octave get divided.
The name of the pitch in Western nomenclature.
The pitch class of the pitch.
The name of the pitch class in Western nomenclature.
The factor with which to multiply a frequency to reach the next pitch.
- add(n_pitch_classes_difference)¶
Transposes the
EqualDividedOctavePitchby n_pitch_classes_difference.- Parameters
n_pitch_classes_difference (Union[float, fractions.Fraction]) –
- Return type
Union[None, mutwo.parameters.pitches.EqualDividedOctavePitch]
- static cents_to_ratio(cents)¶
Converts a cent value to its respective frequency ratio.
- Parameters
cents (Union[float, fractions.Fraction]) – Cents that shall be converted to a frequency ratio.
- Return type
quicktions.Fraction
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.cents_to_ratio(1200) Fraction(2, 1)
- static hertz_to_cents(frequency0, frequency1)¶
Calculates the difference in cents between two frequencies.
- Parameters
frequency0 (Union[float, fractions.Fraction]) – The first frequency in Hertz.
frequency1 (Union[float, fractions.Fraction]) – The second frequency in Hertz.
- Returns
The difference in cents between the first and the second frequency.
- Return type
float
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.hertz_to_cents(200, 400) 1200.0
- static hertz_to_midi_pitch_number(frequency)¶
Converts a frequency in hertz to its respective midi pitch.
- Parameters
frequency (Union[float, fractions.Fraction]) – The frequency that shall be translated to a midi pitch number.
- Returns
The midi pitch number (potentially a floating point number if the entered frequency isn’t on the grid of the equal divided octave tuning with a = 440 Hertz).
- Return type
float
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.hertz_to_midi_pitch_number(440) 69.0 >>> abc.Pitch.hertz_to_midi_pitch_number(440 * 3 / 2) 75.98044999134612
- static ratio_to_cents(ratio)¶
Converts a frequency ratio to its respective cent value.
- Parameters
ratio (quicktions.Fraction) – The frequency ratio which cent value shall be calculated.
- Return type
float
Example:
>>> from mutwo.parameters import abc >>> abc.Pitch.ratio_to_cents(fractions.Fraction(3, 2)) 701.9550008653874
- subtract(n_pitch_classes_difference)¶
Transposes the
EqualDividedOctavePitchby n_pitch_classes_difference.- Parameters
n_pitch_classes_difference (Union[float, fractions.Fraction]) –
- Return type
Union[None, mutwo.parameters.pitches.EqualDividedOctavePitch]
- property concert_pitch: mutwo.parameters.abc.Pitch¶
The referential concert pitch for the respective pitch object.
- property concert_pitch_pitch_class: Union[float, fractions.Fraction]¶
The pitch class of the referential concert pitch.
- property frequency: float¶
The frequency in Hertz of the pitch.
- property midi_pitch_number: float¶
The midi pitch number (from 0 to 127) of the pitch.
- property n_cents_per_step: float¶
This property describes how many cents are between two adjacent pitches.
- property n_pitch_classes_per_octave: int¶
Defines in how many different pitch classes one octave get divided.
- property name: str¶
The name of the pitch in Western nomenclature.
- property pitch_class: Union[float, fractions.Fraction]¶
The pitch class of the pitch.
- property pitch_class_name: str¶
The name of the pitch class in Western nomenclature.
- Mutwo uses the English nomenclature for pitch class names:
(c, d, e, f, g, a, b)
- property step_factor¶
The factor with which to multiply a frequency to reach the next pitch.