0
$\begingroup$

I'm trying a program that outputs the bass line that you are playing. I have some arrays from a big one with the sound in time domain, that are splited (Hann window). Later, I do the FFT, then I get the peak of each array and apply the harmonic product spectrum algorithm.

Finally, I'm trying to filter all frequencies bellow 39hz and above 440hz, that include all frec. in the bass in E standart. I've tried to eliminate the noise.

I want to distinguish my FFT output when I play my instrument, from when I don't, taking advantage of the frequency filter, I have made the program assume that when it plays a note that is less than 39hz, it automatically takes it as noise. The problem appears when the noise is greater than 39hz (it can be from 0hz to 60hz even) and many of the notes I play on the bass are below 60hz, so with this system I cannot know when I make sound because I'am playing, and when the predominant sound is noise and I'm not playing.

So I need to know how to interpret the FFT output to know when I actually play and when I don't.

The FFT output is the energy (I think) of each frequency in the sound wave, and I have tried to eliminate all FFT outputs below 0.5 (The output is normalized from -1 as minimum value to 1 as maximum value of amplitude in the spectrogram), so I really don't know if this works.

Could anyone to tell me how to identify when I play and when I don't?

$\endgroup$
7
  • $\begingroup$ " I have some arrays from a big one with the sound in time domain". Arrays of what? microphones? what exactly is "a big one"? please, better explain your situation. $\endgroup$
    – havakok
    Commented Apr 7, 2020 at 7:44
  • $\begingroup$ 1 Big Array with all the record of my bass in time domain, splitted into many arrays in time domain. Then I'm applying the fft on each. Array 1D of double type of data, with an amplitude between -1 to 1. $\endgroup$
    – Meliodas
    Commented Apr 7, 2020 at 8:05
  • $\begingroup$ Ok, so you have a long audio segment and you perform STFT? $\endgroup$
    – havakok
    Commented Apr 7, 2020 at 8:15
  • $\begingroup$ Does the original audio segment contain other instruments or only you playing your bass? Is that an electric bass, that is, is the noise an environmental one or a noise generated from the recording devices? $\endgroup$
    – havakok
    Commented Apr 7, 2020 at 8:17
  • $\begingroup$ It's only the bass. I"m recording through a cable, so the noise comes from the recording device I assume. I'm splitting into arrays of 12.000 frames, that is one sample. The sound is record with 48.000Hz, 16 bits each sample. So each second I'm getting 4 frames, and I'm applying fft on each one. $\endgroup$
    – Meliodas
    Commented Apr 7, 2020 at 8:35

1 Answer 1

0
$\begingroup$

The intuitive answer is to threshold with respect to the magnitude.

You are performing a short-time Fourier transform (STFT), that is, segmenting the original into short time windows and performing Fourier transform on each of them. The output of STFT is a frequency-time (t-f) bin table of complex values.

There is an inherent tradeoff in STFT. The shorter your windows are the higher is your time resolution and the lower is your frequency resolution. If you want a high-frequency resolution you will have to use longer windows at the cost of poor time resolution. This paper gives a clue on window length optimization. otherwise, you can simply use the common music window length from papers or online examples. For bass, the frequencies are low = long wavelength, hence, you will want longer windows.

Basically, you can get the magnitude and\or the angle of your t-f table. Assuming your bass has much more energy than the noise gathered by the system, you can look at the magnitude of bins in the required frequency range and drop time segments below a certain threshold. Play a bit with the result and present it as an image. It will give you a science of where to cut. This is a MATLAB example of presenting the magnitude as an image (also called spectrogram)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.