"Audio" (Net Encoder)


represents an encoder that converts an audio file or object into a tensor of audio samples.


represents an encoder with specific parameters for preprocessing.


  • NetEncoder[][input] applies the encoder to an input to produce an output.
  • NetEncoder[][{input1,input2,}] applies the encoder to a list of inputs to produce a list of outputs.
  • The input to the encoder can be an Audio object or a File[] expression.
  • The output of the encoder is a matrix of size n×1, where n is the number of audio samples after the preprocessing is applied.
  • An encoder can be attached to an input port of a net by specifying "port"->NetEncoder[] when constructing the net.
  • Parameters
  • The following parameters are supported:
  • "Normalization"Nonewhether to apply normalization
    "SampleRate"16000target sample rate
    "TargetLength"Alltarget output length
  • With the parameter "Normalization"None, no normalization is applied.
  • With the parameter "Normalization"Automatic, the signal is normalized to the maximum absolute value.
  • With the parameter "TargetLength"->All, the output of the encoder includes all available audio samples from the input audio.
  • With the parameter "TargetLength"->n, the output of the encoder will be the first n audio samples from the input audio, with zero padding applied if n is larger than the number of audio samples.


open allclose all

Basic Examples  (1)

Create an audio NetEncoder:

Click for copyable input

Create an Audio object with three samples:

Click for copyable input

Apply the encoder to the Audio object:

Click for copyable input

Scope  (3)

Parameters  (3)

Possible Issues  (1)

See Also

NetEncoder  Audio  AudioData  AudioResample  ConformAudio  NetChain  NetGraph  NetTrain


Related NetEncoders