Last active
July 23, 2020 14:59
-
-
Save oleavr/8653df4b37b4092bcaf3f9649d98784d to your computer and use it in GitHub Desktop.
How to pronounce “Scapy”, according to macOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setImmediate(function () { | |
var NSAutoreleasePool = ObjC.classes.NSAutoreleasePool; | |
var NSSpeechSynthesizer = ObjC.classes.NSSpeechSynthesizer; | |
var pool = NSAutoreleasePool.alloc().init(); | |
try { | |
var synth = NSSpeechSynthesizer.alloc().init(); | |
var voices = NSSpeechSynthesizer.availableVoices(); | |
var n = voices.count().valueOf(); | |
for (var i = 0; i !== n; i++) { | |
console.log('[*] Voice', i + 1, 'out of', n); | |
synth.setVoice_(voices.objectAtIndex_(i)); | |
synth.startSpeakingString_('Scapy'); | |
do { | |
Thread.sleep(0.05); | |
} while (synth.isSpeaking()); | |
} | |
} finally { | |
pool.release(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment