Text to Speech in Netlogo - text-to-speech

I am creating a program in Netlogo in which I am initializing a variable. The value stored in this variable changes when a function is called. I want that whenever the function is called, the value stored in the variable is pronounced/spoken. I already know how to call external .wav file in Netlogo, but can I pronounce/speak the variable value (say 250) as "two hundred and fifty" at any time?
Any help will be highly appreciated. Thanks

Dunno about other OS's, but Mac OS X has a command called say that does text-to-speech, so you could use the Shell extension to invoke that.
There was an old NetLogo 4.0 extension, also Mac OS X only, that supported text-to-speech directly: https://ccl.northwestern.edu/netlogo/4.0.0/extensions/speech.tgz. But I don't think anybody ever updated it for newer versions of NetLogo.

Related

vlc lua subtitle "reader"

I want to write an extension for VLC in Lua. I have never worked in Lua, and I can't find any information about this problem.
There is a function to get the current subtitle line directly (which is on the screen) ?
Another problem:
What time of unit will be stored in this variable?
local elapsed_time = vlc.var.get(input, "time")
I couldn't find anything except a two year old post which might be relevant: https://forum.videolan.org/viewtopic.php?f=29&t=102482.
About the get function, according to http://www.videolan.org/developers/vlc/share/lua/README.txt it gets the time property of the input object. You would think it were same as input.time but maybe not.

Calling a Fortran program within another Fortran program in Fortran 77

Say I have two programs: solve.f and plot.f . The solve program solves an equation and prints the data to a file. The plot routine reads that data and plots it. Is there a way that I can call the plot.f file in the solve.f file?
I've tried compiling the plot program (the file was named plot) and tried calling it using "call plot" but that did not work. I looked through the documentation and have not been able to find anything related to this issue.
The only alternative I can think of is to combine the two programs into one.
Unless I have completely misunderstood your question, can't you use the SYSTEM() function to execute plot.f (well, its compiled executable really) from solve.f?
Documentation is here.

Debugging interpreter in VM when changing vm primitives

Context
As a university project we want to change the the pharo vm to use an object-table and see what happens.
We use a pharo-vm clone from github and VMMaker. Building the VM works fine.
To get started we added a primitive that returns an incremented Integer:
InterpreterPrimitives>>primitiveIntegerIncrement
"increments an integer"
self pushInteger: self popInteger + 1 .
and modified StackInterpreter class>>initializePrimitiveTable accordingly
MaxPrimitiveIndex := 576.
"... and so on ..."
(575 primitiveFail)
(576 primitiveIntegerIncrement))
And it works.
Problem
When we make changes to the VM we want to test-run already in the SmalltalkImage so we do not need to compile and see it did not work.
Something like:
StackInterpreter test: '1 inc'
And then I can debug if the primitive is wrong or an error occurs. Of course there needs to be done much more but how can I achieve this?
What we tried
category VMMaker-InterpreterSimulation class StackInterpreterSimulator. Trying the code in the comments
DoIt
^ (StackInterpreterSimulator new openOn: Smalltalk imageName) test
errors:
displayForm := 'Display has not yet been installed' asDisplayText form.
the ByteString does not understand asDisplayText
(CogVMSimulator new openOn: Smalltalk imageName) test
(InterpreterSimulator new openOn: Smalltalk imageName) test
error:
PrimitiveFailed: primitive #basicNew: in Array class failed
I also found this screen cast but it only debugs the VM from outside using gbd: http://vimeo.com/22485382#
Our project is hosted here: http://smalltalkhub.com/#!/~kirstin/PharoObjectTable
Current Status
We started implementing an object table. The lookup of attributes can go throught the object table. Full object table support and no usage of direct pointes is very tricky since pointers are expected everywhere. So we use pointers into the object table to identify when a lookup should go through the OT. We also found all object creation primitives and add new objects to the table.
How long is your project and how many people are you ? To me what you try to do is quite some work. Do you have good knowledge about low level behavior ?
To answer your question, the main problem here is that the cog simulator is not maintained in the pharo vm fork. This is because no one in the pharo crew use the simulator. We only use external debugging from gdb. In fact the pharo folks work mostly on VM plugins, the core of the VM is mainly maintained and developed by Eliot Miranda which works on Squeak. Therefore we report to him when there's a bug in the VM core.
For your project you would have to split it in at least 2 steps:
step 1: make the object table work with the stack VM
step 2: make the JIT work with your object table
Note that for step 2 I would recommend not to change the way an object access its header, therefore having a VW-like object table where you have the fixed size header on the one in the the object table, and the fields of the objects (and maybe header extensions) in the heap.
So use the StackVMSimulator and build the StackVM first. When everything will work (including context), you can think about hacking the JIT. Recently Guillermo Polito ported the Stack VM to the build process (see PharoSVMBuilder instead of PharoVMBuilder), a guy reported problems with this builder but you could hack it a bit to make it work.
Now to make the simulator work on Pharo 2.0 (which is the Pharo version of the generator image you have), you have to open the monticello browser and merge from Eliot's branch the Cog package (repo MCHttpRepository location: 'http: //source. squeak. org/VMMaker'), but not the latest Cog, the one at around the same date as the current VMMaker package of pharo-vm because the latest Cog and VMMaker of Eliot's branch are not stable.
The alternative being to start from Eliot's build image and merge things from the pharo branch. Here are infos about how to build the squeak development image (http://www.mirandabanda.org/cogblog/build-image/).
Then Eliot gave me this script once:
| cos |
cos := CogVMSimulator newWithOptions: #(Cogit SistaStackToRegisterMappingCogit).
cos desiredNumStackPages: 8.
cos openOn: 'my/favourite.image'.
cos openAsMorph; toggleTranscript; halt; run
You don't need the SistaStackToRegisterMappingCogit option. I guess some similar script with the StackVMSimulator should work.
Lastly there are some documentation about the simulator but it is only for the CogSimulator (these documentations expects you already knows how the StackSimulator works, and just give you hints about how to use it with the JIT):
http://www.mirandabanda.org/cogblog/2008/12/12/simulate-out-of-the-bochs/
and in one of the video named "Cog VM (part x)", x being from 1 to 6, Eliot shows how he uses the simulator to disassemble x86, print the stack and inspect the heap.
Another tip, ask your questions on the pharo mailing list (pharo users or pharo dev), because here no one may notice your question (fortunately someone pointed me out your question this time).
And tell on the pharo mailing list if you managed to run the simulator in Pharo 2.0, some people (as me) are very interested in it. I was planning to do it at some point.
Good luck ! Nice project anyway.
The last time I tried to use the simulator is roughly a year ago, and I did not make it work.
However, there are a few patches, which I assume never got integrated that might be of help:
https://code.google.com/p/cog/issues/detail?id=106
https://code.google.com/p/cog/issues/detail?id=107
https://code.google.com/p/cog/issues/detail?id=108
Issue 107 includes a patch for your asDisplayText issue.

