Optimizing and updating ringtone code

Nathan Hjelm <[email protected]> Thu, 05 Mar 2009 14:00:06 -0700
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <[email protected]>
I find that adjustwavfilevolume is horribly slow on my macbook pro so  
I propose we change it to use ffmpeg -vol. This change will require a  
new build off ffmpeg for each platform (I have a universal binary for  
macos x ready). The speed increase is more than an order of magnitude  
(it took around 60 seconds to start playing a 260 second song with the  
old routine and it now takes about a second).

Here is the updated routine:
def adjustwavfilevolume(wavfilename, gain):
     """ Ajdust the volume of a wav file.
     """
     temp_name=common.gettempfilename("wav")
     ffmpeg=gethelperbinary ("ffmpeg")
     run(ffmpeg, "-i", wavfilename, "-vol", `int(pow(10.0, gain/10.0)  
* 256.0)`, temp_name)
     os.remove(wavfilename)
     os.rename(temp_name, wavfilename)

Additionally, since I want to add support for mpeg4 (AAC audio)  
ringtones support since all new phone models support them (I have  
already finished the code). AAC sounds better than mp3 at comparable  
bitrates. AAC support requires that the new build of ffmpeg has  
support for libfaac and libfaad.

Any comments?

-Nathan Hjelm

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H