Step 1: your first sound
Step 1 of 8
One call that describes a sound and gets a file.
The whole product rests on one call: describe a sound, get a file. Make it work on its own first.
# soundscape.py
from falcore import Catalyst
catalyst = Catalyst() # reads FALCORE_API_KEY
sound = catalyst.wave.generate("rain on a tin roof", duration=4)
print(sound.file.file_id, sound.usage.plumes, "plumes")
path = catalyst.download(sound, "rain.mp3")
print("saved", path)Running it prints two lines:
fil_005033c8d6174369a80df306 0 plumes
saved rain.mp3Note
The file id and PLUMES number differ for you (the id is new every call, and the number is your administrator's price). saved rain.mp3 is the path you passed to download.
Run it: python soundscape.py, npx tsx soundscape.ts or cargo run. You get a rain.mp3 file.
What just happened
Catalystread your key and built a client. It also created a private session for you (see step 4).wave.generatesent your description to the Wave model and waited for the answer. The answer is a Generation: it holds the files and what the call cost.downloadasked the API for a signed link to the file and saved it. The format defaults tomp3.
Checkpoint (M1): a playable rain.mp3, and the program printed its file id and cost.