Skip to content

Commit 9e4f32e

Browse files
committed
Implement ArtyomJS to timer
1 parent ee04d8d commit 9e4f32e

File tree

5 files changed

+36
-12
lines changed

5 files changed

+36
-12
lines changed

app/components/Timer.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
<script>
66
import { shell } from 'electron'
7-
import Artyom from 'artyom.js'
8-
9-
const Bara = new Artyom();
107
118
export default {
129
props:['time'],

app/components/TimerArea.vue

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<button class="ui button" @click="reset">Reset</button>
1111
<button class="ui button" v-if="isRunning" @click="stop">Stop</button>
1212
</div>
13+
{{ custom_artyom }}
1314
</div>
1415
</div>
1516
</div>
@@ -32,8 +33,8 @@
3233
time:0,
3334
timer:null,
3435
// Text-to-speech will be here later
35-
sound:new Audio("http://s1download-universal-soundbank.com/wav/nudge.wav")
36-
// sound: Bara.say('Time-up!')
36+
custom_artyom: "",
37+
// sound:new Audio("http://s1download-universal-soundbank.com/wav/nudge.wav")
3738
}
3839
},
3940
@@ -54,8 +55,31 @@
5455
this.time--
5556
} else {
5657
clearInterval(this.timer)
57-
this.sound.play()
58-
this.reset()
58+
// this.sound.play()
59+
Bara.initialize({
60+
lang: "id-ID",
61+
debug: true, // Show messages in the console
62+
// If providen, you can only trigger a command if you say its name
63+
// e.g to trigger Good Morning, you need to say "Jarvis Good Morning"
64+
name: "Bara"
65+
}).then(() => {
66+
console.log('%c [GET VOICE] ' + '%c' + Bara.getVoices(), 'background: #000; color: #0F0', 'color: #000');
67+
console.log('%c [Initialize] ' + '%c Artyom has been succesfully initialized', 'background: #000; color: #0F0', 'color: #000');
68+
}).catch((err) => {
69+
console.error("Artyom couldn't be initialized: ", err);
70+
});
71+
72+
Bara.say(this.custom_artyom,{
73+
onStart:function(){
74+
console.log('%c [onStart] ' + '%c The text is being readed', 'background: #000; color: #fff', 'color: #000');
75+
},
76+
onEnd:function(){
77+
console.log('%c [onEnd] ' + '%c Well, that was all!', 'background: #000; color: #fff', 'color: #000');
78+
}
79+
})
80+
81+
Bara.fatality();
82+
this.reset()
5983
}
6084
}, 1000 )
6185
}
@@ -73,6 +97,7 @@
7397
},
7498
setTime (payload) {
7599
this.time = (payload.minutes * 60 + payload.secondes)
100+
this.custom_artyom = payload.custom_artyom
76101
}
77102
},
78103

app/components/TimerSetup.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
<form>
33
<div class="ui tiny form segment">
44
<div class="two fields">
5+
<div class="field">
6+
<label>Text</label>
7+
<input type="text" v-model="custom_artyom" name="custom_artyom" id="custom_artyom">
8+
</div>
59
<div class="field">
610
<label>Menit</label>
711
<input type="number" v-model="minutes" name="time_m" id="min" min="0" max="59">
@@ -18,20 +22,18 @@
1822

1923
<script>
2024
import { shell } from 'electron'
21-
import Artyom from 'artyom.js'
22-
23-
const Bara = new Artyom();
2425
2526
export default {
2627
data () {
2728
return {
29+
custom_artyom: "",
2830
minutes:0,
2931
secondes:0
3032
}
3133
},
3234
methods: {
3335
sendTime() {
34-
this.$emit('set-time', {minutes:this.minutes, secondes:this.secondes})
36+
this.$emit('set-time', {custom_artyom: this.custom_artyom, minutes:this.minutes, secondes:this.secondes})
3537
}
3638
}
3739

main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function createWindow () {
1313
resizable: false,
1414
icon: __dirname + '/build/icon.ico'
1515
});
16-
mainWindow.setMenu(null);
16+
// mainWindow.setMenu(null);
1717
mainWindow.loadURL('file://' + __dirname + '/index.html');
1818

1919
mainWindow.on('closed', function() {

mvp-preview-text2speech-timer-app.jpg

1013 Bytes
Loading

0 commit comments

Comments
 (0)