Class SimpleChordSequence
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<ChordSequence>
,Iterable<CLI_ChordSymbol>
,Collection<CLI_ChordSymbol>
,NavigableSet<CLI_ChordSymbol>
,Set<CLI_ChordSymbol>
,SortedSet<CLI_ChordSymbol>
User is responsible to ensure CLI_ChordSymbols are added in the right position order, in the startBar/nbBars range, and are compatible with the TimeSignature.
- See Also:
-
Constructor Summary
ConstructorDescriptionSimpleChordSequence
(ChordSequence cSeq, TimeSignature ts) Construct a SimpleChordSequence from a standard ChordSequence.SimpleChordSequence
(IntRange barRange, TimeSignature ts) -
Method Summary
Modifier and TypeMethodDescriptionboolean
getBeatRange
(float startBarPosInBeats) The beat range of this SimpleChordSequence provided it starts at startBarPosInBeats.float
getChordDuration
(CLI_ChordSymbol cliCs) Return the specified chord duration in natural beats.int
Compute an index which indicates how similar are the chord types of cSeq and this object.A String which combines the relative root ascending intervals and chord durations, to allow a quick comparison between 2 SimpleChordSequences.static String
getRootProfileOneChordPerBar
(TimeSignature ts, int... rootAscendingIntervals) Generate a root profile for a chord progression with 1 chord per bar and the specified root ascending intervals.int
hashCode()
subSequence
(IntRange subRange, boolean addInitChordSymbol) Overridden to return a SimpleChordSequence.float
toPositionInBeats
(Position pos, float startBarPosInBeats) Convert the specified position into an absolute position in natural beats.Methods inherited from class org.jjazz.rhythmmusicgeneration.api.ChordSequence
clone, compareTo, getBarRange, getChordSymbol, getFirstAfter, getLastBefore, getRootAscIntervals, hasChordAtBeginning, toString
Methods inherited from class java.util.TreeSet
add, addAll, ceiling, clear, comparator, contains, descendingIterator, descendingSet, first, floor, headSet, headSet, higher, isEmpty, iterator, last, lower, pollFirst, pollLast, remove, size, spliterator, subSet, subSet, tailSet, tailSet
Methods inherited from class java.util.AbstractSet
removeAll
Methods inherited from class java.util.AbstractCollection
containsAll, retainAll, toArray, toArray
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Constructor Details
-
SimpleChordSequence
-
SimpleChordSequence
Construct a SimpleChordSequence from a standard ChordSequence.- Parameters:
cSeq
- All ChordSymbols are checked to be compatible with the specified TimeSignature.ts
-
-
-
Method Details
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<CLI_ChordSymbol>
- Specified by:
hashCode
in interfaceSet<CLI_ChordSymbol>
- Overrides:
hashCode
in classChordSequence
-
equals
- Specified by:
equals
in interfaceCollection<CLI_ChordSymbol>
- Specified by:
equals
in interfaceSet<CLI_ChordSymbol>
- Overrides:
equals
in classChordSequence
-
getTimeSignature
-
getBeatRange
The beat range of this SimpleChordSequence provided it starts at startBarPosInBeats.- Parameters:
startBarPosInBeats
-- Returns:
-
getChordDuration
Return the specified chord duration in natural beats.This is the duration until next chord or the end of the chordsequence.
- Parameters:
cliCs
-- Returns:
-
toPositionInBeats
Convert the specified position into an absolute position in natural beats.- Parameters:
pos
-startBarPosInBeats
- The start position of this chord sequence.- Returns:
- If pos is beyond the end of this ChordSequence, then returned value will also be beyond this ChordSequence.
-
subSequence
Overridden to return a SimpleChordSequence.- Overrides:
subSequence
in classChordSequence
- Parameters:
subRange
-addInitChordSymbol
-- Returns:
-
getRootProfile
A String which combines the relative root ascending intervals and chord durations, to allow a quick comparison between 2 SimpleChordSequences.If 2 root profiles of 2 SimpleChordSequences are equal, it means that the 2 ChordSequences have the same size, same number of ChordSymbols at the same position, and that the root relative root ascending intervals are equals, like for e.g. |Dm|G7|C7M|%| and |E7|Am|Dm|%|.
Example: |Dm|G7|Ab7M|%| will produce "s4n3f0:a4i5:a4i1"
"s4" = size is 4 bars
"n3" = there is 3 chord symbols
"f0" = first chord symbol position is on beat 0 of the chord sequence
"a4i5" means advance 4 beats to next chord with a root ascending relative interval of 5 semi-tons.
Example: if chord sequence is empty, return a string like "s4n0".
Example: if chord sequence has only 1 chord symbol, return a string like "s4n1f0".
- Returns:
- A String like "s4n3f0:a4i5:a4i1"
- See Also:
-
getRootProfileOneChordPerBar
Generate a root profile for a chord progression with 1 chord per bar and the specified root ascending intervals.Example: if rootAscendingIntervals=[8;4] and ts is 4/4, return "s3n3f0:a4i8:a4i4" (3 chord symbols, one per bar).
- Parameters:
ts
- The TimeSignature to userootAscendingIntervals
- Number of values is (number of chords - 1). Can't be empty.- Returns:
-
getChordTypeSimilarityIndex
Compute an index which indicates how similar are the chord types of cSeq and this object.- Parameters:
cSeq
- Must have the same number of chord symbols than this Simple ChordSequence.- Returns:
- The sum of ChordType.getSimilarityIndex() run on each chord.
- See Also:
-