Processing wav file with VST?

Apr 13, 2010 at 9:05 PM

Hello, I'm trying to use the VST.Net and NAudio frameworks to build an application that processes audio using a VST plugin.

Ideally, the application should load a wav or mp3 file, process it with the VST, and then write a new file.

I have done some poking around with the VST.Net library and was able to compile and run the samples (specifically the VST Host one). What I have not figured out is how to load an audio file into the program and have it write a new file back out.

I'd like to be able to configure the properties for the VST plugin via C#, and be able to process the audio with 2 or more consecutive VSTs.

Using NAudio, I was able to create this simple script to copy an audio file. Now I just need to get the output from the WaveFileReader into the VST.Net framework somehow.

  private void processAudio()
   
{
        reader
= new WaveFileReader("c:/bass.wav");
        writer
= new WaveFileWriter("c:/bass-copy.wav", reader.WaveFormat);
       
int read;
       
while ((read = reader.Read(buffer, 0, buffer.Length)) > 0)
       
{
            writer
.WriteData(buffer, 0, read);
       
}

        textBox1
.Text = "done";

        reader
.Close();
        reader
.Dispose();
        writer
.Close();
        writer
.Dispose();
   
}

Please help!! Thanks

References:

http://vstnet.codeplex.com (VST.Net)

http://naudio.codeplex.com (NAudio)

Apr 14, 2010 at 9:55 AM

I'm not sure to have completely understood what you try to develop but I think you will find very useful the VST.NET Jacobi.VST.Samples.Delay example (you can download the sources from the VST.NET codeplex page).

For my MP3/WAV VST Player that uses both VST.NET and NAUDIO I've started from this project to configure the base plugin properties (I've also studied portion of MidiNoteMapper code because it implements a wrapper for a standard Windows.form interface).

Once you have built the base VST plugin in the AudioProcessor.cs you can insert all the necessary code to, open, process and output the sound to the VSTAudioBuffer and/or to the WAVEFILEWRITER class.

 

I hope that this generic answer could help you to find the right way to approach your project. 

Coordinator
Apr 15, 2010 at 4:29 PM

What is needed is a WaveStream with an overriden Read method that passes the data through the VST effect. I would love to find the time to have a play with VST.NET but haven't done so yet, so I don't know how easy this would be to implement.

Let us know how you get on, because I would like to include this functionality as part of the NAudio demo project.

Mark

 

Apr 20, 2010 at 2:01 PM

The mismatch between a waf file and an audio buffer in VST is that the waf file uses an interlaced format and VST separates each channel into its own buffer.

@paul:

I've commented on your original question in the VST.NET discussion list here: http://vstnet.codeplex.com/Thread/View.aspx?ThreadId=205889

Lets continue that discussion there, for it is not a real NAudio topic.