Skip to content

Instantly share code, notes, and snippets.

@tommycutter
Created February 1, 2022 16:12
Show Gist options
  • Save tommycutter/3f91117277812d87979c999c49b830a9 to your computer and use it in GitHub Desktop.
Save tommycutter/3f91117277812d87979c999c49b830a9 to your computer and use it in GitHub Desktop.
<?php
$fileName = time().'.mp3';
$fileUrl = $_GET['fileUrl'];
$jsonOutputFile = time().'-normalized.json';
file_put_contents($fileName, file_get_contents($fileUrl));
exec('audiowaveform -i '.$fileName.' -o '.$jsonOutputFile.' --pixels-per-second 20 --bits 8');
sleep(5);
echo file_get_contents($jsonOutputFile);
unlink($fileName);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment