from audiocraft.audiogen import AudioGen #, audio_write | |
import audiofile | |
import numpy as np | |
print('\n\n\n\n___________________') | |
txt = 'sea waves rock crash pirates' | |
sound_generator = AudioGen.get_pretrained('facebook/audiogen-medium') | |
sound_generator.set_generation_params(duration=.7) # why is generating so long at 14 seconds | |
x = sound_generator.generate([txt])[0].detach().cpu().numpy()[0, :] | |
x /= np.abs(x).max() + 1e-7 | |
audiofile.write('del_seane.wav', x, 16000) | |