Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

New Post: making a tone file

$
0
0
I am trying to make a tone file and it is working. but it is not sounding the way I want it to sound. There is a low tone beat in the file. that I did not add to it. And I do not know why it is there.. here is my code:
 wavefile = new WaveFileWriter(save1.FileName, tone.WaveFormat);
                        double counter2 = 0;
                        double Frequency3 = Convert.ToDouble(FREtx3.Text);
                        double Amplitude3 = Convert.ToDouble(PeakTXT3.Text);
                        Beat = Convert.ToDouble(isochronictxt.Text);
                        if (Beat != 0)
                        {
                            Beat = (1 / Beat);
                        }
                        else
                        {
                            Beat = 0;
                        }
                        for (int n = 0; n < time; n++)
                        {
                            if (counter2 >= Beat)
                            {
                                for (int t = 0; t < 10000; t++)
                                {
                                    wavefile.WriteSample(0F);
                                    wavefile.WriteSample(0F);
                                    
                                }

                                counter2 = 0;
                            }
                            else
                            {
                                wavefile.WriteSample((float)Math.Abs((Amplitude3 * Math.Sin((2 * Math.PI * n * Frequency3) / 44100))));
                                wavefile.WriteSample((float)Math.Abs((Amplitude3 * Math.Sin((2 * Math.PI * n * Frequency3) / 44100))));
                                counter2 = counter2 + (1D / 44100D);     
                            }
                        }
                        wavefile.Flush();
                        wavefile.Dispose();
                        file.Add(save1.FileName);
                    }
where is that tone coming from ?
https://onedrive.live.com/redir?resid=CC8AF223519E2440!114&authkey=!ADGTKdZEpF4F4Q4&ithint=file%2c.wav

you can download the song file there...
where is that lost tone coming from ??

Viewing all articles
Browse latest Browse all 5831

Trending Articles