<commit_before><?php
/*
 * This file is part of M4rconverter.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace M4rconverter\Format\Audio;

use FFMpeg\Format\Audio\Aac;

class M4rconverterAac extends Aac
{
    protected $params = ['-map', '0:a', '-map_metadata', '-1', '-c:a', 'libfdk_aac', '-f', 'ipod'];
    public function __construct(array $options = [])
    {
             $this->generateParams($options);
    }
  /**
   * Add more options to the comandline ffmpeg command.
   *
   * @return array
   */
  public function getExtraParams()
  {
      return $this->params;
  }

  public function generateParams(array $options) {
      // set comadline options
      $duration = (isset($options['duration'])) ? $options['duration'] : '';
      $seek = (isset($options['seek'])) ? $options['seek'] : '';
      $setParams = [];

      if (!empty($duration)) {
          $setParams[] = '-t';
          $setParams[] = $duration;
      }

      if (!empty($seek)) {
          $setParams[] = '-ss';
          $setParams[] = $seek;
      }

//      if(isset($options['duration'])){
//         $setParams = ['-af','afade=t=out:st='.($options['duration'] - 1).':d=1','-t',$options['duration']] ;
//      }

      $this->params =  array_merge($this->params,$setParams);

  }
}<commit_msg>add fade at the end<commit_after><?php
/*
 * This file is part of M4rconverter.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace M4rconverter\Format\Audio;

use FFMpeg\Format\Audio\Aac;

class M4rconverterAac extends Aac
{
    protected $params = ['-map', '0:a', '-map_metadata', '-1', '-c:a', 'libfdk_aac', '-f', 'ipod'];
    public function __construct(array $options = [])
    {
             $this->generateParams($options);
    }
  /**
   * Add more options to the comandline ffmpeg command.
   *
   * @return array
   */
  public function getExtraParams()
  {
      return $this->params;
  }

  public function generateParams(array $options) {
      // set comadline options
      $duration = (isset($options['duration'])) ? $options['duration'] : '';
      $seek = (isset($options['seek'])) ? $options['seek'] : '';
      $setParams = [];

      if (!empty($duration)) {
          $setParams[] = '-t';
          $setParams[] = $duration;

          //add a fade at the end
          $setParams[] = '-af';
          $setParams[] = 'afade=t=out:st='.($options['duration'] - 1).':d=1';

      }

      if (!empty($seek)) {
          $setParams[] = '-ss';
          $setParams[] = $seek;
      }


      $this->params =  array_merge($this->params,$setParams);

  }
}
{'fraction_non_alphanumeric': 0.18510562119584675, 'fraction_numerical': 0.005012531328320802, 'mean_word_length': 2.6618610747051115, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '349633', 'n_tokens_mistral': 909, 'n_tokens_neox': 894, 'n_words': 209}