Interface SongFactory


public interface SongFactory
Manage the creation of Song and related components.

  • Method Details

    • getDefault

      static SongFactory getDefault()
    • loadFromFile

      Song loadFromFile(File f) throws SongCreationException
      Load a Song from a file.

      Song's getFile() will return f.
      Song's getName() will return f.getName().

      Parameters:
      f -
      Returns:
      Throws:
      SongCreationException
    • createEmptyChordLeadSheet

      ChordLeadSheet createEmptyChordLeadSheet(String sectionName, TimeSignature ts, int size, String initialChord)
      Create an empty chord leadsheet with the specified parameters.
      Parameters:
      sectionName -
      ts -
      size -
      initialChord - e.g. "C7". If null no initial chord is added.
      Returns:
    • createEmptySong

      Song createEmptySong(String songName)
      Create a 8-bar empty song with only the 4/4 initial Section named "A" and its corresponding SongPart.
      Parameters:
      songName -
      Returns:
    • createEmptySong

      Song createEmptySong(String songName, int nbBars, String initSectionName, TimeSignature ts, String initialChord)
      Create an empty song with the specified parameters.

      Parameters:
      songName - The name of the song
      nbBars -
      initSectionName - The name of the initial section
      ts - The time signature of the initial section
      initialChord - eg "Cm7". A string describing an initial chord to be put at the start of the song. If null no chord is inserted.
      Returns:
    • createRamdomChordLeadSheet

      ChordLeadSheet createRamdomChordLeadSheet(String sectionName, TimeSignature ts, int size)
      Create a ChordLeadSheet with random chord symbols and sections.
      Parameters:
      sectionName -
      ts -
      size -
      Returns:
    • createSampleChordLeadSheet

      ChordLeadSheet createSampleChordLeadSheet(String sectionName, int size)
      Create a ChordLeadSheet with a fixed set of sections and chord symbols in the first 12 bars.

      Parameters:
      sectionName -
      size - Must be >= 12
      Returns:
    • createSong

      Song createSong(String name, ChordLeadSheet cls) throws UnsupportedEditException
      Create a Song from the specified ChordLeadSheet.

      The SongStructure is created from the ChordLeadSheet.

      Parameters:
      name -
      cls -
      Returns:
      Throws:
      UnsupportedEditException - Can happen if too many timesignature changes resulting in not enough Midi channels for the various rhythms.
    • createSong

      Song createSong(String name, SongStructure sgs) throws UnsupportedEditException
      Create a Song from a SongStructure and its parent ChordLeadSheet.
      Parameters:
      name -
      sgs - sgs.getParentChordLeadSheet() must be non null
      Returns:
      Throws:
      UnsupportedEditException - Can happen if too many timesignature changes resulting in not enough Midi channels for the various rhythms.
    • createSong

      Song createSong(String name, SongStructure sgs, boolean disableSongInternalUpdates) throws UnsupportedEditException
      Create a Song from a SongStructure and its parent ChordLeadSheet.
      Parameters:
      name -
      sgs - sgs.getParentChordLeadSheet() must be non null
      disableSongInternalUpdates - If true the returned instance will have internal consistency updates disabled, e.g. changing a section in the ChordLeadSheet won't impact the SongStructure. For special purposes only, this can lead to inconsistent Song states..
      Returns:
      Throws:
      UnsupportedEditException - Can happen if too many timesignature changes resulting in not enough Midi channels for the various rhythms.
    • createSongStructure

      SongStructure createSongStructure(ChordLeadSheet cls) throws UnsupportedEditException
      Create a SongStructure with cls as parentChordLeadSheet.

      One SongPart is created for each cls section.

      Parameters:
      cls -
      Returns:
      Throws:
      UnsupportedEditException