public function insertSilence($duration = 1.0)
    {
        $numSamples  = (int)($this->getSampleRate() * abs($duration));
        $numChannels = $this->getNumChannels();

        $data = str_repeat(self::packSample($this->getZeroAmplitude(), $this->getBitsPerSample()), $numSamples * $numChannels);
        if ($duration >= 0) {
            $this->_samples .= $data;
        } else {
            $this->_samples = $data . $this->_samples;
        }

        $this->setDataSize();  // implicit setSize(), setActualSize(), setNumBlocks()

        return $this;
    }
public function insertSilence($duration = 1.0)
    {
        $numSamples  = (int)($this->getSampleRate() * abs($duration));
        $numChannels = $this->getNumChannels();

        $data = str_repeat(self::packSample($this->getZeroAmplitude(), $this->getBitsPerSample()), $numSamples * $numChannels);
        if ($duration >= 0) {
            $this->_samples .= $data;
        } else {
            $this->_samples = $data . $this->_samples;
        }

        $this->setDataSize();  // implicit setSize(), setActualSize(), setNumBlocks()

        return $this;
    }
public function insertSilence ( $ duration = 1.0 ) { $ numSamples = ( int ) ( $ this -> getSampleRate ( ) * abs ( $ duration ) ) ; $ numChannels = $ this -> getNumChannels ( ) ; $ data = str_repeat ( self :: packSample ( $ this -> getZeroAmplitude ( ) , $ this -> getBitsPerSample ( ) ) , $ numSamples * $ numChannels ) ; if ( $ duration >= 0 ) { $ this -> _samples .= $ data ; } else { $ this -> _samples = $ data . $ this -> _samples ; } $ this -> setDataSize ( ) ; // implicit setSize(), setActualSize(), setNumBlocks() return $ this ; }
Add silence to the wav file.

@param float $duration  (Optional) How many seconds of silence. If negative, add to the beginning of the file. Defaults to 1s.
Add silence to the wav file .