from audiocraft.audiogen import AudioGen #, audio_write import audiofile import numpy as np print('\n\n\n\n___________________') txt = 'car' sound_generator = AudioGen.get_pretrained('facebook/audiogen-medium') sound_generator.set_generation_params(duration=1) # 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('_audio1_.wav', x, 16000)