(self, filename, audio_data, sample_rate=None)
return w
Write wav using audio_data[tensor].
    :param filename: filepath of wav.
    :param audio_data: a tensor containing data of a wav.
    :param sample_rate: [option]the samplerate of the signal we working with, default is 16kHz.
    :return: write wav opration.
Write wav using audio_data[tensor].
    :param filename: filepath of wav.
    :param audio_data: a tensor containing data of a wav.
    :param sample_rate: [option]the samplerate of the signal we working with, default is 16kHz.
    :return: write wav opration.
Write wav using audio_data [ tensor ] . : param filename : filepath of wav . : param audio_data : a tensor containing data of a wav . : param sample_rate : [ option ] the samplerate of the signal we working with default is 16kHz . : return : write wav opration .
def call(self, filename, audio_data, sample_rate=None):
    """
    Write wav using audio_data[tensor].
    :param filename: filepath of wav.
    :param audio_data: a tensor containing data of a wav.
    :param sample_rate: [option]the samplerate of the signal we working with, default is 16kHz.
    :return: write wav opration.
    """
    p = self.config
    filename = tf.constant(filename)

    if sample_rate == None:
      sample_rate = tf.constant(p.sample_rate, dtype=tf.int32)

    assert_op = tf.assert_equal(
        tf.constant(p.sample_rate), tf.cast(sample_rate, dtype=tf.int32))
    with tf.control_dependencies([assert_op]):
      audio_data = tf.cast(audio_data / 32768, dtype=tf.float32)
      contents = tf.audio.encode_wav(
          tf.expand_dims(audio_data, 1), tf.cast(sample_rate, dtype=tf.int32))
      w = tf.io.write_file(filename, contents)

    return w
def call ( self , filename , audio_data , sample_rate = None ) : p = self . config filename = tf . constant ( filename ) if sample_rate == None : sample_rate = tf . constant ( p . sample_rate , dtype = tf . int32 ) assert_op = tf . assert_equal ( tf . constant ( p . sample_rate ) , tf . cast ( sample_rate , dtype = tf . int32 ) ) with tf . control_dependencies ( [ assert_op ] ) : audio_data = tf . cast ( audio_data / 32768 , dtype = tf . float32 ) contents = tf . audio . encode_wav ( tf . expand_dims ( audio_data , 1 ) , tf . cast ( sample_rate , dtype = tf . int32 ) ) w = tf . io . write_file ( filename , contents ) return w