Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Catalina #725

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions lib/tts-providers/mac-os.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ function macSay(phrase, voice) {
return Promise.resolve();
}

var selcetedRate = settings.macSay.rate;
if( !selcetedRate ) {
selcetedRate = "default";
var selectedRate = settings.macSay.rate;
if( !selectedRate ) {
selectedRate = "default";
}
var selectedVoice = settings.macSay.voice;
if( voice ) {
Expand All @@ -24,7 +24,7 @@ function macSay(phrase, voice) {

// Construct a filesystem neutral filename
const phraseHash = crypto.createHash('sha1').update(phrase).digest('hex');
const filename = `macSay-${phraseHash}-${selcetedRate}-${selectedVoice}.m4a`;
const filename = `macSay-${phraseHash}-${selectedRate}-${selectedVoice}.m4a`;
const filepath = path.resolve(settings.webroot, 'tts', filename);

const expectedUri = `/tts/${filename}`;
Expand Down Expand Up @@ -52,13 +52,13 @@ function macSay(phrase, voice) {
// System Preferences -> Accessibility -> Speech -> System Voice
//

var execCommand = `say "${phrase}" -o ${filepath}`;
if( selectedVoice && selcetedRate != "default" ) {
execCommand = `say -r ${selcetedRate} -v ${selectedVoice} "${phrase}" -o ${filepath}`;
var execCommand = `say "${phrase}" -o ${filepath} --data-format=aac`;
if( selectedVoice && selectedRate != "default" ) {
execCommand = `say -r ${selectedRate} -v ${selectedVoice} "${phrase}" -o ${filepath} --data-format=aac`;
} else if ( selectedVoice ) {
execCommand = `say -v ${selectedVoice} "${phrase}" -o ${filepath}`;
} else if ( selcetedRate != "default" ) {
execCommand = `say -r ${selcetedRate} "${phrase}" -o ${filepath}`;
execCommand = `say -v ${selectedVoice} "${phrase}" -o ${filepath} --data-format=aac`;
} else if ( selectedRate != "default" ) {
execCommand = `say -r ${selectedRate} "${phrase}" -o ${filepath} --data-format=aac`;
}

exec(execCommand,
Expand Down