ClippedAudioSource
Wraps an underlying AudioSource to restrict sample reads and visualization to a bounded time window.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ClippedAudioSource(underlyingSource: AudioSource, bounds?: ClipBounds): ClippedAudioSource;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
underlyingSource | AudioSource |
bounds | ClipBounds |
Returns
Section titled “Returns”ClippedAudioSource
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
channelCount | readonly | number | Number of audio channels. |
sampleRate | readonly | number | Sample rate in Hz. |
underlyingSource | readonly | AudioSource | - |
Accessors
Section titled “Accessors”clipDuration
Section titled “clipDuration”Get Signature
Section titled “Get Signature”get clipDuration(): number;Returns
Section titled “Returns”number
clipEnd
Section titled “clipEnd”Get Signature
Section titled “Get Signature”get clipEnd(): number;Returns
Section titled “Returns”number
clipStart
Section titled “clipStart”Get Signature
Section titled “Get Signature”get clipStart(): number;Returns
Section titled “Returns”number
duration
Section titled “duration”Get Signature
Section titled “Get Signature”get duration(): number;Total duration in seconds.
Returns
Section titled “Returns”number
Total duration in seconds.
Implementation of
Section titled “Implementation of”Get Signature
Section titled “Get Signature”get id(): string;Stable identifier for caching computed STFT frames.
Returns
Section titled “Returns”string
Stable identifier for caching computed STFT frames.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy(): void;Returns
Section titled “Returns”void
getClipBounds()
Section titled “getClipBounds()”getClipBounds(): object;Returns
Section titled “Returns”object
clipEnd
Section titled “clipEnd”clipEnd: number;clipStart
Section titled “clipStart”clipStart: number;on<K>(event: K, handler: (e: ClippedSourceEvents[K]) => void): () => void;Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends keyof ClippedSourceEvents |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event | K |
handler | (e: ClippedSourceEvents[K]) => void |
Returns
Section titled “Returns”() => void
onRangeAvailable()
Section titled “onRangeAvailable()”onRangeAvailable(handler: (range: AudioRange) => void): () => void;Subscribes to progressive loading updates as new byte ranges arrive.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
handler | (range: AudioRange) => void | Callback receiving the newly available time range in seconds. |
Returns
Section titled “Returns”Unsubscribe function.
() => void
Implementation of
Section titled “Implementation of”read()
Section titled “read()”read(options: object): | Float32Array<ArrayBufferLike>| Promise<Float32Array<ArrayBufferLike>>;Reads PCM samples for a specific channel and time range.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { channel: number; endTime: number; startTime: number; } | Channel index and time span in seconds. |
options.channel | number | - |
options.endTime | number | - |
options.startTime | number | - |
Returns
Section titled “Returns”| Float32Array<ArrayBufferLike>
| Promise<Float32Array<ArrayBufferLike>>
Float32Array of normalized audio samples.
Implementation of
Section titled “Implementation of”setClipBounds()
Section titled “setClipBounds()”setClipBounds(bounds: ClipBounds): void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
bounds | ClipBounds |
Returns
Section titled “Returns”void