An example of what I'm trying to do is this: https://youtu.be/rSRJ4VIoP-A?t=176
Here's an example of an array that I want to play through the speakers as an audio waveform oscillator, a centered sinc function on an array of 256 items.
I'm familiar with making sine waves, which is a continuous function plotted on an array of an indefinite length. For example, on NAudio (https://markheath.net/post/playback-of-sine-wave-in-naudio):
The question is, how can you replace the sine code with the contents of the specified array?
public class SineWaveProvider32 : WaveProvider32
{
int sample;
public SineWaveProvider32()
{
Frequency = 1000;
Amplitude = 0.25f; // let's not hurt our ears
}
public float Frequency { get; set; }
public float Amplitude { get; set; }
public override int Read(float[] buffer, int offset, int sampleCount)
{
int sampleRate = WaveFormat.SampleRate;
for (int n = 0; n < sampleCount; n++)
{
buffer[n+offset] = (float)(Amplitude * Math.Sin((2 * Math.PI * sample * Frequency) / sampleRate)); //this is the line that does the sine wave. I'm trying to replace it with a specified array to use as a sample
sample++;
if (sample >= sampleRate) sample = 0;
}
return sampleCount;
}
}