at.ofai.music.beatroot

Class BeatTrackDisplay

public class BeatTrackDisplay extends JPanel implements MouseListener, MouseMotionListener

Main panel of BeatRoot's GUI, which displays the audio and beat data and allows editing, scrolling, selecting, etc
Field Summary
static ColorAUDIO_COLOUR
the colour of the amplitude envelope
static doubleadjustment
for synchronising audio and graphics, a constant related to the size of the audio buffer in seconds
static doubleallowedError
For evaluation of beat tracking results, the largest difference allowed between the computed and annotated beat times.
doubleaudioScale
Scaling factor for displaying the amplitude envelope
protected ListIterator<Event>beatPtr
location of selected beat (previous()) in the EventList beats
protected EventListbeats
beat data encoded as a list of Events
static ColorBEAT_COLOUR
the colour of the lines marking the beats
static booleancentred
mode for scrolling the display: if true the cursor remains centred on the screen and the data scrolls; if false the cursor moves and the data is changed just before the cursor reaches the edge of the screen.
protected RectangleclipRect
the clip rectangle for painting only those areas which have changed
static Color[]colour
colour map used in the spectrogram
doublecurrentTime
the current time of audio output (for cursor position)
static booleandebug
Flag for enabling debugging output
static intDEFAULT_MODE
the default display mode
protected doubleendSelection
end of selected data region (may be < start)
protected double[]env
the times corresponding to each point in the magnitudes array
Fontfont
font used for displaying text
protected intfontSize
size of font for inter-beat intervals and axis labels
protected GraphicsgImage
the Graphics object for drawing on img
protected GUIgui
handle to the GUI (parent) object
doublehiThreshold
the threshold above which the maximum colour is used in the spectrogram
protected BufferedImageimg
background image showing audio data but not beats
doubleloThreshold
the threshold below which the minimum colour is used in the spectrogram
protected int[]magnitudes
smoothed amplitude envelope of audio signal
doublemaximumTime
the maximum time that might need to be displayed for this input file (seconds)
FontMetricsmetrics
metrics for calculating the size of printed strings
intmidiMax
largest displayed midi pitch
intmidiMin
smallest displayed midi pitch
doubleminimumTime
the minimum time that might need to be displayed for this input file (seconds)
intmode
a bit string indicating what items are displayed on the main data panel
static ColorMIDI_COLOUR
the colour of the MIDI piano roll
protected double[]offsets
the times of offsets (in seconds) for MIDI data
protected EventListonsetList
a list of onset events for passing to the tempo induction and beat tracking methods
protected double[]onsets
the times of onsets (in seconds)
doubleoverlap
the ratio of hop size to frame size (for aligning the spectrogram with the audio)
static ColorONSET_COLOUR
the colour of the onset markers on the amplitude envelope
protected int[]pitches
the pitches of MIDI notes
protected booleanregionSelected
flag indicating whether a region is selected
protected intscrollDirection
the direction of scrolling when dragging outside the displayed bounds
protected EventselectedBeat
the current beat (in editing and annotation operations)
protected doubleselectedBeatTime
time of selected beat (for undo)
static longserialVersionUID
avoid compiler warning
protected double[][]spectro
spectrogram data
protected intspectroLength
number of frames of valid spectrogram data
protected doublestartSelection
beginning of selected data region
static ColorSELECTION_COLOUR
the background colour of a selected region
static intSHOW_AUDIO
static intSHOW_BEATS
Constants defining the various elements that can be displayed on the main data panel
static intSHOW_DATA
static intSHOW_IBI
static intSHOW_MIDI
static intSHOW_ONSETS
static intSHOW_SPECTRO
protected doubletInc
time interval between frames of spectrogram data (hop time)
static ColorTEXT_COLOUR
the colour of the text (for IBIs and axes)
static booleanusePScore
For evaluation, select whether to use the P-score or T-score
static booleanuseRelativeError
For evaluation of beat tracking results, indicates whether allowedError is interpreted as absolute (in seconds) or relative (0-1).
protected static doubleUNKNOWN
Constant representing an unknown relationship between metrical levels
doublevisibleTimeLength
the duration of the visible audio data (seconds)
doublevisibleTimeStart
the time corresponding to the leftmost point on the panel (seconds)
protected intx0
x-coordinate corresponding to time t = 0 (could be off-screen)
protected intxSize
width in pixels of this panel
protected intyBottom
y-coordinate of bottom of data area (position of x-axis)
protected intyMid
y-coordinate of the bottom of the spectrogram and top of the amplitude envelope area
protected intySize
height in pixels of this panel
protected intyTop
y-coordinate of top of data area
Constructor Summary
BeatTrackDisplay(GUI g, EventList b)
Constructor:
Method Summary
voidaddAfterSelectedBeat()
Interpolates a new beat between the currently selected and the following beat
voidaddBeat(double time)
Adds a beat at the given time.
voidaddBeatNow()
Adds a beat at the current playback time, with an adjustment for audio latency.
static EventListbeatTrack(EventList events)
Perform beat tracking where the GUI is not active; there is no selected region.
static EventListbeatTrack(EventList events, EventList beats)
Perform beat tracking where the GUI is not active; there is no selected region.
voidbeatTrack()
Performs automatic beat tracking and updates the GUI accordingly.
voidclearBeats()
Clears all beats in the selected area and sets beatPtr to point between the beats surrounding the deleted area.
protected voidclearImage()
Clears the background image to white
voidensureShowing(double time, boolean isRunning)
Ensures that the given time is visible on the screen, by requesting a scroll if it is off the screen.
voidevaluate(String beatsFile)
Evaluates a beat tracking solution against an annotation of the data.
static voidevaluate(String beatsFile, EventList beats)
Evaluates a beat tracking solution against an annotation of the data.
static voidevaluate(String annotationFile, String testFile)
Evaluates a beat tracking solution against an annotation of the data.
static voidevaluate(String beatsFile, double[] beatsArr)
Evaluates a beat tracking solution against an annotation of the data.
voidfindClosestBeat(int x, boolean nextHighest)
Finds the closest beat to a given time.
static doublegetAverageIBI(double[] d)
Finds the mean tempo (as inter-beat interval) from an array of beat times
EventListgetBeats()
ColorgetColour(double c)
Maps a double to a colour for displaying the spectrogram
intgetMaximum()
static doublegetMedianIBI(double[] d)
Finds the median tempo (as inter-beat interval) from an array of beat times
intgetMinimum()
double[]getOffsets()
double[]getOnsets()
int[]getPitches()
static doublegetRhythmicLevel(double[] beats, double[] correct)
Estimates the metrical relationship between two beat sequences.
StringgetSelectedRegion(String prefix)
Gets the start (selectedStart) and length (selectedLength) of the region of audio which has been selected (if any).
intgetValue()
Returns the time corresponding to the left edge of the display; used in scrolling
intgetVisibleAmount()
Gets the length of audio that is visible at any one time (i.e. zoom factor).
voidinit(boolean resetSelection)
Initialises the panel after new data is loaded or preferences are changed.
doublelocationToTime(int loc)
Finds the time corresponding to a given x-coordinate.
voidmarkMetricalLevel(int level, int len, int phase)
Marks (only) the selected metrical level as specified.
voidmouseClicked(MouseEvent e)
Ignore composite events (already processed as press/drag/release events)
voidmouseDragged(MouseEvent e)
Called when the mouse is moved with a button down; if a beat is selected, it is moved under the cursor, and if a region is selected it is expanded or shrunk under the cursor.
voidmouseEntered(MouseEvent e)
Request focus for key events whenever the mouse enters the window.
voidmouseExited(MouseEvent e)
Ignore mouse exit events
voidmouseMoved(MouseEvent e)
Ignore mouse movement with no button pressed
voidmousePressed(MouseEvent e)
A mouse button press can be used to move (left button), add (middle button), or delete (right button) a beat, or to select or deselect a region, by clicking on the axis.
voidmouseReleased(MouseEvent e)
Called when the mouse button is released, to finalise move/add/delete operations.
voidmoveBeat(double t1, double t2)
Changes the time of a beat, and re-sorts the list.
static EventnewBeat(double time, int beatNum)
Creates a new Event object representing a beat.
voidpaint(Graphics g)
Renders the panel.
protected voidpaintAudioData(Graphics g)
Paints the audio amplitude envelope and onset markers.
protected voidpaintAxes(Graphics g)
Paints the time axis and labels
protected voidpaintBackground(Graphics g)
Paints the background of the spectrogram and selected area (if any).
protected voidpaintBeats(Graphics g)
Paints the beats and inter-baet intervals
protected voidpaintMidiData(Graphics g)
Paints MIDI data in piano-roll notation.
protected voidpaintSpectroData(Graphics g)
Paints the spectrogram data.
voidremoveBeat(double time)
Deletes a beat.
voidremoveSelectedBeat()
Deletes the currently selected beat
voidreorderBeats()
The current beat (pointed to by beatPtr) is moved to its correct place in the otherwise sorted list of beats.
protected voidrepaintImage()
Updates the background image, after creating it if necessary
voidscrollTo(double time, boolean isRunning)
Updates the screen to show data for the current time, by scrolling and/or moving the cursor.
voidselectBeat(int x, int err)
Selects the nearest beat to a given x-coordinate.
voidselectFirstBeat()
Selects the first beat
voidselectLastBeat()
Selects the last beat
voidselectNextBeat()
Selects the beat after the currently selected beat
voidselectPreviousBeat()
Selects the beat before the currently selected beat
voidsetBeats(EventList b)
Sets the list of beats.
voidsetEnvTimes(double[] envTimes)
Sets the array of times of amplitude envelope points, for displaying.
voidsetMagnitudes(int[] mag)
Sets the array of magnitude values, for displaying.
voidsetMetricalLevel(int x)
Marks the selected beat with all metrical levels up to and including x.
voidsetMode(int on, int off)
Changes the display mode (which elements are displayed on the panel).
voidsetOffsets(double[] off)
Sets the array of offset times, for displaying MIDI input data.
voidsetOnsetList(EventList on)
Sets the onset times as a list of Events, for use by the beat tracking methods.
voidsetOnsets(double[] on)
Sets the array of onset times, for displaying MIDI or audio input data.
voidsetPitches(int[] p)
Sets the array of pitch values, for displaying MIDI input data.
voidsetSpectro(double[][] spec, int len, double inc, double lap)
Sets the data for the spectrogram.
voidsetValue(int value)
Scrolls the data so that the left edge of the panel corresponds to the given time.
voidsetVisibleAmount(int msec)
Sets the length of audio that is visible at any one time (i.e. zoom factor).
inttimeToLocation(double time)
Finds the x-coordinate corresponding to the given time.
voidtoggleAnnotateMode()
Turns keyboard annotation of metrical levels on and off
voidupdate(Graphics g)
Don't clear before repainting

