MIDI 文件中的重叠音符识别问题

Problem Description | 问题描述

The editor drops some specific characters when inputing lyrics with the ctrl + L window at some specific positions.
编辑器会在使用 ctrl + L 窗口输入歌词某些特定位置丢失一个字符的歌词。

Note: After checking, the “specific position” is the position where the MIDI file has overlapping notes.
注:经排查,“特定位置”就是 MIDI 文件中有重叠音符的位置。

Input:

“逐流飘荡紧握着不熄灭的希望”

Output:
image

You can notice that the character in the lyrics is missing. The problem can be repeated if you input the lyrics at notes other than the breakpoint(s), and the position of the missing character is the same.
可以注意到,输入歌词中的“握”字被编辑器吞掉了。并且在除断点处的其他任何位置输入歌词,都会出现同样的问题,并且被吞掉的位置和歌词都相同。

Sorry I cannot provide the project file because new users do not have the permission to upload files.
抱歉,但我无法提供工程文件,因为新用户无权上传文件。

More

I think the problem is caused by a failure to correctly identify and handle overlapping notes when importing MIDI files from outside.
我认为是由于从外部导入 MIDI 文件时未能正确识别处理重叠音符导致的问题。

Video | 视频

Environment | 环境信息

Environment Info

Synthesizer V Studio Pro 1.5.0
Synthesizer V Engine 2.3.2
© 2020, 2021 Dreamtonics Co., Ltd.

== 系统信息 ==
CPU: AuthenticAMD 2869 MHz 8 Cores 16 Threads
CPU Features: SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, FMA3
Memory: 15742 MBytes
Operating System: Windows 10 64 bits
User Language: zh
User Region: CN
Installation Path: D:\Synthesizer V Studio Pro\synthv-studio.exe
Application Directory: C:\Users\Leo\Documents\Dreamtonics\Synthesizer V Studio

== 类型检查 ==
sizeof(int) = 4
sizeof(long) = 4
sizeof(void*) = 8

报告生成于 19 Feb 2022 14:26。
构建于 Dec 23 2021。
双击以复制本报告。

Fixed.
问题原因:MIDI 文件中含有重复的音符,即音符叠在了一起。

This also causes the editor not responding when rendering auto-pitch.

I’ve found these lines in the svp file that has the problem.

...
                    {
                        "onset": 100548000000,
                        "duration": 0,
                        "lyrics": "\u8361",
                        "phonemes": "",
                        "pitch": 73,
                        "detune": 0,
                        "attributes": {}
                    },
                    {
                        "onset": 100548000000,
                        "duration": 352800000,
                        "lyrics": "\u8361",
                        "phonemes": "",
                        "pitch": 73,
                        "detune": 0,
                        "attributes": {}
                    },
...

See, there is a note with a duration of 0. And that’s what causes the problem because once I deleted all the notes with the duration of 0, all the problems are solved.

My suggestion:
Now collected in my GitHub Repo.

function getClientInfo() {
    return {
        "name": "Delete 0-Duration Notes",
        "category": "Utils",
        "author": "Github @leostudiooo",
        "versionNumber": 0.1,
        "minEditorVersion": 65536
    }
}

function main() {
    var count = 0;
    var noteGroup = SV.getMainEditor().getCurrentGroup().getTarget()

    for (var index = 0; index < noteGroup.getNumNotes(); index++) {
        if (noteGroup.getNote(index).getDuration() == 0) {
            noteGroup.removeNote(index);
            count++;
        }
    }

    SV.showMessageBox(
        "Cleaning Process Complete.",
        "Removed " + count + " 0-Duration Note(s)."
    )
}

@khuasw to get to know this

Update.

The problem is caused by FL Studio when I used it to make the score midi. Two same notes just overlapped on the same place so it would export as a 0-duration note and a normal note in the midi file. So this is to solve the problem caused by the “invisible notes”, not normal overlapping notes mentioned in Inactive notes after MIDI import?.