View Full Version : TimeStretch in AVISynth 2.5.5 Alpha - Strange stereo effects ?
aklendathu
26th February 2004, 10:35
The new TimeStretch keyword in AVISynth 2.5.5 Alpha is a great addition as it allows NTSC FILM to PAL conversion using the speedup method by adjusting the audio duration (tempo) without changing the pitch.
That said, however, my initial experiences are a bit disappointing since although perfect a/v sync is maintained, strange stereo effects take place (such as loss of directional sound effects and speech) - for example, as I listen to the original audio with headphones, the speech of one movie character comes from the centre position. Upon conversion, it seems that the character's voice is split in two, each coming from its own channel, and in addition, the relative voice intensity in each channel oscillates, although in that particular dialogue the character is perfectly still and in the centre of the screen.
Has anyone else noticed this yet ? Is it due to some (mis)configuration ?
I used the simple scheme listed as an example: TimeStretch(tempo=(100.0*25.0)/23.976)
sh0dan
26th February 2004, 12:34
To avoid the stereo limitation of the SoundTouch library each channel is processed separately.
I'll ask the author of SoundTouch, if there is any chance it might become multichannel aware.
scharfis_brain
26th February 2004, 12:48
maybe it should converted with middle/side signals, to preserve stereo.
middle = L+R
side = L-R
sh0dan
26th February 2004, 13:12
Easily done. :)
convertaudiotofloat()
l = getchannel(1)
r = getchannel(2)
r_inv = amplify(r, -1.0)
middle = mixaudio(l,r,1.0,1.0).timestretch(pitch=150)
side =mixaudio(l,r_inv,1.0, 1.0).timestretch(pitch=150)
l_new = mixaudio(middle, side, 1.0, 1.0)
r_new = mixaudio(middle, amplify(side, -1.0), 1.0, 1.0)
mergechannels(l_new, r_new)
Left + Right might be swapped.
aklendathu
26th February 2004, 15:14
@Sh0dan:
Thanks for the reply.
Is your code something than can be implemented within an AVS script ?
And, why the pitch=150 in timestretch ?
aklendathu
26th February 2004, 22:15
I used the following script trying to include Sh0dan's code:
WAVSource("H:\FILM_48k.wav")
TimeStretch(tempo=(100.0*25.0)/23.976)
convertaudiotofloat()
l = getchannel(1)
r = getchannel(2)
r_inv = amplify(r, -1.0)
middle = mixaudio(l,r,1.0,1.0)
side =mixaudio(l,r_inv,1.0, 1.0)
l_new = mixaudio(middle, side, 1.0, 1.0)
r_new = mixaudio(middle, amplify(side, -1.0), 1.0, 1.0)
mergechannels(l_new, r_new)
TimeStretch(tempo=(100.0*25.0)/23.976)
a=convertaudioto16bit()
v=AVISource("H:\FILM.avi",audio=false)
AudioDub(v,a)
AssumeFPS(25)
Unfortunately, no improvement is noticeable.
Notice I took out the timestretch in l_new and r_new as it made the speech sound like chip'n'dale...
sh0dan
26th February 2004, 23:53
WAVSource("H:\FILM_48k.wav")
convertaudiotofloat()
l = getchannel(1)
r = getchannel(2)
r_inv = amplify(r, -1.0)
middle = mixaudio(l,r,1.0,1.0)
side =mixaudio(l,r_inv,1.0, 1.0)
l_new = mixaudio(middle, side, 1.0, 1.0).TimeStretch(tempo=(100.0*25.0)/23.976)
r_new = mixaudio(middle, amplify(side, -1.0), 1.0, 1.0).TimeStretch(tempo=(100.0*25.0)/23.976)
a = mergechannels(l_new, r_new)
v=AVISource("H:\FILM.avi",audio=false)
AudioDub(v,a)
AssumeFPS(25)
aklendathu
27th February 2004, 01:53
Thanks for your reply.
My posted script had a bug (TimeStretch twice) but I also tried your
corrected version, without improvement on the quality of the audio.
Is it OK if I post a link to a sample clip for you to look at ?
Bogalvator
27th February 2004, 03:09
Probably no need to send sh0dan a clip, I can verify that TimeStretch is a bit borked at the mo.
Everytime I try it it has the problem you mention, so is probably easily recreated with any sample.
Assume it will be fixed for AviSynth 2.5.5 stable? ;)
sh0dan
27th February 2004, 10:31
Ï have contacted the author, and will hopefully be able to adjust it.
As noted in the documentation seeking is _not_ sampleexact, and my experiments show that this is also cause of some desync, when splitting channels like this.
Thanks for the feedback!
Bogalvator
27th February 2004, 14:23
In the meantime, the SoundTouch implementation in Foobar2000 seems to be working with no problems, so you can still adjust the tempo of the audio this way.
Leak
27th February 2004, 16:46
Originally posted by Bogalvator
In the meantime, the SoundTouch implementation in Foobar2000 seems to be working with no problems, so you can still adjust the tempo of the audio this way.
Or, if you want something automated, there's a command line utility called SoundStretch that you can get from the SoundTouch homepage. Works for me...
np: Delarosa & Asora - Paz Suite 4 (Miss Kittin - Radio Caroline Volume 1 comp.)
aklendathu
1st March 2004, 11:22
Yes, it works OK for me as well.
It would seem that in adapting the SoundTouch libraries for AviSynth some nasty bug was introduced ? That is, assuming the code is pretty similar ...
Well, it's an alpha release anyway... so I guess we've been warned ;)
sh0dan
1st March 2004, 11:42
Originally posted by aklendathu
[B]It would seem that in adapting the SoundTouch libraries for AviSynth some nasty bug was introduced ? That is, assuming the code is pretty similar .../B]
Did you read the thread? To quote myself:
To avoid the stereo limitation of the SoundTouch library each channel is processed separately.
Basicly you have to choose between mono/stereo only processing OR the glitches. I would like to have proper multichannel support, but the author says it isn't likely he'll support it. It might be possible to hack it into the SoundTouch library, but I haven't looked deeper into this.
aklendathu
1st March 2004, 20:04
Originally posted by sh0dan
Did you read the thread? To quote myself:
Basicly you have to choose between mono/stereo only processing OR the glitches. I would like to have proper multichannel support, but the author says it isn't likely he'll support it. It might be possible to hack it into the SoundTouch library, but I haven't looked deeper into this.
I don't understand what you mean by this. The sound track of my clip is 2-channel stereo 48kHz 16-bit wav file. When I process the very same clip using the soundstretch command line utility (which I guess uses the same soundtouch library) I get no distortions whatsoever...
Regards,
Pedro.
sh0dan
7th March 2004, 19:18
ok - Since there is no aparent solution to this, I added a specific stereo mode in SoundTouch, that will enable stereo processing to work without the described problems.
This will be in the next CVS release.
The phase problems however remains when there are more than 2 channels present. I will make a note in the documentation.
aklendathu
10th March 2004, 14:00
Thanks, sh0dan.
I'll keep an eye peeled for the next release.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.