Abstract A novel cuboid method with particle swarm optimization (PSO) is proposed to attenuate real-life noise from heart sound (HS) signals. Firstly, the quasi-cyclic feature of HS is explored. It is found that for each cycle of HS, the fragmental signals at similar time section have similar frequency and energy. Based on this finding, short-time Fourier transform (STFT) is employed to decompose each HS cycle into time–frequency fragments which are called granules. Next, a cuboid is built for each granule to identify and see if it is a constituent of HS or noise. The dimensions of cuboid’s length, width, and height are optimized by PSO. An objective function of PSO based on the normalized autocorrelation coefficient is proposed. Then, granules representing HS are retained and merged into noise-quasi-free HS signal. The proposed de-noising method is assessed using mean square error (MSE) and compared with the recently proposed wavelet multi-threshold method (WMTM) and Tang’s method. The experimental results show that the proposed method not only filters HS signal effectively but also well retains its pathological information.