Skip to content

feat(Text2Speech): Add support for text to speech #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jun 25, 2025

Conversation

lukasdotcom
Copy link
Member

@lukasdotcom lukasdotcom commented Apr 30, 2025

This creates an implementation for text to speech. (nextcloud/server#52051)

I don't really know for sure what to do about the voices because I couldn't find an endpoint that lists the voices. Right now its just hardcoded to one of openai's voices. Some ideas that I have are:

  1. Make the input field text for the voice and just fail when an invalid voice is given
  2. Detect when open ai endpoint is being used and then use hardcoded list
  3. Let admin create a list of valid values to use

Openai's documentation for text to speech: https://platform.openai.com/docs/guides/text-to-speech#voice-options

Copy link
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

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

Nicely done!
Can you use tabs for indentation in Php files?
You can fix all your files at once with composer run cs:fix

@lukasdotcom lukasdotcom force-pushed the tts branch 3 times, most recently from 1270a80 to cdb8aaf Compare May 5, 2025 23:07
@lukasdotcom lukasdotcom marked this pull request as ready for review May 5, 2025 23:08
Copy link

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Copy link
Contributor

@kyteinsky kyteinsky left a comment

Choose a reason for hiding this comment

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

thanks for the nice work!
It works wonderfully.

btw, the limit for the input is 4096 characters (https://platform.openai.com/docs/api-reference/audio/createSpeech#audio-createspeech-input). It would be a QoL improvement to split the sentences as such but it can be a feature for later.

@lukasdotcom
Copy link
Member Author

Also I rebased this branch to make sure that the change I had to add for every test also was added to the emoji provider.

$iResponse->method('getHeader')->with('Content-Type')->willReturn('application/json');

Copy link
Contributor

@kyteinsky kyteinsky left a comment

Choose a reason for hiding this comment

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

some minor changes

Signed-off-by: Lukas Schaefer <[email protected]>
Signed-off-by: Lukas Schaefer <[email protected]>
Signed-off-by: Lukas Schaefer <[email protected]>
Signed-off-by: Lukas Schaefer <[email protected]>
Signed-off-by: Lukas Schaefer <[email protected]>
Signed-off-by: Lukas Schaefer <[email protected]>
Signed-off-by: Lukas Schaefer <[email protected]>
Copy link
Contributor

@kyteinsky kyteinsky left a comment

Choose a reason for hiding this comment

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

thanks a lot 🚀

@lukasdotcom lukasdotcom merged commit 4bfb7ae into nextcloud:main Jun 25, 2025
23 of 29 checks passed
@lukasdotcom
Copy link
Member Author

lukasdotcom commented Jun 25, 2025

Note: Will need to fix the failing unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants