import audiofile | |
import numpy as np | |
from audiocraft import AudioGen | |
txt = 'dogs barging in the street' | |
sound_generator = AudioGen(duration=.04, | |
device='cuda:0').to('cuda:0').eval() | |
x = sound_generator.generate([txt])[0].detach().cpu().numpy() | |
x /= np.abs(x).max() + 1e-7 | |
audiofile.write('del_seane.wav', x, 16000) | |