Skip to content

Add elevenlabs-tts extension - #15992

Closed
lachiejames wants to merge 3 commits into
raycast:mainfrom
lachiejames:ext/elevenlabs-tts
Closed

lachiejames wants to merge 3 commits into
raycast:mainfrom
lachiejames:ext/elevenlabs-tts

Conversation

@lachiejames

@lachiejames lachiejames commented Dec 21, 2024 •

Copy link
Copy Markdown
Contributor

Description

ElevenLabs TTS is a powerful text-to-speech extension that brings premium AI voices to Raycast. Simply select any text in any application, trigger the command with your hotkey, and hear natural-sounding speech instantly.

Key features:

  • 🎭 20+ premium AI voices with unique personalities and accents
  • ⚡️ Real-time streaming for instant playback
  • 🎛️ Fine-tune voice stability and clarity
  • 🔊 Stop/start control with the same hotkey
  • 🌐 Works with any text-based application

Screencast

Watch Demo

Extension Setup

Voice Selection

Technical Implementation Highlights

  • WebSocket-based streaming for efficient audio delivery
  • Event-driven architecture for robust audio processing
  • Temporary file management for memory-efficient playback
  • Comprehensive error handling with user-friendly messages
  • Full test coverage for core functionality

Checklist

  • I read the extension guidelines
  • I read the documentation about publishing
  • I ran npm run build and tested this distribution build in Raycast
  • I checked that files in the assets folder are used by the extension itself
  • I checked that assets used by the README are placed outside of the metadata folder

- docs: update README (raycast#23)
- docs: add changelog (raycast#22)
- feat: add Node.js version management and CI unit testing workflow (raycast#21)
- security: bump cross-spawn to 7.0.6 (raycast#20)
- fix: removes refs to default hotkey (raycast#19)
- fix: refactor into separate files (raycast#18)
- fix: add more comments (raycast#17)
- fix: add unit tests (raycast#16)
- fix: refactor into AudioManager (raycast#15)
- fix: remove \'play-sound\' dependency (raycast#14)
- Revert "fix: refactor into separate files (raycast#10)" (raycast#13)
- Revert "fix: add more README instructions (raycast#11)" (raycast#12)
- fix: add more README instructions (raycast#11)
- fix: refactor into separate files (raycast#10)
- feat: rename extension to \'ElevenLabs TTS\' (raycast#9)
- fix: update extension icon (raycast#8)
- fix: run prettier (raycast#7)
- fix: pin dependencies (raycast#6)
- fix: add more comments (raycast#5)
- fix: add more logging and error handling (raycast#4)
- fix: use websockets for faster TTS streaming (raycast#3)
- fix: add toasts for UI feedback (raycast#2)
- feat: use elevenlabs for TTS since it\'s better (raycast#1)
- initial commit
@raycastbot raycastbot added the new extension Label for PRs with new extensions label Dec 21, 2024
@raycastbot

raycastbot commented Dec 21, 2024 •

Copy link
Copy Markdown
Collaborator

Congratulations on your new Raycast extension! 🚀

Due to our current reduced availability, the initial review may take up to 10-15 business days 🎄

Once the PR is approved and merged, the extension will be available on our Store.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted these files and republished, but they haven't been removed from this PR. Possible bug in npm run publish?

@thomaspaulmann

Copy link
Copy Markdown
Member

Wow that's a very cool extension! Love the approach for streaming the audio 👌

@pernielsentikaer pernielsentikaer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi 👋

Thanks for your contribution 💪

I have now tested your extension, and I have some feedback ready for you:

  • Can we show an error tost if the API is wrong? Right now it just shows "Playing..."

Raycast03012025-ObMwaUm6 png@2x

I'm looking forward to testing this extension again 🔥

Request a new review when you are ready. Feel free to contact me here or at Slack if you have any questions.

Comment on lines +1 to +11
/**
* Preferences configurable through Raycast's UI
* These settings affect voice generation quality and characteristics
*/
export interface Preferences {
elevenLabsApiKey: string; // API key from ElevenLabs dashboard
voiceId: string; // Selected voice identifier
stability: string; // Voice stability (0.0-1.0)
similarityBoost: string; // Voice clarity enhancement (0.0-1.0)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* Preferences configurable through Raycast's UI
* These settings affect voice generation quality and characteristics
*/
export interface Preferences {
elevenLabsApiKey: string; // API key from ElevenLabs dashboard
voiceId: string; // Selected voice identifier
stability: string; // Voice stability (0.0-1.0)
similarityBoost: string; // Voice clarity enhancement (0.0-1.0)
}

You don't need to manually set preference types as this is autogenerated in raycast-env.d.tsx

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pernielsentikaer 👋,

Thanks for your feedback and for testing the extension! I wanted to give you an update on the situation and link you to a related issue I've opened for the underlying problem.

I encountered a series of issues while attempting to update this PR (#15992). The root cause seems to be related to how the npm run publish command handles moved or deleted files.

While trying to resolve this, I followed the workflow recommended by the error messages and ran npx @raycast/api@latest pull-contributions, but this failed with a Git fast-forward error. Eventually, I deleted the local .config/raycast/public-extensions-fork folder and reran npm run publish. However, this created a new PR instead of updating the existing one.

Here’s the issue I raised to document the problem in detail: #16142

The new PR for this extension is here: #16140.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pernielsentikaer pernielsentikaer self-assigned this Jan 3, 2025
lachiejames added a commit to lachiejames/raycast-elevenlabs-tts that referenced this pull request Jan 3, 2025
Relates to raycast/extensions#15992 (comment)

## Changes
- Removed manual `Preferences` interface from `types.ts` in favor of auto-generated types from `raycast-env.d.ts`
- Updated preference type annotations to use `Preferences.SpeakSelected` namespace
- Simplified imports by removing redundant preference type

## Motivation
The Raycast framework auto-generates preference types in `raycast-env.d.ts` based on the extension's manifest. This change removes duplicate type definitions and uses the official typing system, improving type safety and maintainability.

## Testing
- Verified that all preference values are correctly typed and accessible
- Confirmed that voice settings are properly parsed from preferences
- Ensured existing functionality continues to work as expected
lachiejames added a commit to lachiejames/raycast-elevenlabs-tts that referenced this pull request Jan 3, 2025
Relates to raycast/extensions#15992 (review)

### TL;DR
Added API key validation before establishing WebSocket connections in the AudioManager.

### What changed?
- Added `node-fetch` as a new dependency
- Implemented a new `validateApiKey` method in AudioManager that checks the API key against the ElevenLabs API
- Modified the `initializeStream` method to validate API keys before attempting WebSocket connections

### How to test?
1. Try connecting with a valid ElevenLabs API key - should work as expected
2. Try connecting with an invalid API key - should receive an error before WebSocket connection attempt
3. Verify that the validation checks against the `/v1/voices` endpoint

### Why make this change?
To provide better error handling and user feedback by validating API keys early in the connection process, rather than waiting for WebSocket connection failures. This prevents unnecessary connection attempts with invalid credentials and provides clearer error messages to users.
@lachiejames lachiejames closed this Jan 3, 2025
@lachiejames
lachiejames deleted the ext/elevenlabs-tts branch January 3, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new extension Label for PRs with new extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants