Package at.ofai.music.beatroot
Class AgentList
- java.lang.Object
-
- at.ofai.music.beatroot.AgentList
-
public class AgentList extends java.lang.Object
Class for maintaining the set of all Agents involved in beat tracking a piece of music. Implements a simple linked list terminated by an AgentList with a null Agent (ag).
-
-
Field Summary
Fields Modifier and Type Field and Description Agent
ag
A beat tracking Agentstatic int
count
The length of the list (number of beat tracking Agents)static boolean
debug
Flag for printing debugging output.static double
DEFAULT_BI
For the purpose of removing duplicate agents, the default JND of IBIstatic double
DEFAULT_BT
For the purpose of removing duplicate agents, the default JND of phaseAgentList
next
The remainder of the linked liststatic double
thresholdBI
For the purpose of removing duplicate agents, the JND of IBI.static double
thresholdBT
For the purpose of removing duplicate agents, the JND of phase.static boolean
useAverageSalience
Flag for choice between sum and average beat salience values for Agent scores.
-
Constructor Summary
Constructors Constructor and Description AgentList()
Default constructorAgentList(Agent a, AgentList al)
Constructor for an AgentList: the Agent a is prepended to the list al.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
add(Agent a)
Inserts newAgent into the list in ascending order of beatIntervalvoid
add(Agent newAgent, boolean sort)
Appends newAgent to list (sort==false), or inserts newAgent into the list in ascending order of beatIntervalvoid
beatTrack(EventList el)
Perform beat tracking on a list of events (onsets).void
beatTrack(EventList el, double stop)
Perform beat tracking on a list of events (onsets).Agent
bestAgent()
Finds the Agent with the highest score in the list.void
print()
Deep print of AgentList for debuggingvoid
remove(AgentList ptr)
Removes the current item from the list.protected void
removeDuplicates()
Removes Agents from the list which are duplicates of other Agents.void
sort()
Sorts the AgentList by increasing beatInterval, using a bubble sort since it is assumed that the list is almost sorted.
-
-
-
Field Detail
-
ag
public Agent ag
A beat tracking Agent
-
count
public static int count
The length of the list (number of beat tracking Agents)
-
debug
public static boolean debug
Flag for printing debugging output.
-
DEFAULT_BI
public static final double DEFAULT_BI
For the purpose of removing duplicate agents, the default JND of IBI- See Also:
- Constant Field Values
-
DEFAULT_BT
public static final double DEFAULT_BT
For the purpose of removing duplicate agents, the default JND of phase- See Also:
- Constant Field Values
-
next
public AgentList next
The remainder of the linked list
-
thresholdBI
public static double thresholdBI
For the purpose of removing duplicate agents, the JND of IBI. Not changed in the current version.
-
thresholdBT
public static double thresholdBT
For the purpose of removing duplicate agents, the JND of phase. Not changed in the current version.
-
useAverageSalience
public static boolean useAverageSalience
Flag for choice between sum and average beat salience values for Agent scores. The use of summed saliences favours faster tempi or lower metrical levels.
-
-
Method Detail
-
print
public void print()
Deep print of AgentList for debugging
-
add
public void add(Agent a)
Inserts newAgent into the list in ascending order of beatInterval
-
add
public void add(Agent newAgent, boolean sort)
Appends newAgent to list (sort==false), or inserts newAgent into the list in ascending order of beatInterval- Parameters:
newAgent
- The agent to be added to the listsort
- Flag indicating whether the list is sorted or not
-
sort
public void sort()
Sorts the AgentList by increasing beatInterval, using a bubble sort since it is assumed that the list is almost sorted.
-
remove
public void remove(AgentList ptr)
Removes the current item from the list. The current item does not need to be the head of the whole list.- Parameters:
ptr
- Points to the Agent which is removed from the list
-
removeDuplicates
protected void removeDuplicates()
Removes Agents from the list which are duplicates of other Agents. A duplicate is defined by the tempo and phase thresholds thresholdBI and thresholdBT respectively.
-
beatTrack
public void beatTrack(EventList el)
Perform beat tracking on a list of events (onsets).- Parameters:
el
- The list of onsets (or events or peaks) to beat track
-
beatTrack
public void beatTrack(EventList el, double stop)
Perform beat tracking on a list of events (onsets).- Parameters:
el
- The list of onsets (or events or peaks) to beat track.stop
- Do not find beats afterstop
seconds.
-
bestAgent
public Agent bestAgent()
Finds the Agent with the highest score in the list.- Returns:
- The Agent with the highest score
-
-