Class BeatRoot

  • java.lang.Object
    • at.ofai.music.beatroot.BeatRoot


  • public class BeatRoot
    extends java.lang.Object
    The main class of the BeatRoot application. Processes the command line arguments (see processArgs()) and creates the three main objects:
    • gui - the graphical user interface object, which displays the audio and beat data and processes mouse and key events;
    • audioPlayer - the object which deals with audio output, playing the audio data with or without percussion sounds marking the beats;
    • audioProcessor - processes audio to find onsets, and calls the tempo induction and beat tracking methods
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      protected java.lang.String argsFile
      Input file for batch processing where each line contains a list of arguments for a BeatRoot run
      protected java.lang.String audioIn
      File name of audio input file
      protected AudioPlayer audioPlayer
      The object that deals with audio output
      protected AudioProcessor audioProcessor
      The object that deals with processing the audio data
      protected boolean batchMode
      Flag indicating that no GUI input is expected, i.e.
      protected java.lang.String beatsFile
      Input file name for annotated beat times (for evaluating BeatRoot)
      protected java.lang.String beatsIn
      Input file name of beat times in TMF format (instead of automatic beat tracking)
      protected java.lang.String featureFile
      Input file name for (onset) feature file, instead of audio input, for ICASSP'07 paper
      protected Chooser fileChooser
      The dialog window for selecting files for opening and saving data
      protected GUI gui
      The graphical user interface (frame) object
      protected static boolean ignoreWarnings
      Flag indicating whether warning messages should be ignored or displayed
      protected boolean onsetOnly
      Flag to load/save onsets
      protected boolean playWithBeats
      Flag indicating whether audio with beats should be played after processing is complete
      protected java.io.BufferedReader reader
      For reading argsFile
      protected boolean silentFlag
      Flag for suppressing messages to standard output
      protected java.lang.String textOutputFile
      Output file name for saving the beat times in text format, one to a line
      protected int useAnnotation
      For beat tracking with the first n notes given, this is the value of n.
    • Constructor Summary

      Constructors 
      Constructor and Description
      BeatRoot(java.lang.String[] args)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static void error(java.lang.String message)
      Print an error message and opens an exit dialog.
      protected java.lang.String[] getArgs()
      Reads a line from the arguments file argsFile, and converts it into an array of Strings, allowing for quoted strings.
      static void main(java.lang.String[] args)
      Entry point for BeatRoot application.
      void processArgs(java.lang.String[] args)
      Process command line arguments.
      static void quit()
      Open an exit dialog.
      static java.lang.String[] stringToArgs(java.lang.String s) 
      static void warning(java.lang.String message)
      Print a warning message.
      • Methods inherited from class java.lang.Object

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

      • argsFile

        protected java.lang.String argsFile
        Input file for batch processing where each line contains a list of arguments for a BeatRoot run
      • audioIn

        protected java.lang.String audioIn
        File name of audio input file
      • audioPlayer

        protected AudioPlayer audioPlayer
        The object that deals with audio output
      • audioProcessor

        protected AudioProcessor audioProcessor
        The object that deals with processing the audio data
      • batchMode

        protected boolean batchMode
        Flag indicating that no GUI input is expected, i.e. that the program exits after processing the command line
      • beatsFile

        protected java.lang.String beatsFile
        Input file name for annotated beat times (for evaluating BeatRoot)
      • beatsIn

        protected java.lang.String beatsIn
        Input file name of beat times in TMF format (instead of automatic beat tracking)
      • featureFile

        protected java.lang.String featureFile
        Input file name for (onset) feature file, instead of audio input, for ICASSP'07 paper
      • fileChooser

        protected Chooser fileChooser
        The dialog window for selecting files for opening and saving data
      • gui

        protected GUI gui
        The graphical user interface (frame) object
      • ignoreWarnings

        protected static boolean ignoreWarnings
        Flag indicating whether warning messages should be ignored or displayed
      • onsetOnly

        protected boolean onsetOnly
        Flag to load/save onsets
      • playWithBeats

        protected boolean playWithBeats
        Flag indicating whether audio with beats should be played after processing is complete
      • reader

        protected java.io.BufferedReader reader
        For reading argsFile
      • silentFlag

        protected boolean silentFlag
        Flag for suppressing messages to standard output
      • textOutputFile

        protected java.lang.String textOutputFile
        Output file name for saving the beat times in text format, one to a line
      • useAnnotation

        protected int useAnnotation
        For beat tracking with the first n notes given, this is the value of n. (e.g. n==1 determines the initial phase only; n==2 determines the initial phase and tempo)
    • Constructor Detail

      • BeatRoot

        public BeatRoot(java.lang.String[] args)
        Constructor. Initialises the BeatRoot application, including the GUI, and processes any command line arguments.
        Parameters:
        args - Optional command line arguments.
        See Also:
        processArgs(String[])
    • Method Detail

      • processArgs

        public void processArgs(java.lang.String[] args)
        Process command line arguments. Arguments are: [option]* [audioFile], where audioFile is the file name of the audio input file containing WAV format data. The option arguments can be any of the following (in any order):
      • -m argsFile File name of text file containing lines of arguments for batch processing
      • -a beatFile File name of text file containing annotated beat times for evaluation
      • -i beatFile File name of TMF file containing beat times for editing
      • -b Process in batch mode (save results and exit immediately after processing)
      • -f featureFile Feature file on which to perform beat tracking (for ICASSP'07 paper)
      • -h highThreshold Spectrogram energy threshold corresponding to maximum value in colour map
      • -l lowThreshold Spectrogram energy threshold corresponding to minimum value in colour map
      • -o outputFile Save output to this file (implies -b)
      • -O Output the times of onsets, not beats, and exit (use -o flag to specify the output file; implies batch mode)
      • -p Play audio with beats as soon as processing is completed
      • -q Suppress output of warnings (TODO)
      • -s audioScaleFactor Constant for scaling amplitude envelope display
      • -t hopTime spacing of audio frames (in seconds, default 0.01)
      • -T frameTime size of FFT (in seconds, default 0.01161)
      • -w live input (not used)
      • -c cursor is always at centre; data scrolls past it
      • -e allowedError allowed error in beat position for evaluation
      • -E allowedRelativeError allowed relative error (0-1) in beat position for evaluation
  • getArgs

    protected java.lang.String[] getArgs()
    Reads a line from the arguments file argsFile, and converts it into an array of Strings, allowing for quoted strings.
    Returns:
    The next line of arguments as a String[]
  • stringToArgs

    public static java.lang.String[] stringToArgs(java.lang.String s)
  • quit

    public static void quit()
    Open an exit dialog. Protects against inadvertant presses of the exit button. Could be extended to save settings and data automatically.
  • warning

    public static void warning(java.lang.String message)
    Print a warning message. Could be extended to save warning messages to a log file.
    Parameters:
    message - The warning message
  • error

    public static void error(java.lang.String message)
    Print an error message and opens an exit dialog. Generally better than an immediate exit, since the user might want to save some data before exiting.
    Parameters:
    message - The error message
  • main

    public static void main(java.lang.String[] args)
    Entry point for BeatRoot application.
    Parameters:
    args - Optional command line arguments (see constructor for details)