kuma4649 / mml2vgm

GNU General Public License v3.0
105 stars 10 forks source link

Dynamic channel allocation function #119

Open denjhang opened 3 years ago

denjhang commented 3 years ago

The dynamic channel allocation function allows me to compose music with more audio tracks than the actual number of channels. In fact, in most cases, the channels of YM2612 are not fully used all the time, and there are always idle channels. If this function is available, the channel utilization can be improved a lot, and there are fewer restrictions when composing tracks. .

musicalman commented 3 years ago

So you want something like this? When you want dynamic allocation, you write your mml data on tracks. Each track has a list of parts it is allowed to write to. When you write on a track, the compiler will search for free parts in which to place notes. If a new note arrives but all parts are occupied, decide which part to cut off. Perhaps the part with the lowest volume should be cut first. It sounds quite complicated to implement. I think the part arpeggio function is a good compromise. It's not exactly what you want, but it helps in some cases.

denjhang commented 3 years ago

So you want something like this? When you want dynamic allocation, you write your mml data on tracks. Each track has a list of parts it is allowed to write to. When you write on a track, the compiler will search for free parts in which to place notes. If a new note arrives but all parts are occupied, decide which part to cut off. Perhaps the part with the lowest volume should be cut first. It sounds quite complicated to implement. I think the part arpeggio function is a good compromise. It's not exactly what you want, but it helps in some cases.

In fact, this is not complicated, only a simple algorithm is needed to use these channels in turn. In general, the new notes directly overwrite the old ones. In addition, it is also necessary to calculate the actual length of the note. Longer notes have a higher priority to be covered. . Something like that.

denjhang commented 3 years ago

In practical examples, Windows comes with OPL3/OPNA MIDI driver with this algorithm, which can play MIDI in FM sound source (usually there are more MIDI channels than FM hardware channels)

kuma4649 commented 3 years ago

申し訳ありませんが、その形式をサポートする予定はありません。

OPLの様に短時間での大量の書きこみに耐えられるCHIPなら問題ないでしょうけども、 そうではないChipも多数あります。

また、Chip毎に発音するためのアルゴリズムを組むのも大変で複雑だからです。

更に、MDPlayerで鍵盤表示が見にくい状態になるという理由もあります。 (IBM系のOPLのデータを再生した場合や、MULTIPCMのデータを再生した場合によくわかると思います)

データを作成するユーザーは常に発音数を意識する必要があります。 初期のMIDI音源やM01(DSのソフト)にみられる発音数の少なさから発生する制限です。

denjhang commented 3 years ago

For algorithmic issues, there are currently two projects that have implemented this function. I suggest you refer to their code. In fact, the OPL series chips are very suitable for dynamic channel allocation.

https://github.com/Wohlstand/libADLMIDI https://github.com/Wohlstand/libOPNMIDI

kuma4649 commented 3 years ago

作り方がわからないという問題だけではありません。 申し訳ありませんが、この機能についてはサポートしません。