Open Arthur-McArthur opened 1 year ago
yes please. Saving the last output location OR allowing us to set the output directory would be great.
You can easily adapt the notebook code, your own scripts, etc. to export the audio:
from scipy.io.wavfile import write as write_wav
import uuid
descriptions = [
'lofi 80s workout music',
'downtempo vhs vibes',
]
output = model.generate(
descriptions=descriptions,
progress=True
)
for i, description in enumerate(descriptions):
file_id = uuid.uuid4()
# Write a text file containing the description.
open(f"{file_id}.txt", "w").write(description)
# Write the wav file
write_wav(f"{file_id}.wav", 32000, output[i].squeeze().cpu().numpy()
You can easily adapt the notebook code, your own scripts, etc. to export the audio:
I appreciate the guidance/support. Unfortunately I'm one of those 3rd gen interface users -- not the designer (1st gen), nor on level with coding (2nd gen), but that 3rd gen that is right above that group that can only use it if it's a one-click install.
I run it locally via Gradio (preferred). What file do I add this to? Where?
I've got the other stuff done, I just keep getting distracted and never pushed a fork public. It sounds like you got a very specific and complicated work flow in mind? I always have trouble imaging people who aren't me using the UI, can you elaborate? Or if it's too off topic for an issue on a git, send me a 'dm' via some channel. It would help to know how people use things, before I build..
I am envisioning a workflow similar to how I use Stable Diffusion locally, where I would write prompt syntax like:
" a {dark|mysterious|happy} melody played by a {flute|guitar|trumpet} with a {fast|slow} tempo "
and then hit generate forever and let it create many different variations within the output folder, named with the prompt. For example the name of an item could be: "00001-a_dark_melody_played_by_a_guitar_with_a_slow_tempo".
Stable Diffusion has a "Dynamic Prompt" extension that allows for reading wildcards out of text files as well.
Hello @Arthur-McArthur , were you able to impement it? @Duemellon did you find which file had to be changed? I think it can be done easily using something like notepad++ the opening one of the files. Thanks @noprompt still waiting for more guidance, is it inthe musicgen_app file?
@Duemellon , open musigen_app with notepad++, then go to the line around 150 ish, "print("Tempfiles currently stored: ", len(file_cleaner.files))", at the end of it press enter to insert an empty line of code, and paste there, this:
file_id = uuid.uuid4()
write_wav(f"{texts[0]}.wav", 32000, outputs.squeeze().cpu().numpy())
Thats it. Make sure every line is alined with the lines above and before it. Now restart the app with python .\demos\musicgen_app.py --inbrowser if its already open the clode it with CTRL+C Now every file is saved inside the directory and named like our prompt.
Make sure to add
from scipy.io.wavfile import write as write_wav
import uuid
At the beginning of the file somewhere. Enjoy (be careful though, if you have the same prompt and different parameters, new files will delete old ones)
Would be useful to have an easily accessible output folder.
Generate forever would help us make many outputs and cherry-pick the best ones.
Wildcards could help create unusual and unexpected outputs.