This class maps the current analyzed wav file. It has the methods to extract the chunk and the data from the file.

LICENSE: "Audero Wav Extractor" (from now on "The software") is released under the CC BY-NC 3.0 ("Creative Commons Attribution NonCommercial 3.0") license. More details can be found here: http://creativecommons.org/licenses/by-nc/3.0/

WARRANTY: The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

author Aurelio De Rosa
version 1.0
license CC BY-NC 3.0
link https://bitbucket.org/AurelioDeRosa/audero-wav-extractor
package Audero\AuderoWavExtractor

 Methods

The constructor of the object. It initialized the object and set the filename of the wav file.

__construct(string $FilePath) 

Parameters

$FilePath

string

The filename, including the path, of the managed file wav

Retrieves the number of channles of the current file.

getChannelsNumber() : int | null

Returns

intnull

Retrieves the number of sample slices per second.

getDataRate() : int | null

Returns

intnull

This method get the current file duration

getDuration() : int

Returns

intThe duration of the file in milliseconds

Retrieves the path to the current file

getFilePath() : string

Returns

string

Get the headers of the current wav file. If the headers contains not recognize chunks, these will be drop.

getHeaders(int $HeaderSize) : array

Parameters

$HeaderSize

int

The amount of bytes of the current wav headers (including dropped chunks)

Exceptions

\Exception If the wav file is not available or cannot be open.

Returns

arrayThe array that contains the headers (excluding dropped chunks)

Get the headers size in byte

getHeadersSize(\$OnlyRecognizedChunks $OnlyRecognizedChunks) : int

Parameters

$OnlyRecognizedChunks

\$OnlyRecognizedChunks

If the value is FALSE (default), the method will calculate the size of the actual headers. This means that, if there were any dropped chunks, these will be counted. Otherwise, the method returns just the bytes of the recognized chunks.

Returns

intThe number of bytes

Extract the portion from the original audio

getWavChunk(int $Start, int $End) : string

Parameters

$Start

int

The time in milliseconds from which to start

$End

int

The time in milliseconds from which to end

Exceptions

\Exception If the file wav is not available or cannot be open.

Returns

string

Convert the array that contain the headers in a string

headersToString() : string

Returns

string

Set the size of the data chunk.

setDataChunkSize(int $Size) 

Parameters

$Size

int

Set the path to the wav file that has to be managed

setFilePath(string $FilePath) 

Parameters

$FilePath

string

Exceptions

\InvalidArgumentException If the file does not exist or if the file does not appear to be a wav.

This method is used to load all the needed classes to let this class works.

autoload() 

 Properties

 

The filename, including the path, of the managed file wav

$FilePath : string

 

An array containing the headers of the wav file

$Headers : array

 

The size in byte of the wav file

$HeadersSize : int