code: def write(series, output, scale=None):
      
      fsamp = int(series.sample_rate.decompose().value)
      if scale is None:
          scale = 1 / numpy.abs(series.value).max()
      data = (series.value * scale).astype('float32')
      return wavfile.write(output, fsamp, data)
docs: Write a `TimeSeries` to a WAV file
  
      Parameters
      ----------
      series : `TimeSeries`
          the series to write
  
      output : `file`, `str`
          the file object or filename to write to
  
      scale : `float`, optional
          the factor to apply to scale the data to (-1.0, 1.0),
          pass `scale=1` to not apply any scale, otherwise
          the data will be auto-scaled
  
      See also
      --------
      scipy.io.wavfile.write
          for details on how the WAV file is actually written
  
      Examples
      --------
      >>> from gwpy.timeseries import TimeSeries
      >>> t = TimeSeries([1, 2, 3, 4, 5])
      >>> t = TimeSeries.write('test.wav')