Class MusicSpecs


  • public class MusicSpecs
    extends java.lang.Object
    A static class that contains musical specifications.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Ilge Akkaya
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (ilgea)
    • Constructor Summary

      Constructors 
      Constructor Description
      MusicSpecs()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List getChordPitches​(java.lang.String chord, boolean useScale)
      Get a list of notes contained by the chord.
      static java.util.HashMap getChordTones​(java.util.List<java.lang.String> chords)
      Get the chord tones contained by the given chords.
      static java.lang.String translateKeyToLetterNote​(double key, boolean addOctave)
      Translate a MIDI key to its equivalent letter note representation.
      static int translateLetterToKeyIndex​(java.lang.String keyLetter)
      Translate a letter note to MIDI key.
      static int translateNoteToKey​(java.lang.String note)
      Translate a letter note to MIDI key.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • TERMINATION_CHORD

        public static final java.lang.String TERMINATION_CHORD
        Symbol for the termination chord.
        See Also:
        Constant Field Values
      • TERMINATION_NOTE_SYMBOL

        public static final java.lang.String TERMINATION_NOTE_SYMBOL
        Symbol for the termination note.
        See Also:
        Constant Field Values
      • REST_SYMBOL

        public static final java.lang.String REST_SYMBOL
        Rest symbol.
        See Also:
        Constant Field Values
      • TERMINATION_NOTE_KEY

        public static final int TERMINATION_NOTE_KEY
        MIDI key for the termination note.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MusicSpecs

        public MusicSpecs()
    • Method Detail

      • getChordTones

        public static java.util.HashMap getChordTones​(java.util.List<java.lang.String> chords)
        Get the chord tones contained by the given chords.
        Parameters:
        chords - The list of chords
        Returns:
        a map of pitches contained by the specified list of chords
      • getChordPitches

        public static java.util.List getChordPitches​(java.lang.String chord,
                                                     boolean useScale)
        Get a list of notes contained by the chord.
        Parameters:
        chord - The chord name
        useScale - A boolean specifying whether scale notes should be included
        Returns:
        a List of notes
      • translateKeyToLetterNote

        public static java.lang.String translateKeyToLetterNote​(double key,
                                                                boolean addOctave)
        Translate a MIDI key to its equivalent letter note representation.
        Parameters:
        key - MIDI key index
        addOctave - boolean -- if true indicates that octave information should be output
        Returns:
        letter note representation of note
      • translateNoteToKey

        public static int translateNoteToKey​(java.lang.String note)
        Translate a letter note to MIDI key.
        Parameters:
        note - a letter note
        Returns:
        the MIDI key index
      • translateLetterToKeyIndex

        public static int translateLetterToKeyIndex​(java.lang.String keyLetter)
        Translate a letter note to MIDI key.
        Parameters:
        keyLetter - a letter note
        Returns:
        the MIDI key index in base 12