number->string and related procedures in GIMP scheme scripting

I am frustrated with string-to-number and number-to-string conversion in GIMP scripting. I am runnning GIMP 2.6.8 in Windows Vista.
I understand that GIMP's internal Scheme implementation changes over the versions and I can't seem to nail down the documentation. From what I can gather GIMP's Scheme is a subset of TinyScheme and/or supports the R5RS standard procedures. In any case, I usually just look in the packaged script directory for examples when I want to try something new, because that should work for sure, right?
For example, grid-system.scm comes with the latest GIMP release and has the expression,
(string-append (number->string obj) " ")
which is exactly what I want. However, if I use number->string in my own script, or even type it into GIMP's script console (which is how I usually test out new stuff I want to do) it tells me number->string is an unbound variable:
> (number->string 3)
Error: eval: unbound variable: number->string
Other standard procedures from, say R5RS, work just fine:
> (string-append "frust" "rated")
"frustrated"
So,
1) Is there some lurking documentation for current GIMP Scheme scripting other than something drastic like searching GIMP's source code?
2) Can I use the GIMP console to spit out a list of all defined procedures to find something I need?
3) Anyone else confirm that number->string is not defined for the current Windows build, even though it appears in the packaged scripts? My web searches haven't turned up any related problems, and a complete uninstall of all GIMP versions, back to latest puts me in the same scrape.
You can rebind variables and monkeypatch top level standard library functions in Scheme, but I don't think you can unbind top level variables. Maybe there is some library file that isn't loading right.
My TinyScheme in GIMP 2.6.8 on OS X executes number->string just fine.
number->string is defined in share/gimp/2.0/scripts/script-fu.init as
(define (number->string n) (anyatom->string n number?))
so you could just run that code to rebind the variable. Or maybe you could reload script-fu.init

Is there a system where executing a program and calling a function is unified?

I would like to be able to do one or more of the following from the shell:
- call any function from the program not only the main
- pass parameters that are not only strings (not only argv)
- have a program return not only int (the return code from main)
- assign returned values to shell-level variables to be able to pass them to other programs
You get the idea.
For instance python toplevel allow this for python programs.
What about C++?
Or a ELF replacement on linux that would allow that?
If you looking for an operating system that does this - the vxWorks shell/C interpreter does this.
But, it's vxWorks - a realtime operating system (no GUI).
It's not too difficult to come up with an app that allows you to call certain functions by name from dynamic libraries such as DLLs under Windows, provided those functions take only a limited selection of parameter types such as ints, floats and fixed strings.
However, for most C++ programs this is not sufficient. For example, suppose your C++ function takes s std::map of dynamic string to socket as a parameter - how are you going to create the map, to say nothing of its contents in your shell?
But if you can forgo C++, there is one language cum operating system that does exactly what you suggest - Smalltalk. If you are interested in this paradigm, take a look at Squeak, which is free software.
Under Windows, there is RUNDLL32 to call DLL function, eg
RUNDLL32.EXE USER32.DLL,SwapMouseButton
Have you looked at c-repl?
The system would have to be completely interpreted, right? And how would you know the function signatures of the things you were calling?