(wav_audio, hparams)
return spec
Transforms the contents of a wav file into a series of spectrograms.
Transforms the contents of a wav file into a series of spectrograms.
Transforms the contents of a wav file into a series of spectrograms .
def wav_to_spec(wav_audio, hparams):
  """Transforms the contents of a wav file into a series of spectrograms."""
  if hparams.spec_type == 'raw':
    spec = _wav_to_framed_samples(wav_audio, hparams)
  else:
    if hparams.spec_type == 'cqt':
      spec = _wav_to_cqt(wav_audio, hparams)
    elif hparams.spec_type == 'mel':
      spec = _wav_to_mel(wav_audio, hparams)
    else:
      raise ValueError('Invalid spec_type: {}'.format(hparams.spec_type))

    if hparams.spec_log_amplitude:
      spec = librosa.power_to_db(spec)

  return spec
def wav_to_spec ( wav_audio , hparams ) : if hparams . spec_type == 'raw' : spec = _wav_to_framed_samples ( wav_audio , hparams ) else : if hparams . spec_type == 'cqt' : spec = _wav_to_cqt ( wav_audio , hparams ) elif hparams . spec_type == 'mel' : spec = _wav_to_mel ( wav_audio , hparams ) else : raise ValueError ( 'Invalid spec_type: {}' . format ( hparams . spec_type ) ) if hparams . spec_log_amplitude : spec = librosa . power_to_db ( spec ) return spec