Click here to Skip to main content
15,886,609 members
Articles / Programming Languages / C#
Article

Audio DSP with C#

Rate me:
Please Sign up or sign in to vote.
4.55/5 (23 votes)
6 Sep 20032 min read 219.6K   8.7K   92   28
A .NET class library for audio processing.

Sample Image - audio_process.jpg

Introduction

Garbe.Sound is a small .NET library for audio processing. The principal idea is to give programmers with a RAD environment for developing audio filters. With the basic classes, it comes with a few filters already implemented, like:

  • Gain Filter
  • Delay Filter
  • LowPass Filter
  • Mixer
  • Reverberation
  • Head Related Transfer Function (HRTF)
  • Read and Write Wave Files (just mono yet)

The library is still a Beta 1 Version, but is already functional. Any comments are welcome!! :)

Using the code

One of the ideias of the library is to be easy of programming. Trying to do so, I choose a sistematic view of the classes in the library, where each filter can be perceived like a box with a input and output signal.

Almost all classes in the library inheritance from SoundObj class, that implements this basic sistematic view. This permits that you write code like this:

C#
WaveReader    wr1 = new WaveReader("teste2.wav");
WaveReader    wr2 = new WaveReader("teste.wav");
Gain        ga1 = new Gain(0.5f);
Gain        ga2 = new Gain(0.5f);
Mixer        mx  = new Mixer(2);
WaveWriter    wwl = new WaveWriter("exit.wav", wr1.NumChannels, 
                                 wr1.SampleRate, wr1.BitsPerSamples, 1, true);
            
ga1.Input = wr1;
ga2.Input = wr2;
mx[0] = ga1;
mx[1] = ga2;
wwl.Input = mx;
            
for(int k = 0; k < wwl.Interations; k++)
{
    wr1.DoProcess();
    wr2.DoProcess();
    ga1.DoProcess();
    ga2.DoProcess();
    mx.DoProcess();
    wwl.DoProcess();
}

wr1.Close();
wr2.Close();
wwl.Close();

This is a very simple code that just have 2 signal inputs (teste.wav and teste2.wav), amplify both by 0.5 (ga1 and ga2 objects), mixes both in just one signal that is the output of the signal, wich is saved as exit.wav.

Links

History

  • 02.09.2003 - Beta 1

Bugs and Comments

If you have any comments or find some bugs, I would love to hear about it and make it better.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Brazil Brazil
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 2 Pin
gunzygcs12-Feb-09 7:28
gunzygcs12-Feb-09 7:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.