making prediction path relative

this makes it work in the live experience where there is a path beyond
the root level
This commit is contained in:
Yotam Mann 2017-02-13 17:31:06 -05:00
parent 49148c97df
commit 7cad5b3ef6

View File

@ -52,7 +52,7 @@ class AI extends events.EventEmitter{
let additional = endTime let additional = endTime
additional = Math.min(additional, 8) additional = Math.min(additional, 8)
additional = Math.max(additional, 1) additional = Math.max(additional, 1)
request.load(`/predict?duration=${endTime + additional}`, JSON.stringify(request.toArray()), 'POST').then((response) => { request.load(`./predict?duration=${endTime + additional}`, JSON.stringify(request.toArray()), 'POST').then((response) => {
response.slice(endTime / 2).tracks[1].notes.forEach((note) => { response.slice(endTime / 2).tracks[1].notes.forEach((note) => {
const now = Tone.now() + 0.05 const now = Tone.now() + 0.05
if (note.noteOn + now > this._aiEndTime){ if (note.noteOn + now > this._aiEndTime){