auditok.signal.compute_average_channel

auditok.signal.compute_average_channel(data, fmt, channels)[source]

Compute and return average channel of multi-channel audio data. If the number of channels is 2, use compute_average_channel_stereo() (much faster). This function uses satandard array module to convert bytes data into an array of numeric values.

Parameters:
  • data (bytes) – multi-channel audio data to mix down.
  • fmt (str) – format (single character) to pass to array.array to convert data into an array of samples. This should be “b” if audio data’s sample width is 1, “h” if it’s 2 and “i” if it’s 4.
  • channels (int) – number of channels of audio data.
Returns:

mono_audio – mixed down audio data.

Return type:

bytes