Clone this wiki locally
media: library is an extension which supports three basic multimedia operations: playing MIDI files, displaying images, and speaking text.
Compared with the core Ripple libraries, this one has "toy" status, but who knows... maybe you'll find it useful.
In order to use it with the Ripple Java implementation, you need to build the ripple-media module from source or import it using Maven (see Running Ripple).
For a media-enabled Ripple command line, use
cd ripple-media/ ./ripple-media.sh
Naturally, you must run the script on your local machine (or at any rate, one with a graphical desktop and audio output) in order to get the benefit of these primitives.
To use the library in another project, include the full class name
net.fortytwo.ripple.libs.media.MediaLibrary in the
net.fortytwo.ripple.model.Library provider-configuration file, i.e. use this file.
This primitive fetches and plays a MIDI file. It expects one argument at the top of the stack: the URI of the MIDI file to play. It inspects stack to find the URI, attempts to fetch a file from the URI, and if successful, plays the file before producing the original stack as a solution. The file continues playing until either the end of the track is reached, or the Ripple process terminates.
# Turn on your speakers, and... 1) <http://www.bachcentral.com/BachCentral/WTCBkI/Prelude1.mid> play.  <http://www.bachcentral.com/BachCentral/WTCBkI/Prelude1.mid>
This primitive fetches an image and displays it in a popup window. It expects one argument at the top of the stack: the URI of the image file to display. It peeks at the argument on the stack, attempts to fetch the file and, if successful, renders it in a popup window before producing the original stack as a solution. The popup window remains open until closed by the user, or until the Ripple process terminates.
# Show some identi.ca profile pictures 1) <http://identi.ca/user/114> foaf:knows. foaf:img. 5 limit. show.  <http://avatar.identi.ca/1-397-20100903013814.jpeg>  <http://avatar.identi.ca/12668-original-20090124160414.jpeg>  <http://avatar.identi.ca/58-original-20080618232014.png>  <http://avatar.identi.ca/12956-original-20090131063357.png>  <http://avatar.identi.ca/226-original-20080706205455.jpeg>
This primitive speaks the text of a string in the default FreeTTS voice. It expects a single argument at the top of the stack: the text to speak. It peeks at the text on the stack, then speaks the text while producing the original stack as a solution.
At the command line, you can cause the primitive to stop speaking new text by double-tapping the ESC key.
# It speaks while it solves. 1) (1 2 3 4 5) each. to-string. speak.  "1"^^xsd:string  "2"^^xsd:string  "3"^^xsd:string  "4"^^xsd:string  "5"^^xsd:string 2) <http://identi.ca/user/114> foaf:knows. foaf:name. 5 limit. speak.  "Dan Brickley"  "Robert Mark White"  "Marco Frattola"  "Yoan Blanc"  "Keith Alexander" [...]