# How to difference a loud sound (playing notes), from a soft noise in spectrum. (Pitch detection with bass)

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?

• " 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. Apr 7, 2020 at 7:44
• 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. Apr 7, 2020 at 8:05
• Ok, so you have a long audio segment and you perform STFT? Apr 7, 2020 at 8:15
• 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? Apr 7, 2020 at 8:17
• 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. Apr 7, 2020 at 8:35