torchaudio.functional.apply_codec¶
- torchaudio.functional.apply_codec(waveform: Tensor, sample_rate: int, format: str, channels_first: bool = True, compression: Optional[float] = None, encoding: Optional[str] = None, bits_per_sample: Optional[int] = None) Tensor[source]¶
- DEPRECATED: Apply codecs as a form of augmentation. - Parameters:
- waveform (Tensor) – Audio data. Must be 2 dimensional. See also - `channels_first`.
- sample_rate (int) – Sample rate of the audio waveform. 
- format (str) – File format. 
- channels_first (bool, optional) – When True, both the input and output Tensor have dimension (channel, time). Otherwise, they have dimension (time, channel). 
- compression (float or None, optional) – Used for formats other than WAV. For more details see - torchaudio.backend.sox_io_backend.save().
- encoding (str or None, optional) – Changes the encoding for the supported formats. For more details see - torchaudio.backend.sox_io_backend.save().
- bits_per_sample (int or None, optional) – Changes the bit depth for the supported formats. For more details see - torchaudio.backend.sox_io_backend.save().
 
- Returns:
- Resulting Tensor. If - channels_first=True, it has (channel, time) else (time, channel).
- Return type:
- Tensor 
 - Warning - This function has been deprecated. Please migrate to - torchaudio.io.AudioEffector.