Re: The Synthizer Thread
Hi,
I don't reallyw ant to submit an issue, as I've no idea if I'm doing something wrong or not here.
The below code works extremely slowly on my system. I hit the space bar, and the sound plays maybe 0.5-1.0 seconds afterwards.
Here's the code:
]
"""Minimal Synthizer test."""
from typing import Optional
import pyglet from pyglet.window import Window, key from synthizer import (Buffer, BufferGenerator, Context, DirectSource, initialized) from cytolk import tolk class TestWindow(Window): """Override the key handler.""" audio_context: Optional[Context] = None generator: Optional[BufferGenerator] = None source: Optional[DirectSource] = None def on_key_press(self, symbol: int, modifiers: int) -> None: """Intercept the space bar.""" if symbol == key.SPACE: tolk.speak('Shoot.') if self.audio_context is None: self.audio_context = Context() self.generator = BufferGenerator(self.audio_context) self.source = DirectSource(self.audio_context) self.source.add_generator(self.generator) if self.generator is not None: if self.generator.buffer is None: self.generator.buffer = Buffer.from_stream( 'file', 'shoot.wav' ) else: self.generator.position = 0.0 else: return super().on_key_press(symbol, modifiers) if __name__ == '__main__': pyglet.options['shadow_window'] = False window: TestWindow = TestWindow(caption='Synthizer Test') with initialized(): tolk.load() pyglet.app.run()
As far as I can tell it's equally slow playing a wav file or an MP3.
Here are the two files I'm testing with. I converted them from another wav file (not included) using Goldwave.
https://www.dropbox.com/t/FlKInOQWQAM9yMMe.
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector