public function dcaEncode($filename = '', $channels = 2)
    {
        // if (! empty($filename) && ! file_exists($filename)) {
        //     return;
        // }

        $flags = [
             '-ac', $channels, // Channels
             '-aa', $this->audioApplication, // Audio application
             '-ab', round($this->bitrate / 1000), // Bitrate
             '-as', round($this->frameSize * 48), // Frame Size
            '-vol', round($this->volume * 2.56), // Volume
              '-i', (empty($filename)) ? 'pipe:0' : "\"{$filename}\"", // Input file
        ];

        $flags = implode(' ', $flags);

        return new Process("{$this->dca} {$flags}");
    }
public function dcaEncode($filename = '', $channels = 2)
    {
        // if (! empty($filename) && ! file_exists($filename)) {
        //     return;
        // }

        $flags = [
             '-ac', $channels, // Channels
             '-aa', $this->audioApplication, // Audio application
             '-ab', round($this->bitrate / 1000), // Bitrate
             '-as', round($this->frameSize * 48), // Frame Size
            '-vol', round($this->volume * 2.56), // Volume
              '-i', (empty($filename)) ? 'pipe:0' : "\"{$filename}\"", // Input file
        ];

        $flags = implode(' ', $flags);

        return new Process("{$this->dca} {$flags}");
    }
public function dcaEncode ( $ filename = '' , $ channels = 2 ) { // if (! empty($filename) && ! file_exists($filename)) { //     return; // } $ flags = [ '-ac' , $ channels , // Channels '-aa' , $ this -> audioApplication , // Audio application '-ab' , round ( $ this -> bitrate / 1000 ) , // Bitrate '-as' , round ( $ this -> frameSize * 48 ) , // Frame Size '-vol' , round ( $ this -> volume * 2.56 ) , // Volume '-i' , ( empty ( $ filename ) ) ? 'pipe:0' : "\"{$filename}\"" , // Input file ] ; $ flags = implode ( ' ' , $ flags ) ; return new Process ( "{$this->dca} {$flags}" ) ; }
Encodes a file to Opus with DCA.

@param string $filename The file name that will be encoded.
@param int    $channels How many audio channels to encode with.

@return Process A ReactPHP Child Process
Encodes a file to Opus with DCA .