Field Detail

AUDIO_COLOUR

static Color AUDIO_COLOUR
the colour of the amplitude envelope

adjustment

public static double adjustment
for synchronising audio and graphics, a constant related to the size of the audio buffer in seconds

allowedError

public static double allowedError
For evaluation of beat tracking results, the largest difference allowed between the computed and annotated beat times.

audioScale

double audioScale
Scaling factor for displaying the amplitude envelope

beatPtr

protected ListIterator<Event> beatPtr
location of selected beat (previous()) in the EventList beats

beats

protected EventList beats
beat data encoded as a list of Events

BEAT_COLOUR

static Color BEAT_COLOUR
the colour of the lines marking the beats

centred

public static boolean centred
mode for scrolling the display: if true the cursor remains centred on the screen and the data scrolls; if false the cursor moves and the data is changed just before the cursor reaches the edge of the screen.

clipRect

protected Rectangle clipRect
the clip rectangle for painting only those areas which have changed

colour

public static final Color[] colour
colour map used in the spectrogram

currentTime

double currentTime
the current time of audio output (for cursor position)

debug

public static boolean debug
Flag for enabling debugging output

DEFAULT_MODE

public static final int DEFAULT_MODE
the default display mode

endSelection

protected double endSelection
end of selected data region (may be < start)

