flat assembler
Message board for the users of flat assembler.

Index > MenuetOS > Midi synth/sequencer

Author
Thread Post new topic Reply to topic
Ville



Joined: 17 Jun 2003
Posts: 321
Ville 06 Nov 2025, 15:18
You can use upto 256 instruments, which receive at differerent midi channels and note ranges. It has displays for sequencer tracks, synth, mixer, piano roll and notation. Menuet scheduler runs at 1000hz and can be set as high as 100000hz (100khz), so the limiting latency factor is usually sound cards buffer length.


Description:
Filesize: 295.23 KB
Viewed: 485 Time(s)

SYNS2b2.png


Post 06 Nov 2025, 15:18
View user's profile Send private message Reply with quote
bzt



Joined: 09 Nov 2018
Posts: 93
bzt 08 Dec 2025, 17:39
MenuetOS always amazes me! Awesome. I have a question though.

Ville wrote:
You can use upto 256 instruments
MIDI has 128 instruments in total, so I guess you wanted to write 256 parallel voices maybe (maximum is 16384 voices = all 128 possible notes played on all 128 instruments at once)?

But my real question is, how do you generate the PCM waveforms for these instruments? I can see on the left screenshot that wave banks are tweakable, but how do you get them in the first place? Do you use a sound font? Or did you also port some synthetizer like fluidsynth or an OPL emulator? Or did you just wrote an arbitrary wave generator with customizable parameters?

Either way, very very impressive! MIDI playback without a dedicated hardware is quite some feat! (Actually my Linux box with the latest MuseScore and Rosegarden software is not up to the task of playing MIDI files... I had to grab a quick-and-dirty player source with built-in OPL emulator from github and compile that myself)
Post 08 Dec 2025, 17:39
View user's profile Send private message Reply with quote
Ville



Joined: 17 Jun 2003
Posts: 321
Ville 09 Dec 2025, 14:56
There are different ways to map the synthesizers instrument from the midi track.

1) By midi channel and note position (keyboard split).
2) By tracks instrument setting and note position.
3) Using General Midi mapping, where drum midi channel 10 instruments
(35 bass drum - 81 triangle) are mapped to synth instruments 135-181,
so you dont have to worry about splitting the keyboard for each drum.

You can select which mapping to use from the drop-down menu.

The audio-wave is generated from

1) Waveform generator, which generates waves from preset options, like basic sine, square, sawtooth etc. with additive synthesis.
2) Waveform file from usb stick or hd.

Parameters (envelope, wave settings, phase, pan, etc) are set by user for each instrument.

Playing the notes is pretty straight forward. Notes are just fetched in time order and the synth/sampler instrument is selected based on the above rules. The wave-form is written to the audio buffer according to instruments pan, volume, phase, envelope settings, etc. This happens in real-time, writing the notes to audio buffer a few seconds ahead of current play position, so you can modify the synth/mixer settings in real-time while playing. (I wrote all code.)

btw, I wish they would have kept the easy to approach protocol for Midi 2.0 and simply multiplied the bit-widths and added new features as system exclusive messages. But I quess thats a different conversation Smile
Post 09 Dec 2025, 14:56
View user's profile Send private message Reply with quote
bzt



Joined: 09 Nov 2018
Posts: 93
bzt 10 Dec 2025, 10:20
Ville wrote:
Waveform generator, which generates waves from preset options, like basic sine, square, sawtooth etc. with additive synthesis.
Yes, I got that, my question was, what kind of waveform generator do yo use?
1. Soundfont is a collection of parameters for a standardized set of synth methods (typical example fluidsynth)
2. OPL is a software emulation of the YM3812 / YM262 / etc. chips, so here an instrument is a set of register values (for example, but ymfmidi reads the actual register values from this file)
3. Custom waveform generator (for example like this player)

With all these, you have some kind of "presets" to combine and transform basic waveforms. The difference is how this is implemented. For 1. you have some high level abstraction and variable length parameter records, for 2. you have fixed sized records with register values, and for 3. well, custom, so whatever.

(FYI IMHO option 1. is unnecessarily overcomplicated should be avoided, 2. is the best compromise between quality and complexity, but only needed if recreating that old Adlib/SoundBlaster vibe is the aim, therefore most of the time option 3. is more than sufficient.)
Ville wrote:
Waveform file from usb stick or hd.
Yes, I saw the "Wavefile" button Smile Pretty neat, MIDI players usually stuck in chiptune wavegen hell and never use high quality PCM samples for some reason. So really awesome!
Post 10 Dec 2025, 10:20
View user's profile Send private message Reply with quote
Ville



Joined: 17 Jun 2003
Posts: 321
Ville 11 Dec 2025, 18:05
The waveform generator is a custom synthesizer, which is likely closest to OPL. The synthesizer reads parameters from user definable registers, which control how oscillators and all other wave properties behave. And the parameters are saved as fixed length record for all instruments.
bzt wrote:
2. is the best compromise between quality and complexity

So yes, Ive came to the same conclusion Smile
Post 11 Dec 2025, 18:05
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.