Speech, Sounds, and Music options

User contributed sources that have become inactive, deprecated, or generally unusable. But ... we don't really want to throw them away either.
Post Reply
Sigord
Posts: 153
Joined: Mar 14, 2013 9:54
Location: Hastings UK
Contact:

Speech, Sounds, and Music options

Post by Sigord »

I have discovered I was foolish to remove the ZIP of my simple extras for FB at http://www.sigord.co.uk//TEMP/FBextras.zip
originally it was quoted in www.freebasic.net/forum/viewtopic.php?f=8&t=22215 The BAS file is included.

So I have uploaded a slightly new version using below as the menu. The EXE files were of course created by other BASICs, which unlike FB have not been adapted to run under a Linux, though they do work in some cases using Wine.

Comments always welcome.
angros47
Posts: 2329
Joined: Jun 21, 2005 19:04

Re: Speech, Sounds, and Music options

Post by angros47 »

Under wine, midi usually doesn't work (unless you have configured it in the host system)

Since in your post you talked about the old TRAN speech for dos (it used SAY.COM and SPEECH.COM)... have you tried my port to freebasic?
Sigord
Posts: 153
Joined: Mar 14, 2013 9:54
Location: Hastings UK
Contact:

Re: Speech, Sounds, and Music options

Post by Sigord »

Sorry what is the link to your port to freebasic?

I gave up using Tran years ago finding modern CPUs are much to fast, and it can no longer be slowed down to hear the Speech sounds. But if anyone is interested I will put it up on my site along with the DOC gen.
angros47
Posts: 2329
Joined: Jun 21, 2005 19:04

Re: Speech, Sounds, and Music options

Post by angros47 »

Here it is:

http://www36.zippyshare.com/v/13840637/file.html

it's dos only, but it can easily be ported to linux (to windows it's a bit more difficult).

You can find details here: http://freebasic.net/forum/viewtopic.php?f=4&t=22101
Sigord
Posts: 153
Joined: Mar 14, 2013 9:54
Location: Hastings UK
Contact:

Re: Speech, Sounds, and Music options

Post by Sigord »

Thanks I do not suppose there is any code available to create sounds or speech under Debian Linux such as Mint I use, even if it cannot be tested properly under FB first as is usual

I now find TRAN still works OK using DOSBOX if you slow it down a little first by using say SET TRAN= 5,2

In view of the interest shown here I have now uploaded the little 32 ZIP at http://www.sigord.co.uk//Temp/TRAN.zip
angros47
Posts: 2329
Joined: Jun 21, 2005 19:04

Re: Speech, Sounds, and Music options

Post by angros47 »

Speech under linux mint, or ubuntu, is really easy; you can just open a pipe toward the espeak utility:

Code: Select all

open pipe "espeak" for output as #1
print #1,"Hello world!"
close #1
Sigord
Posts: 153
Joined: Mar 14, 2013 9:54
Location: Hastings UK
Contact:

Re: Speech, Sounds, and Music options

Post by Sigord »

Thanks very much indeed.

Where might we find a list of other ' pipe ' functions we might as easily access with FB please?

After all the great advantage of FB is the way code can usually be easily used on some Linux. I find below detects if code is being used on Windows or Linux to allow us to use Windows software such as Notepad or other programs for Linux. For example how can we be sure to call up the Terminal under Linux hoping to activate Unix code please?

Code: Select all

os = 0 : locate 10,30
#ifdef __FB_WIN32__
os = 1
#endif
angros47
Posts: 2329
Joined: Jun 21, 2005 19:04

Re: Speech, Sounds, and Music options

Post by angros47 »

A pipe is just a function to pass the output of a program to another program in real time; espeak is just a program you can call from the terminal, by using

Code: Select all

espeak 'hello world'
In FreeBasic you could do the same by using

Code: Select all

SHELL "espeak 'hello world'
but you shouldn't, since this solution will load/unload the espeak program for every sentence you say.

But you can send data to a program using the pipe character |

If you have a file called file.txt, you can do, from the terminal:

Code: Select all

cat file.txt|espeak
Want to hear the names of all files in your directory?

Code: Select all

ls|espeak

You can also use the same trick to feed data to a freebasic program: if you put, instead of espeak, the name of a program written by you, this program will be able to read the file with just "INPUT", as if it were written from the keyboard.

There are some programs, in linux, called "filters", that are expecially designed to be used through the pipe (i.e. "more", "less", "sort"...)

The "open pipe" is just a solution to be able to use this trick in FreeBasic, too. If you open a pipe toward "aplay", you will be able to feed it raw audio data, and create your sounds, for example.

So, to answer your question, a list of all "pipe" functions actually is a list of every linux command.

About using the terminal in linux and windows:

Code: Select all

#ifdef __FB_WIN32__
    shell "dir"
#endif
#ifdef __FB_LINUX__
    shell "ls"
#endif 
The above code show the directory, using equivalent command in windows (dir) and linux (ls)
Post Reply