Void (itch) (Frozentape) Mac OS

broken image


Bartender
  1. Void (itch) (frozentape) Mac Os Update
  2. Void (itch) (frozentape) Mac Os Catalina
  3. Void (itch) (frozentape) Mac Os X
posted 8 years ago
  • Optional 'thank-you' note:
I've been playing with text to speech recently. After giving up on FreeTTS as more trouble than alternative approaches, I've been able to develop classes for the purpose for Windows (using a VBScript) and Linux, running in Sun VirtualBox (using a shell script and eSpeak) but I don't have access to, nor have ever so much as touched, a Mac. The Mac-specific code that follows is a cut-paste-edit of a full night's worth of Google searching. I took a look around, but I don't see any topics of this nature here.
This is not exactly a SSCCE, but it is as short as I could make it. If you have a Mac and a little time on your hands, feedback and bug fixes would be most welcome.import java.io.*; import java.util.*; public class MacSpeaker { protected File scriptFile; protected Process process; protected final String[] voices; protected int voiceIndex = 0; //protected int pitch = 0; // -10 to +10 protected int volume = 50; // 0 to 100 protected int rate = 100; // 80 to 400 public static void main(String[] args) { new MacSpeaker().test(); } private void test() { int numVoices = voices.length; if (numVoices 0) { return; } Random random = new Random(); for (int i = 0; i < 10 && i < numVoices; i++) { voiceIndex = random.nextInt(numVoices); volume = random.nextInt(100); System.out.println('Voice: ' + voices[voiceIndex] + ' Volume: ' + volume); speakAndWait('Hello World'); try { Thread.sleep(500); } catch (InterruptedException ex) { ex.printStackTrace(); } } } public MacSpeaker() { voices = populateVoiceArray(); } protected String[] populateVoiceArray() { Scanner input = null; try { Process p = Runtime.getRuntime().exec('say -v '?'); new ProcessReader(p, true); // consume the error stream input = new Scanner(p.getInputStream()); List<String> voiceList = new ArrayList<String>(); while (input.hasNextLine()) { voiceList.add(input.nextLine()); } return voiceList.toArray(new String[0]); } catch (IOException ex) { ex.printStackTrace(); } return new String[]{}; } protected void makeScriptFile() { String speakScript = ' + 'on run argvn' + ' set theCall to (item 1 of argv)n' + ' set theVoice to (item 2 of argv)n' + ' set theVolume to (item 3 of argv)n' + ' set theRate to (item 4 of argv)n' + ' set oldVolume to output volume of (get volume settings)n' + ' set volume output volume ((oldVolume * theVolume) / 100)n' + ' say -v theVoice -r theRate theCall with waiting until completionn' + ' set volume output volume (oldVolume)n' + 'end runn'; FileWriter fw = null; try { scriptFile = File.createTempFile('speech', '.scpt'); scriptFile.deleteOnExit(); fw = new java.io.FileWriter(scriptFile); fw.write(speakScript); } catch (IOException ex) { ex.printStackTrace(); } finally { if (fw != null) { try { fw.close(); } catch (IOException ex) { ex.printStackTrace(); } } } } public void speakAndWait(String call) { process = speak(call); if (process != null) { try { process.waitFor(); } catch (InterruptedException ex) { ex.printStackTrace(); } } } protected Process speak(String call) { process = null; try { process = Runtime.getRuntime().exec(new String[]{'osascript', scriptFile.getAbsolutePath(), '' + call + '', '' + voices[voiceIndex] + '', ' + volume, ' + rate }); new ProcessReader(process, false); // consume the output stream new ProcessReader(process, true); // consume the error stream } catch (IOException ex) { ex.printStackTrace(); } return process; } } class ProcessReader { public ProcessReader(Process process, final boolean errorStream) { final InputStream processStream = errorStream ? process.getErrorStream() : process.getInputStream(); new Thread() { @Override public void run() { try { BufferedReader br = new BufferedReader(new InputStreamReader(processStream)); String line; while ((line = br.readLine()) != null) { if (errorStream) { System.err.println(line); } else { System.out.println(line); } } } catch (IOException ex) { ex.printStackTrace(); } } }.start(); } }
Thank you for reading.
  1. Finally I put void-core-stage2 in a bundle named default and added a dependency on void-core-stage1-core to void-core-stage2. Those two changes together mean that by default s6-linux-init will bring up default, which will being up both void-core-. oneshots, but bringing default down will only bring down void-core-stage2.
  2. It's a 680×0 Mac emulator for OS X. You need a ROM file to make it work, but I hear it's pretty easy to find one if you Google around. (Yeah, I know it's piracy, but come on.
  3. This article includes a list of references, related reading or external links, but its sources remain unclear because it lacks inline citations. Please help to improve this article by introducing more precise citations.

Yes they absolutely should. I first wrote Wimoweh to scratch an itch – I was fed up of coming back to find that my machine had gone to sleep when it should have been ripping a disc or encoding a file. As newer versions of OS X have made power management at the application level easier the problem should lessen.

luck, db
There are no new questions, but there may be new answers.

Bartender
posted 8 years ago
  • Optional 'thank-you' note:
Example use: (should work out-of-the-box on Windows XP and above, requires eSpeak to be installed for Linux).
http://www.fileden.com/files/2008/12/12/2221280/HousieGame.jar
(Frozentape)

luck, db
There are no new questions, but there may be new answers.

author & internet detective
posted 8 years ago
  • Optional 'thank-you' note:
Copy and pasted. Ran and got

Indie assault mac os. Voice `'?' not found.


I then changed the 'say' line to use an actual name rather than a question mark.
Process p = Runtime.getRuntime().exec('say -v Bruce');
But then it hung because say requires a message.
This thread suggests looking in a directory for the list of available voices.
Jeanne-Boyarskys-MacBook-Pro:2012-cs258-testing nyjeanne$ ls /System/Library/Speech/Voices/
AgataCompact.SpeechVoice LeeCompact.SpeechVoice
Agnes.SpeechVoice MagedCompact.SpeechVoice
Albert.SpeechVoice MikkoCompact.SpeechVoice
Alex.SpeechVoice MilenaCompact.SpeechVoice
AylinCompact.SpeechVoice NaraeCompact.SpeechVoice
BadNews.SpeechVoice NarisaCompact.SpeechVoice
Bahh.SpeechVoice Organ.SpeechVoice
Bells.SpeechVoice OskarCompact.SpeechVoice
Boing.SpeechVoice PaoloCompact.SpeechVoice
Bruce.SpeechVoice Princess.SpeechVoice
Bubbles.SpeechVoice Ralph.SpeechVoice
Cellos.SpeechVoice RaquelCompact.SpeechVoice
DanielCompact.SpeechVoice SamanthaCompact.SpeechVoice
Deranged.SpeechVoice Sin-JiCompact.SpeechVoice
DiegoCompact.SpeechVoice StineCompact.SpeechVoice
EszterCompact.SpeechVoice Ting-TingCompact.SpeechVoice
FelixCompact.SpeechVoice Trinoids.SpeechVoice
Fred.SpeechVoice Vicki.SpeechVoice
GoodNews.SpeechVoice Victoria.SpeechVoice
Hysterical.SpeechVoice VirginieCompact.SpeechVoice
IdaCompact.SpeechVoice Whisper.SpeechVoice
JavierCompact.SpeechVoice XanderCompact.SpeechVoice
JoanaCompact.SpeechVoice Ya-LingCompact.SpeechVoice
Junior.SpeechVoice YannickCompact.SpeechVoice
Kathy.SpeechVoice Zarvox.SpeechVoice
KyokoCompact.SpeechVoice ZuzanaCompact.SpeechVoice

[OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2

Bartender
posted 8 years ago
  • Optional 'thank-you' note:
Jeanne, thank you for trying the code.

Kingdom vs zombies mac os. Jeanne Boyarsky wrote:Copy and pasted. Ran and got

Voice `'?' not found.


That's strange. I took that from the official reference. It's even in the examples towards the bottom of that page.
What does that do from the terminal, with and without the single quotes? I'm thinking the single quotes may require quoting or double-quoting when passed from Runtime.exec. There's one line in my Linux implementation that looks like this, I may need something similar here. + ' '' + call + ''

I then changed the 'say' line to use an actual name rather than a question mark.
Process p = Runtime.getRuntime().exec('say -v Bruce');
But then it hung because say requires a message.

Void (itch) (frozentape) Mac Os Update


Yes, that I would expect. But the purpose of that method is to retrieve a String array of available voice names (for subsequent use in a JComboBox).
Does this alternative, adapted from a MacScripter topc, work for you? protected String[] populateVoiceArray() { Scanner input = null; try { String voicesScript = ' + '#!/usr/local/bin/pythonn' + 'from AppKit import NSSpeechSynthesizern' + 'voices = NSSpeechSynthesizer.availableVoices()n' + 'for voice in voices:n' + ' voiceattr = NSSpeechSynthesizer.attributesForVoice_(voice)n' + ' voicename = voiceattr['VoiceName']n' + ' print voicename.encode('utf-8')n'; File file = File.createTempFile('voices', '.py'); file.deleteOnExit(); FileWriter fw = new FileWriter(file); fw.write(voicesScript); fw.close(); Process p = Runtime.getRuntime().exec('python ' + file.getPath()); new ProcessReader(p, true); // consume the error stream input = new Scanner(p.getInputStream()); List<String> voiceList = new ArrayList<String>(); while (input.hasNextLine()) { voiceList.add(input.nextLine()); } return voiceList.toArray(new String[0]); } catch (IOException ex) { ex.printStackTrace(); } finally { if (input != null) { input.close(); } } return new String[]{}; }

This thread suggests looking in a directory for the list of available voices.


That would be a last resort, capturing the 'ls' of that directory. Looks like the parsing needed, to get a voice name that can be passed to say, is to take the part up to the first dot and insert a space before each uppercase letter (except the first).
Thank you again.

luck, db
There are no new questions, but there may be new answers.

author & internet detective
posted 8 years ago
  • Optional 'thank-you' note:
Say -v '?' Gave an error message at the command line.

[OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2

Greenhorn
posted 8 years ago
  • Optional 'thank-you' note:
Darryl,
I don't know if this will help you or not, but in Terminal, if I type:
say -v bruce hello my name is bruce
the computer speaks in the Bruce voice: hello my name is bruce
If I type only 'say -v bruce' at the beginning then hit enter, I get the beach ball spinning for a few seconds, then whatever I type at the prompt is spoken in the bruce voice once I hit the enter key. Each phrase I have it speak is on one line in the Terminal.
Perhaps this is already known to you, but maybe not.
BD

I've got just enough Java knowledge to royally screw everything up. :-)

Greenhorn
posted 8 years ago
  • Optional 'thank-you' note:
I ran your first code, and changed the ? to a name like Jeanne did. I stepped it to the while loop that read from the Scanner instance, which ended up being a null reference.
I pasted in your new code, and the terminal output read:
Voice: Ralph Volume: 61
and got a Null pointer in the try block at scripFile.getAbsolutePath() in the speak method.
Hope that helps. :-)
BD

I've got just enough Java knowledge to royally screw everything up. :-)

Bartender
posted 8 years ago
  • Optional 'thank-you' note:
Thank you, Howard. Should I conclude that the man page for say is in error? Or am I looking at a page that's for a version later than that you're testing on?
edit Oh, I see that say -v '?' appears for ver. 10.7.4 and isn't there for 10.6.
What about the second option, the one uising NSSpeechSynthesizer? Does that fly?

luck, db
There are no new questions, but there may be new answers.

Greenhorn
posted 8 years ago
  • Optional 'thank-you' note:
Far be it from me to declare a manual in error. I just typed some stuff into Terminal and reported to you what happened. :-)
I am running Lion. I did not consult the manual, just typed in a few commands to test how 'say' worked.
If you want me to test something specific, just ask. :-)
Cheers
BD

I've got just enough Java knowledge to royally screw everything up. :-)

Use you shots to reveal the position of the enemies and shoot them.



Instructions:

  • Move with the arrow keys
  • Shoot with the space bar
  • Support Gamepads (tested with a PS4 controller)
  • Press 's' key to switch the screen shakes on and off

Void (itch) (frozentape) Mac Os Catalina

Dragons lunch demo mac os. Tips:

  • Move at the bottom to see more around your ship
  • Don't always shoot, the light on your shot is wider when releasing the shoot button

Made in 48 hours during the GMTKJam. The theme was Dual Purpose design.

Music by Onosendai - http://onosendai.free.fr/

Void (itch) (frozentape) Mac Os X

StatusReleased
PlatformsWindows, macOS
Rating
AuthorNic Magnier
GenreAction
Made withLÖVE
TagsLÖVE, Minimalist, Shoot 'Em Up

Download

Log in with itch.io to leave a comment.





broken image