task icon Task

Convert Story to Audio

Convert a bedtime story draft to audio narration using ElevenLabs

Requirements
Story text from session draft. Voice preference from user profile.
3

Get the narrator voice ID from stateUser Profile Facts preferences (file: personal.md, default: Rachel 21m00Tcm4TlvDq8ikWAM).

5

Create stateGenerated Audio (category: bedtime-stories) directory if it doesn't exist.

7

Tell the user: '[Name]'s story is ready!' Share the audio path.

                    To run this task you must have the following required information:

> Story text from session draft. Voice preference from user profile.

If you don't have all of this information, exit here and respond asking for any extra information you require, and instructions to run this task again with ALL required information.

---

You MUST use a todo list to complete these steps in order. Never move on to one step if you haven't completed the previous step. If you have multiple CONSECUTIVE read steps in a row, read them all at once (in parallel). Otherwise, do not read a file until you reach that step.

Add all steps to your todo list now and begin executing.

## Steps

1. [Read Story Draft]: Discover relevant information in the user's filesystem at `session/bedtime-story-draft/*.md`. (Get the session draft file path)

2. [Read Generated Audio]: Discover relevant information in the user's filesystem at `documents/media/audio/[category]/**/*`. (Get the audio output path (category: bedtime-stories))

3. Get the narrator voice ID from `documents/user/profile/[file=personal|goals|interests|ideology].md` preferences (file: personal.md, default: Rachel 21m00Tcm4TlvDq8ikWAM).

4. [Gather Arguments: Prep Story for Audio] The next step has the following requirements for arguments, do not proceed until you have all the required information:
- `storyFilePath`: state:bedtime.story.draft file path
- `outputDir`: session directory path (parent of state:bedtime.story.draft)

5. [Run Code: Prep Story for Audio]: Call `run_script` with:

```json
{
  "file": {
    "path": https://sk.ills.app/code/bedtime.story.prep/preview,
    "args": [
      "storyFilePath",
      "outputDir"
    ]
  },
  "packages": null
}
```

6. Create `documents/media/audio/[category]/**/*` (category: bedtime-stories) directory if it doesn't exist.

7. [Gather Arguments: Text to Speech] The next step has the following requirements for arguments, do not proceed until you have all the required information:
- `textFilePath`: the clean text file path output by the prep step
- `voiceId`: voice ID from preferences (Rachel: 21m00Tcm4TlvDq8ikWAM, Charlotte: XB0fDUnXU5powFXDhCwa, Adam: pNInz6obpgDQGcFmaJgB)
- `modelId` (default: "eleven_multilingual_v2"): eleven_multilingual_v2
- `outputFormat` (default: "mp3_44100_128"): mp3_44100_128
- `outputDir` (default: "session"): state:media.audio.generated (category: bedtime-stories)

8. [Run Code: Text to Speech]: Call `run_script` with:

```json
{
  "file": {
    "path": https://sk.ills.app/code/media.audio.tts/preview,
    "args": [
      "textFilePath",
      "voiceId",
      "modelId",
      "outputFormat",
      "outputDir"
    ]
  },
  "packages": null
}
```

9. Tell the user: '[Name]'s story is ready!' Share the audio path.