Sets the audio bitrate value.

@param int $bitrate

@return AudioFormatInterface
@throws \InvalidArgumentException
501877
public function setAudioBitrate($bitrate)
	{
		if ( ! is_numeric($bitrate) || $bitrate < 0)
		{
			throw new \InvalidArgumentException('The audio bitrate value must be a integer type.');
		}
		
		$this->audioBitrate = (int) $bitrate;
		
		return $this;
	}
1072726
public function setGrade($grade)
    {
        $allowedValues = $this->getGradeAllowableValues();
        if (!is_null($grade) && !in_array($grade, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'grade', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['grade'] = $grade;

        return $this;
    }
540314
public function setFileSize($size)
    {
        if ($size === null) {
            $this->fileSize = null;

            return $this;
        }

        if (!is_numeric($size)) {
            throw new InvalidArgumentException('File size must be an integer or a float.');
        }

        $this->fileSize = $size;

        return $this;
    }
1169513
public function write_bits($bits)
    {
        $value = 0;

        foreach ($bits as $n => $bit) {
            $bit = $bit ? 1 : 0;
            $value |= ($bit << $n);
        }

        $this->out .= chr($value);

        return $this;
    }
996819
public function getAudioBitRate()
    {
        if ($this->audioBitRate === null) {
            $match = [];
            preg_match(self::$REGEX_AUDIO_BITRATE, $this->output, $match);
            $this->audioBitRate = (int)(array_key_exists(1, $match) ? ($match[1] * 1000) : 0);
        }

        return $this->audioBitRate;
    }
389627
public function setFrequency($frequency)
	{
		if ( ! is_numeric($frequency) || $frequency < 1)
		{
			throw new \InvalidArgumentException('Wrong sample frequency value.');
		}
		
		$this->audioFrequency = $frequency;
		
		return $this;
	}
1322307
public function setFormat($format)
    {
        if (!is_null($format)) {
            $this->format = $format;
            $this->useFormat(false);
        }

        return $this;
    }
90572
public function apply(TranscodeInterface $media, FormatInterface $format)
	{
		$options = [
			'seek_start' => (string) $this->getStartTime()
		];
		
		if ($this->getDuration() !== null)
		{
			if ($this->getDuration()->toSeconds() > $media->getDuration())
			{
				throw new \InvalidArgumentException('The duration value exceeds the allowable value.');
			}
			
			$options['seek_end'] = (string) $this->getDuration();
		}
		
		return $options;
	}
481842
public function setEncoding($encoding)
	{
		if ( ! is_string($encoding) || ! in_array($encoding, mb_list_encodings())) {
			throw new \InvalidArgumentException(
				__METHOD__."() expects parameter one, encoding, to be a valid "
				 . "character encoding name"
			);
		}
		
		$this->encoding = $encoding;
		
		return $this;
	}
632319
public function setFormat($format)
    {
        if (in_array($format, TextFormat::asArray()) === true) {
            $this->format = $format;
        } else {
            $msg = "The 'format' argument must be a value from the TextFormat enumeration, '" . gettype($format) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
540137
public function setBitrate($bitrate)
    {
        $deferred = new Deferred();

        if ($bitrate > 128000 || $bitrate < 8000) {
            $deferred->reject(new \InvalidArgumentException("{$bitrate} is not a valid option. The bitrate must be between 8,000bpm and 128,000bpm."));

            return $deferred->promise();
        }

        if ($this->speaking) {
            $deferred->reject(new \Exception('Cannot change bitrate while playing.'));

            return $deferred->promise();
        }

        $this->bitrate = $bitrate;

        $deferred->resolve();

        return $deferred->promise();
    }
161528
public function setDuration($seconds)
    {
        $seconds = round($seconds, 3);

        if ($seconds < 0 || $seconds > 999999.999) {
            throw new InvalidArgumentException('Duration seconds must be in range 0-999999.999');
        }

        $this->duration = $seconds;

        return $this;
    }
823188
public function setTaxRate($taxRate)
    {
        if (empty($taxRate) || ! is_numeric($taxRate)) {
            throw new \InvalidArgumentException('Please supply a valid tax rate.');
        }

        $this->taxRate = $taxRate;
        
        return $this;
    }
1264800
public function setFrameRate($frameRate)
	{
		if ( ! is_numeric($frameRate) || $frameRate < 0)
		{
			throw new \InvalidArgumentException('Wrong the frame rate value.');
		}
		
		$this->videoFrameRate = $frameRate;
		
		return $this;
	}
1164120
public static function bitrate ($bitrate, $unit = '')
		{
			if (is_numeric($bitrate) and $bitrate >= 0)
			{
				if (( !$unit && $bitrate >= 1000000 ) || $unit == 'mb/s')
					return round($bitrate / ( 1000000 )) . ' mb/s';
				elseif (( !$unit && $bitrate >= 1000 ) || $unit == 'kb/s')
					return round($bitrate / ( 1000 )) . ' kb/s';

				return round($bitrate) . ' b/s';
			}

			return null;
		}
299595
public function setFormat($format) {
        if ($format === null) {
            $format = [];
        } else if ( ! is_array($format)) {
            $format = [$format];
        }

        $this->format = $format;

        return $this;
    }
311726
public function setEmailFormat($format)
    {
        if (!in_array($format, $this->_emailFormatAvailable)) {
            throw new InvalidArgumentException('Format not available.');
        }
        $this->_emailFormat = $format;

        return $this;
    }