Skip to content

Commit

Permalink
beep on speech end
Browse files Browse the repository at this point in the history
  • Loading branch information
RollingHog committed Apr 10, 2024
1 parent ead8834 commit c668b0a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ const textarea = {
},
}

function doBeep() {
var context = new window.AudioContext()
var osc = context.createOscillator() // instantiate an oscillator
osc.type = 'sine' // this is the default - also square, sawtooth, triangle
osc.frequency.value = 940 // Hz
osc.connect(context.destination) // connect it to the destination
osc.start() // start the oscillator
osc.stop(context.currentTime + 0.15)
}

var transcript
recognition.onresult = function (event) {

Expand Down Expand Up @@ -62,6 +72,7 @@ recognition.onstart = function () {

recognition.onspeechend = function () {
// getEl('recog_status').innerText = 'Recognition off'
doBeep()
getEl('b_switch_recognition').style.backgroundColor = ''
}

Expand Down

0 comments on commit c668b0a

Please sign in to comment.