(filename, sample_rate, load_audio_with_librosa)
return example_list[0].SerializeToString()
Processes an audio file into an Example proto.
Processes an audio file into an Example proto.
Processes an audio file into an Example proto .
def create_example(filename, sample_rate, load_audio_with_librosa):
  """Processes an audio file into an Example proto."""
  wav_data = tf.gfile.Open(filename, 'rb').read()
  example_list = list(
      audio_label_data_utils.process_record(
          wav_data=wav_data,
          sample_rate=sample_rate,
          ns=music_pb2.NoteSequence(),
          # decode to handle filenames with extended characters.
          example_id=six.ensure_text(filename, 'utf-8'),
          min_length=0,
          max_length=-1,
          allow_empty_notesequence=True,
          load_audio_with_librosa=load_audio_with_librosa))
  assert len(example_list) == 1
  return example_list[0].SerializeToString()
def create_example ( filename , sample_rate , load_audio_with_librosa ) : wav_data = tf . gfile . Open ( filename , 'rb' ) . read ( ) example_list = list ( audio_label_data_utils . process_record ( wav_data = wav_data , sample_rate = sample_rate , ns = music_pb2 . NoteSequence ( ) , # decode to handle filenames with extended characters. example_id = six . ensure_text ( filename , 'utf-8' ) , min_length = 0 , max_length = - 1 , allow_empty_notesequence = True , load_audio_with_librosa = load_audio_with_librosa ) ) assert len ( example_list ) == 1 return example_list [ 0 ] . SerializeToString ( )