Home Reference Source Repository
import Agent from 'music-tempo/src/Agent.js'
public class | source

Agent

Agent is the central class for beat tracking

Constructor Summary

Public Constructor
public

constructor(tempo: Number, firstBeatTime: Number, firsteventScore: Number, agentList: Array, params: Object)

Constructor

Member Summary

Public Members
public

reference to the agent list

public

the current tempo hypothesis of the Agent, expressed as the beat period

public

the time of the most recent beat accepted by this Agent

public

correction factor for updating beat period

public

the array of onsets accepted by this Agent as beats, plus interpolated beats

public

the time after which an Agent that has not accepted any beat will be destroyed

public

the initial tempo hypothesis of the Agent, expressed as the beat period

public

the maximum allowed deviation from the initial tempo, expressed as a fraction of the initial beat period

public

factor for correcting score, if onset do not coincide precisely with predicted beat time

public

sum of salience values of the onsets which have been interpreted as beats by this Agent

public

the maximum time that a beat can deviate from the predicted beat time without a fork occurring

public

the maximum amount by which a beat can be later than the predicted beat time, expressed as a fraction of the beat period

public

the maximum amount by which a beat can be earlier than the predicted beat time, expressed as a fraction of the beat period

public

the number of beats found by this Agent, including interpolated beats

Method Summary

Public Methods
public

acceptEvent(eventTime: Number, eventScore: Number, err: Number, beatCount: Number)

Accept the event time as a beat time, and update the state of the Agent accordingly

public

Makes a clone of the Agent

public

considerEvent(eventTime: Number, eventScore: Number): Boolean

The event time is tested if it is a beat time

public

Interpolates missing beats in the Agent's beat track

Public Constructors

public constructor(tempo: Number, firstBeatTime: Number, firsteventScore: Number, agentList: Array, params: Object) source

Constructor

Params:

NameTypeAttributeDescription
tempo Number

tempo hypothesis of the Agent

firstBeatTime Number

the time of the first beat accepted by this Agent

firsteventScore Number

salience value of the first beat accepted by this Agent

agentList Array

reference to the agent list

params Object
  • optional
  • default: {}

parameters

params.expiryTime Number
  • optional
  • default: 10

the time after which an Agent that has not accepted any beat will be destroyed

params.toleranceWndInner Number
  • optional
  • default: 0.04

the maximum time that a beat can deviate from the predicted beat time without a fork occurring

params.toleranceWndPre Number
  • optional
  • default: 0.15

the maximum amount by which a beat can be earlier than the predicted beat time, expressed as a fraction of the beat period

params.toleranceWndPost Number
  • optional
  • default: 0.3

the maximum amount by which a beat can be later than the predicted beat time, expressed as a fraction of the beat period

params.correctionFactor Number
  • optional
  • default: 50

correction factor for updating beat period

params.maxChange Number
  • optional
  • default: 0.2

the maximum allowed deviation from the initial tempo, expressed as a fraction of the initial beat period

params.penaltyFactor Number
  • optional
  • default: 0.5

factor for correcting score, if onset do not coincide precisely with predicted beat time

Public Members

public agentListRef: Array source

reference to the agent list

public beatInterval: Number source

the current tempo hypothesis of the Agent, expressed as the beat period

public beatTime: Number source

the time of the most recent beat accepted by this Agent

public correctionFactor: Number source

correction factor for updating beat period

public events: Array source

the array of onsets accepted by this Agent as beats, plus interpolated beats

public expiryTime: Number source

the time after which an Agent that has not accepted any beat will be destroyed

public initialBeatInterval: Number source

the initial tempo hypothesis of the Agent, expressed as the beat period

public maxChange: Number source

the maximum allowed deviation from the initial tempo, expressed as a fraction of the initial beat period

public penaltyFactor: Number source

factor for correcting score, if onset do not coincide precisely with predicted beat time

public score: Number source

sum of salience values of the onsets which have been interpreted as beats by this Agent

public toleranceWndInner: Number source

the maximum time that a beat can deviate from the predicted beat time without a fork occurring

public toleranceWndPost: Number source

the maximum amount by which a beat can be later than the predicted beat time, expressed as a fraction of the beat period

public toleranceWndPre: Number source

the maximum amount by which a beat can be earlier than the predicted beat time, expressed as a fraction of the beat period

public totalBeatCount: Number source

the number of beats found by this Agent, including interpolated beats

Public Methods

public acceptEvent(eventTime: Number, eventScore: Number, err: Number, beatCount: Number) source

Accept the event time as a beat time, and update the state of the Agent accordingly

Params:

NameTypeAttributeDescription
eventTime Number

the event time to be accepted

eventScore Number

salience values of the event time

err Number

the difference between the predicted and actual beat times

beatCount Number

the number of beats since the last beat

public clone(): Agent source

Makes a clone of the Agent

Return:

Agent

agent's clone

public considerEvent(eventTime: Number, eventScore: Number): Boolean source

The event time is tested if it is a beat time

Params:

NameTypeAttributeDescription
eventTime Number

the event time to be tested

eventScore Number

salience values of the event time

Return:

Boolean

indicate whether the given event time was accepted as a beat time

public fillBeats() source

Interpolates missing beats in the Agent's beat track