env

protected double[] env
the times corresponding to each point in the magnitudes array

font

Font font
font used for displaying text

fontSize

protected int fontSize
size of font for inter-beat intervals and axis labels

gImage

protected Graphics gImage
the Graphics object for drawing on img

gui

protected GUI gui
handle to the GUI (parent) object

hiThreshold

double hiThreshold
the threshold above which the maximum colour is used in the spectrogram

img

protected BufferedImage img
background image showing audio data but not beats

loThreshold

double loThreshold
the threshold below which the minimum colour is used in the spectrogram

magnitudes

protected int[] magnitudes
smoothed amplitude envelope of audio signal

maximumTime

double maximumTime
the maximum time that might need to be displayed for this input file (seconds)

metrics

FontMetrics metrics
metrics for calculating the size of printed strings

midiMax

int midiMax
largest displayed midi pitch

midiMin

int midiMin
smallest displayed midi pitch

minimumTime

double minimumTime
the minimum time that might need to be displayed for this input file (seconds)

mode

int mode
a bit string indicating what items are displayed on the main data panel

MIDI_COLOUR

static Color MIDI_COLOUR
the colour of the MIDI piano roll

offsets

protected double[] offsets
the times of offsets (in seconds) for MIDI data

onsetList

protected EventList onsetList
a list of onset events for passing to the tempo induction and beat tracking methods

