Views
No views yet
1import IPython
2import soundfile as sf
3from tango import Tango
4
5tango = Tango("declare-lab/tango-music-af-ft-mc")
6
7prompt = "The song has a traditional jazzy feel to it. The piano chord progression is bouncy and light. The electric guitar has a chorus applied to it, and we hear various licks being played."
8audio = tango.generate(prompt)
9sf.write(f"{prompt}.wav", audio, samplerate=16000)
10IPython.display.Audio(data=audio, rate=16000)generate function uses 100 steps by default to sample from the latent diffusion model. We recommend using 200 steps for generating better quality audios. This comes at the cost of increased run-time.1prompt = "The song has a traditional jazzy feel to it. The piano chord progression is bouncy and light. The electric guitar has a chorus applied to it, and we hear various licks being played."
2audio = tango.generate(prompt, steps=200)
3IPython.display.Audio(data=audio, rate=16000)generate_for_batch function to generate multiple audio samples for a batch of text prompts:1prompts = [
2 "This song is a fusion of alternative and folk genres, highlighting simple yet soulful melodies and minimalist instrumentals.",
3 "The instrumental music features an ensemble that resembles the orchestra. The melody is being played by a brass section while strings provide harmonic accompaniment.",
4 "This music is instrumental. The tempo is fast with a lively keyboard harmony, steady drumming, groovy bass lines and harmonica melodic. The song is fresh, groovy, sunny, happy; vivacious and spirited."
5]
6audios = tango.generate_for_batch(prompts, samples=2)@article{kong2024improving,
title={Improving Text-To-Audio Models with Synthetic Captions},
author={Kong, Zhifeng and Lee, Sang-gil and Ghosal, Deepanway and Majumder, Navonil and Mehrish, Ambuj and Valle, Rafael and Poria, Soujanya and Catanzaro, Bryan},
journal={arXiv preprint arXiv:2406.15487},
year={2024}
}