facebookresearch / audiocraft

Audiocraft is a library for audio processing and generation with deep learning. It features the state-of-the-art EnCodec audio compressor / tokenizer, along with MusicGen, a simple and controllable music generation LM with textual and melodic conditioning.
MIT License
20.17k stars 2.01k forks source link

How to change sample rate in AudioGen demo #381

Open benanstrom opened 6 months ago

benanstrom commented 6 months ago

In the Text Conditional demo for AudioGen, the sample rate is set 16000 Hz in the model, is there a way to change it to 44000? I tried changing the value 16000 to 44000 in the audiogen.py file, but this produced time warped results. The issue I'm having is that I'd like to create audio that has noise up to 20000 Hz, I suspect that the demo only produces noise up to 8000 Hz as it is now. Is there an easy way to adjust this?

I've tried adjusting the sample rate in the display_audio function, but that results in truncation.

I was thinking that maybe it has to do with this sentence in the README - "The number of samples generated and the batch size used are controlled by the dataset.generate configuration while the other generation parameters are defined in generate.lm.". However, I'm not sure how to implement the change to the configuration.