Open ytrezq opened 1 year ago
From what I understand, one with enough knowledge about MIDI implementation shoudl be able to do it.
The guts of the ESFM native functions are in NATV.CPP.
There is the MidiMessage
function where MIDI-commands are dispatched (i.e. 0xB0 for "Change Control") and this function can be enhanced accordingly to support more stuff.
You may want to use ESSPlayMid code for experimenting, as it allows you to experiment and develop in user mode and don't have to reload the kernel mode driver every time when you change something.
Problem is I was never taught the link between spectral frequencies and the eard sound. I have zero knowledge about it.
Basically you are limited with what the hardware supports: https://github.com/jwt27/esfm
Not sure if you can simulate some stuff with the given functionality, but I have zero knowledge about this topic either.
Every sound is the compound of several sinuses. There are multiple examples on how to achieve reverb and chrorus on opl3 (though I don t understand them), so nothing prevents it with esfm.
I don't think that it would work without native support of the sound card: https://www.vogons.org/viewtopic.php?t=72747 Which samples are you referring to? And I don't see Chorus effect in the ESFM documentation nor do I see it in Solo-1 documentation. From the datasheets, only ES689/ES690 supports chorus/reverb.
Rather than direct hardware support, it has to be done manually. But I do have played opl3 examples with reverb.
I was curious how the ESS Maestro 2E cards, which claim to have reverb and chorus support, do it. Found out in their NT4 driver: https://www.zx.net.nz/mirror/ftp.esstech.com/pub/audio/pci/maestro-2e/winnt40/40282.zip Turns out that they just use a Software Synthesizer there using their custom ESSSWT.DLS sound font which is included in the package. So this is not ESFM, but just a plain Software Synthesizer (like the one that comes with Windows).
I also verified the ES1969 Windows 9x driver (ESFM.DRV) and it contains the exact same code as the NT4/Win2k driver, thus the same code as in this repository, no fancy enhancements etc.
My point is to have an optional more correct rendering when playing midi files (difficult to record the music and then apply the specified chorus and reverb in the midi file on specific instruments).
At least, specifying which instruments should play louder than others is a key rendering for a music (supported by general midi files but not the original driver as far I m aware which use generic sound models instead) .
Well, this driver implements all that ESFM on the ES1969 can do, it doesn't support chorus and reverb natively, as verified by the docs and the drivers. ESS starting with Maestro series (ES1968) does wavetable synthesis and supports reverb and chorus through it (as can be seen in the product data sheet ) which is what above mentioned driver for the Meastro does there.
So as you are on the ES1969, your only option may be to use a Software synthesizer that supports chorus and reverb like FluidSynth and maybe enhance it with required features, if not already present, no need for ESFM there, it will work with any soundcard, as it is rendered by the CPU, not by the Soundcard hardware.
I don t understand how but they are many examples which show how detuning an operator can be used to have in hardware chorus (and since esfm can do it per op it should be easier). As a result, I have a midi file played on opl3 with and without reverb.
Also what about the more important sound level? (Playing a channel louder than an other channel)
Isn't the volume level already implemented? See: https://github.com/leecher1337/es1969/blob/dc95b621bcd4fb6a6f30f5b1625c0747c0bd0ca6/src/win2k/NATV.cpp#L239
If you find out how to add a chorus, as said, all can be implemented in natv.cpp ESFM driver. From what I can see wiht chorus flag in the wavetable synthesizer of the ES1968, it adds 0xA0000 on calculating the Pitch Ratio. But unfortunetaly, I'm not a musician, so I don't have the necessary basics and understanding.
From my past win9x recordings, setting the channel volume to 1 doesn t mute the channel (notes played like other notes).
What I mean is instead of specific hardware request in fm synth, you change specific operator settings as if you wanted to change the type of sound being played (changing how the signal is generated along harmonics).
I can help you as a musician but turning signal generators into useful sound requires huge specific knowledge I don t have.
https://www.muzines.co.uk/articles/practically-fm/3527?theme=1 (should also work on 4 ops and detune is a register on esfm). There won t be generic settings though: it will depend on the instrument being played, and so on.
Just verified that hte MIDI ESFM implementation in the Miles Sound System 3 (ESFM.MDI driver) also is the same as the one of this driver, so at least there are no driver implementations out in the wild for mentioned feature.
Feel free to experiment with the setup_voice
and setup_operator
functions. Maybe you can build a patch set with enabled chorus that can be loaded for some instruments where you were able to create the effect with the 4 available operators.
Even then, it would be better to modify the sound bank format for cleaner code since the chorus setting would be specific to each instrument.
The sounrdbank format is sepcific for the ESFM synthesizer (basically contains the requested register's content for every instrument), so there is no point in modifying it. You can make a typedef struct
for definition, if you want to improve readibility.
The soundbank contains operator s registers content for every instrument. But for a given identical chorus effect, they need to be altered in way which is specific to each instrument.
The format of the patch table is pretty straightforward: Check out ESFM docs for register definitions. Patch file format:
The patch file starts with 128 USHORTs that specify the offset of the 128 programs defined by General Midi.
Then follows the table with 128 USHORTs that specify the offset of the General midi Percussion instruments also defined by general midi.
Afterwards the actual patch definitions start, consisting of:
╔═══════╦═══════╤═══════╤═══════╤═══════╤═══════╤═══════╤═══════╤═══════╗
║ R↓ B→ ║ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 ║
╠═══════╬═══════╪═══════╪═══════╪═══════╪═══════╪═══════╧═══════╪═══════╣
║ ║ FP4 │ FP3 │ FP2 │ FP1 │ ? │ Operation │ PAT16 ║
╚═══════╩═══════╧═══════╧═══════╧═══════╧═══════╧═══════════════╧═══════╝
PAT16: Use Patch16? Operation: 0 - Only use voice 1 1 - Also use second voice, if set 2 - Also use second voice, if not set, steal voice FP1..FP4: Set fixed pitch for operator 1-4
Relative velocity for operator 1-4
╔═══════╦═══════╤═══════╤═══════╤═══════╤═══════╤═══════╤═══════╤═══════╗
║ R↓ B→ ║ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 ║
╠═══════╬═══════╧═══════╪═══════╧═══════╪═══════╧═══════╪═══════╧═══════╣
║ ║ Rel.veloc. 4 │ Rel.veloc. 3 │ Rel.veloc. 2 │ Rel.veloc. 1 ║
╚═══════╩═══════════════╧═══════════════╧═══════════════╧═══════════════╝
Registers to set for each operator as documented under "Operator registers" in ESFM documentation.
If Operation
in Byte 0 is > 0 then data for the second voice follows (Starting with byte 0
from above again).
To facilitate the creation of appropriate patch sets, I created a little bank editor GUI that may be useful for editing: https://github.com/leecher1337/esfmbank
Thank you. For more information, reverb can be created by increasing the release time only on the carriers operators.
Otherwise why can t the envelope related midi sysex messages can t be implemented as is since there s dedicated registers that time?
You are free to create a patch set with ESFM bank editor that contains chorus and one that has reverb and then they can be integrated in the driver.
Enveloep related midi sysex messages? You mean the control messages Envelope Attack Time (49h) and Envelope Release Time (48h)? You can try to implement them, if you know how to do it (I do not), take ESFMBANK source code, edit MidiMessage
function accordingly and test them with the "Play" function of the ESFMBANK editor. This way you can experiment without having to reload the driver every time. Compiler is MS Visual Studio 6, but the project file may also be ported to newer Visual Studio versions, if you don't have it.
I know the original driver doesn t do it. But would it be possible to implement some things like chorus, vibrato rate or reverb type or channel s master volume (maybe filter resonance isn t possible in theory).