util - Rantanen/node-mumble GitHub Wiki

Functions

toVarint(i) ⇒ Buffer
fromVarint(b) ⇒ number
readPermissions(permissionFlags) ⇒ Object
writePermissions(permissionObject) ⇒ number
applyGain(frame, gain) ⇒ Buffer

Applies gain to the audio frame. Modifies the frame.

downmixChannels(frame, channels) ⇒ Buffer

Downmixes multi-channel frame to mono.

resample(frame, sourceRate, targetRate) ⇒ Buffer

The resampling is done by duplicating samples every now and then so it's not the best quality. Also the source/target rate conversion must result in a whole number of samples for the frame size.

rescaleToUInt16LE(frame, sourceDepth, sourceUnsigned, sourceBE) ⇒ Buffer

Assuming both source and target Bit depth are multiples of eight, this function rescales the frame. E.g. it can be used to make a 16 Bit audio frame of an 8 Bit audio frame.

toVarint(i)

Converts a number to Mumble varint.

See: http://mumble-protocol.readthedocs.org/en/latest/voice_data.html#variable-length-integer-encoding
Params

  • i number - Integer to convert

Returns: Buffer - Varint encoded number

fromVarint(b)

Converts a Mumble varint to an integer.

See: http://mumble-protocol.readthedocs.org/en/latest/voice_data.html#variable-length-integer-encoding
Params

  • b Buffer - Varint to convert

Returns: number - Decoded integer

readPermissions(permissionFlags)

Read permission flags into an permission object.

Params

  • permissionFlags number - Permission bit flags

Returns: Object - Permission object with the bit flags decoded.

writePermissions(permissionObject)

Write permission flags into an permission object.

Params

  • permissionObject Object - Permissions object

Returns: number - Permission bit flags

applyGain(frame, gain)

Params

  • frame Buffer - Audio frame with 16-bit samples.
  • gain number - Multiplier for each sample.

Returns: Buffer - The audio frame passed in.

Applies gain to the audio frame. Modifies the frame.

downmixChannels(frame, channels)

Params

  • frame Buffer - Multi-channel audio frame.
  • channels number - Number of channels.

Returns: Buffer - Downmixed audio frame.

Downmixes multi-channel frame to mono.

resample(frame, sourceRate, targetRate)

Resamples the frame.

Params

  • frame Buffer - Original frame
  • sourceRate number - Original sample rate
  • targetRate number - Target sample rate

Returns: Buffer - New resampled buffer.

The resampling is done by duplicating samples every now and then so it's not the best quality. Also the source/target rate conversion must result in a whole number of samples for the frame size.

rescaleToUInt16LE(frame, sourceDepth, sourceUnsigned, sourceBE)

Rescales the frame.

Params

  • frame Buffer - Original frame
  • sourceDepth number - Original Bit depth
  • sourceUnsigned Boolean - whether the source values are unsigned
  • sourceBE Boolean - whether the source values are big endian

Returns: Buffer - Rescaled buffer.

Assuming both source and target Bit depth are multiples of eight, this function rescales the frame. E.g. it can be used to make a 16 Bit audio frame of an 8 Bit audio frame.

⚠️ **GitHub.com Fallback** ⚠️