haoheliu / AudioLDM

AudioLDM: Generate speech, sound effects, music and beyond, with text.
https://audioldm.github.io/
Other
2.45k stars 222 forks source link

Is there any docs on how to run Super Resolution? #104

Closed DamienDeepgram closed 1 year ago

DamienDeepgram commented 1 year ago

I found this code but no examples how to run it

olaviinha commented 1 year ago

I assume because there is not that much real-world demand for upsampling lower quality audio to 16 kHz.

This should work:

def superres(text, duration, audio_path, guidance_scale, random_seed, n_candidates, steps):
  waveform = super_resolution_and_inpainting(
    audioldm,
    text,
    audio_path,
    random_seed,
    ddim_steps=steps,
    duration=duration,
    guidance_scale=guidance_scale,
    n_candidate_gen_per_text=n_candidates,
    time_mask_ratio_start_and_end=(1.0, 1.0)
    freq_mask_ratio_start_and_end=(0.75, 1.0)
  )
  if(len(waveform) == 1):
    waveform = waveform[0]
  return waveform

low_quality_audio = 'path/to/very_low_quality_audio.wav'
upsampled_16k_audio = superres(None, 12, low_quality_audio, 2.5, 666, 3, 200)
DamienDeepgram commented 1 year ago

Awesome thanks