onsets

protected double[] onsets
the times of onsets (in seconds)

overlap

double overlap
the ratio of hop size to frame size (for aligning the spectrogram with the audio)

ONSET_COLOUR

static Color ONSET_COLOUR
the colour of the onset markers on the amplitude envelope

pitches

protected int[] pitches
the pitches of MIDI notes

regionSelected

protected boolean regionSelected
flag indicating whether a region is selected

scrollDirection

protected int scrollDirection
the direction of scrolling when dragging outside the displayed bounds

selectedBeat

protected Event selectedBeat
the current beat (in editing and annotation operations)

selectedBeatTime

protected double selectedBeatTime
time of selected beat (for undo)

serialVersionUID

public static final long serialVersionUID
avoid compiler warning

spectro

protected double[][] spectro
spectrogram data

spectroLength

protected int spectroLength
number of frames of valid spectrogram data

startSelection

protected double startSelection
beginning of selected data region

SELECTION_COLOUR

static Color SELECTION_COLOUR
the background colour of a selected region

SHOW_AUDIO

public static final int SHOW_AUDIO

SHOW_BEATS

public static final int SHOW_BEATS
Constants defining the various elements that can be displayed on the main data panel

SHOW_DATA

public static final int SHOW_DATA

SHOW_IBI

public static final int SHOW_IBI

SHOW_MIDI

public static final int SHOW_MIDI

SHOW_ONSETS

public static final int SHOW_ONSETS

SHOW_SPECTRO

public static final int SHOW_SPECTRO

tInc

protected double tInc
time interval between frames of spectrogram data (hop time)

TEXT_COLOUR

static Color TEXT_COLOUR
the colour of the text (for IBIs and axes)

usePScore

public static boolean usePScore
For evaluation, select whether to use the P-score or T-score

useRelativeError

public static boolean useRelativeError
For evaluation of beat tracking results, indicates whether allowedError is interpreted as absolute (in seconds) or relative (0-1).

UNKNOWN

protected static final double UNKNOWN
Constant representing an unknown relationship between metrical levels

visibleTimeLength

double visibleTimeLength
the duration of the visible audio data (seconds)

visibleTimeStart

double visibleTimeStart
the time corresponding to the leftmost point on the panel (seconds)

x0

protected int x0
x-coordinate corresponding to time t = 0 (could be off-screen)

xSize

protected int xSize
width in pixels of this panel

yBottom

