def detect_MIDI_notes(self):
        """
            The algorithm for calculating midi notes from a given wav file.
        """

        (framerate, sample) = wav.read(self.wav_file)
        
        # We need to change the 2 channels into one because STFT works only
        # for 1 channel. We could also do STFT for each channel separately.
        #monoChannel = sample.mean(axis=1)
        
        duration = getDuration(self.wav_file)
        midi_notes = []

        # Consider only files with a duration longer than 0.2 seconds.
        if duration > 0.18:
            #print 'Calculating FFT...'

            (FFT, filteredFreqs, maxFreq, magnitudes, significant_freq) = self.calculateFFT(duration, framerate, sample)
            #plotPartials(filteredFreqs, maxFreq, magnitudes)
            #print FFT
            #print filteredFreqs
            #print filteredFreqs
            #plotPowerSpectrum(FFT, get_frequencies_axis(framerate, int(duration * framerate)), maxFreq)

            #plotPowerSpectrum(FFT, filteredFreqs, 1000)
            #print filteredFreqs
            #print 'Clustering frequencies...'
            clusters = self.clusterFrequencies(filteredFreqs)
            #print clusters
            #print 'Getting clusters means...'
            averagedClusters = self.getClustersMeans(clusters)
            #print averagedClusters
            #print averagedClusters
            #print 'Getting F0 candidates...'
            #print averagedClusters
            f0_candidates = self.getF0Candidates(averagedClusters)
            #print f0_candidates
            #print f0_candidates
            #print 'Matching with MIDI notes...'
            midi_notes = self.matchWithMIDINotes(f0_candidates)

            # Include a note with a significant magnitude:
            # if its magnitude is higher than the sum of magnitudes of all other spectral peaks
            # include it in the list of detected notes and remove the note that's octave lower than this one
            # if it was also detected.
            if significant_freq > 0:
                significant_midi_notes = self.matchWithMIDINotes([significant_freq])
                significant_midi_note = significant_midi_notes[0]
                if midi_notes not in significant_midi_note:
                    midi_notes.append(significant_midi_note)
                    midi_notes = self.remove_lower_octave(significant_midi_note, midi_notes)

            #print 'Successfully detected MIDI notes.'
            '''
            for i in range(len(midi_notes)):
                midi_notes[i] = midi_notes[i]+1
            '''
        return midi_notes
dataset/ETHPy150Open Agerrr/Automated_Music_Transcription/least_squares_first_peaks_2.py/MIDI_Detector_Least_Squares_2.detect_MIDI_notes/swapped operands of `not in`