Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added Speak.js #328

Closed
wants to merge 2 commits into from

3 participants

@gitbase

any updates on this ?

@ryankirkman
Owner

It looks like it is forked from https://github.com/kripken/speak.js - why is that?

@thomasdavis
Owner

Closing to inactivity...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 12, 2012
  1. @gitbase

    added speak.js

    gitbase authored
  2. @gitbase

    removed a weird hidden file

    gitbase authored
This page is out of date. Refresh to see the latest.
View
1  ajax/libs/speak.js/1.0.0/speakClient.js
@@ -0,0 +1 @@
+(function(a,b){var c=a.document;var d={};var e=a.speak;d.noConflict=function(){a.speak=e;return d};var f;try{f=new Worker("//cdnjs.cloudflare.com/ajax/libs/speak.js/1.0.0/speakWorker.js")}catch(g){console.log("speak.js warning: no worker support")}d.pause=function(){c.getElementById("player").pause()};d.resume=function(){c.getElementById("player").play()};d.play=function(a,b,d){function g(a){function b(b,c){var d=0;var e=0;while(c){d+=a[b]<<e;e+=8;b++;c--}return d}if(b(20,2)!=1)throw"Invalid compression code, not PCM";if(b(22,2)!=1)throw"Invalid number of channels, not 1";return{sampleRate:b(24,4),bitsPerSample:b(34,2),samples:a.subarray(44)}}function h(a){function b(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var c="=";var d="";var e=0;var f=0;for(var g=0;g<a.length;g++){e=e<<8|a[g];f+=8;while(f>=6){var h=e>>f-6&63;f-=6;d+=b[h]}}if(f==2){d+=b[(e&3)<<4];d+=c+c}else if(f==4){d+=b[(e&15)<<2];d+=c}return d}c.getElementById("audio").innerHTML='<audio id="player" src="data:audio/x-wav;base64,'+b(a)+'">';if(d){c.getElementById("player").addEventListener("ended",d)}c.getElementById("player").play()}function i(a){try{var b=new Audio;b.mozSetup(1,a.sampleRate);var c=a.samples.length;var d=a.samples;var e=new Float32Array(c);for(var f=0;f<c;f++){var g=d[f<<1]+(d[(f<<1)+1]<<8);if(g>=32768)g|=~32767;e[f]=g/32768}b.mozWriteAudio(e);return true}catch(h){return false}}function j(a){var b=Date.now();var c=g(a);h(a);if(e)console.log("speak.js: wav processing took "+(Date.now()-b).toFixed(2)+" ms")}var e=1;if(b&&b.noWorker){var k=Date.now();var l=generateSpeech(a,b);if(e)console.log("speak.js: processing took "+(Date.now()-k).toFixed(2)+" ms");j(l)}else{var k=Date.now();f.onmessage=function(a){if(e)console.log("speak.js: worker processing took "+(Date.now()-k).toFixed(2)+" ms");j(a.data)};f.postMessage({text:a,args:b})}};a.speak=d})(window)
View
10 ajax/libs/speak.js/1.0.0/speakGenerator.js
10 additions, 0 deletions not shown
View
1  ajax/libs/speak.js/1.0.0/speakWorker.js
@@ -0,0 +1 @@
+importScripts("//cdnjs.cloudflare.com/ajax/libs/speak.js/1.0.0/speakGenerator.js");onmessage=function(a){postMessage(generateSpeech(a.data.text,a.data.args))}
View
21 ajax/libs/speak.js/package.json
@@ -0,0 +1,21 @@
+{
+ "name": "speakjs"
+ , "title": "speak.js"
+ , "description": "Browser based Text-to-Speech JavaScript library"
+ , "version": "1.0.0"
+ , "homepage": "http://speak-demo.herokuapp.com"
+ , "author": {
+ "name": "Alon Zakai"
+ }
+ , "repository": {
+ "type": "git"
+ , "url": "https://github.com/katsuyan/speak.js"
+ }
+ , "licenses": [{
+ "type": "GPL3"
+ , "url": "https://github.com/katsuyan/speak.js/blob/master/License.txt"
+ }]
+ , "dependencies": {}
+ , "devDependencies": {}
+ , "keywords": []
+}
Something went wrong with that request. Please try again.