Skip to content
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

Phomenizer calls async loud. #40

Open
bfrisco-raft opened this issue Feb 7, 2025 · 7 comments
Open

Phomenizer calls async loud. #40

bfrisco-raft opened this issue Feb 7, 2025 · 7 comments

Comments

@bfrisco-raft
Copy link

Describe the bug
phonemize calls Espeak audio out when not needed.

ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM default
Calling espeak in a container when only needing PCM binary still attempts to request audio source.

The following command
espeak-ng "Hello World" -w output.wav

Does not require a card, and will return PCM directly to wave file.

Could this be changed to call quiet in main located
here

System
Linux/amd64 container

To reproduce
Call phonemizer.phonemize in linux with no ALSA default PCM

It seems hex 2 is called instead of hex 1 for Synchronous no speak
Initialized as Asynchronous

@hexgrad
Copy link
Owner

hexgrad commented Feb 7, 2025

Is this something that can be fixed in misaki or does it need to be addressed in https://github.com/bootphon/phonemizer instead?

@bfrisco-raft
Copy link
Author

It would guess it is primarily a Phonemizer issue, however, I noticed Misaki or Kokoro is now using Phonemizer-fork since there has been radio silence from Phonemizer main.

I brought this issue up, because of update blow my comment here,
bootphon/phonemizer#44 (comment)

Let me know where I should move this issue, if this is not the right place.

@hexgrad
Copy link
Owner

hexgrad commented Feb 10, 2025

Thanks for the heads up, feel free to leave this issue open until its resolved.

fyi @thewh1teagle

@thewh1teagle
Copy link
Contributor

It would guess it is primarily a Phonemizer issue, however, I noticed Misaki or Kokoro is now using Phonemizer-fork since there has been radio silence from Phonemizer main.

I brought this issue up, because of update blow my comment here, bootphon/phonemizer#44 (comment)

Let me know where I should move this issue, if this is not the right place.

See in my Github the repository
I need to fix the URLs in the package

@bfrisco-raft
Copy link
Author

bfrisco-raft commented Feb 12, 2025

It would guess it is primarily a Phonemizer issue, however, I noticed Misaki or Kokoro is now using Phonemizer-fork since there has been radio silence from Phonemizer main.
I brought this issue up, because of update blow my comment here, bootphon/phonemizer#44 (comment)
Let me know where I should move this issue, if this is not the right place.

See in my Github the repository I need to fix the URLs in the package

It should be the value 0x00, here

line 89

 if self._library.espeak_Initialize(0x02, 0, None, 0) <= 0:

see the explanation of the issue here.
bootphon/phonemizer#197

NOTE: This is also in the original Phonemizer code, it was not designed to bypass the audio out.
However, this is not needed and causes errors in containers.

ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM sysdefault
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM sysdefault
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

@thewh1teagle
Copy link
Contributor

You can create PR to pass optional parameter to control it (but keep the default behavior)

@bfrisco-raft
Copy link
Author

This will require an update to Misaki as well, there must be an adjustment to enabling the API through the wrapper.

I added a method which will be able to load the appropriate flag the change the logic.

Found it has to do with the API calling espeak_initalize(), where the espeak-ng CLI only calls three functions.

  • espeak_ng_InitializeOutput
  • espeak_ng_InitializePath
  • speak_ng_GetSampleRate

This prevents the PCM card from being called elsewhere.

	if (option_waveout || quiet) {
		// writing to a file (or no output), we can use synchronous mode
		result = espeak_ng_InitializeOutput(ENOUTPUT_MODE_SYNCHRONOUS, 0, devicename[0] ? devicename : NULL);
		samplerate = espeak_ng_GetSampleRate();
		samples_split = samplerate * samples_split_seconds;

		espeak_SetSynthCallback(SynthCallback);
	if (p_text != NULL) {
		int size;
		size = strlen(p_text);
		espeak_Synth(p_text, size+1, 0, POS_CHARACTER, 0, synth_flags, NULL, NULL);

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

No branches or pull requests

3 participants