Media_ConvertSound ( container ; filename ; soundType { ; parameters } )
Media_ConvertSound converts a sound file to different sound format.
Parameter | Description |
---|---|
container | Location of the sound to be converted. |
filename | Output file name. | soundType | Output sound file format (hex code from Media_ListSoundOutputFormats). | parameters | Optional parameter. Convert settings in XML. |
The available list of sound formats can be obtained using the Media_ListSoundOutputFormats function. Media_ConvertSound can use either the full line description returned by Media_ListSoundOutputFormats or simply the 8-digit hex code at the beginning of the line.
The optional format settings parameter is an XML value that is obtained using the Media_SoundFormatDialog function. If this parameter is left empty “” the user is shown a format settings dialog. The XML format is new in MediaManager 18.
AAC License and MPEG-4 Sound Files
Most sound format codecs, like WAV and AIFF, are automatically loaded, registered, and available through QuickTime. The AAC encoder format includes MPEG-4 audio and video (“.mp4”, “.m4a”, etc.) files. On Windows, AAC/MPEG-4 encoding requires a special registration. You can purchase an inexpensive AAC license from 1stplugins https://www.1stplugins.com/. Macintosh users can convert to AAC/MPEG-4 format without an AAC license.
MP3 Audio Format
MediaManager is able to handle MP3 audio files. If you want to convert to MP3 format, however, you must first install a third-party MP3 encoder, such as LAME (see https://en.wikipedia.org/wiki/LAME for explanation and links). Once you’ve installed the MP3 encoder and rebooted your system, you should see MP3 as one of the options listed by the Media_ListSoundOutputFormats function and incorporate it into the Media_ConvertSound function.
Examples
To convert a sound to WAV format, giving the user the option to set the convert settings when the script runs:
Set Field [ MyTable::Sound Converted ;
Media_ConvertSound (
MyTable::Sound Original ;
"soundConverted.wav" ;
"57415645"
) ]
To convert a sound using the type format stored in a field (which uses the result of a Media_ListSoundOutputFormats calc as the value list):
Set Field [ MyTable::Sound Converted ;
Media_ConvertSound (
MyTable::Sound Original ;
"soundConverted" ;
MyTable::Sound Formats
) ]
To convert a sound to WAV format, with the optional settings preset with Media_SoundFormatDialog in a preference field:
Set Field [ MyTable::Sound Converted ;
Media_ConvertSound (
MyTable::Sound Original ;
"soundConverted.wav" ;
"57415645" ;
MyTable::WAV Settings
) ]