Annotation Pro API
Public Member Functions | Properties | Events | List of all members
Wave Class Reference

A wave. More...

Inherits IWaveProvider.

Public Member Functions

 Wave ()
 Default constructor. More...
 
void AppendSilence (int miliseconds)
 Append silence at the end of audio More...
 
delegate void ChangedDelegate (object sender, EventArgs e)
 Changed delegate. More...
 
void Close ()
 Closes this object. More...
 
void Convert (int samplerate, int bits, int channels)
 Convert audio to given wave format More...
 
void Crop (int start, int end)
 Crops audio using given start and stop More...
 
byte [] GetSampleBytes (int index, int channel)
 Gets a sample. More...
 
int GetSampleFromStreamPosition ()
 Gets sample from stream position. More...
 
Wave GetSubWave (int start, int end)
 Gets sub wave. More...
 
int GetValue (int index, int channel)
 Gets a value. More...
 
List< double[]> GetWindows (int startInSamples, int endInSamples, int channel, int windowSizeInMs, int stepInMs, bool normalized)
 Divides data from the given channel into windows (frames) More...
 
void LoadEmptyWave (int miliseconds)
 Load empty sound into wave object More...
 
void Open (string fileName)
 Opens the given file with event. More...
 
virtual void Open (string fileName, bool fireChangedEvent)
 Opens the given file. More...
 
int Read (byte[] buffer, int offset, int count)
 Fill the specified buffer with wave data. More...
 
void Save (string fileName)
 Saves the given file. More...
 
void SetSample (int index, int channel, byte[] bytes)
 Sets a sample. More...
 
void SetStreamPositionFromSample (int sample)
 Sets stream position from sample. More...
 
void SetValue (int index, int channel, int value)
 Sets a value. More...
 
Wave [] SplitChannels ()
 Splits the channels. More...
 

Properties

int BitsPerSample [get]
 Gets the bits per sample. More...
 
int Channels [get]
 Gets the channels. More...
 
byte [] Data [get]
 Gets the data. More...
 
int DataLength [get]
 Gets the length of the data. More...
 
int FileLength [get]
 Gets the length of the file. More...
 
bool IsData [get]
 Audio data is loaded if true More...
 
bool LoopPlayback [get, set]
 Gets or sets a value indicating whether the loop playback. More...
 
int MaximumRange [get]
 Gets the maximum range for this wave format. This range is represented as absolute number. Ex: 8 bit - range 256 Ex2: 16 bit - range 65536 More...
 
int MaximumValue [get]
 Gets the maximum value for this wave format. Maximum value is an absolute number. Ex: 8 bit - maximum value 128. Ex2: 16 bit - maximum value 32768. More...
 
int Samplerate [get]
 Gets the samplerate. More...
 
int SamplesCount [get]
 Gets the number of samples. More...
 
int StreamCustomStop [get, set]
 Gets or sets the stream custom stop. More...
 
int StreamPosition [get, set]
 Gets or sets the stream position. More...
 

Events

ChangedDelegate Changed
 Event queue for all listeners interested in Changed events. More...
 

Detailed Description

A wave.

Constructor & Destructor Documentation

◆ Wave()

Wave ( )
inline

Default constructor.

Member Function Documentation

◆ AppendSilence()

void AppendSilence ( int  miliseconds)
inline

Append silence at the end of audio

Parameters
milisecondsSilence length in miliseconds

◆ ChangedDelegate()

delegate void ChangedDelegate ( object  sender,
EventArgs  e 
)

Changed delegate.

Parameters
senderSource of the event.
eEvent information.

◆ Close()

void Close ( )
inline

Closes this object.

◆ Convert()

void Convert ( int  samplerate,
int  bits,
int  channels 
)
inline

Convert audio to given wave format

Parameters
samplerateSamplerate
bitsBits per sample
channelsChannels

◆ Crop()

void Crop ( int  start,
int  end 
)
inline

Crops audio using given start and stop

Parameters
startcropping start
endcropping stop

◆ GetSampleBytes()

byte [] GetSampleBytes ( int  index,
int  channel 
)
inline

Gets a sample.

Parameters
indexZero-based index of the.
channelThe channel.
Returns
An array of byte.

◆ GetSampleFromStreamPosition()

