The eight steps
Eight small steps, each ending with something you can run.
You build the product in the order a real project grows: prove one call, make it a scene, make it safe, make it robust, then make it shareable. Every step shows the same code in Python, TypeScript and Rust, and every step ends with something you can run and check.
The plan
| Step | You add | You are done when |
|---|---|---|
| 1. Your first sound | One wave.generate call and one download. | A playable rain.mp3 exists and the program prints its file id and cost. |
| 2. Three layers in one call | A list of prompts for bed, detail and depth. | Three files exist, and the prompts are visibly different. |
| 3. Add music | A Composer call and the master file. | A music file exists next to the layers. |
| 4. Sessions and downloads | The session id, kept and reused. | You can download a file again from only its id and session. |
| 5. Balance and cost | A balance check before spending, and a cost total. | With a zero balance the program stops before spending. |
| 6. Background jobs | async music for long tracks, and waiting for the job. | A two-minute track completes without holding a connection open. |
| 7. Error handling | One handler for every error kind. | You have seen each message by running against the mock. |
| 8. Manifest and command line | A manifest.json and argument parsing. | A colleague with only a key can run it and get the same folder. |
Tip
Each step builds on the one before it, but each also runs on its own. If something breaks, go back to the last step that worked.
In this section
- your first soundOne call that describes a sound and gets a file.
- three layers in one callGenerate a bed, close detail and distant depth together.
- add musicCompose a music bed and take the finished master.
- sessions and downloadsWhy a file needs its session, and what the SDK remembers for you.
- balance and costLook before you spend, and total what you spent.
- long tracks in the backgroundRun slow work as a job and wait for it.
- handle errors properlySay something useful for every kind of failure.
- manifest and command lineRecord what was made, and take the scene from the command line.