Umamio
14th October 2008, 19:44
Following from this post (http://forum.doom9.org/showthread.php?p=1178485#post1178485) I was wondering if anyone knew how to turn this pseudo-code into a working avisynth script:
introVideo = AviSource("Intro.avi")
introStereoAudio =WavSource("IntroAudio-Stereo.wav")
introSixChannelAudio = WavSource("IntroAudio-51.wav")
filmVideo = dgdecode_mpeg2source("Wahwahwah.d2v")
filmAudio = ac3Source("SourceAudioOfDoom.ac3")
function AudioMaker(int channels)
{
if channels>0
{
if (channels > 5) # 5.1 and above
{
if (channels == 6)
audio = introSixChannelAudio
else
audio = MergeChannels(introSixChannelAudio, AudioMaker(channels-6))
}
else
{
if ((channels%2) == 1) #OddNumber of Channels
{
if (channels == 1)
audio = introStereoAudio.ConvertToMono
else
audio = MergeChannels(introStereoAudio , AudioMaker(channels-2))
}
else #Even Channels
{
if (channels == 2)
audio = introStereoAudio
else
audio = MergeChannels(introStereoAudio , AudioMaker(channels-2))
}
}
}
else { assert("No audio, fool! Avisynth explosion imminent") }
return audio
}
AudioDub(introVideo, AudioMaker(filmAudio.audioChannels)) ++ AudioDub(filmVideo, filmAudio)
The idea is, I have an intro video with a stereo source and a 5.1 source (fake 5.1, the stereo was run through besweet and converted to 5.1) and I want to be able to join the intro to films that can have any number of audio channels (>0 , <infinity)
The original idea was:
"I am thinking of making a poor man's audio mixer for the intro audio. Along the lines of:
If film has 1 audio channel, Merge Stereo -> Mono
If film has 2 audio channels, Use stereo
If film has 3 audio channels, Use stereo (left and right) channels + used merged audio on centre channel
if film has 4 audio channels, use stereo on front 2 and back 2,
if film has 5 audio channels, use stereo on front 2 and back 2, use merged stereo on centre
if film has 6 audio channels, use 5.1 source"
But the position of the audio does not matter so much at the moment.
Thanks for any help!
introVideo = AviSource("Intro.avi")
introStereoAudio =WavSource("IntroAudio-Stereo.wav")
introSixChannelAudio = WavSource("IntroAudio-51.wav")
filmVideo = dgdecode_mpeg2source("Wahwahwah.d2v")
filmAudio = ac3Source("SourceAudioOfDoom.ac3")
function AudioMaker(int channels)
{
if channels>0
{
if (channels > 5) # 5.1 and above
{
if (channels == 6)
audio = introSixChannelAudio
else
audio = MergeChannels(introSixChannelAudio, AudioMaker(channels-6))
}
else
{
if ((channels%2) == 1) #OddNumber of Channels
{
if (channels == 1)
audio = introStereoAudio.ConvertToMono
else
audio = MergeChannels(introStereoAudio , AudioMaker(channels-2))
}
else #Even Channels
{
if (channels == 2)
audio = introStereoAudio
else
audio = MergeChannels(introStereoAudio , AudioMaker(channels-2))
}
}
}
else { assert("No audio, fool! Avisynth explosion imminent") }
return audio
}
AudioDub(introVideo, AudioMaker(filmAudio.audioChannels)) ++ AudioDub(filmVideo, filmAudio)
The idea is, I have an intro video with a stereo source and a 5.1 source (fake 5.1, the stereo was run through besweet and converted to 5.1) and I want to be able to join the intro to films that can have any number of audio channels (>0 , <infinity)
The original idea was:
"I am thinking of making a poor man's audio mixer for the intro audio. Along the lines of:
If film has 1 audio channel, Merge Stereo -> Mono
If film has 2 audio channels, Use stereo
If film has 3 audio channels, Use stereo (left and right) channels + used merged audio on centre channel
if film has 4 audio channels, use stereo on front 2 and back 2,
if film has 5 audio channels, use stereo on front 2 and back 2, use merged stereo on centre
if film has 6 audio channels, use 5.1 source"
But the position of the audio does not matter so much at the moment.
Thanks for any help!