Building sam text to speech for haiku

so i was able to build sam text to speech for haiku however it only seems to work if i output the speech as a wav file and play it back with a media player heres the source code i used

here are the changes i made to the makefile in order to get this to work

CFLAGS =  -Wall -O2 -fcommon `sdl-config --cflags`
LFLAGS = `sdl-config --libs`

make sure you install libsdl then just

./sam "hello there" -wav wavefile

why do this you may ask because i can though if you want some thing more reliable i would just use espeak but if your an odd ball like me this is how to do it

I’m thinking about maybe making a haiku. Package, but I’m not too sure about the licensing and stuff on the github repository, it does say it’s under “fair use” but it seems kind of sketch then again it is pretty much forty year old abandoneware

well screw it i made a haiku package I should do some tweaks to the info file but here it is I tested the package it should work I don’t have my own repo yet so for now I’m just gonna host it using google drive for now but stay posted on that I might make one in the far future and its all going to be simple ports like this one

1 Like

maybe i should make a sound pack with this while I’m at it

OMG. It’s fueling old memories of my first text to speech experience in the '80, on my first ever computer, a Sinclair Spectrum 48k!

I know, right. I just wish it would actually output to the speakers directly, instead of having to save a wave file then, again, the fact that I have it even partially working is amazing let me know if you have any other problems with it or anything i could do differently with porting it

Well, I guess with some work, using the BSoundPlayer class and a callback, it should be something possible.

If you want to try it, you can get inspiration from this code in Haiku source tree:
src/tests/kits/media/playwav/playwav.cpp

It’s a tiny testing code that use the BSoundPlayer class, a background thread reading audio samples (44.1kHz 16bits stereo) from a Wav file and pushing them to a port so that the BSoundPlayer registered callback could consume these samples and .

I guess the sam -wav ooutput option is somehow producing these samples and write then in a file. Instead, a patched version could then use the Haiku API to actually play the generated audio samples instead.

Perhaps you could find some inspirations looking at pipertts package?

Wow…this would be a great addition to Haiku. Especially if you work out playing it out of the speakers. Good work!