Audio class - Quefumas/gensound GitHub Wiki

TODO

Basically a wrapper for numpy.ndarray object, with shape being (num_channels, num_samples), data type numpy.float64.

Some properties are described below, but note that this won't necessarily reflect recent changes in code, so you are encouraged to read the code instead.

  • Audio.audio - the ndarray with the audio data, as above
  • Audio.num_channels
  • Audio.length - returns number of samples
  • Audio.duration - returns duration in ms (float)
  • Audio.shape - returns Audio.audio.shape
  • Audio.to_length(self, length) - ensures has at least length samples, padding with zeros if needed. Does not crop.
  • Audio.extend(self, how_much) - always adds how_much zero samples at the end.