Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            WaveAudio test = new WaveAudio(44100, 1);

            test.LengthInSamples = 44100 * 7;
            double freq             = 100;                     //300;
            PeriodicAlternative osc = new PAChangeSquare(4.0); //new PASin();

            for (int i = 0; i < test.LengthInSamples; i++)
            {
                test.data[0][i] = 0.9 * osc.GetValue(i * freq * 2.0 * Math.PI / (double)44100.0);
            }
            //player.Play(test, true);

            WaveAudio win    = new WaveAudio(strMedia + "acoust.wav");
            WaveAudio wmixed = WaveAudio.Mix(WaveAudio.Modulate(test, win), 0.7, win, 0.3);

            player.Play(wmixed, true);
        }
Пример #2
0
        public static void operations_test(AudioPlayer pl)
        {
            WaveAudio noteLongLow = new Triangle(Triangle.FrequencyFromMidiNote(60), 0.5).CreateWaveAudio(1.0);
            WaveAudio noteShortHi = new Triangle(Triangle.FrequencyFromMidiNote(64), 0.5).CreateWaveAudio(0.5);

            pl.Play(WaveAudio.Concatenate(noteLongLow, noteShortHi));
            pl.Play(WaveAudio.Concatenate(noteShortHi, noteLongLow));
            pl.Play(WaveAudio.Mix(noteShortHi, noteLongLow));
            pl.Play(WaveAudio.Mix(noteLongLow, noteShortHi));
            WaveAudio tmp = new Sine(200, 1.0).CreateWaveAudio(4.0);

            tmp.setNumChannels(2, true);
            pl.Play(WaveAudio.Modulate(new WaveAudio(mediadir + "d44k16bit2ch.wav"), tmp));

            WaveAudio cp;

            cp = noteLongLow.Clone(); cp.FadeIn(0.3); pl.Play(cp);
            cp = noteLongLow.Clone(); cp.FadeOut(0.3); pl.Play(cp);
            cp = noteLongLow.Clone(); cp.Amplify(0.5); pl.Play(cp);
            cp = noteLongLow.Clone(); cp.Amplify(2.0); pl.Play(cp);
        }