getInstalledVoices returning null
Glutch opened this issue · comments
say.getInstalledVoices(voices => console.log(voices)) //null
say.speak('hello') works, and i have a lot of voices installed in "narrator settings"
windows 10
Read somewhere that say.js grabs the selected narrator of the system. However if i change the narrator in windows settings (and i can hear that the voice change of course, with the narrator) - say.js still uses only one, the female Zira
You've got the wrong syntax, the callback returns two variables. You are printing the error.
say.getInstalledVoices((err, voices) => console.log(voices))
But this is how the latest version installs:
declare module 'say' {
const say: SayJS.Say;
namespace SayJS {
type errorCallback = (err: string) => void;
class Say {
public export(text: string, voice?: string, speed?: number, filePath?: string, callback?: errorCallback): void;
public speak(text: string, voice?: string, speed?: number, callback?: errorCallback): void;
public stop(): void;
public getInstalledVoices(callback: errorCallback): void;
}
}
export = say;
}
So the whole TypeScript declaration is wrong.
Needs this change:
type errorCallback = (err: any, voices: string[]) => void;