function wave_file_path($file_path)
{
    $file_path = media_file_path($file_path);
    return $file_path . 'media.wav';
}
 function __buildAudio($file_path)
 {
     if (!empty($this->_options['EncoderAudioExtension'])) {
         if (get_file_info('audio', $file_path, $this->_options['PathFFmpeg'])) {
             $this->_progressStep('EncodeAudio', 5, 'Encoding Audio ' . $file_path);
             $media_path = media_file_path($file_path);
             $audio_path = $media_path . 'audio.' . $this->_options['EncoderAudioExtension'];
             $switches = array();
             if (!safe_path($audio_path)) {
                 throw new RuntimeException('Could not create path: ' . $audio_path);
             }
             $cmd = '';
             $cmd .= $this->_options['PathFFmpeg'] . ' -i ';
             $cmd .= $file_path;
             $cmd .= ' -ab ' . $this->_options['EncoderAudioBitrate'] . 'k';
             $cmd .= ' -ar ' . $this->_options['EncoderAudioFrequency'];
             //$cmd .= ' -acodec ' . $this->_options['EncoderAudioExtension'];
             $cmd .= ' -vn ' . $audio_path;
             $response = $this->_shellExecute($cmd);
             if (!$response) {
                 throw new RuntimeException('Problem with audio command: ' . $cmd);
             }
             if (!file_exists($audio_path)) {
                 throw new RuntimeException('Could not build audio: ' . $response);
             }
             $cached_wav = cache_file_wav($file_path, $switches, $this->_options['PathFFmpeg']);
             if (!$cached_wav) {
                 throw new RuntimeException('Could not determine path to audio wav file: ' . $file_path);
             }
             if (!empty($this->_options['Verbose'])) {
                 $this->log($cached_wav['command']);
             }
             if (!$cached_wav['path']) {
                 throw new RuntimeException('Could not build audio wav file: ' . $file_path);
             }
             $wav_file_path = $cached_wav['path'];
             // get a more accurate duration reading from WAV file
             if (!($meta_path = meta_file_path('blah', $wav_file_path))) {
                 throw new RuntimeException('Could not determine meta path for ' . $wav_file_path);
             }
             if (!($meta_dir = dir_path($meta_path))) {
                 throw new RuntimeException('Could not determine dir path of ' . $meta_path);
             }
             if (!($duration = get_file_info('duration', $wav_file_path, $this->_options['PathFFmpeg']))) {
                 throw new RuntimeException('Could not determine duration of ' . $wav_file_path);
             }
             if (!set_file_info($file_path, 'duration', $duration)) {
                 throw new RuntimeException('Could not set duration of ' . $file_path);
             }
             // make waveform graphic
             $this->_ignore[] = $wav_file_path;
             $audio_path = $media_path . 'audio.' . $this->_options['EncoderWaveformExtension'];
             $cmd = '';
             $cmd .= $this->_options['PathWaveformGenerator'] . ' --input ' . $wav_file_path;
             $cmd .= ' --height 64 --width 2800';
             $cmd .= ' --linecolor ' . $this->_options['EncoderWaveformForecolor'];
             $cmd .= ' --padding 0';
             $cmd .= ' --backgroundcolor ' . $this->_options['EncoderWaveformBackcolor'];
             $cmd .= ' --output ' . $audio_path;
             $response = $this->_shellExecute($cmd);
             if (!file_exists($audio_path)) {
                 throw new RuntimeException('Could not create waveform graphic: ' . $cmd);
             }
             $this->_shellExecute('rm -R ' . $meta_dir);
             $this->_progressStep('EncodeAudio', 100, 'Encoded Audio');
         }
     }
 }