-
Notifications
You must be signed in to change notification settings - Fork 16
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
mbrola languages (Windows support) #2
Comments
Ouh. My first contributer. Alright, first, I really appreciate your help, however I've always been programming python on linux, so for me, Windows porting is dark magic. I can try and set up a python dev env on windows as to help you, but i really don't know how the subprocess library behaves on windows. Nor do i know how the pyaudio sound backend does on windows, so, those two things should be considered. EDIT: mbrola's website seems to be down... |
Here are the windows binaries, btw: http://tcts.fpms.ac.be/synthesis/mbrola/bin/pcwin/MbrolaTools35.exe |
Oh thanks! Yeah, the site was down but it looks like it works now. I'll download the binaries and language files and I'll give it a go later (and of course I'll report my findings). |
Nice. I'll set up a python dev env to test out your discoveries :) |
Ok, the first obvious problem is that
The next problem (kind of a recurring theme) is that private methods in Another Windows-specific issue is that I've noticed that most of the I've also noticed that a functionality of Anyway, I managed to fork the project locally and played with it a bit. So far I got TestStrToPhonems tests to pass (except test_german, for some reason de1 mbrola voice file is not detected - but de2 is). Can you check my fork and see if there's no regression on Linux? |
Aw, well, I'm a bit too tired and I merged your forked without looking at this very exhaustive message. I'm sorry for that 🤕 . It doesn't matter much anyway, since I haven't pushed the current version to the pypi repo. I'm sorry, it's my first package, i'm a bit clumsy with these things. I'm currently fixing some regressions that have been introduced, but nothing bad, don't worry. Concerning the problems linked to the windows version of mbrola, I truly have no clue about what to do. I should be able to set up a python windows env by the end of the week to see what I can do.
Oh, that's on purpose. It's a small optimisation. Since, most of the time, people don't care about phonems, and just want some audio out of some text (I have some very strong statistics to support this claim!), I figured it's more efficient to have this pipeline:
instead of this pipeline (which is used when editing phonems):
It spares the parsing of the phonem object, to immediately synthesize it back to a string. Hope this makes sense to you. |
It totally makes sense. At the same time it looks like premature optimization to me. How big are the gains exactly? Also it leads to code duplication - we have big chunks of code doing exactly the same thing. In other news, I got a working .wav file with
Can you check if it's going to be a problem? Also, I can't get |
I have no idea about the de1 database either. Maybe try getting a trace of the error somehow (although i don't thing mbrola has a --verbose option). Regarding the .wav stuff, i'll have to admit I copied someone else's code to "package" mbrola's output into a "real" wav file (c.f. the Your concern is a valid one though. We could, however, add an PS: it'd be good though if we could comment that mysterious line from |
I can't even run in from the command line. It simply says I see. So there's no problem with using Fully agree on commenting the |
Nice, Im going to dig into it to figure out how that bytes-packing sorcery works. It's the kind of stuff I tend to like. REgarding the wav dicussion, I think keeping only wav is a good option for now, but if someone asks for more formats, we could add those. In the meantime, i'm probably going to add some examples on how to use that .wav bytes object to do other kind of stuff, a bit like in the README.md. Rregarding the mb-de1 problem, is the error coming from espeak or from mbrola? Thanks again for your help. EDIT: I figured out how the bytes-packing sorcery works, and more especially, using your quoted text from mbrola, why exactly did the dude that made this code did it. I'll add comments as soon as possible to |
Good call on the examples. And it's great that you figured out the bytes method. The error is coming from espeak. |
Hm. I'll check again on linux this evening, see if it's related to windows. |
Ok, we're almost there. There's one more problem with running tests on Windows. For some reason I still fail all ToAudio tests. They all raise
Interestingly, |
I think i know what causes these errors, I think it has to do with the quoting you introduced to fix your previous error on windows. I'll have to test this at home this evening. Btw, i had some problems on travis to install PyAudio, but it's fixed. Once the unittests are OK on ubuntu 14.04, we should be good to go for a 0.2 release. \o/ |
Awesome news about travis! The error happened before I made those changes too (and I confirmed it by reverting to an old version on my local repo). I added a default voice folder location on Windows (it will be empty at first, of course). Also, I figured out the cause of my mb-de1 problem. My espeak installation didn't have |
Sorry, I was away for some time. I checked my installation on an Ubuntu 14.04 machine, and it did not have the de2 mbrola voice file. You can see all of those in this listing: This is probably a problem to be solved using the PS: I've just remarked that, in theory, it's possible to make espeak say stuff in greek with a german accent : |
Then how are you able to pass the tests with de1 voice? |
|
For anyone looking for Windows support in 2023, one can install mbrola and espeak through WSL, the new linux interpreter/partition provided by microsoft. Here I was running python from the windows system, but simply calling the linux mbrola and espeak. (I guess one could also do everything in the linux partition, which would require no change to this software.) Effectively one just need to change a few line of code in this library: if platform in ('linux', 'darwin'):
espeak_binary = 'espeak'
mbrola_binary = 'mbrola'
mbrola_voices_folder = "/usr/share/mbrola"
elif platform == 'win32':
# If the path has spaces it needs to be enclosed in double quotes.
espeak_binary = '"C:\\Program Files (x86)\\eSpeak\\command_line\\espeak"'
mbrola_binary = '"C:\\Program Files (x86)\\Mbrola Tools\\mbrola"'
mbrola_voices_folder = os.path.expanduser('~\\.mbrola\\')
if not os.path.exists(mbrola_voices_folder):
os.makedirs(mbrola_voices_folder)
if not os.path.exists(espeak_binary):
espeak_binary = "wsl espeak"
mbrola_binary = "wsl MALLOC_CHECK_=0 mbrola"
mbrola_voices_folder = "/usr/share/mbrola" # if (Path(self.mbrola_voices_folder)
# / Path(voice_name)
# / Path(voice_name)).is_file():
# self.lang = lang
# self.voice_id = voice_id
# else:
# raise self.InvalidVoiceParameters(
# "Voice %s not found. Check language and voice id, or install "
# "by running 'sudo apt install mbrola-%s'. On Windows download "
# "voices from https://github.com/numediart/MBROLA-voices"
# % (voice_name, voice_name))
self.lang = lang
self.voice_id = voice_id def _phonemes_to_audio(self, phonemes: PhonemeList) -> bytes:
# voice_path_template = ('%s/%s%d/%s%d'
# if platform in ("linux", "darwin")
# else '%s\\%s%d\\%s%d')
voice_path_template = "%s/%s%d/%s%d"
voice_phonemic_db = (voice_path_template
% (self.mbrola_voices_folder, self.lang,
self.voice_id, self.lang, self.voice_id)) The reason for commenting the path checking and changing the path template to a linux path template is that I am not sure how to properly deal with path formatting toward the linux partition in my situation. |
Since mbrola and espeak both provide Windows binaries, I'd like to give voxpopuli a shot and see if I can make it work on Windows.
However, mbrola project website seems to be unavailable and I can't download neither the binary nor language files. Is there any mirror that hosts those files?
The text was updated successfully, but these errors were encountered: