new Transport(BPM)

Transport abstraction. Singleton and instantiated by default.

Parameter

Name Type Optional Description

BPM

Number

 

Beat per minute.

Methods

static
getBPM() → Number

Returns current BPM.

Returns

Number 

static
getLoopEnd() → Number

Returns loop end by tick.

Returns

Number 

static
getLoopStart() → Number

Returns loop start by tick.

Returns

Number 

static
getNow() → Number

Returns playhead position by tick.

Returns

Number 

static
isRunning() → Boolean

Returns current running status of transport.

Returns

Boolean 

static
pause()

Pauses current playback.

static
rewind()

Rewinds playhead to the beginning.

static
sec2tick(sec) → Number

Converts second to tick based on transport tempo.

Parameter

Name Type Optional Description

sec

Number

 

Second

Returns

Number 

static
setBPM(BPM)

Sets transport BPM.

Parameter

Name Type Optional Description

BPM

Number

 

Beat per minute.

static
setLoopEnd(tick)

Sets loop end position by tick.

Parameter

Name Type Optional Description

tick

Number

 

Loop end in tick.

static
setLoopStart(tick)

Sets loop start position by tick.

Parameter

Name Type Optional Description

tick

Number

 

Loop start in tick.

static
setNow(tick)

Sets playhead position by tick.

Parameter

Name Type Optional Description

tick

Number

 

Playhead position in ticks.

static
start()

Starts playback.

static
tick2sec(tick) → Number

Converts tick to second based on transport tempo.

Parameter

Name Type Optional Description

tick

Number

 

Tick (atomic musical time unit)

Returns

Number 

static
toggleLoop(bool)

Toggles or sets loop status.

Parameter

Name Type Optional Description

bool

(Boolean or undefined)

 

Loop state. If undefined, it toggles the current state.