original_docstring: Write an audio content as a Audio Interchange File Format file.
  
          :param filename: (str) output filename.
  
          
docstring: Write an audio content as a Audio Interchange File Format file.
docstring_tokens: Write an audio content as a Audio Interchange File Format file .
code: def save(self, filename):
          """Write an audio content as a Audio Interchange File Format file.
  
          :param filename: (str) output filename.
  
          """
          if self._audio_fp is not None:
              self.rewind()
              frames = self._audio_fp.readframes(self._audio_fp.getnframes())
              self.save_fragment(filename, frames)
  
          elif len(self) == 1:
              channel = self._channels[0]
              fp = open(filename, 'w')
              f = aifc.open(fp)
              f.setnchannels(1)
              f.setsampwidth(channel.get_sampwidth())
              f.setframerate(channel.get_framerate())
              f.setnframes(channel.get_nframes())
              try:
                  AiffIO._write_frames(f, channel.get_frames())
              finally:
                  f.close()
  
          else:
              self.verify_channels()
  
              frames = b""
              sp = self._channels[0].get_sampwidth()
              for i in range(0, self._channels[0].get_nframes()*sp, sp):
                  for j in range(len(self._channels)):
                      fc = self._channels[j].get_frames()
                      frames += fc[i:i+sp]
  
              f = aifc.open(filename, 'w')
              f.setnchannels(len(self._channels))
              f.setsampwidth(sp)
              f.setframerate(self._channels[0].get_framerate())
              f.setnframes(self._channels[0].get_nframes())
              try:
                  AiffIO._write_frames(f, frames)
              finally:
                  f.close()
code_tokens: def save ( self , filename ) : if self . _audio_fp is not None : self . rewind ( ) frames = self . _audio_fp . readframes ( self . _audio_fp . getnframes ( ) ) self . save_fragment ( filename , frames ) elif len ( self ) == 1 : channel = self . _channels [ 0 ] fp = open ( filename , 'w' ) f = aifc . open ( fp ) f . setnchannels ( 1 ) f . setsampwidth ( channel . get_sampwidth ( ) ) f . setframerate ( channel . get_framerate ( ) ) f . setnframes ( channel . get_nframes ( ) ) try : AiffIO . _write_frames ( f , channel . get_frames ( ) ) finally : f . close ( ) else : self . verify_channels ( ) frames = b"" sp = self . _channels [ 0 ] . get_sampwidth ( ) for i in range ( 0 , self . _channels [ 0 ] . get_nframes ( ) * sp , sp ) : for j in range ( len ( self . _channels ) ) : fc = self . _channels [ j ] . get_frames ( ) frames += fc [ i : i + sp ] f = aifc . open ( filename , 'w' ) f . setnchannels ( len ( self . _channels ) ) f . setsampwidth ( sp ) f . setframerate ( self . _channels [ 0 ] . get_framerate ( ) ) f . setnframes ( self . _channels [ 0 ] . get_nframes ( ) ) try : AiffIO . _write_frames ( f , frames ) finally : f . close ( )
short_docstring: Write an audio content as a Audio Interchange File Format file.
short_docstring_tokens: Write an audio content as a Audio Interchange File Format file .
comment: """Write an audio content as a Audio Interchange File Format file.
  
          :param filename: (str) output filename.
  
          """