Wohlstand / libOPNMIDI

A Software MIDI Synthesizer library with OPN2 (YM2612) emulator
GNU Lesser General Public License v3.0
91 stars 7 forks source link

Option for mono? #109

Closed Torguen closed 9 months ago

Torguen commented 3 years ago

Hi, i think this is not the right place to ask this. How is the "mono" activated? I mean, reduce the polyphony to 1 voice. Sorry if this is not the right place but I couldn't find another site.

Wohlstand commented 2 years ago

Hello! Sorry for no response for a long time. But, I have no idea, why do you need the monophony enforced? If you play regular MIDI file which expects a polyphonic synthesizer (having more than one parallel note in the same file), the only last one will survive, and the result from the chord would be unexpected (in the condition the auto-arpeggio feature is disabled).

Anyway, recently I added the "channels allocation" option and you can set the "any released" mode, then you can play notes and they will shut up releasing sound, and will start a new sound over releasing one. You may try some out.

Torguen commented 2 years ago

Hello, thanks for the information. I use monophony in the instruments for the music of the retro video games that I develop. So, to simulate the sound of a Genesis/Mega Drive, I usually turn mono on each channel. These consoles only played one sound at a time on each channel, so they are monophonic channels. I'll try that when I can.

Wohlstand commented 2 years ago

You don't need the mono, but you, probably, really meant the different algorithm of channel allocation. Did I understand you right?.

I.e. taking the channel after the key is released, without waiting while releasing still sound, so, the small example:

Demo file itself: Drunken Sailor_synstr.mid.zip

P.P.S. Also, disable automatic arpeggio (if enabled) to avoid messing of the sound.

Wohlstand commented 2 years ago

@Torguen , what do you say?

Torguen commented 2 years ago

Hello, I will be able to try it when the summer is over. I'll leave a comment if I remember.

Wohlstand commented 2 years ago

No problem :)

average34 commented 2 years ago

Hello. I have a similar problem with ADLPlug / OPNMIDI. I want a mono mode (monophonic mode), as well as Sometimes I don't like to have the reverberation of the previous note left behind.

The PMDWin.dll emulator does not leave reverberations on the next note: https://drive.google.com/file/d/13rO5tS5CbudCQ9HZe7Ex-gvy66R_Vg8s/view?usp=sharing

However, with OPNMIDI (play in Studio One 3), the reverberation remains on the next note: https://drive.google.com/file/d/1DpSmt2myZuKLYI9SC7R3VcAJrKJ3Ie69/view?usp=sharing

Perhaps the latter may sound more desirable in general. However, personally, I prefer the former because I want the music to be as close to the actual PC9821 music as possible. Even if there is a little bit of noise.

To reproduce this in the current OPNMIDI, I set the Release Rate to 15 if there is a next note, and if there is no next note, I set the Release Rate between 0 and 14. But this is quite complicated. Also, I cannot deal with short rests.

If you can create a switch to mono mode that would make this operation easier, I would like to see it included in OPNMIDI.


私もADLPlugおよびOPNMIDIで似たような悩みを抱えています。 モノモード(モノフォニックモード)がほしい、というのもそうですが、 前の音の残響音が残ってしまうのが好ましくないことがあります。

PMDWin.dll エミュレータでは残響が次の音には残りません。 (URL1) しかし、OPNMIDI(play in Studio One 3)では残響が次の音に残ります。 (URL2)

もしかすると、後者のほうが望ましく聴こえるかもしれません。 しかし、私はなるべく実際のPC9821の音楽に近づけたいため、前者のような表現にしたいのです。たとえプチプチノイズが乗ったとしても。

これを現状のOPNMIDIで再現するには、次の音があるならばRelease Rateを15に設定し、次の音がなければRelease Rateを0-14の間に設定する、という対処を私は取っています。しかしこれはかなり煩雑です。また短い休符が挟まった場合に対応できません。

この操作を楽にしてくれるモノモードへの切り替えを作れるのならば、OPNMIDIに搭載していただきたいです。

Wohlstand commented 2 years ago

@average34, I actually implemented the channel allocation mode on the library side: https://github.com/Wohlstand/libOPNMIDI/commit/8c8f28ec3a3582722411e688d6871da7e7d41045 So, it should work. However, to make it work at ADLPlug, we need the help of @jpcima to implement options to utilise the new-made library side feature. THe same I did at libADLMIDI too.

Wohlstand commented 2 years ago

p.s. demos of channel allocation modes work are here: https://github.com/Wohlstand/libOPNMIDI/issues/109#issuecomment-1170206240

average34 commented 2 years ago

Thank you! 👍 I immediately made a suggestion to @jpcima. https://github.com/jpcima/ADLplug/issues/87

Wohlstand commented 2 years ago

Anyway, this thing is totally not called as "mono mode", it's channel allocation model to re-use the same channel without waiting for its releasing. The default mode ensures the releasing sound will still being hearable and not shouted up immediately. And so, for some needs the "same channel" mode is needed. Suggested to use the "same instrument" model to make sure random hihat won't mute your melody.

Wohlstand commented 9 months ago

Closing this as fully completed.