code: def signal(self, force_fs=False):
          assert None not in self.voltage_limits, 'Max voltage level not set'
          if force_fs:
              samplerate = force_fs
          else:
              samplerate = self.samplerate()
          track_signals = []
          max_db = max([comp.intensity() for t in self._segments for comp in t])
          atten = 0
          for track in self._segments:
              track_list = []
              for component in track:
                  track_list.append(component.signal(fs=samplerate, 
                                                     atten=0, 
                                                     caldb=self.caldb, 
                                                     calv=self.calv))
              if len(track_list) > 0:   
                  track_signals.append(np.hstack(track_list))
          full_len = len(max(track_signals, key=len))
          total_signal = np.zeros((full_len,))
          for track in track_signals:
              total_signal[0:len(track)] += track
          component_names = list(set([comp.name for track in self._segments for comp in track]))
          if 'silence' in component_names:
              component_names.remove('silence')
          if len(component_names) > 1 or (len(component_names) == 1 and component_names[0] != "Square Wave"):
              total_signal = convolve_filter(total_signal, self.impulseResponse)
              maxv = self.voltage_limits[0]
              to_speaker = True
          else:
              maxv = self.voltage_limits[1]
              to_speaker = False
          total_signal[-1] = 0
          undesired_attenuation = 0
          minv = self.voltage_limits[2]
          sig_max = np.max(abs(total_signal))
          if sig_max > maxv:
              total_signal = (total_signal/sig_max)*maxv
              attenuated = 20 * np.log10(sig_max/maxv)
              if attenuated <= atten:
                  atten = atten - attenuated
              else:
                  undesired_attenuation = attenuated - atten
                  atten = 0
                  logger = logging.getLogger('main')
                  logger.warning("STIMULUS AMPLTIUDE {:.2f}V EXCEEDS MAXIMUM({}V), RESCALING. \
                      UNDESIRED ATTENUATION {:.2f}dB".format(sig_max, maxv, undesired_attenuation))
          elif sig_max < minv and sig_max !=0 and to_speaker:
              before_rms = np.sqrt(np.mean(pow(total_signal,2)))
              total_signal = (total_signal/sig_max)*minv
              after_rms = np.sqrt(np.mean(pow(total_signal,2)))
              attenuated = -20 * np.log10(before_rms/after_rms)
              atten += attenuated
          return total_signal, atten, undesired_attenuation