protected int yBottom
y-coordinate of bottom of data area (position of x-axis)

yMid

protected int yMid
y-coordinate of the bottom of the spectrogram and top of the amplitude envelope area

ySize

protected int ySize
height in pixels of this panel

yTop

protected int yTop
y-coordinate of top of data area

Constructor Detail

BeatTrackDisplay

public BeatTrackDisplay(GUI g, EventList b)
Constructor:

Parameters: g A handle to the parent GUI object b The list of beats

Method Detail

addAfterSelectedBeat

public void addAfterSelectedBeat()
Interpolates a new beat between the currently selected and the following beat

addBeat

public void addBeat(double time)
Adds a beat at the given time.

Parameters: time Time in seconds of the new beat

addBeatNow

public void addBeatNow()
Adds a beat at the current playback time, with an adjustment for audio latency. This was a failed attempt at a tapping interface to BeatRoot, as the timing doesn't appear to be at all stable on my platform.

beatTrack

public static EventList beatTrack(EventList events)
Perform beat tracking where the GUI is not active; there is no selected region.

Parameters: events The onsets or peaks in a feature list

Returns: The list of beats, or an empty list if beat tracking fails

beatTrack

public static EventList beatTrack(EventList events, EventList beats)
Perform beat tracking where the GUI is not active; there is no selected region.

Parameters: events The onsets or peaks in a feature list beats The initial beats which are given, if any

Returns: The list of beats, or an empty list if beat tracking fails

beatTrack

public void beatTrack()
Performs automatic beat tracking and updates the GUI accordingly. If a region is selected, the beats outside the region are kept intact and the tempo preserved across the region boundaries.

clearBeats

public void clearBeats()
Clears all beats in the selected area and sets beatPtr to point between the beats surrounding the deleted area.

clearImage

protected void clearImage()
Clears the background image to white

ensureShowing

public void ensureShowing(double time, boolean isRunning)
Ensures that the given time is visible on the screen, by requesting a scroll if it is off the screen.

Parameters: time The current time of audio output in seconds isRunning Flag indicating whether audio output is active

evaluate

public void evaluate(String beatsFile)
Evaluates a beat tracking solution against an annotation of the data.

Parameters: beatsFile The file name of the annotation data

evaluate

public static void evaluate(String beatsFile, EventList beats)
Evaluates a beat tracking solution against an annotation of the data.

Parameters: beatsFile The file name of the annotation data beats The list of beats to be evaluated

evaluate

public static void evaluate(String annotationFile, String testFile)
Evaluates a beat tracking solution against an annotation of the data.

Parameters: annotationFile The file name of the annotation data testFile The file name containing the beat times (as text) to be evaluated

evaluate

public static void evaluate(String beatsFile, double[] beatsArr)
Evaluates a beat tracking solution against an annotation of the data.

Parameters: beatsFile The file name of the annotation data beatsArr The array of beat times to be evaluated

findClosestBeat

void findClosestBeat(int x, boolean nextHighest)
Finds the closest beat to a given time. Returns with beatPtr pointing to the beat (as next()), unless the list is empty

Parameters: x The horizontal location on the panel representing the time to search around nextHighest If true, the returned beat must occur after the given time

getAverageIBI

public static double getAverageIBI(double[] d)
Finds the mean tempo (as inter-beat interval) from an array of beat times

Parameters: d An array of beat times

Returns: The average inter-beat interval

getBeats

public EventList getBeats()

Returns: the list of beats

getColour

Color getColour(double c)
Maps a double to a colour for displaying the spectrogram

Parameters: c The energy value

Returns: The corresponding colour for this energy value

getMaximum

public int getMaximum()

Returns: The maximum time that might need to be displayed for this data

getMedianIBI

public static double getMedianIBI(double[] d)
Finds the median tempo (as inter-beat interval) from an array of beat times

Parameters: d An array of beat times

Returns: The median inter-beat interval

getMinimum

public int getMinimum()

Returns: The minimum time that might need to be displayed for this data

getOffsets

public double[] getOffsets()

