0

I have a script where a user uploads an MP3 of themself stating their name. Ultimately i would like to trim any dead air from the beginning of the mp3, so that when you click play, it instantly starts with the users voice.

My Question is

How can i take an MP3 and detect at what position in the recording the first sound is made using PHP.

AlBeebe
  • 8,101
  • 3
  • 51
  • 65

3 Answers3

2

FFMPEG might help but not 100% sure. PHP cannot do it on it's own.

FFMPEG has two parts:

  • Server software called FFMPEG.
  • PHP extension called FFMPEG-PHP

You will also need the appropriate codes probably.

transilvlad
  • 13,974
  • 13
  • 45
  • 80
1

even easier to do it with sox, here be the link: http://digitalcardboard.com/blog/2009/08/25/the-sox-of-silence/

Maciej Jankowski
  • 2,794
  • 3
  • 26
  • 33
0
  • Check PHP exec documentation: here
  • Download sox: here

Run this

sox inputfile.mp3 outputfile.mp3 silence 1 0.1 0.1% reverse silence 1 0.1 0.1% reverse

source

Community
  • 1
  • 1
Mancilla
  • 38
  • 6
  • 1
    The proper way to submit link-only answers is either to post them as comments or post the relevant data in your answer. Link-only answers are usually flagged for deletion. – NSNoob Nov 16 '15 at 10:59
  • So it would be acceptable if I did it like that but, instead of linking the whole sentence, linked a "[link]" at the end of each sentence? BTW, last line is the code AlBeebe needs to making sox work. – Mancilla Nov 17 '15 at 11:51
  • you should share the link too for reference but just to protect your answer from becoming irrelevant if the link ever changes, you should add necessary info to your answer as well. And You should format the last line as code by editing tools. – NSNoob Nov 17 '15 at 11:54