PHP code example of rezon73 / wave

1. Go to this page and download the library: Download rezon73/wave library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rezon73 / wave example snippets




use Rezon73\Wave\Wave;

$wave = new Wave();
$wave->setFilename('path/to/your/file.wav');

$metadata = $wave->getMetadata();
$metadata->getName();
$metadata->getSize();
$metadata->getFormat();
$metadata->getChannels();
$metadata->getSampleRate();
$metadata->getBytesPerSecond();
$metadata->getBlockSize();
$metadata->getBitsPerSample();
$metadata->getExtensionSize();
$metadata->getExtensionData();

// Assuming we already analyzed the wave...
$data = $wave->getWaveformData();

// Get the amplitude values for each channel
foreach($data->getChannels() as $channel) {
    $amplitudes[] = $channel->getValues();
}

$wave->setSteps(10000);