Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
require.ensure(['@magenta/music'], async () => {
try {
await this.piano.load()
const { OnsetsAndFrames } = require('@magenta/music')
this.model = new OnsetsAndFrames('/assets/model')
await this.model.initialize()
this.loading = false
this._enabled = true
//add a notification
if (WebMidi.supported){
document.querySelector('acc-snackbar').setAttribute('message', 'Choose an audio file to transcribe, or play live with a MIDI keyboard.')
} else {
document.querySelector('acc-snackbar').setAttribute('message', 'Choose an audio file to transcribe.')
}
} catch (e){
this.loading = false
this.emit('error', e)
console.log(e)
document.querySelector('#error-snack').setAttribute('message', 'Transcription not supported')
}
})