int GetSampleFromStreamPosition ( )
inline

Gets sample from stream position.

Returns
The sample from stream position.

◆ GetSubWave()

Wave GetSubWave ( int  start,
int  end 
)
inline

Gets sub wave.

Parameters
startStart in samples.
endEnd in samples.
Returns
The sub wave.

◆ GetValue()

int GetValue ( int  index,
int  channel 
)
inline

Gets a value.

Parameters
indexZero-based index of the.
channelThe channel.
Returns
The value.

◆ GetWindows()

List<double[]> GetWindows ( int  startInSamples,
int  endInSamples,
int  channel,
int  windowSizeInMs,
int  stepInMs,
bool  normalized 
)
inline

Divides data from the given channel into windows (frames)

Parameters
startInSamplesstart region in samples
endInSamplesend region in samples
channel0-based number of channels
windowSizeInMswindow size in ms
stepInMsstep in ms
normalizedTrue if want get normalized window
Returns

◆ LoadEmptyWave()

void LoadEmptyWave ( int  miliseconds)
inline

Load empty sound into wave object

Parameters
milisecondsDuration in miliseconds

◆ Open() [1/2]

void Open ( string  fileName)
inline

Opens the given file with event.

Exceptions
ExceptionThrown when an exception error condition occurs.
Parameters
fileNameFilename of the file.

◆ Open() [2/2]

virtual void Open ( string  fileName,
bool  fireChangedEvent 
)
inlinevirtual

Opens the given file.

Exceptions
ExceptionThrown when an exception error condition occurs.
Parameters
fileNameFilename of the file.
fireChangedEventIf true fire changed event.

◆ Read()

int Read ( byte []  buffer,
int  offset,
int  count 
)
inline

Fill the specified buffer with wave data.

Parameters
bufferThe buffer.
offsetThe offset.
countNumber of.
Returns
the number of bytes written to the buffer.

◆ Save()

void Save ( string  fileName)
inline

Saves the given file.

Parameters
fileNameFilename of the file.

◆ SetSample()

void SetSample ( int  index,
int  channel,
byte []  bytes 
)
inline

Sets a sample.

Parameters
indexZero-based index of the.
channelThe channel.
bytesThe bytes.

◆ SetStreamPositionFromSample()

void SetStreamPositionFromSample ( int  sample)
inline

Sets stream position from sample.

Parameters
sampleThe sample.

◆ SetValue()

void SetValue ( int  index,
int  channel,
int  value 
)
inline

Sets a value.

Parameters
indexZero-based index of the.
channelThe channel.
valueThe value.

◆ SplitChannels()

Wave [] SplitChannels ( )
inline

Splits the channels.

Returns
A Wave[].

Property Documentation

◆ BitsPerSample

int BitsPerSample
get

Gets the bits per sample.

The bits per sample.

◆ Channels

int Channels
get

Gets the channels.

The channels.

◆ Data

byte [] Data
get

Gets the data.

The data.

◆ DataLength

int DataLength
get

Gets the length of the data.

The length of the data.

◆ FileLength

int FileLength
get

Gets the length of the file.

The length of the file.

◆ IsData

bool IsData
get

Audio data is loaded if true

◆ LoopPlayback

bool LoopPlayback
getset

Gets or sets a value indicating whether the loop playback.

true if loop playback, false if not.

◆ MaximumRange

int MaximumRange
get

Gets the maximum range for this wave format. This range is represented as absolute number. Ex: 8 bit - range 256 Ex2: 16 bit - range 65536

◆ MaximumValue

int MaximumValue
get

Gets the maximum value for this wave format. Maximum value is an absolute number. Ex: 8 bit - maximum value 128. Ex2: 16 bit - maximum value 32768.

◆ Samplerate

int Samplerate
get

Gets the samplerate.

The samplerate.

◆ SamplesCount

int SamplesCount
get

Gets the number of samples.

The number of samples.

◆ StreamCustomStop

int StreamCustomStop
getset

Gets or sets the stream custom stop.

The stream custom stop.

◆ StreamPosition

int StreamPosition
getset

Gets or sets the stream position.

The stream position.

Event Documentation

◆ Changed

ChangedDelegate Changed

Event queue for all listeners interested in Changed events.


The documentation for this class was generated from the following file: