is that possible to convert the Audio sample to Spectrogram through APIs in laravel ....is there any package which is good for that ? i want to know for apps which are finding the song by listening the music or sample audio of the song
Other approach would be to invoke ffmpeg manually:
<?php
class SpectrogramCreator
{
const FFMPEG_BIN = '/usr/local/bin/ffmpeg'; // adjust to your system
public function create(string $file_in, string $file_out)
{
$p = new \Symfony\Component\Process\Process([
self::FFMPEG_BIN,
'-y',
'-i',
$file_in,
'-lavfi',
'showspectrumpic=s=800x400:mode=separate',
$file_out,
]);
$p->mustRun();
}
}
Usage:
(new SpectrogramCreator)->create('/tmp/video.mp4', '/tmp/spectrogram.png');
// /tmp/spectrogram.png created
@Glukinho as much as i can understand this thing create the audio fingerprint (image in png format) right then how it is comparing to other audios to fetch the matching song ?
@srushti_kansagara Sorry, it seems I misunterstood the term "spectrogram". I thought you are talking about generating waveforms (images with sound levels), but you are probably looking for something like Shazam...
@Glukinho yahh like one client want an app which should be able to listen to music or part of the audio and should give the matching song list ... so i want to know that this kind of thing is possible in the laravel .. like i can build an API for this app in laravel