pinterf / AviSynthPlus

AviSynth with improvements
http://avs-plus.net
208 stars 24 forks source link

"Evaluate: Unhandled C++ exception!" on "TimeStretch" #42

Closed belonesox closed 4 years ago

belonesox commented 4 years ago

Lets consider small script with example of speed up with pitch compensation for audio. For old AVS it works.

For AVS+

audio = WavSource("d.wav").ConvertAudioToFloat().SSRC(48000)
video = Version()
scene = AudioDub(video, audio)

function SpeedUpByX(scene, times) {
    origaudiorate = scene.AudioRate 
    scene = scene.AssumeFPS(scene.FrameRate*times, sync_audio=true).ChangeFPS(24)
    scene = scene.TimeStretch(pitch=100.0/times)
    scene = scene.ResampleAudio(origaudiorate)
    return scene
}

#return SpeedUpByX(scene, 4) #ok
return SpeedUpByX(scene, 5) #NOT ok [avisynth @ 037e77c0] Evaluate: Unhandled C++ exception!

Sample files https://drive.google.com/file/d/1FFOJPMH32IaIFVPGHucQSEsouwMi0oAe/view?usp=sharing (41K)

AVS+ 32bit, debug, from

commit 4c4635eaa32689336d45a26c5b326598242d6b2b
Author: Pinterf <pinterfer@gmail.com>
Date:   Mon Nov 25 12:33:11 2019 +0100
pinterf commented 4 years ago

Thanks, first step done, reproducible.

pinterf commented 4 years ago

The problem is that the effective sample rate is 240000, but over 192000 in internal exception is thrown. if (aSampleRate > 192000) ST_THROW_RT_ERROR("Error: Excessive samplerate"); This TimeStretch plugin is an external one from http://www.surina.net/soundtouch/ Its internal exceptions - by which the parameter checking problems are signing - are not handled specifically, we are seeing only an unhandled C++ exception.

pinterf commented 4 years ago

Fixed: proper error message is now shown.