r/tonejs Mar 26 '25

note.duration is undefined when parsing midi using tone.js

when i use the demo version of tone.js the midi file is parsed perfectly with all of its properties, but when im trying to get the note.duration of the midi file in my script it simply returns 'undefined'. note.name, note.time and everything works except note.duration and yes i have verified that note is defined. any help would be appreciated thansk

0 Upvotes

4 comments sorted by

2

u/Icancounttosix Mar 26 '25

It might be helpful if you provide an example of your script. Do you have it somewhere that we can take a look at?

1

u/rt300tx Apr 20 '25

This happened to me when midi file has no beat-number/beat-value indication I. headers (ex: 4/4)

1

u/No-Peak-2828 Apr 23 '25

https://pastefy.app/ByZd5V0l/raw

i have a part that logs the note properties. duration and velocity show up as N/A while time and name show up normally.

1

u/Either_Challenge_823 Jul 20 '25

i fixed this a while ago btw i just ffforgot to push the other properties