Skip to content

Instantly share code, notes, and snippets.

@oleavr
Last active July 23, 2020 14:59
Show Gist options
  • Select an option

  • Save oleavr/8653df4b37b4092bcaf3f9649d98784d to your computer and use it in GitHub Desktop.

Select an option

Save oleavr/8653df4b37b4092bcaf3f9649d98784d to your computer and use it in GitHub Desktop.

Revisions

  1. oleavr revised this gist Jul 23, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion scapy.js
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ setImmediate(function () {

    synth.setVoice_(voices.objectAtIndex_(i));

    synth.startSpeakingString_('scapy');
    synth.startSpeakingString_('Scapy');
    do {
    Thread.sleep(0.05);
    } while (synth.isSpeaking());
  2. oleavr created this gist Jul 23, 2020.
    25 changes: 25 additions & 0 deletions scapy.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    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();
    }
    });