Class: VolumeTransformer

core.VolumeTransformer(options)

Transforms a stream of PCM volume.

Constructor

new VolumeTransformer(options)

Parameters:
Name Type Description
options Object Any optional TransformStream options plus some extra:
Properties
Name Type Attributes Default Description
type string The type of transformer: s16le (signed 16-bit little-endian), s16be, s32le, s32be
volume number <optional>
1 The output volume of the stream
Source:
Example
// Half the volume of a signed 16-bit little-endian PCM stream
input
 .pipe(new prism.VolumeTransformer({ type: 's16le', volume: 0.5 }))
 .pipe(writeStream);

Extends

  • TransformStream

Members

(readonly) volumeDecibels :number

The current volume of the stream in decibels
Type:
  • number
Source:

(readonly) volumeLogarithmic :number

The current volume of the stream from a logarithmic scale
Type:
  • number
Source:

Methods

setVolume(volume)

Sets the volume relative to the input stream - i.e. 1 is normal, 0.5 is half, 2 is double.
Parameters:
Name Type Description
volume number The volume that you want to set
Source:

setVolumeDecibels(db)

Sets the volume in decibels.
Parameters:
Name Type Description
db number The decibels
Source:

setVolumeLogarithmic(value)

Sets the volume so that a perceived value of 0.5 is half the perceived volume etc.
Parameters:
Name Type Description
value number The value for the volume
Source: