Festival is not compatible with pulseaudio (won't speak when other app is playing sound)

Bug #209900 reported by Fred
56
This bug affects 9 people
Affects Status Importance Assigned to Milestone
festival (Fedora)
Fix Released
Medium
festival (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: festival

So if I use festival, it speaks.

But if I am listening to music in Rhythmbox or watch a movie in Totem, then festival does not work! :(

$ echo hello | festival --tts
Linux: can't open /dev/dsp

WORKAROUND:
Create ~/.festivalrc with the following content:

;;;; Use pulseaudio to output sound
(Parameter.set 'Audio_Command "paplay -n festival $FILE")
(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Required_Format 'snd)

Tags: a11y

Related branches

Revision history for this message
puccha (yuri-schaeffer) wrote :

I think festival uses oss, a legacy sound server that only allows one audio stream at a time for most soundcards. Look for an argument to make it use alsa. Or alternatively fool festival and route the audio stream through alsa:

$ echo hello | aoss festival --tts

You might want to install the "alsa-oss" package first.

Alsa can mix different sound streams on a software level if your soundcard can't.

Revision history for this message
Fred (eldmannen+launchpad) wrote :

Then tell those guy who make Festival to switch to ALSA instead.

Revision history for this message
In , Matthias (matthias-redhat-bugs) wrote :

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)

Revision history for this message
In , Matthew (matthew-redhat-bugs) wrote :

Thanks for the suggestion. I have a big update planned for after then F10 release and I'll get this in then.

Revision history for this message
In , Matthias (matthias-redhat-bugs) wrote :

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.

Revision history for this message
In , Matthew (matthew-redhat-bugs) wrote :

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?

Revision history for this message
In , Matthias (matthias-redhat-bugs) wrote :

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.

Revision history for this message
In , Lennart (lennart-redhat-bugs) wrote :

If festival behaves correctly we could simply run festival prefixed with "padsp".

Revision history for this message
In , Matthew (matthew-redhat-bugs) wrote :

> If festival behaves correctly we could simply run festival prefixed with
> "padsp".

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

Revision history for this message
In , Matthias (matthias-redhat-bugs) wrote :

For F11, we should probably take a look at using speech-dispatcher with orca.

Revision history for this message
In , Matthias (matthias-redhat-bugs) wrote :
Revision history for this message
In , Ray (ray-redhat-bugs) wrote :

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?

Revision history for this message
In , Lennart (lennart-redhat-bugs) wrote :

They use aplay? Oh my! That's horrible!

Revision history for this message
In , Matthias (matthias-redhat-bugs) wrote :

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.

Revision history for this message
In , Ray (ray-redhat-bugs) wrote :

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.

Revision history for this message
In , Ray (ray-redhat-bugs) wrote :

also interesting is the festival source tree seems to suggest it has a libesound backend, which should work with pa...

Revision history for this message
In , Ray (ray-redhat-bugs) wrote :

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?

Revision history for this message
In , Ray (ray-redhat-bugs) wrote :

scratch comment 13. i missed the "while playing music" bit. i can reproduce if rhythmbox is playing music.

Revision history for this message
In , Lennart (lennart-redhat-bugs) wrote :

Anyone tried whether this would work?

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

Revision history for this message
In , Ray (ray-redhat-bugs) wrote :

so running

(Paramter.get 'Audio_Method)

yields, linux16audio instead of esdaudio

doing

(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.

Revision history for this message
In , Ray (ray-redhat-bugs) wrote :

Matthias pointed out this might break festival for runlevel 3 users.

Lennart, do you know if it will?

Revision history for this message
In , Matthias (matthias-redhat-bugs) wrote :

To answer that question:

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

Revision history for this message
In , Lennart (lennart-redhat-bugs) wrote :

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.

Revision history for this message
In , Ray (ray-redhat-bugs) wrote :

pacat doesn't work if pulseaudio isn't running, right?

Revision history for this message
In , Matthias (matthias-redhat-bugs) wrote :

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...)

Revision history for this message
In , Lennart (lennart-redhat-bugs) wrote :

Since pacat links against libpulse it would use the race-free PA-style autospawning. Hence using pacat is fine.

Revision history for this message
In , Matthew (matthew-redhat-bugs) wrote :

(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.

Revision history for this message
In , Ray (ray-redhat-bugs) wrote :

It works on my system in X. Haven't tried from runlevel 3.

Revision history for this message
In , Ray (ray-redhat-bugs) wrote :

okay i built festival with the pacat workaround for now.

We should revisit this at some point, though.

Revision history for this message
Daniel Ellis (danellisuk) wrote :

Although Puccha's comment about using aoss will work. My understanding is that it will route audio as follows:-

  festival > oss > alsa > pulseaudio

A more efficient method of routing festival is to use padsp which passes oss directly to pulseaudio as follows:-

  festival > oss > pulseaudio

The command would be:

$ echo "Hello" | padsp festival --tts

(aoss is not installed by default in Ubuntu 9.10, whereas padsp is)

Changed in festival (Ubuntu):
status: New → Confirmed
summary: - Festival won't speak when other app is playing sounds
+ Festival is not compatible with pulseaudio (won't speak when other app
+ is playing sound)
Revision history for this message
Daniel Ellis (danellisuk) wrote :

A thread on ubuntu forums http://ubuntuforums.org/showthread.php?t=751169 shows how to make festival work with pulseaudio directly. This will avoid having to use a wrapper such as padsp.

On my machine, I created the file /etc/festival.scm and entered the following four lines:-

;;;; Use pulseaudio to output sound
(Parameter.set 'Audio_Command "paplay -n festival $FILE")
(Parameter.set 'Audio_Method 'Audio_Command)
(Parameter.set 'Audio_Required_Format 'snd)

Festival now works as expected and the sound stream is identified as festival in Sound Preferences on the Application tab.

Now that Ubuntu uses pulseaudio as default, how can we go about including this default configuration file?

Revision history for this message
puccha (yuri-schaeffer) wrote : Re: [Bug 209900] Re: Festival is not compatible with pulseaudio (won't speak when other app is playing sound)

Daniel Ellis wrote:
> ;;;; Use pulseaudio to output sound
> (Parameter.set 'Audio_Command "paplay -n festival $FILE")
> (Parameter.set 'Audio_Method 'Audio_Command)
> (Parameter.set 'Audio_Required_Format 'snd)
>
> Festival now works as expected and the sound stream is identified as
> festival in Sound Preferences on the Application tab.
>
> Now that Ubuntu uses pulseaudio as default, how can we go about
> including this default configuration file?

The Debian package maintainer for Festival is Kartik Mistry
(http://packages.qa.debian.org/f/festival.html). I think it is best to
contact him and ask for the configuration change (I cc'd him/her). Next
time Canonical forks Debian the changes are copied. I'm not sure however
whether Debian also uses Pulseaudio.

@Kartik: We are talking about configuring Festival to use Pulse by
default in Ubuntu/Debian. Alsa might be a nice compromise in case Debian
doesn't do Pulse. see: (https://bugs.launchpad.net/bugs/209900).

//puccha

Revision history for this message
Anders (andersja+launchpad-net) wrote :

FYI the padsp workaround segfaults in a fully patched Karmic

$ echo "Hello" | padsp festival --tts

Segmentation fault

Revision history for this message
Kartik Mistry (kartik.mistry) wrote : Re: [Bug 209900] Re: Festival is not compatible with pulseaudio (won't speak when other app is playing sound)

On Sun, Dec 20, 2009 at 4:35 AM, Anders
<email address hidden> wrote:
> FYI the padsp workaround segfaults in a fully patched Karmic
>
> $ echo "Hello" | padsp festival --tts
> Segmentation fault

We don't have pulseaudio by default - so, as of now, we can add
README.pulseaudio somewhere in doc/ folder.

--
 Cheers,
 Kartik Mistry | 0xD1028C8D | IRC: kart_
 Debian GNU/Linux Developer | Identica: @kartikm
 Blogs: {ftbfs, kartikm}.wordpress.com

Revision history for this message
Sergio Oller (zeehio) wrote :

There is a native audio module for Festival and Speech Tools available at:

http://svn.berlios.de/viewcvs/festlang/trunk/

It is possible to get the source from:

svn checkout svn://svn.berlios.de/festlang/trunk/speech_tools
svn checkout svn://svn.berlios.de/festlang/trunk/festival

tags: added: a11y
Revision history for this message
Charlie Kravetz (cjkgeek) wrote :

Thanks for reporting this bug and any supporting documentation. Since this bug has enough information provided for a developer to begin work, I'm going to mark it as confirmed and let them handle it from here. Thanks for taking the time to make Ubuntu better!

Changed in festival (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Triaged
Revision history for this message
Jarno Suni (jarnos) wrote :

The bug occurs even without pulseaudio.

Revision history for this message
Jarno Suni (jarnos) wrote :
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package festival - 1:2.0.95~beta-5.1ubuntu2

---------------
festival (1:2.0.95~beta-5.1ubuntu2) natty; urgency=low

  * No longer depend on alsa-oss and oss-compat (LP: #612751)
  * Add festival.scm for default audio setting (LP: #662630, #209900)
 -- Andreas Moog <email address hidden> Wed, 02 Mar 2011 07:39:07 +0100

Changed in festival (Ubuntu):
status: Triaged → Fix Released
Changed in festival (Fedora):
importance: Unknown → Medium
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.