Returns: the array of offset times

getOnsets

public double[] getOnsets()

Returns: the array of onset times

getPitches

public int[] getPitches()

Returns: the array of MIDI pitches

getRhythmicLevel

public static double getRhythmicLevel(double[] beats, double[] correct)
Estimates the metrical relationship between two beat sequences.

Parameters: beats The system's beat times correct The annotated beat times

Returns: A double encoding the metrical relationship between the sequences, which ideally should be an integer or reciprocal of an integer.

getSelectedRegion

public String getSelectedRegion(String prefix)
Gets the start (selectedStart) and length (selectedLength) of the region of audio which has been selected (if any). The result is returned as a String containing a list of attribute-value pairs, where the attribute and value are separated by '=' and the pairs are separated by a space.

Parameters: prefix Other attribute-value pairs

Returns: The prefix followed by the start and length pairs if set

getValue

public int getValue()
Returns the time corresponding to the left edge of the display; used in scrolling

Returns: The time in milliseconds of the left edge of the display

getVisibleAmount

public int getVisibleAmount()
Gets the length of audio that is visible at any one time (i.e. zoom factor).

Returns: Length in milliseconds

init

public void init(boolean resetSelection)
Initialises the panel after new data is loaded or preferences are changed.

Parameters: resetSelection Indicates whether the selected region should be cleared

locationToTime

public double locationToTime(int loc)
Finds the time corresponding to a given x-coordinate.

Parameters: loc The given x-coordinate

Returns: The corresponding time in seconds

markMetricalLevel

public void markMetricalLevel(int level, int len, int phase)
Marks (only) the selected metrical level as specified.

Parameters: level The given metrical level len The number of lowest-level beats in one unit of this metrical level phase The position of the first lowest-level beat relative to the boundaries of this metrical level, where 0 means it is aligned

mouseClicked

public void mouseClicked(MouseEvent e)
Ignore composite events (already processed as press/drag/release events)

mouseDragged

public void mouseDragged(MouseEvent e)
Called when the mouse is moved with a button down; if a beat is selected, it is moved under the cursor, and if a region is selected it is expanded or shrunk under the cursor.

mouseEntered

public void mouseEntered(MouseEvent e)
Request focus for key events whenever the mouse enters the window.

mouseExited

public void mouseExited(MouseEvent e)
Ignore mouse exit events

mouseMoved

public void mouseMoved(MouseEvent e)
Ignore mouse movement with no button pressed

mousePressed

public void mousePressed(MouseEvent e)
A mouse button press can be used to move (left button), add (middle button), or delete (right button) a beat, or to select or deselect a region, by clicking on the axis.

Parameters: e The object describing the event that occurred

mouseReleased

public void mouseReleased(MouseEvent e)
Called when the mouse button is released, to finalise move/add/delete operations.

moveBeat

public void moveBeat(double t1, double t2)
Changes the time of a beat, and re-sorts the list. If no beat is found at the given time, an error message is printed and nothing further occurs.

Parameters: t1 The original time of the beat t2 The new time of the beat

newBeat

public static Event newBeat(double time, int beatNum)
Creates a new Event object representing a beat.

Parameters: time The time of the beat in seconds beatNum The index of the beat

Returns: The Event object representing the beat

paint

public void paint(Graphics g)
Renders the panel.

Parameters: g The Graphics object for painting on this panel.

paintAudioData

protected void paintAudioData(Graphics g)
Paints the audio amplitude envelope and onset markers.

Parameters: g The Graphics object to paint to (i.e. img)

paintAxes

protected void paintAxes(Graphics g)
Paints the time axis and labels

Parameters: g The Graphics object to paint to

paintBackground

protected void paintBackground(Graphics g)
Paints the background of the spectrogram and selected area (if any).

Parameters: g The Graphics object to paint to (i.e. img)

paintBeats

protected void paintBeats(Graphics g)
Paints the beats and inter-baet intervals

Parameters: g The Graphics object to paint to

paintMidiData

protected void paintMidiData(Graphics g)
Paints MIDI data in piano-roll notation.

