File size: 475 Bytes
c5e1f80
fe62fb4
 
c5e1f80
 
 
fe62fb4
c5e1f80
 
fe62fb4
c5e1f80
 
 
 
e366cd5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)