All Packages Class Hierarchy This Package Previous Next Index
Class com.nosuch.midi.Alg
java.lang.Object
|
+----com.nosuch.midi.Alg
- public class Alg
- extends Object
MidiAlgorithm collects some algorithmic composition functions.
-
Alg()
-
-
addRootEvery(MidiPhrase, int)
-
-
arpeggio(MidiPhrase)
- Arpeggiate the input phrase.
-
cutTime(MidiPhrase, long)
- Return all notes after a specified time
-
cutTime(MidiPhrase, long, long)
- Return a specified time range of a phrase
-
echo(MidiPhrase, int, int, double)
-
-
everyNth(MidiPhrase, int)
- Return a phrase containing every Nth note of a phrase
-
everyRandomNth(MidiPhrase, int)
- Return a phrase containing a random selection of notes,
choosing approximately 1 of every n notes.
-
findRoot(MidiPhrase)
-
-
flip(MidiPhrase)
- Flip the input phrase.
-
gvolchange(int)
-
-
highest(MidiPhrase)
- Return the highest pitch in the specified phrase.
-
highestnt(MidiPhrase)
- Return the highest pitch in the specified phrase.
-
latest(MidiPhrase)
- Return the latest ending time of the notes in a phrase.
-
lowest(MidiPhrase)
- Return the lowest pitch in the specified phrase.
-
lowestnt(MidiPhrase)
- Return the lowest-pitched note in the specified phrase.
-
main(String[])
-
-
makeRootEvery(MidiPhrase, int)
- Figure out a root note every intrvl beats
-
merge(MidiPhrase, MidiPhrase)
-
-
merge(MidiPhrase, MidiPhrase, MidiPhrase)
-
-
merge(MidiPhrase, MidiPhrase, MidiPhrase, MidiPhrase)
-
-
mono(MidiPhrase, int)
- Returns a monophonic version of the specified phrase.
-
nextquant(long, long)
- This function quantizes the specified number using the specified
quantize value, and returns the result.
-
nonNotes(MidiPhrase)
- Return a phrase containing "non" notes (e.g.
-
numquant(long, long)
- Quantizes the specified number using a particular quantize value.
-
octaveFence(MidiPhrase, int, int)
- Try to put all notes within the limits of pitches p1,p2
This is accomplished by shifting notes in octave increments.
-
onBeat(MidiPhrase, long)
- Return a phrase containing notes that are on a particular beat.
-
onlyNotes(MidiPhrase)
- Return a phrase containing only "normal" notes in the input phrase.
-
progchange(int, int)
- Return a program-change message.
-
quantize(MidiPhrase, int)
- Quantize a phrase.
-
repeat(MidiPhrase, int)
- Repeat a phrase n times.
-
repeat(MidiPhrase, int, int)
-
-
scaTimes(MidiPhrase, double)
- Scale a phrase by multiplying the time and duration
each note by a specified factor.
-
split(MidiPhrase)
-
-
strnotes(String)
- Return a phrase of notes based on the letters in a String
-
stutter(MidiPhrase, int, int)
- For each section of phrase ph of width wid, repeat it num times
-
stutterrand(MidiPhrase)
- For each section (of random width, within a small range
of possible widths) of phrase ph, repeat it
-
sussect(long, int)
- Generate a phrase with controller messages that press the sustain
pedal on the specified channel (c) and let it up after the specified
amount of time (tm).
-
transpose(MidiPhrase, int)
- Transpos the pitch of the notes in a phrase by a given amount.
-
transposeSeqInPlace(MidiPhrase, MidiPhrase)
-
Alg
public Alg()
flip
public static MidiPhrase flip(MidiPhrase p)
- Flip the input phrase.
arpeggio
public static MidiPhrase arpeggio(MidiPhrase p)
- Arpeggiate the input phrase.
repeat
public static MidiPhrase repeat(MidiPhrase p,
int n)
- Repeat a phrase n times.
repeat
public static MidiPhrase repeat(MidiPhrase p,
int n,
int q)
echo
public static MidiPhrase echo(MidiPhrase ph,
int num,
int rtime,
double rfactor)
onlyNotes
public static MidiPhrase onlyNotes(MidiPhrase p)
- Return a phrase containing only "normal" notes in the input phrase.
nonNotes
public static MidiPhrase nonNotes(MidiPhrase p)
- Return a phrase containing "non" notes (e.g. MidiBytes)
in the input phrase.
lowest
public static int lowest(MidiPhrase p)
- Return the lowest pitch in the specified phrase.
lowestnt
public static MidiMsg lowestnt(MidiPhrase p)
- Return the lowest-pitched note in the specified phrase.
highest
public static int highest(MidiPhrase p)
- Return the highest pitch in the specified phrase.
highestnt
public static MidiMsg highestnt(MidiPhrase p)
- Return the highest pitch in the specified phrase.
findRoot
public static MidiMsg findRoot(MidiPhrase ph)
makeRootEvery
public static MidiPhrase makeRootEvery(MidiPhrase melody,
int intrvl)
- Figure out a root note every intrvl beats
addRootEvery
public static MidiPhrase addRootEvery(MidiPhrase mel,
int intrvl)
cutTime
public static MidiPhrase cutTime(MidiPhrase p,
long tm1,
long tm2)
- Return a specified time range of a phrase
cutTime
public static MidiPhrase cutTime(MidiPhrase p,
long tm1)
- Return all notes after a specified time
stutter
public static MidiPhrase stutter(MidiPhrase ph,
int wid,
int num)
- For each section of phrase ph of width wid, repeat it num times
merge
public static MidiPhrase merge(MidiPhrase p1,
MidiPhrase p2)
merge
public static MidiPhrase merge(MidiPhrase p1,
MidiPhrase p2,
MidiPhrase p3)
merge
public static MidiPhrase merge(MidiPhrase p1,
MidiPhrase p2,
MidiPhrase p3,
MidiPhrase p4)
stutterrand
public static MidiPhrase stutterrand(MidiPhrase ph)
- For each section (of random width, within a small range
of possible widths) of phrase ph, repeat it
transpose
public static MidiPhrase transpose(MidiPhrase p,
int delta)
- Transpos the pitch of the notes in a phrase by a given amount.
latest
public static long latest(MidiPhrase p)
- Return the latest ending time of the notes in a phrase.
transposeSeqInPlace
public static MidiPhrase transposeSeqInPlace(MidiPhrase p,
MidiPhrase seq)
numquant
public static long numquant(long v,
long q)
- Quantizes the specified number using a particular quantize value.
If you want to guarantee that the result is not less than the
original (which is typical when you are quantizing a time value
and want to guarantee that the result is some time in the future),
use nextquant().
nextquant
public static long nextquant(long t,
long q)
- This function quantizes the specified number using the specified
quantize value, and returns the result. The result is guaranteed to
be greater than the original number; if quantization would produce
a smaller number, it is increased by the quantize value. This is
typically used when you want to quantize a time value, and want to
guarantee that the result will refer to some time in the future,
not in the past.
quantize
public static MidiPhrase quantize(MidiPhrase ph,
int qnt)
- Quantize a phrase. Each note's starting time will be
quantized by the specified quant value. If a limit
is specified, notes that would need to be moved by an
amount larger than this limit will not be adjusted at all.
octaveFence
public static MidiPhrase octaveFence(MidiPhrase ph,
int p1,
int p2)
- Try to put all notes within the limits of pitches p1,p2
This is accomplished by shifting notes in octave increments.
scaTimes
public static MidiPhrase scaTimes(MidiPhrase ph,
double f)
- Scale a phrase by multiplying the time and duration
each note by a specified factor.
split
public static MidiPhrase[] split(MidiPhrase p)
mono
public static MidiPhrase mono(MidiPhrase ph,
int typ)
- Returns a monophonic version of the specified phrase.
If type==0, high notes are given priority (e.g. if two notes are
playing simultaneously, the higher note will be chosen).
If type==1, low notes are given priority. If type==2,
the priority is randomized.
everyNth
public static MidiPhrase everyNth(MidiPhrase p,
int n)
- Return a phrase containing every Nth note of a phrase
everyRandomNth
public static MidiPhrase everyRandomNth(MidiPhrase p,
int n)
- Return a phrase containing a random selection of notes,
choosing approximately 1 of every n notes.
onBeat
public static MidiPhrase onBeat(MidiPhrase p,
long d)
- Return a phrase containing notes that are on a particular beat.
progchange
public static MidiPhrase progchange(int patchnum,
int ch)
- Return a program-change message.
patchnum is 1-based, ch (channel) is 1-based
gvolchange
public static MidiPhrase gvolchange(int v)
sussect
public static MidiPhrase sussect(long tm,
int c)
- Generate a phrase with controller messages that press the sustain
pedal on the specified channel (c) and let it up after the specified
amount of time (tm).
strnotes
public static MidiPhrase strnotes(String s)
- Return a phrase of notes based on the letters in a String
main
public static void main(String args[])
All Packages Class Hierarchy This Package Previous Next Index