@Operator(group="audio") public final class DecodeWav extends PrimitiveOp
The -32768 to 32767 signed 16-bit values will be scaled to -1.0 to 1.0 in float.
When desired_channels is set, if the input contains fewer channels than this then the last channel will be duplicated to give the requested number, else if the input has more channels than requested then the additional channels will be ignored.
If desired_samples is set, then the audio will be cropped or padded with zeroes to the requested length.
The first output contains a Tensor with the content of the audio samples. The lowest dimension will be the number of channels, and the second will be the number of samples. For example, a ten-sample-long stereo WAV file should give an output shape of [10, 2].
Modifier and Type | Class and Description |
---|---|
static class |
DecodeWav.Options
Optional attributes for
DecodeWav |
operation
Modifier and Type | Method and Description |
---|---|
Output<Float> |
audio()
2-D with shape `[length, channels]`.
|
static DecodeWav |
create(Scope scope,
Operand<String> contents,
DecodeWav.Options... options)
Factory method to create a class wrapping a new DecodeWav operation.
|
static DecodeWav.Options |
desiredChannels(Long desiredChannels) |
static DecodeWav.Options |
desiredSamples(Long desiredSamples) |
Output<Integer> |
sampleRate()
Scalar holding the sample rate found in the WAV header.
|
equals, hashCode, op, toString
public static DecodeWav create(Scope scope, Operand<String> contents, DecodeWav.Options... options)
scope
- current scopecontents
- The WAV-encoded audio, usually from a file.options
- carries optional attributes valuespublic static DecodeWav.Options desiredChannels(Long desiredChannels)
desiredChannels
- Number of sample channels wanted.public static DecodeWav.Options desiredSamples(Long desiredSamples)
desiredSamples
- Length of audio requested.Copyright © 2022. All rights reserved.