From Avisynth wiki
Revision as of 14:39, 18 May 2016 by Raffriff42 (Talk | contribs)
Jump to: navigation, search

AssumeSampleRate(clip clip, int samplerate)

Changes the sample rate of the current clip without changing the number of samples.

This changes the pitch, playback speed and running time of the audio.
It will also affect synchronization with the video.


  • Fix an audio sync problem:
# Let's say that this clip loses audio sync:
# by the end, the audio is behind by 200 milliseconds.

Ar  = AudioRate # original audio sample rate
dur = AudioDuration  # total duration in seconds
adj = -0.200    # correction needed (decrease audio duration by 200 msec)

# Adjust audio duration:
AssumeSampleRate(Round(dur / (dur+adj) * Ar))

# Restore original sample rate while retaining new duration;
# this step is may be skipped if you don't mind a slightly nonstandard sample rate.

# Video and audio are now in sync.
  • Play video and audio at half speed:

# Play video at half speed: audio will be out of sync 

# Play audio at half speed: (pitch will be lowered by an octave)

# Video and audio are now in sync.
# Equivalent to calling AssumeFPS(..., sync_audio=true) (see below)

See Also

If true, the audio sample rate is changed by the same amount; the pitch of the resulting audio is shifted.
If false (the default), the audio is unchanged; this means the audio will lose synchronization over time.
Personal tools