<div dir="ltr">Hi,<br><br>I had written a mail to the speechd community regarding the problems that James was facing some time back.<br><br><blockquote>Hi,<br><br>James is using speech-dispatcher on the OLPC laptop. I would
just like to ask in the speechd community what is the exact meaning of
the following espeak.log messages. (I get similar log messages for each
speech synthesis request - either from spd-say or James' Read Etexts
activity.<br><br><ol><li style="color: black; font-weight: normal; font-style: normal;"><div style="font-weight: normal;"> Tue Jul  8 17:25:20 2008 [29778] ALSA: Setting access type to INTERLEAVED
</div></li><li style="color: black; font-weight: normal; font-style: normal;"><div style="font-weight: normal;">
 Tue Jul  8 17:25:20 2008 [30690] ALSA: Setting sample format to S16_LE
</div></li><li style="color: black; font-weight: normal; font-style: normal;"><div style="font-weight: normal;">
 Tue Jul  8 17:25:20 2008 [31120] ALSA: Setting sample rate to 22050
</div></li><li style="color: black; font-weight: normal; font-style: normal;"><div style="font-weight: normal;">
 Tue Jul  8 17:25:20 2008 [31778] ALSA: Setting channel count to 1
</div></li><li style="color: black; font-weight: normal; font-style: normal;"><div style="font-weight: normal;">
 Tue Jul  8 17:25:20 2008 [32067] ALSA: Setting hardware parameters on the ALSA device
</div></li><li style="color: black; font-weight: normal; font-style: normal;"><div style="font-weight: normal;">
 Tue Jul  8 17:25:20 2008 [32968] ALSA: cannot set parameters (File descriptor in bad state) state=SUSPENDED
</div></li></ol>We cannot hear any audio output during speech-synthesis
on the OLPC laptops. Any hints about the problem will be greatly
appreciated.<br><br></blockquote>And this was the analysis by Hynek from the speechd community. (It would've done well if I had cross posted the mail back then to devel..oh well)<br><br><div style="margin-left: 40px;">
1.<br>
      Tue Jul  8 17:25:20 2008 [29778] ALSA: Setting access type to<br>
      INTERLEAVED<br>
  2.</div><div style="margin-left: 40px;" class="Ih2E3d"><br>
       Tue Jul  8 17:25:20 2008 [30690] ALSA: Setting sample format to<br>
      S16_LE<br></div><div style="margin-left: 40px;">
  3.</div><div style="margin-left: 40px;" class="Ih2E3d"><br>
       Tue Jul  8 17:25:20 2008 [31120] ALSA: Setting sample rate to<br>
      22050<br></div><div style="margin-left: 40px;">
  4.</div><div style="margin-left: 40px;" class="Ih2E3d"><br>
       Tue Jul  8 17:25:20 2008 [31778] ALSA: Setting channel count to 1<br></div><div style="margin-left: 40px;">
  5.</div><div style="margin-left: 40px;" class="Ih2E3d"><br>
       Tue Jul  8 17:25:20 2008 [32067] ALSA: Setting hardware<br>
      parameters on the ALSA device<br></div><div style="margin-left: 40px;">
  6.</div><div style="margin-left: 40px;" class="Ih2E3d"><br>
       Tue Jul  8 17:25:20 2008 [32968] ALSA: cannot set parameters<br>
      (File descriptor in bad state) state=SUSPENDED<br>
<br>
</div>
<div style="margin-left: 40px;"><br>
Hello,<br><br>
on every request to play a sound, the ALSA device must<br>
be initialized for the exact audio parameters (22050Hz,<br>
1 channel signed 16 bit data, low endian...).<br><br>
A call of the function snd_pcm_hw_params() is necessary<br>
to set these parameters on the device and bring it<br>
to the PREPARED state, where it is possible to play<br>
audio. The only restriction given in the ALSA documentation<br>
is that snd_pcm_hw_params() can't be called when ALSA<br>
is in the state RUNNING. (But the documentation is  not really<br>
complete.)<br><br><a href="http://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m.html#g98ba19d2800b7d601277fd8c068505da" target="_blank">http://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m.html#g98ba19d2800b7d601277fd8c068505da</a><br>
<br>
The last message (6) indicates that the call to snd_pcm_hw_params<br>
fails. ,,File descriptor in bad state'' is the error message given<br>
by alsa. The device is however well in the SUSPENDED state, which<br>
contradicts this error message.<br><br>
Since this essential step fails, the audio can't be played<br>
and so you don't hear anything. Thus index marks are delivered<br>
very fast etc. etc.<br><br>
The exact code inside Speech Dispatcher audio library that<br>
fails is:<br><br>
MSG("Setting hardware parameters on the ALSA device");     if ((err =
snd_pcm_hw_params (id->alsa_pcm, id->alsa_hw_params)) < 0) {<br>
   MSG("cannot set parameters (%s) state=%s",<br>
       snd_strerror (err), snd_pcm_state_name(snd_pcm_</div>







<div style="margin-left: 40px;" id=":10m" class="ArwC7c ckChnd">state(id->alsa_pcm)));      return -1;<br>
   }<br>
<br>
It looks to me that the error message is misleading and<br>
the actual problem is elsewhere. Perhaps the audio device<br>
in OLPC can't accept these parameters? Perhaps there<br>
is some permission problem and it is not possible to bring<br>
the audio into the PREPARED state? Perhaps this is a<br>
one-channel soundcard and is being blocked by something<br>
else?<br>
<br>
I suggest to try whether 'aplay' works in the exact same<br>
conditions (under the user that otherwise runs<br>
speech-dispatcher) etc.</div><br><div>

                                        
                                
                        
                        
                        
                                                                
                                
                                
                                
                                I did not get around to testing Hynek's suggestion till now however. <br><br>Best,<br>Hemant<br><br><br><div class="gmail_quote">On Tue, Jul 15, 2008 at 9:17 PM, Erik Garrison <<a href="mailto:erik@laptop.org">erik@laptop.org</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Tue, Jul 15, 2008 at 09:06:02AM -0500, James Simmons wrote:<br>
</div><div class="Ih2E3d">> Michael,<br>
><br>
> The activity logs contain no clues.  Really no message at all.<br>
><br>
> The Activity window is present but non-responsive.  You can switch to<br>
> the main screen using F3 (the XO equivalent activity-switching key) but<br>
> you cannot shut down the application there.  When you switch back to<br>
> Read Etexts the screen is blank, as if something is preventing it from<br>
> repainting.  So the app doesn't bail out, it just hangs.  I can use<br>
> other activities like the log viewer and the terminal no problem.<br>
><br>
> And of course nothing like this happens when testing with Xubuntu, or<br>
> when testing the standalone app containing the same code running under<br>
> the Terminal.<br>
><br>
<br>
</div>How would I obtain the source so that I can assist in debugging?<br>
<font color="#888888"><br>
Erik</font></blockquote></div></div></div>