This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6aa7f5d
Showing
11 changed files
with
1,704 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{js,json,yml}] | ||
indent_style = space | ||
indent_size = 2 | ||
max_line_length = 79 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/generators | ||
/node_modules | ||
*.tgz |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Rauli Laine | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# oddcast-tts-demo | ||
|
||
Helper functions for generating MP3 URLs from text using oddcast.com's | ||
text-to-speech demo. | ||
|
||
## Usage | ||
|
||
```JavaScript | ||
const { buildUrl, voices } = require('oddcast-tts-demo'); | ||
|
||
buildUrl('Hello, World.', voices.daniel); | ||
|
||
// Produces: | ||
// https://cache-a.oddcast.com/c_fs/3053a357f5d3a85a17182971a84007c9.mp3?engine=4&language=1&voice=5&text=Hello%2C%20World.&useUTF8=1 | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const md5 = require('md5'); | ||
|
||
module.exports = (text, voice) => { | ||
const { id, language, engine } = voice; | ||
const fragments = [ | ||
`<engineID>${engine}</engineID>`, | ||
`<voiceID>${id}</voiceID>`, | ||
`<langID>${language.id}</langID>`, | ||
'<ext>mp3</ext>', | ||
text | ||
]; | ||
|
||
return md5(fragments.join('')); | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const buildUrl = require('build-url'); | ||
|
||
const buildHash = require('./build-hash'); | ||
|
||
module.exports = (text, voice, hash = null) => buildUrl( | ||
'https://cache-a.oddcast.com', | ||
{ | ||
path: `c_fs/${hash || buildHash(text, voice)}.mp3`, | ||
queryParams: { | ||
engine: voice.engine, | ||
language: voice.language.id, | ||
voice: voice.id, | ||
text, | ||
useUTF8: 1 | ||
} | ||
} | ||
); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports.languages = require('./languages'); | ||
module.exports.voices = require('./voices'); | ||
module.exports.buildHash = require('./build-hash'); | ||
module.exports.buildUrl = require('./build-url'); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
module.exports = { | ||
ar: { | ||
name: 'Arabic', | ||
id: 27, | ||
code: 'ar' | ||
}, | ||
eu: { | ||
name: 'Basque', | ||
id: 22, | ||
code: 'eu' | ||
}, | ||
ca: { | ||
name: 'Catalan', | ||
id: 5, | ||
code: 'ca' | ||
}, | ||
zh: { | ||
name: 'Chinese', | ||
id: 10, | ||
code: 'zh' | ||
}, | ||
cs: { | ||
name: 'Czech', | ||
id: 18, | ||
code: 'cs' | ||
}, | ||
da: { | ||
name: 'Danish', | ||
id: 19, | ||
code: 'da' | ||
}, | ||
nl: { | ||
name: 'Dutch', | ||
id: 11, | ||
code: 'nl' | ||
}, | ||
en: { | ||
name: 'English', | ||
id: 1, | ||
code: 'en' | ||
}, | ||
eo: { | ||
name: 'Esperanto', | ||
id: 31, | ||
code: 'eo' | ||
}, | ||
fi: { | ||
name: 'Finnish', | ||
id: 23, | ||
code: 'fi' | ||
}, | ||
fr: { | ||
name: 'French', | ||
id: 4, | ||
code: 'fr' | ||
}, | ||
gl: { | ||
name: 'Galician', | ||
id: 15, | ||
code: 'gl' | ||
}, | ||
de: { | ||
name: 'German', | ||
id: 3, | ||
code: 'de' | ||
}, | ||
el: { | ||
name: 'Greek', | ||
id: 8, | ||
code: 'el' | ||
}, | ||
hi: { | ||
name: 'Hindi', | ||
id: 24, | ||
code: 'hi' | ||
}, | ||
hu: { | ||
name: 'Hungarian', | ||
id: 29, | ||
code: 'hu' | ||
}, | ||
id: { | ||
name: 'Indonesian', | ||
id: 28, | ||
code: 'id' | ||
}, | ||
it: { | ||
name: 'Italian', | ||
id: 7, | ||
code: 'it' | ||
}, | ||
ja: { | ||
name: 'Japanese', | ||
id: 12, | ||
code: 'ja' | ||
}, | ||
ko: { | ||
name: 'Korean', | ||
id: 13, | ||
code: 'ko' | ||
}, | ||
no: { | ||
name: 'Norwegian', | ||
id: 20, | ||
code: 'no' | ||
}, | ||
pl: { | ||
name: 'Polish', | ||
id: 14, | ||
code: 'pl' | ||
}, | ||
pt: { | ||
name: 'Portuguese', | ||
id: 6, | ||
code: 'pt' | ||
}, | ||
ro: { | ||
name: 'Romanian', | ||
id: 30, | ||
code: 'ro' | ||
}, | ||
ru: { | ||
name: 'Russian', | ||
id: 21, | ||
code: 'ru' | ||
}, | ||
es: { | ||
name: 'Spanish', | ||
id: 2, | ||
code: 'es' | ||
}, | ||
sv: { | ||
name: 'Swedish', | ||
id: 9, | ||
code: 'sv' | ||
}, | ||
th: { | ||
name: 'Thai', | ||
id: 26, | ||
code: 'th' | ||
}, | ||
tr: { | ||
name: 'Turkish', | ||
id: 16, | ||
code: 'tr' | ||
} | ||
}; |
Oops, something went wrong.