public void WriteChunk(AudioChunk chunk) { short[] data = chunk.GetData(); for (int i = 0; i < data.Length; i++) { _writer.Write(data[i]); } }
public static AudioChunk MakeChordChunk(int duration, int frequency, int amplitude, int channelCount = 2) { AudioChunk chunk = new AudioChunk(); chunk.AddOscillator(WaveType.Sine, duration, frequency, amplitude, channelCount); chunk.AddOscillator(WaveType.Square, duration, frequency, amplitude, channelCount); //chunk.AddOscillator(WaveType.Sawtooth, duration, frequency, amplitude, channelCount); return(chunk); }
public static AudioChunk MakeBassChunk(int duration, int frequency, int amplitude, int channelCount = 2) { AudioChunk chunk = new AudioChunk(); chunk.AddOscillator(WaveType.Triangle, duration, frequency, amplitude, channelCount); //chunk.AddOscillator(WaveType.Sawtooth, duration, frequency, amplitude, channelCount); //chunk.AddOscillator(WaveType.Square, duration, frequency + 50, amplitude / 2, channelCount); //chunk.AddOscillator(WaveType.Sawtooth, duration, frequency + 50, amplitude / 2, channelCount); //chunk.AddOscillator(WaveType.Square, duration, 5, amplitude , channelCount); //chunk.AddOscillator(WaveType.Sawtooth, duration, 5, amplitude, channelCount); //chunk.AddOscillator(WaveType.Square, duration, 20, amplitude / 3, channelCount); //chunk.AddOscillator(WaveType.Sawtooth, duration, 20, amplitude / 3, channelCount); return(chunk); }