"Audero Wav Extractor" is a PHP library that allows to extract a chunk from a wav file.
The extracted chunk of the wav file can be saved on the hard disk, can be forced to be prompted as download by the user's browser, returned as a string for a later processing or a combination of the first and second possibilities. It is very easy to use "Audero Wav Extractor" to extract a piece of audio from a wav file. All you have to do is give the name of the file, the start and the end time to extract (optionally you can provide a name for the extracted chunk).
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.
| package | Audero\WavExtractor |
|---|---|
| author | Aurelio De Rosa |
| license | CC BY-NC 3.0 |
| link | https://bitbucket.org/AurelioDeRosa/audero-wav-extractor |
__construct(string $filePath)
It loads all the required class and create the Wav object that represents the chosen one.
stringThe filename, including the path, of the managed file wav
downloadChuck(int $start, int $end, string $filename) : void
intThe start time, in milliseconds, of the portion to extract
intThe end time, in milliseconds, of the portion to extract
stringThe filename that will be shown by the browser
extractChunk(int $start, int $end, int $destination, string $filename) : string
The chunk will be saved, with name $filename, in the local server, the browser or the user and so on based on the value of $Destination.
The possible value of $Destination are:
| deprecated | Since version 2.0.0 |
|---|
intThe start time, in milliseconds, of the portion to extract
intThe end time, in milliseconds, of the portion to extract
intWhere to save the extracted chunk
string&$filename The name to assign to the chunk. If no name is provided the method generate one using this rule: "InputFilename-Start-End.wav"
\InvalidArgumentException |
If the give boundary is invalid (for example if the end is lower than start) or if the destination value isn't valid (for example greater than 4). |
|---|---|
\RuntimeException |
If there's not enough memory to save the given range |
stringThe chunk to extract, including the headersgetChunk(int $start, int $end) : string
intThe start time, in milliseconds, of the portion to extract
intThe end time, in milliseconds, of the portion to extract
\InvalidArgumentException |
If the give boundary is invalid (for example if the end is lower than start) or if the destination value isn't valid (for example greater than 4). |
|---|---|
\RuntimeException |
If there's not enough memory to save the given range |
stringThe chunk to extract, including the headersgetWav() : \Audero\WavExtractor\Wav\Wav
\Audero\WavExtractor\Wav\WavThe current wav fileisEnoughMemory(int $start, int $end) : bool
intThe start time, in milliseconds, of the chunk that has to be extracted
intThe end time, in milliseconds, of the chunk that has to be extracted
booltrue if the memory is enough. false otherwise.saveChunk(int $start, int $end, string $filename) : void
intThe start time, in milliseconds, of the portion to extract
intThe end time, in milliseconds, of the portion to extract
stringThe filename to use to save the file on the hard disk
\InvalidArgumentException |
If the chunk is empty |
|---|---|
\Exception |
If the library is unable to create the file on the hard disk |
getFilename(boolean $includeExtension) : string
If false is passed, the extension of the file is stripped.
booleanInclude or not the extension (.wav) of the file. Default is true.
stringThe filename of the managed wav file$wav : \Audero\WavExtractor\Wav\Wav