public void buildList(AudioParsing.WAV file, int threshold, int resolution) { // initialize data storage, chunked data is a collection of samples, where resolution is number of samples per chunk. // matches is a dictionary that stores a sample's index and a list of all other samples indicies that are deemed similar enough matches = new Dictionary <int, List <int> >(); int[][] chunkedData = new int[2][]; for (int i = 0; i + resolution < file.audio[0].Length; i += resolution) { // initialize chunkedData[0] as the chunk we are comparing the rest of the samples to // and initialize it to a slice of size resolution from i-i+resolution of samples chunkedData[0] = file.audio[0][i..(i + resolution)];
static void Main(string[] args) { AudioParsing.WAV newWav = new AudioParsing.WAV("Don't Care.wav"); AudioParsing.DifferenceChecker differ = new AudioParsing.DifferenceChecker(); differ.buildList(newWav, 10000, 50000); var ms = new MemoryStream(newWav.wavFile); var rs = new RawSourceWaveStream(ms, new WaveFormat((int)newWav.dwSamplesPerSec, (int)newWav.dwBitsPerSample, (int)newWav.wChannels)); var outputDevice = new WaveOutEvent(); outputDevice.Init(rs); outputDevice.Play(); while (outputDevice.PlaybackState == PlaybackState.Playing) { Thread.Sleep(1000); outputDevice.Pause(); Random random = new Random(); int num = random.Next(checked ((int)newWav.dataSize)); rs.Position = num; outputDevice.Play(); } }