Bug 467531 - make festival work with pulseaudio
Summary: make festival work with pulseaudio
Alias: None
Product: Fedora
Classification: Fedora
Component: festival
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: David Zeuthen
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: F10DesktopBlocker
TreeView+ depends on / blocked
Reported: 2008-10-18 01:38 UTC by Matthias Clasen
Modified: 2013-03-06 03:57 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-10-28 01:59:55 UTC
Type: ---

Attachments (Terms of Use)

Description Matthias Clasen 2008-10-18 01:38:02 UTC
I wonder why we don't configure festival to make it work with pulseaudio.

Running festival with our package, while music is playing, yields:

[mclasen@localhost ~]$ festival --tts text
Linux: can't open /dev/dsp

This can be fixed by adding the following lines to /etc/festival/siteinit.scm:

(Parameter.set 'Audio_Command "aplay $FILE")
(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Required_Format 'snd)

Comment 1 Matthew Miller 2008-10-18 13:13:42 UTC
Thanks for the suggestion. I have a big update planned for after then F10 release and I'll get this in then.

Comment 2 Matthias Clasen 2008-10-18 21:07:20 UTC
If you don't mind, I'd really like to get this in before F10. We're shipping with PA on by default, and it would be a bit of a bummer to have non-working speech as a consequence of that.

Comment 3 Matthew Miller 2008-10-19 00:42:35 UTC
I'm fine with that -- I just don't have time to work on it. 

Some notes:

This should go in /usr/share/festival/lib/init.scm rather than in /etc/festival/siteinit.scm since it's a system default rather than a local customization.

Are there any downsides to using this method?

Comment 4 Matthias Clasen 2008-10-19 02:03:01 UTC
Ok, I do the work to get this in the package, and I can put it into lib/init.scm.
I've asked Lennart for his opinion about the best way to make festival work with PA, I'll wait for his response before building this.

Comment 5 Lennart Poettering 2008-10-20 15:19:01 UTC
If festival behaves correctly we could simply run festival prefixed with "padsp".

Comment 6 Matthew Miller 2008-10-20 15:25:16 UTC
> If festival behaves correctly we could simply run festival prefixed with
> "padsp".

Who is "we"? Any program which uses festival?

Comment 7 Matthias Clasen 2008-10-20 18:23:36 UTC
For F11, we should probably take a look at using speech-dispatcher with orca.

Comment 8 Matthias Clasen 2008-10-20 18:24:53 UTC
see http://live.gnome.org/Orca/SpeechDispatcher

Comment 9 Ray Strode [halfline] 2008-10-24 21:15:45 UTC
Two thoughts:

1) should probably use paplay instead of aplay since it gives us the ability to name the stream in pavucontrol

2) isn't this a bad idea in general? I mean doesn't it mean festival will write out all audio to a file, and play the file adding lots of latency for orca users?

Comment 10 Lennart Poettering 2008-10-24 21:26:24 UTC
They use aplay? Oh my! That's horrible!

Comment 11 Matthias Clasen 2008-10-24 21:34:31 UTC
Does orca currently work at all when pulseaudio is running ?

As I said: longer-term, sound-dispatcher may be a better option. 
Or maybe just write a pa backend for festival.

Comment 12 Ray Strode [halfline] 2008-10-24 21:40:13 UTC
Lennart, it doesn't use aplay right now, but Matthias's proposal in comment 0 was to use aplay.

Matthias, yea I was using orca the other day to test gnome bug 535827 and i was getting audio okay.

Comment 13 Ray Strode [halfline] 2008-10-24 21:41:17 UTC
also interesting is the festival source tree seems to suggest it has a libesound backend, which should work with pa...

Comment 14 Ray Strode [halfline] 2008-10-24 21:42:47 UTC
Actually, I can't reproduce the failure in comment 0.

Maybe it was broken for some reason and has since been fixed?

Can you still reproduce the original issue?

Comment 15 Ray Strode [halfline] 2008-10-24 21:44:06 UTC
scratch comment 13.  i missed the "while playing music" bit.  i can reproduce if rhythmbox is playing music.

Comment 16 Lennart Poettering 2008-10-27 15:42:51 UTC
Anyone tried whether this would work?

(Parameter.set 'Audio_Command "pacat --channels=1 --rate=$SR $FILE")

Comment 17 Ray Strode [halfline] 2008-10-27 16:09:38 UTC
so running

(Paramter.get 'Audio_Method)

yields, linux16audio instead of esdaudio


(Parameter.set 'Audio_Method 'esdaudio)

then starting rhythmbox and playing music, followed by:

(SayText "hello")

gives the message "hello" on top of the music.

I think we just need to change the default audio backend to esdaudio.

Comment 18 Ray Strode [halfline] 2008-10-27 16:11:29 UTC
Matthias pointed out this might break festival for runlevel 3 users.  

Lennart, do you know if it will?

Comment 19 Matthias Clasen 2008-10-27 16:36:18 UTC
To answer that question:

ESD: error writing - Bad file descriptor
#<Utterance 0xb7197818>

Comment 20 Lennart Poettering 2008-10-27 17:14:42 UTC
The thing with esd-style autospawning is that it is racy, does not do locking while testing whether to startup a new instance. I'd prefer if we didn't rely n esd style autospawning.

Which leaves us the options. a) use pacat or b) make sure that pulseaudio --start was rung and completed before festival becomes active.

Comment 21 Ray Strode [halfline] 2008-10-27 19:01:40 UTC
pacat doesn't work if pulseaudio isn't running, right?

Comment 22 Matthias Clasen 2008-10-27 20:15:29 UTC
Yes, I think the only solution that has a chance of working in the absense of PA is aplay (which is why I put that in the initial comment, btw...)

Comment 23 Lennart Poettering 2008-10-27 23:53:39 UTC
Since pacat links against libpulse it would use the race-free PA-style autospawning. Hence using pacat is fine.

Comment 24 Matthew Miller 2008-10-28 00:37:23 UTC
(In reply to comment #16)
> Anyone tried whether this would work?
> (Parameter.set 'Audio_Command "pacat --channels=1 --rate=$SR $FILE")

So, on my rawhide system, this makes a horrible loud static noise. But this system has been constantly tracking rawhide for a year and a half or, and pulseaudio has always worked inconsistently.

Comment 25 Ray Strode [halfline] 2008-10-28 00:50:09 UTC
It works on my system in X.  Haven't tried from runlevel 3.

Comment 26 Ray Strode [halfline] 2008-10-28 01:59:55 UTC
okay i built festival with the pacat workaround for now.

We should revisit this at some point, though.

Note You need to log in before you can comment on or make changes to this bug.