Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //star wars
- int[] melodia = { 440, 440, 440, 349, 523, 440, 349, 523, 440, 0, 659, 659, 659, 698, 523, 415, 349, 523, 440, 0, 880, 880, 440, 440, 880, 831, 784, 698, 740, 0, 622, 659, 415, 440, 523, 0, 440, 523, 440, 0 };
- int[] czasTrwania = { 500, 500, 500, 350, 150, 500, 350, 150, 650, 500, 500, 500, 500, 350, 150, 500, 350, 150, 650, 500, 500, 500, 350, 150, 500, 350, 150, 650, 150, 500, 150, 500, 150, 1000, 500, 350, 150, 500, 350, 150, 650 };
- using (var waveOut = new WaveOutEvent())
- {
- for (int i = 0; i < frequencies.Length; i++)
- {
- if (frequencies[i] != 0)
- {
- var sineWave = new SignalGenerator()
- {
- Gain = 0.2,
- Frequency = frequencies[i],
- Type = SignalGeneratorType.Sin
- }.Take(TimeSpan.FromMilliseconds(durations[i]));
- waveOut.Init(sineWave);
- waveOut.Play();
- while (waveOut.PlaybackState == PlaybackState.Playing)
- {
- Thread.Sleep(10);
- }
- }
- else
- {
- Thread.Sleep(durations[i]);
- }
- }
- }
- //Mario Bros
- int[] melodia = { 659, 659, 0, 659, 0, 523, 659, 0, 784, 0, 392, 0, 523, 0, 392, 0, 330, 0, 440, 494, 0, 466, 0, 440, 0, 392, 659, 0, 784, 780, 0, 784, 0, 659, 0, 523, 587, 0, 494, 0, 523, 0, 392, 0, 330, 0, 440, 494, 0, 466, 0, 440, 0 };
- int[] czasTrwania = { 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 400, 200, 200, 200, 400, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 400, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200 };
- using (var waveOut = new WaveOutEvent())
- {
- for (int i = 0; i < frequencies.Length; i++)
- {
- if (frequencies[i] != 0)
- {
- var sineWave = new SignalGenerator()
- {
- Gain = 0.2,
- Frequency = frequencies[i],
- Type = SignalGeneratorType.Sin
- }.Take(TimeSpan.FromMilliseconds(durations[i]));
- waveOut.Init(sineWave);
- waveOut.Play();
- while (waveOut.PlaybackState == PlaybackState.Playing)
- {
- Thread.Sleep(10);
- }
- }
- else
- {
- Thread.Sleep(durations[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement