Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

可能不支持坐山听风老师的所有作品 Uncaught Error Error: TNaN is not a valid duration. #8

Open
weypro opened this issue Apr 29, 2023 · 1 comment

Comments

@weypro
Copy link

weypro commented Apr 29, 2023

如题,具体报错如下

Uncaught Error Error: TNaN is not a valid duration.
    at getTickDuration (e:\chongchong-free-master\node_modules\midi-writer-js\build\index.js:355:17)
    at NoteEvent (e:\chongchong-free-master\node_modules\midi-writer-js\build\index.js:794:31)
    at writeMIDI (e:\chongchong-free-master\libCCMZ.js:148:20)
    at writeAndConvert (e:\chongchong-free-master\functions.js:26:17)
    at <anonymous> (e:\chongchong-free-master\libCCMZ.js:56:17)

原因是MidiWriter.NoteEventmDurationundefined
进一步向上溯源

if (tick === thisTick) {
              mDuration = baseMultiplier * lastTempo / currTempo;
              mTick = baseMultiplier * lastTempo / currTempo;
            }

因为在此处if (tick === thisTick) 为假,所以直接跳过了mDuration的赋值
因为我看不懂这段代码为何要这样计算所以也没法改,除了这位老师的作品外又测试了其他几首,复杂一点的作品速度就有问题了
如果作者能补完核心代码的注释那就好了

@yjwu
Copy link

yjwu commented Jun 6, 2023

line 123mDuration 创建时未初始化; 初始赋为baseMultiplier就好了~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants