Package org.jfugue.tools
Class GetPatternStats
- java.lang.Object
-
- org.jfugue.tools.GetPatternStats
-
public class GetPatternStats extends java.lang.Object
ProvidesPattern
and MIDI analysis of the following elements: General descriptors, Pitch descriptors, Duration descriptors, Silence descriptors (rests), Interval descriptors (half-steps), Inter Onset Interval (IOI), Harmonic Descriptors (Non-diatonics), Rhythm Descriptors (Syncopations), Normality Descriptors.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
GetPatternStats.Stats
-
Constructor Summary
Constructors Constructor Description GetPatternStats()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
comparePatterns(Pattern p1, Pattern p2)
Parses two patterns to find average difference of all statsGetPatternStats.Stats
getDurationStats()
GetsStats
object containing note duration N, Average (mean - min), SD, and Range.int[]
getGeneralStats()
Gets general statistics (Number of notes, number of rests, number of measures)GetPatternStats.Stats
getHarmonicStats()
GetsStats
object containing harmonics N, Average (mean - min), SD, and Range.GetPatternStats.Stats
getIntervalStats()
GetsStats
object containing pitch interval N, Average (mean - min), SD, and Range.GetPatternStats.Stats
getIOIStats()
GetsStats
object containing inter-onset-interval(IOI) N, Average (mean - min), SD, and Range.GetPatternStats.Stats
getPitchStats()
GetsStats
object containing pitch N, Average (mean - min), SD, and Range.GetPatternStats.Stats
getRestStats()
GetsStats
object containing rest duration N, Average (mean - min), SD, and Range.int
getRhythmStats()
Gets number of syncopations.void
parsePattern(java.io.File midiFile, java.lang.Boolean clear)
Parses MIDI file to calculate statistics for all descriptorsvoid
parsePattern(Pattern pattern, java.lang.Boolean clear)
Parses JFuguePattern
to calculate statistics for all descriptors.
java.lang.String
toString()
-
-
-
Method Detail
-
parsePattern
public void parsePattern(Pattern pattern, java.lang.Boolean clear)
Parses JFuguePattern
to calculate statistics for all descriptors.
- Parameters:
pattern
- The JFuge Pattern to be parsed.clear
- True to clear previous data, false to add to previous data
-
parsePattern
public void parsePattern(java.io.File midiFile, java.lang.Boolean clear) throws java.io.IOException, javax.sound.midi.InvalidMidiDataException
Parses MIDI file to calculate statistics for all descriptors- Parameters:
midiFile
- The MIDI file to be parsed.clear
- True to clear previous data, false to add to previous data- Throws:
java.io.IOException
javax.sound.midi.InvalidMidiDataException
-
comparePatterns
public double comparePatterns(Pattern p1, Pattern p2)
Parses two patterns to find average difference of all stats- Parameters:
Pattern
- Pattern 1 to be parsedPattern
- Pattern 2 to be parsed- Returns:
- The average difference between patterns
-
getGeneralStats
public int[] getGeneralStats()
Gets general statistics (Number of notes, number of rests, number of measures)- Returns:
- Array index 0: N of Notes; index 1: N of rests; index 2: N of measures
-
getPitchStats
public GetPatternStats.Stats getPitchStats()
GetsStats
object containing pitch N, Average (mean - min), SD, and Range.- Returns:
Stats
object for pitch
-
getDurationStats
public GetPatternStats.Stats getDurationStats()
GetsStats
object containing note duration N, Average (mean - min), SD, and Range.- Returns:
Stats
object for note duration
-
getRestStats
public GetPatternStats.Stats getRestStats()
GetsStats
object containing rest duration N, Average (mean - min), SD, and Range. Only silences greater than a 16th note are evaluated.- Returns:
Stats
object for rest duration
-
getIntervalStats
public GetPatternStats.Stats getIntervalStats()
GetsStats
object containing pitch interval N, Average (mean - min), SD, and Range. Intervals are in half-steps.- Returns:
Stats
object for pitch interval
-
getIOIStats
public GetPatternStats.Stats getIOIStats()
GetsStats
object containing inter-onset-interval(IOI) N, Average (mean - min), SD, and Range. Inter-onset-intervals are the number of MIDI pulses between the onset of non-rest notes.- Returns:
Stats
object for IOI
-
getRhythmStats
public int getRhythmStats()
Gets number of syncopations. Syncopations are calculated as any note that begins between beats and extends beyond the next beat. ie. C5H C5W C5H - the middle note is syncopated.- Returns:
Stats
object for rhythm
-
getHarmonicStats
public GetPatternStats.Stats getHarmonicStats()
GetsStats
object containing harmonics N, Average (mean - min), SD, and Range. Non-diatonic notes based off of the parsed key signature or default of Cmaj. Average is average of 0-4, as a degree of non-diatonic notes. ie. 0: ♭II, 1: ♭III (♮III for minor key), 2: ♭V, 3: ♭VI, 4: ♭VII. SD is also computed using degree of non-diatonic notes.- Returns:
Stats
object for harmonics
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-