-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
10 changed files
with
96 additions
and
25 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
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
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
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
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
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
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,43 @@ | ||
import * as cp from "child_process"; | ||
import * as os from "os"; | ||
import Logger from "./Logger"; | ||
import { VoiceParameter } from "./Voice" | ||
import { Speaker } from "./Speaker" | ||
const defaultParameter = { | ||
volume: 50, | ||
rate: 100, | ||
pitch: 100 | ||
} | ||
class Tamiyasu implements Speaker { | ||
path: string = ""; | ||
constructor(path: string) { | ||
this.path = path; | ||
} | ||
// Tamiyasuは読み上げ終了を検知出来ない | ||
speak(text: string, vParam: VoiceParameter, callback?: () => any) { | ||
var args = text.replace(/\n/gi, " "); | ||
cp.spawn(this.path, [args]).on("exit", (code) => { | ||
Logger.log("result", code); | ||
}).on("error", (err) => { | ||
Logger.log("result", err.name); | ||
process.exit(1); | ||
}); | ||
} | ||
|
||
cancel() { | ||
// var args = " /stop_now"; | ||
// cp.exec(this.path + args, (e, s) => { | ||
// console.log(s); | ||
// }); | ||
} | ||
speaking() { | ||
return false; | ||
} | ||
|
||
public static calcStringSize(text: string, timeLimit: number) { | ||
let limitSize = timeLimit * readPerSecondWord; | ||
return text.substring(0, limitSize); | ||
} | ||
} | ||
const readPerSecondWord = 4; | ||
export default Tamiyasu; |
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
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
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