Parameters: g The Graphics object to paint to (i.e. img)

paintSpectroData

protected void paintSpectroData(Graphics g)
Paints the spectrogram data.

Parameters: g The Graphics object to paint to (i.e. img)

removeBeat

public void removeBeat(double time)
Deletes a beat.

Parameters: time The time of the beat (in seconds)

removeSelectedBeat

public void removeSelectedBeat()
Deletes the currently selected beat

reorderBeats

public void reorderBeats()
The current beat (pointed to by beatPtr) is moved to its correct place in the otherwise sorted list of beats.

repaintImage

protected void repaintImage()
Updates the background image, after creating it if necessary

scrollTo

public void scrollTo(double time, boolean isRunning)
Updates the screen to show data for the current time, by scrolling and/or moving the cursor.

Parameters: time The current time of audio output in seconds isRunning Flag indicating whether audio output is active

selectBeat

public void selectBeat(int x, int err)
Selects the nearest beat to a given x-coordinate.

Parameters: x The x-coordinate (e.g. of a mouse-click) near which a beat is sought err The allowed error in the beat location: if negative, no limit is imposed on the beat, otherwise the beat must be within err pixels of x. If no suitable beat is found, there is no selected beat.

selectFirstBeat

public void selectFirstBeat()
Selects the first beat

selectLastBeat

public void selectLastBeat()
Selects the last beat

selectNextBeat

public void selectNextBeat()
Selects the beat after the currently selected beat

selectPreviousBeat

public void selectPreviousBeat()
Selects the beat before the currently selected beat

setBeats

public void setBeats(EventList b)
Sets the list of beats.

Parameters: b The list of beats

setEnvTimes

public void setEnvTimes(double[] envTimes)
Sets the array of times of amplitude envelope points, for displaying.

Parameters: envTimes The array of times in seconds corresponding to the values in magnitudes

setMagnitudes

public void setMagnitudes(int[] mag)
Sets the array of magnitude values, for displaying.

Parameters: mag The array of amplitude envelope values

setMetricalLevel

public void setMetricalLevel(int x)
Marks the selected beat with all metrical levels up to and including x.

Parameters: x The given highest metrical level

setMode

public void setMode(int on, int off)
Changes the display mode (which elements are displayed on the panel). Constant values (SHOW_BEATS, etc.) are defined above.

Parameters: on A bit string indicating the elements that should be switched on off A bit string indicating the elements that should be switched off

setOffsets

public void setOffsets(double[] off)
Sets the array of offset times, for displaying MIDI input data.

Parameters: off The array of MIDI offset times

setOnsetList

public void setOnsetList(EventList on)
Sets the onset times as a list of Events, for use by the beat tracking methods.

Parameters: on The times of onsets in seconds

setOnsets

public void setOnsets(double[] on)
Sets the array of onset times, for displaying MIDI or audio input data.

Parameters: on The times of onsets in seconds

setPitches

public void setPitches(int[] p)
Sets the array of pitch values, for displaying MIDI input data.

Parameters: p The array of MIDI pitch values

setSpectro

public void setSpectro(double[][] spec, int len, double inc, double lap)
Sets the data for the spectrogram.

Parameters: spec The spectrogram data, indexed by time and frequency len The number of frames of spectrogram data inc The time interval between frames of spectrogram data lap The ratio between hop size and frame size

setValue

public void setValue(int value)
Scrolls the data so that the left edge of the panel corresponds to the given time.

Parameters: value The given time in milliseconds

setVisibleAmount

public void setVisibleAmount(int msec)
Sets the length of audio that is visible at any one time (i.e. zoom factor).

Parameters: msec Length in milliseconds

timeToLocation

public int timeToLocation(double time)
Finds the x-coordinate corresponding to the given time.

Parameters: time Time in seconds

Returns: The corresponding x-coordinate

toggleAnnotateMode

public void toggleAnnotateMode()
Turns keyboard annotation of metrical levels on and off

update

public void update(Graphics g)
Don't clear before repainting