Add audio translation task type and provider#335
Conversation
0c8d7be to
2e45e17
Compare
| $this->logger->warning('Text to speech generation failed: no speech returned'); | ||
| throw new ProcessingException('Text to speech generation failed: no speech returned'); | ||
| } | ||
| $translatedAudio = $includeWatermark ? $this->watermarkingService->markAudio($apiResponse['body']) : $apiResponse['body']; |
There was a problem hiding this comment.
maybe better to watermark the transcript of the input audio so the translated text and the translated audio both have the watermark in the target language
There was a problem hiding this comment.
The audio should always be marked directly as there is specific metadata that is added to the audio.
| if ($includeWatermark) { | ||
| if ($userId !== null) { | ||
| $user = $this->userManager->getExistingUser($userId); | ||
| $lang = $this->l10nFactory->getUserLanguage($user); | ||
| $l = $this->l10nFactory->get(Application::APP_ID, $lang); | ||
| $ttsPrompt .= "\n\n" . $l->t('This was generated using Artificial Intelligence.'); | ||
| } else { | ||
| $ttsPrompt .= "\n\n" . $this->l->t('This was generated using Artificial Intelligence.'); | ||
| } | ||
| } |
There was a problem hiding this comment.
this can also work but it would add the text/audio in the user's language which may or may not be the target language.
There was a problem hiding this comment.
The watermark is now appended to the input transcript in the language of the user. So it ends up being in the audio and text outputs in the target language.
67bfb51 to
1849a43
Compare
|
I had to update the composer dependencies to fix CI issues. |
lukasdotcom
left a comment
There was a problem hiding this comment.
Didn't look that deeply yet, but found a few things. Also it might be worth it to use the new methods in TranslateService for the old task processing provider too.
| $this->logger->warning('Text to speech generation failed: no speech returned'); | ||
| throw new ProcessingException('Text to speech generation failed: no speech returned'); | ||
| } | ||
| $translatedAudio = $includeWatermark ? $this->watermarkingService->markAudio($apiResponse['body']) : $apiResponse['body']; |
There was a problem hiding this comment.
The audio should always be marked directly as there is specific metadata that is added to the audio.
9181c87 to
d173c96
Compare
|
A test for the AudioToAudioTranslate provider would be nice, but I'm fine if we go without :) |
| use OCP\TaskProcessing\ShapeDescriptor; | ||
|
|
||
| class AudioToAudioTranslateTaskType implements ITaskType { | ||
| public const ID = Application::APP_ID . ':audio2audio:translate'; |
There was a problem hiding this comment.
Any reason to have this not in server?
There was a problem hiding this comment.
(Except that server PRs are annoying :D )
There was a problem hiding this comment.
I'll add it later and adjust here.
…, factorize translation logic in the translate service Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
…rmarked in the target language Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
3d348ab to
17df89a
Compare
use TranslateService::getStaticLanguages() to get the input shape enum values watermark the audio directly keep the watermark suffix in the language of the user who scheduled register audio translation provider if tts is enabled fix reporting translation output fix cache being created inside a loop cleanup Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
a631631 to
d01c43f
Compare
Uh oh!
There was an error while loading. Please reload this page.