This is the first time I try to analyse audio stream on C#. Without any experience, it will be grateful that you share your solution. :)
Using NAudio(an opensource for C# dealing with audio), I try to compare two audio stream with the following stages:
Read in a .wav file and store in float[] in 16 Bits:
audio = new AudioFileReader("test.wav"); _buffer = new float[wave.length]; audio.Read (_buffer, 0, _buffer.Length);
Pass the
float[]
toSmbPitchShifter()
, and set thePitchShift=1
(not change the pitch), set the osamp as the hop size, and pass the _buffer.sps = new SmbPitchShifter(); sps.PitchShift(1, _buffer.Length, 2048, 32, 44100, _buffer);
Last, compare two STFT float[] using DTW algorithm.
Now, I am stucked at the stage 2, and have some questions:
1. I do not exactly know what is my sampleRate, but set it to 44100 as default...
2. After the above code, I got a new _buffer float[], with
dater after stage2 1: https://imgur.com/a/VLmHJ
as I know the data after STFT should be [-1.0, 1.0). What step did I miss, or I am completely wrong at the beginning?
3. I have no idea what window is NAudio used.NAudio.Dsp.SmbPitchShifter.CS from github
These bothered me for a long time. As you can tell I am new in audio analyse, and i am really appreciate for your advice. Have a good day.