LogoPixi’VN
indexInterfaces

Interface: MediaInterface

Defined in: src/sound/interfaces/MediaInterface.ts:3

Extends

  • Pick<Player, "blockTime" | "disposed" | "loaded" | "loop" | "loopEnd" | "loopStart" | "mute" | "now" | "playbackRate" | "reverse" | "restart" | "start" | "stop" | "chain" | "disconnect" | "volume" | "state">

Properties

blockTime

> blockTime: number

Defined in: node_modules/tone/build/esm/core/context/ToneWithContext.d.ts:57

Inherited from

Pick.blockTime


disposed

> disposed: boolean

Defined in: node_modules/tone/build/esm/core/Tone.d.ts:52

Inherited from

Pick.disposed


loaded

> loaded: boolean

Defined in: node_modules/tone/build/esm/source/buffer/Player.d.ts:189

Inherited from

Pick.loaded


loop

> loop: boolean

Defined in: node_modules/tone/build/esm/source/buffer/Player.d.ts:163

Inherited from

Pick.loop


loopEnd

> loopEnd: Time

Defined in: node_modules/tone/build/esm/source/buffer/Player.d.ts:149

Inherited from

Pick.loopEnd


loopStart

> loopStart: Time

Defined in: node_modules/tone/build/esm/source/buffer/Player.d.ts:144

Inherited from

Pick.loopStart


mute

> mute: boolean

Defined in: node_modules/tone/build/esm/source/Source.d.ts:97

Inherited from

Pick.mute


~~muted~~

> muted: boolean

Defined in: src/sound/interfaces/MediaInterface.ts:31

Deprecated

Use mute instead.


paused

> paused: boolean

Defined in: src/sound/interfaces/MediaInterface.ts:27

Whether the sound is currently paused.


playbackRate

> playbackRate: number

Defined in: node_modules/tone/build/esm/source/buffer/Player.d.ts:174

Inherited from

Pick.playbackRate


reverse

> reverse: boolean

Defined in: node_modules/tone/build/esm/source/buffer/Player.d.ts:184

Inherited from

Pick.reverse


~~speed~~

> speed: number

Defined in: src/sound/interfaces/MediaInterface.ts:35

Deprecated

Use playbackRate instead.


state

> state: BasicPlaybackState

Defined in: node_modules/tone/build/esm/source/Source.d.ts:89

Inherited from

Pick.state


volume

> volume: Param<"decibels">

Defined in: node_modules/tone/build/esm/source/Source.d.ts:49

The volume of the output in decibels.

Example

const source = new Tone.PWMOscillator().toDestination();
source.volume.value = -6;

Inherited from

Pick.volume

Methods

chain()

> chain(...nodes): this

Defined in: node_modules/tone/build/esm/core/context/ToneAudioNode.d.ts:125

Connect the output of this node to the rest of the nodes in series.

Parameters

nodes

...InputNode[]

Returns

this

Example

const player = new Tone.Player("https://tonejs.github.io/audio/drum-samples/handdrum-loop.mp3");
player.autostart = true;
const filter = new Tone.AutoFilter(4).start();
const distortion = new Tone.Distortion(0.5);
// connect the player to the filter, distortion and then to the master output
player.chain(filter, distortion, Tone.Destination);

Inherited from

Pick.chain


disconnect()

> disconnect(destination?, outputNum?, inputNum?): this

Defined in: node_modules/tone/build/esm/core/context/ToneAudioNode.d.ts:114

disconnect the output

Parameters

destination?

InputNode

outputNum?

number

inputNum?

number

Returns

this

Inherited from

Pick.disconnect


now()

> now(): number

Defined in: node_modules/tone/build/esm/core/context/ToneWithContext.d.ts:39

Return the current time of the Context clock plus the lookAhead.

Returns

number

Example

setInterval(() => {
	console.log(Tone.now());
}, 100);

Inherited from

Pick.now


restart()

> restart(time?, offset?, duration?): this

Defined in: node_modules/tone/build/esm/source/buffer/Player.d.ts:114

Stop and then restart the player from the beginning (or offset)

Parameters

time?

number

When the player should start.

offset?

Time

The offset from the beginning of the sample to start at.

duration?

Time

How long the sample should play. If no duration is given, it will default to the full length of the sample (minus any offset)

Returns

this

Inherited from

Pick.restart


start()

> start(time?, offset?, duration?): this

Defined in: node_modules/tone/build/esm/source/buffer/Player.d.ts:98

Play the buffer at the given startTime. Optionally add an offset and/or duration which will play the buffer from a position within the buffer for the given duration.

Parameters

time?

Time

When the player should start.

offset?

Time

The offset from the beginning of the sample to start at.

duration?

Time

How long the sample should play. If no duration is given, it will default to the full length of the sample (minus any offset)

Returns

this

Inherited from

Pick.start


stop()

> stop(time?): this

Defined in: node_modules/tone/build/esm/source/Source.d.ts:125

Stop the source at the specified time. If no time is given, stop the source now.

Parameters

time?

Time

When the source should be stopped.

Returns

this

Example

const source = new Tone.Oscillator().toDestination();
source.start();
source.stop("+0.5"); // stops the source 0.5 seconds from now

Inherited from

Pick.stop