Monday, January 10, 2011

Trimming WMA File Duration

A part of dial-in conferencing services that we just shipped as a part Microsoft Lync 2010 has to do with recording a name for an anonymous user when joining a conference and then playing it during the conference (e.g. "Mike Johnston has joined the conference").

The problem here is that sometimes, depending on a Gateway, there is an ending beep (recorded from the '#' sign that a user presses when she is done with recording). It is difficult to predict in advance how many milliseconds should be cut from the user name recorded file (since in some systems there is no trailing beep at all). By default we cut 500 milliseconds and let the administrator the possibility to configure a different value if she wants to.

What is the best way for admin to figure out how many milliseconds should be trimmed from a file containing a beep? Easy - here is a tool that when run creates a serie of files with n milliseconds  trimmed from its end. Unfortunately it was too late to include this tool as a part of Lync Reskit Tool but this issue should be definitely fixed by the next Lync release.

Instructions:
  • Download the tool, unzip it, and place the executable to a directory, say C:\trim
  • Copy a WMA file containing the trailing beep to the same directory and name it target.wma
  • Run the tool trimfile.exe without any parameters
  • As a result 21 files reslt100.wma, result150.wma, ..., result1000.wma will be created and placed to the same directory. The number indicates (approximate) number of milliseconds cut from the file.
  • Listen to the resulting files to figure out how many milliseconds should be cut from the file.
The tool was created using Windows Media C++ libraries. If you want to play around with it, take a look at main.cppWMVCopy.h and WMVCopy.cpp

No comments:

Post a Comment