Sound software or .NET library

I need to be able to play certain tones in a C # application. I don’t care if he generates them on the fly or if they reproduce them from a file, but I just need a SOME way to generate tones that have not only a variable volume and frequency, but also a variable timbre. It would be especially useful if everything I used to generate these tones had many preset tones, and it would be even more fun if these tones didn't all sound midi-ish (which means some of them sounded like that as if it could be a recording of real instruments).

Any suggestions?

+4
source share
4 answers

Perhaps you would like to take a look at my question Creating a sine or square wave in C #

Using NAudio in particular was a great choice.

+3
source

This article helped me with something similar: http://social.msdn.microsoft.com/Forums/vstudio/en-US/18fe83f0-5658-4bcf-bafc-2e02e187eb80/beep-beep

In particular, this is the Beep class:

public class Beep { public static void BeepBeep(int Amplitude, int Frequency, int Duration) { double A = ((Amplitude * (System.Math.Pow(2, 15))) / 1000) - 1; double DeltaFT = 2 * Math.PI * Frequency / 44100.0; int Samples = 441 * Duration / 10; int Bytes = Samples * 4; int[] Hdr = {0X46464952, 36 + Bytes, 0X45564157, 0X20746D66, 16, 0X20001, 44100, 176400, 0X100004, 0X61746164, Bytes}; using (MemoryStream MS = new MemoryStream(44 + Bytes)) { using (BinaryWriter BW = new BinaryWriter(MS)) { for (int I = 0; I < Hdr.Length; I++) { BW.Write(Hdr[I]); } for (int T = 0; T < Samples; T++) { short Sample = System.Convert.ToInt16(A * Math.Sin(DeltaFT * T)); BW.Write(Sample); BW.Write(Sample); } BW.Flush(); MS.Seek(0, SeekOrigin.Begin); using (SoundPlayer SP = new SoundPlayer(MS)) { SP.PlaySync(); } } } } } 

It can be used as follows

 Beep.BeepBeep(100, 1000, 1000); /* 10% volume */ 
+2
source
0
source

So that your generated sounds do not sound "midi-ish", you will have to use real samples and play them. Try to find a good bank of real tools, for example http://www.sampleswap.org/filebrowser-new.php?d=INSTRUMENTS+single+samples%2F

Then, when you want to record a melody from them, simply change the playback frequency relative to the original frequency.

Please drop me a line if you find this answer helpful.

0
source

All Articles