On Thursday, 23 April 2015 at 22:26:28 UTC, Jens Bauer wrote:
On Thursday, 23 April 2015 at 19:24:31 UTC, Chris wrote:
On Thursday, 23 April 2015 at 16:57:30 UTC, Jens Bauer wrote:
3: Audio mixing and playback (eg. a MOD player for instance).
5: Queueing up a bunch of different jobs;

At the moment I'm using threads to implement a speech synthesizer. It waits for input, synthesizes it, and then "speaks" in a separate thread. If new input comes, the speaking thread is stopped. I wonder, if fibers would be a viable alternative to threads (after all audio playback was mentioned in the list above).

I'll try and give you some (perhaps useless) input... :)

I think there are a number of good possibilities for spreading out the jobs. First thought is to split every job on spaces; eg. every word is a separate job, some words may be possible to "recycle" either fully or partly, depending on how they're pronounced in the particular context.
I cannot give any conclusions, but I do see that ...
Using multiple CPU cores with each their own Fiber would probably be the most optimal solution. Each Fiber could perhaps synthesize a word at a time. -But I do not know if you're able to control which core your Fiber is running on.

That would of course only generate the data (faster than real-time on most systems). An audio frame-buffer interrupt could 'pull' the data, when necessary. Such an interrupt could also mix multiple voices (having different/variable volume and panning) if needed (here I'm thinking of 'speaking' the conversations in a chat-room).

I was more thinking of the audio thread. But the audio is probably better off in a separate thread.

Reply via email to