Just as AviSynth supports video plug-ins it would make sense for it to also support the already existing range of high quality audio plug-ins (both free and commercial) already available. There are several audio plug-in standards, but I don't find the choice very difficult:
* RTAS: ProTools only.
* PowerCore: PowerCore hardware only.
* DirectSound: Windows only, generally abandoned because of inadequate preset architechture and missing automation possibilities.
* AudioUnit: Mac only.
* VST 2.4: The most widespread standard for the last 15 years on both Windows and Mac despite Apple's attempts at killing it.
I think it would make much more sense to give access to the tremendously large amount of existing VST plugins, than trying to invent a new standard all over again, hoping for enough plugins to be ported to AviSynth. Let me summarize what VST plugins can do (from memory, so might be lacking details):
1) Mono and stereo processing (but channel count is specified as any number in the API as far as I recall)
2) Input and output is 32-bit floats, typically in the range from -1.00 to +1.00 unless the signal exceeds maximum 0dB, which is quite possible internally in most audio software because they are floats.
3) A number of presets can be saved and/or loaded by the host application (avisynth)
4) Any parameter of a VST plugin could be accessed and controlled dynamically by AviSynth through the movie being processed (so volume fades, filter sweeps and many more things are possible.)
5) Each parameter is accessible as a number to the host app (avisynth), but I think you could also address them by name if the name is unique.
6) Most VST plugins offer displaying a UI. If they don't, the host application is expected to present a UI, but I think this could be skipped in the case of AviSynth.
VST is a standard defined by Steinberg, but it is not more "closed" or proprietary than the .avi format, and is well accepted in the freeware community (see www.kvraudio.com for many examples.) There are many professional quality VST plugins available which are highly suitable for movie conversion related operations, such as compression, limiters, EQs, stereo processing of various kinds.
Being a sound engineer, I do not quite have the sufficient skills to implement a full blown VST host into AviSynth, but I did manage to code a few VST plugins, and I am sure I could answer many questions if anyone felt the urge to try implementing this into AviSynth. I hope someone can see the vast possibilities in this. Comments are welcome. :)
The Avisynth plugin api already supports audio processing with the GetAudio() method of the IClip interface. There is also a standard ConvertAudio inbuilt that will automatically convert any supported input format to a format that the filter can successfully process.
There are existing plugins that can load and run Sox and Bass audio plugins, I see no immediate impediment to writing a similar plugin to support VST plugins.
// instantiable null filter
class GenericVideoFilter : public IClip {
protected:
PClip child;
VideoInfo vi;
public:
GenericVideoFilter(PClip _child) : child(_child) { vi = child->GetVideoInfo(); }
PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env) { return child->GetFrame(n, env); }
void __stdcall GetAudio(void* buf, __int64 start, __int64 count, IScriptEnvironment* env) { child->GetAudio(buf, start, count, env); }
const VideoInfo& __stdcall GetVideoInfo() { return vi; }
bool __stdcall GetParity(int n) { return child->GetParity(n); }
int __stdcall SetCacheHints(int cachehints,int frame_range) { return 0; };
};
and
class ConvertAudio : public GenericVideoFilter
/**
* Helper class to convert audio to any format
**/
{
public:
ConvertAudio(PClip _clip, int prefered_format);
void __stdcall GetAudio(void* buf, __int64 start, __int64 count, IScriptEnvironment* env);
int __stdcall SetCacheHints(int cachehints,int frame_range); // We do pass cache requests upwards, to the cache!
static PClip Create(PClip clip, int sample_type, int prefered_type);
....