public abstract class Pitch
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int[] |
circleOfFifths
The circle of fifths relative to root.
|
static int[] |
dorian
The dorian scale relative to root.
|
static float |
LOG2
The constant log(2) = 0.6931472.
|
static int[] |
major
The major scale relative to root.
|
static int[] |
minor
The minor scale relative to root.
|
static int[] |
pentatonic
Pentatonic.
|
static java.lang.String[] |
pitchNames
Pitch names for scale starting at C.
|
Constructor and Description |
---|
Pitch() |
Modifier and Type | Method and Description |
---|---|
static float |
forceFrequencyToScale(float freq,
int[] scale) |
static int |
forceToScale(int pitch,
int[] scale)
Takes a pitch and returns that pitch adjusted downwards to the nearest pitch in the given scale.
|
static int |
forceToScale(int pitch,
int[] scale,
int notesPerOctave)
Takes a pitch and returns that pitch adjusted downwards to the nearest pitch in the given scale.
|
static float |
ftom(float frequency)
Convert frequency to MIDI note number.
|
static float |
mtof(float midi)
Convert MIDI note number to frequency.
|
public static final float LOG2
public static final java.lang.String[] pitchNames
public static final int[] dorian
public static final int[] major
public static final int[] minor
public static final int[] circleOfFifths
public static final int[] pentatonic
public static final float ftom(float frequency)
frequency
- the required frequency.public static final float mtof(float midi)
midi
- the required MIDI note number.public static final int forceToScale(int pitch, int[] scale, int notesPerOctave)
pitch
- the pitch to modify.scale
- the scale to use.notesPerOctave
- how many notes in your octave (12 if you're not sure).public static final int forceToScale(int pitch, int[] scale)
pitch
- the pitch to modify.scale
- the scale to use.public static final float forceFrequencyToScale(float freq, int[] scale)