@Namespace(value="tensorflow::ops") @NoOffset @Properties(inherit=tensorflow.class) public class AudioSpectrogram extends Pointer
Produces a visualization of audio data over time.
Spectrograms are a standard way of representing audio information as a series of
slices of frequency information, one slice for each window of time. By joining
these together into a sequence, they form a distinctive fingerprint of the sound
over time.
This op expects to receive audio data as an input, stored as floats in the range
-1 to 1, together with a window width in samples, and a stride specifying how
far to move the window between slices. From this it generates a three
dimensional output. The first dimension is for the channels in the input, so a
stereo audio input would have two here for example. The second dimension is time,
with successive frequency slices. The third dimension has an amplitude value for
each frequency during that time slice.
This means the layout when converted and saved as an image is rotated 90 degrees
clockwise from a typical spectrogram. Time is descending down the Y axis, and
the frequency decreases from left to right.
Each value in the result represents the square root of the sum of the real and
imaginary parts of an FFT on the current window of samples. In this way, the
lowest dimension represents the power of each frequency in the current window,
and adjacent windows are concatenated in the next dimension.
To get a more intuitive and visual look at what this operation does, you can run
tensorflow/examples/wav_to_spectrogram to read in an audio file and save out the
resulting spectrogram as a PNG image.
Arguments:
* scope: A Scope object
* input: Float representation of audio data.
* window_size: How wide the input window is in samples. For the highest efficiency
this should be a power of two, but other values are accepted.
* stride: How widely apart the center of adjacent sample windows should be.
Optional attributes (see Attrs
):
* magnitude_squared: Whether to return the squared magnitude or just the
magnitude. Using squared magnitude can avoid extra calculations.
Returns:
* Output
: 3D representation of the audio frequencies as an image.
Modifier and Type | Class and Description |
---|---|
static class |
AudioSpectrogram.Attrs
Optional attribute setters for AudioSpectrogram
|
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
AudioSpectrogram(Pointer p)
Pointer cast constructor.
|
AudioSpectrogram(Scope scope,
Input input,
long window_size,
long stride) |
AudioSpectrogram(Scope scope,
Input input,
long window_size,
long stride,
AudioSpectrogram.Attrs attrs) |
Modifier and Type | Method and Description |
---|---|
Input |
asInput() |
Output |
asOutput() |
static AudioSpectrogram.Attrs |
MagnitudeSquared(boolean x) |
Node |
node() |
Operation |
operation() |
AudioSpectrogram |
operation(Operation setter) |
Output |
spectrogram() |
AudioSpectrogram |
spectrogram(Output setter) |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public AudioSpectrogram(Pointer p)
Pointer(Pointer)
.public AudioSpectrogram(@Const @ByRef Scope scope, @ByVal Input input, @Cast(value="tensorflow::int64") long window_size, @Cast(value="tensorflow::int64") long stride)
public Node node()
@ByVal public static AudioSpectrogram.Attrs MagnitudeSquared(@Cast(value="bool") boolean x)
public AudioSpectrogram operation(Operation setter)
public AudioSpectrogram spectrogram(Output setter)
Copyright © 2022. All rights reserved.