2016-01-26 3 views
6

私はpyvonaを使用しようとしていますが、speak()関数ではこれが起こり続けます。ここでは、コードです:私のpyvona speak()関数が動作していません

def speak(self, text_to_speak): 
    """Speak a given text 
    """ 
    if not pygame_available: 
     raise PyvonaException(
      "Pygame not installed. Please install to use speech.") 

    with tempfile.SpooledTemporaryFile() as f: 
     with self.use_ogg_codec(): 
      self.fetch_voice_fp(text_to_speak, f) 
     f.seek(0) 
     if not pygame.mixer.get_init(): 
      pygame.mixer.init() 
     channel = pygame.mixer.Channel(5) 
     sound = pygame.mixer.Sound(f) 
     channel.play(sound) 
     while channel.get_busy(): 
      pass 

は、エラーが

Traceback (most recent call last): 
    File "/Users/noahchalifour/Desktop/pyvona-0.25/pyvona.py", line 250, in <module> 
     v.speak('Hello World') 
    File "/Users/noahchalifour/Desktop/pyvona-0.25/pyvona.py", line 138, in speak 
     sound = pygame.mixer.Sound(f) 
TypeError: Unrecognized argument (type SpooledTemporaryFile) 
+0

あなたはpygameのどのバージョンを使用していますか? – unutbu

+0

は私にとってはうまく動作します、どうやってpygameとpyvonaをインストールしましたか? –

+0

imはpygameを使用しています1.9.2 –

答えて

0

ファイルがサウンドファイルそれであれば、この

sound = pygame.mixer.Sound(file=f) 

または

sound = pygame.mixer.Sound(file=f._file) 

を試してみてくださいですシュウ仕事。

0

pygameのと同様の問題を持った後、私がしようと、pygletに移動:

Import pyglet 
music = pyglet.media.load('file.mp3') 
music.play() 
pyglet.app.run() 
関連する問題