Z
Z
Zvercheg2018-01-27 19:43:53
C++ / C#
Zvercheg, 2018-01-27 19:43:53

How to work with sound in C#?

The idea is to check if one audio track is similar to another. Both were recorded with a microphone. To do this, with the help of C# and the NAudio library, I took the values ​​from the microphone. Got a WAV file. Further drove values ​​in an array of bytes (byte a []). And got 1.2 million values ​​for a 9s track. I tried to compare them into a "stupid" million values ​​with a million and got outright nonsense. I have a book on hand that describes musical notes in GHz, an example of La 1 act (A1) = 440 GHz. Now the question is how many values ​​are responsible for this note A (I have a sampling rate = 44100 and 2 channels). How can I understand that at this moment in time the amplitude is 440, and in another second, let's assume 330. From this array. I was advised to use FFT OFT (Fast Fourier Transform or Windowed Fourier Transform) but frankly I don't fully understand how they work and what they can give me. I ask for help, who does not feel sorry for their time - explain.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
res2001, 2018-01-27
@Zvercheg

In wav, the signal is written in the time domain, i.e. how it is removed from the microphone and converted to a number in this form and ends up in wav (well, this is a simplified version). There are no frequencies in the time domain. Frequencies are sinusoids. The time domain is the sum of all the sinusoids that make up the signal.
To go to frequencies (hertz) you need to perform a discrete Fourier transform (in matlab - fft() ).
The output of fft will be an array of frequencies. The first half of the array will have what you need, take the element with index 440 (frequency 440 Hz), the value of this element will be the amplitude of the frequency 440 Hz.

R
Roman Mirilaczvili, 2018-01-31
@2ord

You need to search on the subject of acoustic imprint. Let's say https://en.wikipedia.org/wiki/Acoustic_fingerprint
There is also a pHash library.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question