-
Notifications
You must be signed in to change notification settings - Fork 334
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
Added an option of output: the wave array directly to memory (as a list of number 16-bit) #96
base: master
Are you sure you want to change the base?
Added an option of output: the wave array directly to memory (as a list of number 16-bit) #96
Conversation
…_to_file in linux
The pypi link was to pypi, not to the pyttsx project page on pypi.
- the platform specific dependencies are already handled by `extras_require` - when the wheel is built on macos / windows the `install_requires` will contain extra values (it appears the one on pypi for the latest version was built on macos)
add to_memory function
WARNING, only implemented for windows
usage: >>> engine.to_memory(ss, audio_array) >>> engine.runAndWait() >>> data = np.expand_dims(np.asarray(audio_array[0] ,dtype=np.int16),axis=1) >>> # you can test the output by: scipy.io.wavfile.write('name.wav',22050,data)
@redreamality This will most likely not be merged until the conflicts are resolved in your repository. |
@redreamality @nateshmbhat i commited it here: https://github.com/Jiangshan00001/pyttsx4
|
@Jiangshan00001 can u raise a PR here for the same? |
sure @nateshmbhat |
Hi @Jiangshan00001 . there are conflicts in this PR. would you be open to resolve the conflicts and update the PR. would be glad to merge it. |
conflicts resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo here can u please update
I see now this and PR #270. Pretty similar @redreamality its been a while. Whats your thoughts on save_to_memory. This doesnt sit with me right as a method name.. its not really in memory - its a save_to_bytes isnt it? Hold on - I've looked again and no , i see what you are doing. Thats pretty specific. What about if this module did have a save_to_bytes. Then in your local script you would be able to just pile up the PCM 16 bytestream however you want. Wouldnt that be more useful? NB: It would be a bit like this: https://github.com/willwade/tts-wrapper?tab=readme-ov-file#2-real-time-playback-using-sounddevice |
FYI.. Ive been digging into this more. SAPI does have a SAPI.SpMemoryStream method as @Jiangshan00001 has done.. But in Mac I cant find a native way of doing this so you would have to write a hack of writing to a temp file and then parsing it out. or using more frameworks like AVFoundation.. eSpeak should be easy to do.. I would push my PR but its My branch is here https://github.com/willwade/pyttsx3/tree/to_bytestream If I figure out even a hack method for nsss I'll do a PR |
I'm just providing a method that keeps the stream in memory, without the need of any temp file> FYI.. Ive been digging into this more. SAPI does have a SAPI.SpMemoryStream method as @Jiangshan00001 has done.. But in Mac I cant find a native way of doing this so you would have to write a hack of writing to a temp file and then parsing it out. or using more frameworks like AVFoundation..
I'm just providing a method that keeps the stream in memory, without the need of any temp file. This method, as i mentioned at very beginning, just works for windows. |
Yeah. I've done it now for espeak too now. I think if we can do a method for nsss it's worth reviewing this. I'll push it as a WIP for review |
CAUTION. only implemented for Windows sapi5 driver.