A sound from text: Stable Audio
Lesson "audio-sound", in the group Sound and speech of the lesson list. Steps: 10.
What you will be able to do
You build a graph that makes a sound effect or a short piece of music from a prompt.
What you need
- It goes on from A first picture from text. The card says so; it is a hint, not a lock.
- Model files the lesson checks:
- for
ckpt_nameof Load Checkpoint: a file whose name hasstableandaudio; - for
clip_nameof Load CLIP: a file whose name hast5andbase.
- for
- Nodes: Load Checkpoint, Load CLIP, CLIP Text Encode (Prompt), Empty Latent Audio, KSampler, VAE Decode Audio, Save Audio (Advanced) / SaveAudio / SaveAudioMP3 / PreviewAudio.
- The app downloads and installs nothing. The step texts below say which files and folders, and which ComfyUI template names them.
The steps
The words of each step, as the lesson shows them. Node names are in bold.
What Stable Audio makes (reading)
Stable Audio Open 1.0 makes short sounds from text: rain on a roof, footsteps in snow, a drum loop, a pad for a background. It does not sing and does not speak.
The graph is the graph of a first picture with a separate text reader and a decoder for sound.
The lesson builds the graph from an empty canvas: "File ▸ New project".
Load the model
Add a Load Checkpoint node and choose
stable-audio-open-1.0.safetensorsinckpt_name. The file lies in models/checkpoints.This file holds the part that draws the sound and its decoder. The text reader is not inside: it comes from its own file in the next step.
If the file you need is not in the list, your ComfyUI does not have it. The app downloads nothing. The easiest way is to open, in ComfyUI itself, the template "Stable Audio 1.0: Text to Audio": it shows which files are missing and where to put them. Then choose "Sync ▸ Sync now" in this app's menu, and the files appear in the lists.
Load the text reader
Add a Load CLIP node. In
clip_namechooset5-base.safetensorsfrom models/text_encoders, and settypetostable_audio.The type tells ComfyUI how the reader is built. With another type the file loads, but the model gets a prompt it cannot use.
Describe the sound
Add two CLIP Text Encode (Prompt) nodes and connect the
CLIPoutput of Load CLIP to theclipinput of each.In the
textfield of the first write what should be heard, in plain words: heavy rain on a tin roof, distant thunder. The second may stay empty or list what is not wanted.Say the kind of sound, the place and the mood. For music add the genre and the tempo, for example 120 BPM.
Say how long the sound is
Add a Empty Latent Audio node and set
seconds. For a sound effect 10 seconds is plenty.The model was trained on pieces of up to 47 seconds. A longer blank gives silence or noise at the end.
Add the sampler
Add a KSampler node and connect four inputs:
modelfrom Load Checkpoint;positiveandnegativefrom the two text nodes;latent_imagefrom Empty Latent Audio.
Set
stepsto 50 andcfgto 5. The official template uses 50 steps and acfgnear 5, withsampler_nameset todpmpp_3m_sde_gpuandschedulertoexponential. Set those two in ComfyUI as well if your list has them.Turn the result into sound
Add a VAE Decode Audio node. Connect the output of KSampler to its
samplesinput and theVAEoutput of Load Checkpoint to itsvaeinput.Save the sound
Add a Save Audio (Advanced) node and connect the output of VAE Decode Audio to its
audioinput. In ComfyUI the file goes into output/audio.When the sound is bad (reading)
- Mush instead of a clear sound: describe one sound, not a whole scene.
- Noise at the end: the blank is longer than the sound you described; shorten
seconds. - Too quiet or too thin: add words about the recording, such as close, studio, clean.
The model makes sounds, not speech. For speech there is the lesson "Speech from text: Chatterbox".
The graph is ready (reading)
Save the graph with "File ▸ Save workflow for ComfyUI…", open the file in ComfyUI and run it there. This app runs nothing in ComfyUI itself.
What the lesson checks
A reading step is done when you press Got it, next. A doing step ticks itself off when the canvas holds:
- Step 2, Load the model:
- a Load Checkpoint node.
ckpt_nameof Load Checkpoint holds a file whose name hasstableandaudio(capitals, dots and dashes do not matter).
- Step 3, Load the text reader:
- a Load CLIP node.
clip_nameof Load CLIP holds a file whose name hast5andbase(capitals, dots and dashes do not matter).typeof Load CLIP isstable_audio.
- Step 4, Describe the sound:
- a CLIP Text Encode (Prompt) node.
- a CLIP Text Encode (Prompt) node.
CLIPof Load CLIP intoclipof CLIP Text Encode (Prompt) (prompt).CLIPof Load CLIP intoclipof CLIP Text Encode (Prompt) (negative prompt).textof CLIP Text Encode (Prompt) (prompt) holds at least 10 characters.
- Step 5, Say how long the sound is:
- a Empty Latent Audio node.
secondsof Empty Latent Audio is from 1 to 47; Do this for me sets 10.
- Step 6, Add the sampler:
- a KSampler node.
MODELof Load Checkpoint intomodelof KSampler.CONDITIONINGof CLIP Text Encode (Prompt) (prompt) intopositiveof KSampler.CONDITIONINGof CLIP Text Encode (Prompt) (negative prompt) intonegativeof KSampler.LATENTof Empty Latent Audio intolatent_imageof KSampler.stepsof KSampler is from 25 to 100; Do this for me sets 50.cfgof KSampler is from 3 to 7; Do this for me sets 5.
- Step 7, Turn the result into sound:
- a VAE Decode Audio node.
LATENTof KSampler intosamplesof VAE Decode Audio.VAEof Load Checkpoint intovaeof VAE Decode Audio.
- Step 8, Save the sound:
- a Save Audio (Advanced) or SaveAudio or SaveAudioMP3 or PreviewAudio node.
AUDIOof VAE Decode Audio intoaudioof Save Audio (Advanced) or SaveAudio or SaveAudioMP3 or PreviewAudio.