/// Processes the given text into WAV audio data and writes it to a given file.
/// 
/// This handles the `Vec<i16>` to `Vec<u8>` conversion internally.
/// 
/// # Errors
/// See [`Speaker::synthesize`] + the file writing failed.
Processes the given text into WAV audio data and writes it to a given file.
This handles the `Vec` to `Vec` conversion internally.
Processes the given text into WAV audio data and writes it to a given file . This handles the ` Vec ` to ` Vec ` conversion internally .
pub fn synthesize_to_file(&mut self, file: &mut std::fs::File, text: &str) -> Result<()> {
        let audio_data_i16 = self.synthesize(text)?;
        let audio_data: Vec<u8> = audio_data_i16.into_iter().flat_map(i16::to_le_bytes).collect();
        file.write_all(&audio_data)?;
        Ok(())
    }
pub fn synthesize_to_file ( & mut self , file : & mut std :: fs :: File , text : & str ) -> Result < ( ) > { let audio_data_i16 = self . synthesize ( text ) ? ; let audio_data : Vec < u8 > = audio_data_i16 . into_iter ( ) . flat_map ( i16 :: to_le_bytes ) . collect ( ) ; file . write_all ( & audio_data ) ? ; Ok ( ( ) ) }
Processes the given text into WAV audio data and writes it to a given file.
Processes the given text into WAV audio data and writes it to a given file .
&mut self
file
&mut std::fs::File
text
&str
errors
See [`Speaker::synthesize`] + the file writing failed.
See [ ` Speaker :: synthesize ` ] + the file writing failed .