code: def magspec(frames, NFFT):
      
      if numpy.shape(frames)[1] > NFFT:
          logging.warn(
              'frame length (%d) is greater than FFT size (%d), frame will be truncated. Increase NFFT to avoid.',
              numpy.shape(frames)[1], NFFT)
      complex_spec = numpy.fft.rfft(frames, NFFT)
      return numpy.absolute(complex_spec)
docs: Compute the magnitude spectrum of each frame in frames. If frames is an NxD matrix, output will be Nx(NFFT/2+1).
  
      :param frames: the array of frames. Each row is a frame.
      :param NFFT: the FFT length to use. If NFFT > frame_len, the frames are zero-padded.
      :returns: If frames is an NxD matrix, output will be Nx(NFFT/2+1). Each row will be the magnitude spectrum of the corresponding frame.