Click or drag to resize
Accord.NET (logo)

WaveDecoder Class

Wave audio file decoder.
Inheritance Hierarchy
SystemObject
  Accord.Audio.FormatsWaveDecoder

Namespace:  Accord.Audio.Formats
Assembly:  Accord.Audio.DirectSound (in Accord.Audio.DirectSound.dll) Version: 3.7.0
Syntax
public class WaveDecoder : IAudioDecoder
Request Example View Source

The WaveDecoder type exposes the following members.

Constructors
  NameDescription
Public methodWaveDecoder
Constructs a new Wave decoder.
Public methodWaveDecoder(Stream)
Constructs a new Wave decoder.
Public methodWaveDecoder(String)
Constructs a new Wave decoder.
Top
Properties
  NameDescription
Public propertyAverageBitsPerSecond
Gets the average bits per second of the underlying Wave stream.
Public propertyBitsPerSample
Gets the bits per sample of the underlying Wave stream.
Public propertyBytes
Gets the total number of bytes read by this Wave encoder.
Public propertyChannels
Gets the number of channels of the underlying Wave stream.
Public propertyDuration
Gets the total time span duration (in milliseconds) read by this encoder.
Public propertyFrames
Gets the number of frames of the underlying Wave stream.
Public propertyPosition
Gets the current frame within the current decoder stream.
Public propertySampleRate
Gets the sample rate for the underlying Wave stream.
Public propertySamples
Gets the number of samples of the underlying Wave stream.
Public propertyStream
Gets the underlying Wave stream.
Top
Methods
  NameDescription
Public methodClose
Closes the underlying stream.
Public methodDecode
Decodes the Wave stream into a Signal object.
Public methodDecode(Int32)
Decodes the Wave stream into a Signal object.
Public methodDecode(Int32, Int32)
Decodes the Wave stream into a Signal object.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodOpen(Stream)
Open specified stream.
Public methodOpen(String)
Open specified stream.
Public methodOpen(SoundStream)
Opens the specified stream.
Public methodSeek
Navigates to a position in this Wave stream.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodToT
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Examples
// Let's decode a Wave audio file
UnmanagedMemoryStream sourceStream = ...

// Create a decoder for the source stream
WaveDecoder sourceDecoder = new WaveDecoder(sourceStream);

// At this point, we can query some properties of the audio file:
int channels =  sourceDecoder.Channels;
int samples  =  sourceDecoder.Samples;
int frames   =  sourceDecoder.Frames;
int duration =  sourceDecoder.Duration;
int rate     =  sourceDecoder.SampleRate;
int bps      =  sourceDecoder.BitsPerSample;

// Decode the signal in the source stream
Signal sourceSignal = sourceDecoder.Decode();
See Also