def _pcm2wav()

in tts/src/tts/amazonpolly.py [0:0]


    def _pcm2wav(self, audio_data, wav_filename, sample_rate):
        """per Amazon Polly official doc, the pcm in a signed 16-bit, 1 channel (mono), little-endian format."""
        wavf = wave.open(wav_filename, 'w')
        wavf.setframerate(int(sample_rate))
        wavf.setnchannels(1)  # 1 channel
        wavf.setsampwidth(2)  # 2 bytes == 16 bits
        wavf.writeframes(audio_data)
        wavf.close()