Quick start
Make your first sound in a few minutes.
This page takes you from nothing to a saved sound file. Use a test key (fal_test_...) if you have one: every call is free and answers with a small canned sound. A live key (fal_live_...) works the same and spends your balance.
1. Set your key once
The SDKs and the examples read the key from the environment, so it never has to appear in your code. The key is the only setting: the API address is built into every SDK and written out in each cURL example, so there is no address to configure.
export FALCORE_API_KEY="fal_test_paste_your_key_here"2. Check the gateway is up
This call needs no key and costs nothing.
curl -sS "https://api.falcorelabs.com/health"{"ok":true,"service":"Falcore API Gateway 1.0"}That is the real answer of the live gateway (status 200). Anything else means the address is wrong or the service is down.
3. Generate a sound and save it
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")
catalyst.download(sound, "rain.mp3")What you get. The cURL tab prints the reply of step 1 as JSON (step 2 and 3 print the download link and then save the file). The SDK tabs print one line:
fil_005033c8d6174369a80df306 0 plumesThis is a recorded answer, so use it to check the shape. The file id, the request id and the times are different on every call, and the PLUMES number is the price your administrator set for this route. A file called rain.mp3 appears in the folder you ran the command in.
With an SDK you never pass the address or a session id: the address is built in and a private session is created for you. With cURL you choose the session_id (see Sessions and files).
4. Read the response headers
Print the headers with curl -i to see your balance and limits on every response.
| Header | Meaning |
|---|---|
x-plumes-charged | PLUMES taken for this request. |
x-plumes-balance | PLUMES left after this request. |
x-ratelimit-limit | Requests allowed per minute for your key. |
x-ratelimit-remaining | Requests left in the current minute. |
x-request-id | The id of this request. Quote it when you contact support. |
What next
- Learn the building blocks: Generate sound effects and Compose music.
- Build a complete product: How to build your first application.