PHP code example of bluemoehre / flac-php

1. Go to this page and download the library: Download bluemoehre/flac-php 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/ */

    

bluemoehre / flac-php example snippets




use bluemoehre\Flac;

header('Content-Type: text/plain;charset=utf-8');

// benchmark start
$t = microtime(true);

$flac = new Flac('mySong.flac');

// benchmark end
$t = microtime(true) - $t;

echo 'Benchmark: ' . $t .'s' . "\n\n";
echo 'Filename: ' . $flac->getFilename() . "\n";
echo 'File size: ' . $flac->getFileSize() . " Bytes\n";
echo 'Meta-Blocks: '; print_r($flac->getMetadataBlockCounts()); echo "\n";
echo 'Sample Rate: ' . $flac->getSampleRate() . "\n";
echo 'Channels: ' . $flac->getChannels() . "\n";
echo 'Bits per sample: ' . $flac->getBitsPerSample() . "\n";
echo 'Total samples: ' . $flac->getTotalSamples() . "\n";
echo 'Duration: ' . $flac->getDuration() . "s\n";
echo 'MD5 checksum (audio data): ' . $flac->getAudioMd5() . "\n";
echo 'Vorbis-Comment: '; nl2br(print_r($flac->getVorbisComment())); echo "\n";