/v1/history/download API endpoint not supported?
jonathonbarton opened this issue · 1 comments
I looked through example.py and ElevenLabsVoice.py and a straightforward way to pass in text, generate audio, then download the resulting (mp3, if I'm reading the elevenlabs and elevenlabslib documentation right) file to a user-specified location.
RIght now, I'm working around it with
sequence = "Test."
voice = user.get_voices_by_name("whatever voice") # to get the selected voice
outfile = 'Drive:/path/to/file/destination/output.mp3'
mp3_data = voice.generate_audio_bytes(sequence)
with open(outfile, 'wb') as file:
file.write(mp3_data)
p = vlc.MediaPlayer("Drive:/path/to/file/destination/output.mp3")
p.play() # Play the audio as saved to disk with VLC to hear how it would sound in the app, instead of hearing the audio direct to the sound device from Eleven.
I find that audio heard direct from Eleven via generate_and_play_audio(sequence) is perfect, but what's landing on the disk is cut off near to the end. And it's not that it's cut off after x miliseconds (i.e. not giving it enough time to write the file to disk) It's that there's a fixed amount missing from the end of the file, not matter how long the text passed in is...
Is there an existing method that I missed that does what I'm looking for?
Is this a method you could add to the library to "complete the AI-enhanced gameplay loop" of SpeechRecognition -> GPT/ChatGPT -> ElevenLabs -> Local MP3 that a plugin for a game that expects sound to be MP3 or WAV locally on the disk?
EDIT: Doing more testing today - this may be resolved? It'd still be cool to have the option of:
generate_and_save_audio(
self,
prompt:str,
playInBackground:bool,
portaudioDeviceID:Optional[int] = None,
stability:Optional[float]=None,
similarity_boost:Optional[float]=None,
saveToPath:Optional[str]=None, saveAsWav:bool
) -> None:
Added a function to save to disk in helpers.py in the latest commit.