hosted by liquidweb

Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : anyone good with SOX?need code for fade out

Forum Jump

anyone good with SOX?need code for fade out

Reply Post New Thread In Programming Discussion Subscription
Send news tip View All Posts Thread Tools Search this Thread Display Modes
Web Hosting Master
Join Date: Aug 2008
Posts: 1,526

anyone good with SOX?need code for fade out

Hi All,

I have been struggling a lot on this problem and you are my last chance.
My users will be uploading mp3s on my server, I am trying to get all the mp3s to fade out after 1 minute or even better at the half of each song.
I have this code:

shell_exec('/usr/bin/sox input_file.mp3 output_file.mp3 fade t 0 200 5');

It works well with other effect but not with fade out.
The SOX manual says that the middle number "t 0 200 5" should be the length of the track, the last number the fade out length and the first number the fade in length but there is a problem, it is impossible for me to know the middle number in advance because others will be uploading the songs and not me, any any how to change this script in order to accept any song length?



Sponsored Links
Junior Guru
Join Date: Sep 2008
Posts: 191
Keep in mind that I know nothing about SoX here.

Apparently you can do sox -D input.mp3 to get the track length. You should be able to take that value and divide it to get the middle of the song.

Maybe something like this?
PHP Code:
$length floor(shell_exec('/usr/bin/soxi -D input_file.mp3') / 2);
shell_exec('/usr/bin/sox input_file.mp3 output_file.mp3 fade t 0 ".$length." 5'); 

Last edited by Btcc22; 12-17-2009 at 11:33 PM.
Web Hosting Master
Join Date: Aug 2008
Posts: 1,526
Hi Btcc22,

Thanks for your help,

I am going to give it a go and see if something similar to this works,

Thanks for your great help :-)


Sponsored Links

Similar Threads
Thread Thread Starter Forum Replies Last Post
ffmpeg fade out bambinou Programming Discussion 4 11-22-2009 08:21 PM
fade away frames hopesfall Programming Discussion 1 05-24-2008 05:33 PM
Yankees or Red Sox? shotthebreeze Web Hosting Lounge 6 09-10-2006 04:57 PM
CSS Fade riscphree Programming Discussion 9 12-07-2005 06:13 AM
Fade in Fade out slide show? *Link* Z400Central Programming Discussion 5 11-18-2004 12:07 AM

Related posts from
Title Type Date Posted
Web Hosting Sales and Promos Roundup – December 26, 2014 Web Hosting News 2014-12-26 16:25:20
Web Host Code Spaces Closes Shop After Hacker Deletes Customer Data Web Hosting News 2014-06-19 16:34:41
Web Hosting Sales and Promos Roundup - May 2, 2014 Web Hosting News 2014-05-23 16:54:17
Web Hosting Sales and Promos Roundup – April 11, 2014 Web Hosting News 2014-05-23 15:42:21
Free Registration with the WHIR Coupon Code Blog 2014-01-30 13:24:20

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Log in with your username and password

Forgot Password?
WHT Host Brief Email:

We respect your privacy. We will never sell, rent, or give away your address to any outside party, ever.

Web Hosting News:
WHT Membership
WHT Membership



Welcome to

Create your username to jump into the discussion! is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.

(4 digit year)

Already a member?