code: def write_wave(path, audio, sample_rate):
      
      with contextlib.closing(wave.open(path, 'wb')) as wf:
          wf.setnchannels(1)
          wf.setsampwidth(2)
          wf.setframerate(sample_rate)
          wf.writeframes(audio)
docs: Writes a .wav file.
  
      Takes path, PCM audio data, and sample rate.