title: How can I run ruby-espeak as root user?
body: <p>I am creating a ruby based application and I wish it to speak some text.  So far am using espeak:</p>
  
  <pre><code>fork{exec ("espeak 'New file located #{timelog.hour} #{timelog.min}' \" &gt; /dev/null")}
  </code></pre>
  
  <p>which works when i run it as normal user, but I need this script to run as root.  When it runs as root I get:</p>
  
  <pre><code>ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
  ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
  ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
  ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
  ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused
  </code></pre>
  
  <p>Why can't I run this script as root?
  Also, is there another way to make my ruby script do TTS (Text To Speech)?</p>
  
  <p>Added: I have even tried Festival when i run it nothing happens even as normal user.</p>
  
  <pre><code>require "rubygems"
  require "festivaltts4r"
  "I'm talking".to_speech
  </code></pre>
  
  <p>(gem list) ruby 1.9</p>
  
  <pre><code>bigdecimal (1.1.0)
  clickatell (0.8.2)
  espeak-ruby (0.4.0)
  festivaltts4r (0.2.0)
  ffi (1.1.5)
  hoe (3.1.0)
  io-console (0.3)
  json (1.5.4)
  minitest (2.5.1)
  nice-ffi (0.4)
  rake (0.9.2.2)
  rdoc (3.9.4)
  ruby-sdl-ffi (0.4)
  rubygame (2.6.4)
  sms_fu (1.1.2)
  tts (0.3.0)
  </code></pre>
  
  <p>OS:OpenSuse</p>