VOGONS


Reply 680 of 929, by radiance32

User metadata
Rank Member
Rank
Member
FreddyV wrote on 2021-02-26, 13:39:
Hi, […]
Show full quote

Hi,

You can find the file format list in the doc, and I did youtube video on this.
Basically it can play
.RAD (Reality adlib dracker)
.DRO : Dosbox capture
.IMF : Apogee
.VGM, .S3M, .SAT, and others.

Do a graphic interface is not needed and will use too many memory, Mod Master start to be too big already due to a too big usage of Turbo Pascal 😀

I understand... You want to make Mod Master XT as small, fast and efficient as possible, but,
What about this:

Would it be possible for you to make a static or dynamic library that contains just the audio engine, loading of files, etc... (everything except the UI),
and others could create front ends for it ?
My job is C/C++ development, and I have a lot of experience with C and C++ graphics (especially developing 3D engines) and building GUI interfaces.
I could develop a very small and efficient GUI for configuration and selection of the MOD files etc... and then launch your mod player through API calls to the library to do the actual playback...
You would not have to publish or give me any of your source code, that stays completely private to you, all you would have to do is give me a static or dynamic library with a few API calls to set up the configuration (sound card/output type, mixing rate, etc...), load a file into memory, do the playback and music transport controls etc...

What do you think of this ???
That way you can do whatever you want, you don't have to waste ANY time on my idea, and I can experiment with building a nice, graphical, fast C/C++ UI with support for most early and later graphics modes/cards,
like CGA 640x200 mono, Hercules mono, EGA 640x350x16 and VGA 640x480x256...

What do you think of this idea? Interested?
If you have doubts, maybe give me a few weeks/months (I have a day job developing software, and a few other hobby coding projects, so I can only dedicate 10-15 hours or so per week to this) to make up some mockups and show them to you, and then you can decide...
You could then add the GUI front-end I mentioned to your Mod Master XT package as an optional front-end, and users can choose if they want to use your current UI, or, the graphical UI.
I'm happy to make this open-source and put it on a GitHub page, so others could contribute...

Cheers,
Terrence

Terrence

Check out my new HP 100/200LX Palmtop YouTube Channel! https://www.youtube.com/channel/UCCVChzZ62a-c4MdJWyRwdCQ

Reply 681 of 929, by Benedikt

User metadata
Rank Oldbie
Rank
Oldbie

If I understand correctly, the problem is not that the program gets to big to fit in RAM but that there would be too little RAM left for the audio data and mixing buffers.
FreddyV, have you thought about using Turbo Pascal's overlay mechanism? You could put the code for different file formats in separate overlays and keep just those parts in RAM that are required for the file that is currently being played back.

Reply 682 of 929, by root42

User metadata
Rank l33t
Rank
l33t
Benedikt wrote on 2021-02-26, 21:18:

If I understand correctly, the problem is not that the program gets to big to fit in RAM but that there would be too little RAM left for the audio data and mixing buffers.
FreddyV, have you thought about using Turbo Pascal's overlay mechanism? You could put the code for different file formats in separate overlays and keep just those parts in RAM that are required for the file that is currently being played back.

IIRC we talked about this briefly many months back in this thread. I also think this will be useful, especially considering different soundcards (you only need one "driver" at once). And OPL2 play routines could also be put in an overlay.

YouTube and Bonus
80486DX@33 MHz, 16 MiB RAM, Tseng ET4000 1 MiB, SnarkBarker & GUSar Lite, PC MIDI Card+X2+SC55+MT32, OSSC

Reply 683 of 929, by FreddyV

User metadata
Rank Oldbie
Rank
Oldbie

Hi,

Exactly, I am worried about the memory left for the samples and partition, even if Mod Master compress the partition, with 512Kb of RAM, Mod Master can'ty load all the samples if the file is 300Kb.

I started to write this code in 1993, then I did not write it with "Drivers" we can simply add or remove.

The Pascal part is doing the SoundCard init, and the assembly the sound output for example.
The Music replay play all the format with an internal file format. (Can't be splitted as well)

I have the project to do pascal library to use the Sierra SCI drivers, to do a Benchmark and test software.
I would like to work on game graphic code optimization, like having Sierra games or Prince of Persia faster....

The, if I have graphic code with the SCI video driver, why not doing a Graphical "Demo" of Mod Master.
I also had the idea to put the current Mod Master coide in the Mod Master 2.3 interface (Much more advanced, it is in VGA) but small motivation for it.
Mod MAster XT code changed a lot compared to Mod Master 2.3 (Mod Master XT is a modification of Mod Master 2.2)

Reply 685 of 929, by radiance32

User metadata
Rank Member
Rank
Member
FreddyV wrote on 2021-02-28, 12:53:
Hi, […]
Show full quote

Hi,

Exactly, I am worried about the memory left for the samples and partition, even if Mod Master compress the partition, with 512Kb of RAM, Mod Master can'ty load all the samples if the file is 300Kb.

I started to write this code in 1993, then I did not write it with "Drivers" we can simply add or remove.

The Pascal part is doing the SoundCard init, and the assembly the sound output for example.
The Music replay play all the format with an internal file format. (Can't be splitted as well)

I have the project to do pascal library to use the Sierra SCI drivers, to do a Benchmark and test software.
I would like to work on game graphic code optimization, like having Sierra games or Prince of Persia faster....

The, if I have graphic code with the SCI video driver, why not doing a Graphical "Demo" of Mod Master.
I also had the idea to put the current Mod Master coide in the Mod Master 2.3 interface (Much more advanced, it is in VGA) but small motivation for it.
Mod MAster XT code changed a lot compared to Mod Master 2.3 (Mod Master XT is a modification of Mod Master 2.2)

Here's some ideas to tackle the memory / samples issue, I'm sure you have thought and maybe even tried to or implemented a few of these already, but I'll write down here what I can come up with:

* 1: You could add support for EMS (expanded memory)
The LIM 4.0 EMS specification supports up to 32MB of RAM, and is fully supported on 8086+ systems...

* 2: Resample each sample during loading to lower sample rate
During the loading of the MOD file and the samples therein,
you could downsample the samples to fit into the available memory.
Eg, if you have say 400Kb of memory available for samples, and you're loading a mod file with 650kb of samples,
for each sample, multiply the KHz of the original sample by the factor of 0.6153 (400 / 650) and resample the sample during loading, and you'll end up loading all the samples into memory with a total size of 399.945Kb...
It does reduce the quality of the samples, and you'll end up with samples of different KHz (dunno if your engine supports this), but, at least you'll be able to play the whole MOD file in slightly lower quality...
If your engine doesn't support having different KHz for individual samples, you could also resample them so that they are all the same KHz, but reduced so they all fit into memory...
You could vary the amount of resampling to a lower sample rate with some weights based on the sample in question:
Samples with low frequencies, like a drum kick or a low bass line, can be downsampled a little bit more than samples that are of medium or high frequencies...
You could create a non-linear scale like a logarithmic scale that is used during the analysis stage to determine the resampling rates for each sample prior to loading all samples, but after you've made an inventory off all the samples and their
sample rates and their mean fundamental frequency (eg low values are like a drum kick, a bass line etc... / medium for leads, pads, voices, etc... / high for cymbals, hi-hats etc...). You just calculate the "mean fundamental frequency" of the
sample in question, which is a very simple and fast algorithm. You don't need to calculate the mean fundamental frequency with all the sample-values of the sample in question, but just calculate it with getting a few thousand points spread
equally over the length of the sample, so it only takes a very short time to get a decent mean fundamental frequency, and you can also at the same time get the mean volume from this data for use as described below...
Finally, you could optimize this a bit more by adding some weights based on the number of times the sample is used in the song and the volume of the sample (eg if it's only used as a faint sound in the background of the sound-scape) with
samples that are used a lot and/or do not have low volumes getting a bit more KHz than the others, all via a logarithmic scale...

* 3: Make a dynamic sample loading/unloading engine
Before loading the samples, make an inventory of them, their sizes, KHz, and when they are used on the timeline of the song, and you analyze this information and you build an array of what samples are used where on the timeline of the song,
and you load/unload samples dynamically while the song plays, you could create a separate thread or add some code to your audio engine loop that does this while the song is playing.
It's a bit like Bethesda games, like Fallout 3/4 and The Elder Scrolls series, where the terrain and 3d models/textures are loaded dynamically based on your location on the world map and are loading in/out of memory as you move on the world
map.
This won't always work, but, if you can combine it with the point above (resampling the samples to lower rates during loading), you can end up with a hybrid system, where prior to loading the samples, you do your analysis, and you end up with 2 groups of samples:
* resident samples: These are used continuously throughout the song and should not be loaded/unloaded during playback. You load all these samples into memory prior to playback, but you use the "Resample each sample during loading to lower sample rate" technique to load them, with an intelligent algorithm using the non-linear scale and the mean fundamental frequencies of the samples.
* dynamic samples: These samples are the remaining samples, they are not used frequently, and, at all times during the song playback, there is enough time between playing the sample and playing the sample the next time, to unload and load it into memory between those 2 points. These samples are, of course, not loaded before starting playback, and are loaded/unloaded during playback in a reserved memory area with a size that has been calculated by the algorithm I just described, based on the total size of all the samples in the MOD, the amount of available memory for samples, the amount of memory used for the "resident samples" that are loaded using the sample-rate reduction algorithm, etc...

* 4: Recode your current Turbo Pascal User Interface code into C or C++
Not only is compiled, optimized C or C++ faster than Turbo Pascal, it also makes much smaller code,
as it doesn't add all the run-time pascal stuff into the executable, eg, it's linked to dynamic/shared libraries that have their own memory space,
so you end up with a tiny executable and a very small memory footprint for your UI code.
So the amount of memory used by the UI that is currently written in Turbo Pascal will be much smaller, giving you more memory for your audio-engine.
Another big difference is that C and C++ have VERY advanced and modern compilers (eg the latest versions of GCC and G++ or Clang/LLVM).
These compilers produce code that is tiny and VERY optimized with a near-infinite amount of optimizations that the Turbo Pascal compiler lacks...
A very experienced C/C++ developer who knowns his compiler very well and has a good understanding of exactly how his code gets translated into machine code,
can produce executables that are "nearly" as fast and small as those written in assembly language...
You could decide to open-source your code (If you want to, or just the User Interface part, not the audio engine) and put it up on GitHub,
so others can contribute to it, for starters, I myself am eager to contribute as you've read in my previous posts...
This way, you can focus on developing and optimizing the audio engine, and leave the UI stuff to others, so you don't have to waste your time on UI programming,
except for when it's necessary (eg the UI code for the playback part of the application)

I think a hybrid of point 2 and 3 would be a good start, with an analysis pass before loading the samples, that has an advanced algorithm for determining the memory layout for the song and all the data to be loaded into it, and adding support for EMS would be awesome too, for those who have EMS memory on their systems...
I don't know if Mod Master XT already supports EMS, haven't checked, so forgive my ignorance on the matter if this is the case! 🤣 😉

Cheers,
Terrence

PS: Have you a reply regarding my previous post about the GPL-licensed, C++ based UI using the engine as a library ???

Cheers,
Terrence

Check out my new HP 100/200LX Palmtop YouTube Channel! https://www.youtube.com/channel/UCCVChzZ62a-c4MdJWyRwdCQ

Reply 686 of 929, by Benedikt

User metadata
Rank Oldbie
Rank
Oldbie
radiance32 wrote on 2021-02-28, 22:03:
* 4: Recode your current Turbo Pascal User Interface code into C or C++ Not only is compiled, optimized C or C++ faster than Tur […]
Show full quote

* 4: Recode your current Turbo Pascal User Interface code into C or C++
Not only is compiled, optimized C or C++ faster than Turbo Pascal, it also makes much smaller code,
as it doesn't add all the run-time pascal stuff into the executable, eg, it's linked to dynamic/shared libraries that have their own memory space,
so you end up with a tiny executable and a very small memory footprint for your UI code.
So the amount of memory used by the UI that is currently written in Turbo Pascal will be much smaller, giving you more memory for your audio-engine.
Another big difference is that C and C++ have VERY advanced and modern compilers (eg the latest versions of GCC and G++ or Clang/LLVM).
These compilers produce code that is tiny and VERY optimized with a near-infinite amount of optimizations that the Turbo Pascal compiler lacks...
A very experienced C/C++ developer who knowns his compiler very well and has a good understanding of exactly how his code gets translated into machine code,
can produce executables that are "nearly" as fast and small as those written in assembly language...

While I wouldn't necessarily recommend Pascal for brand new code, either, I don't believe that changing the programming language this far down the road makes any sense.
What is more, the C and C++ compilers that are available for 8086 real mode are either very old or very limited.
GCC for 16 bit code, for instance, cannot deal with much beyond the tiny memory model. Your best bet would be the (t)rusty Watcom compiler.
Changing the Pascal compiler, on the other hand, could make sense.
Free Pascal has gotten a 16 bit backend relatively recently and is an optimizing compiler that focuses on Turbo Pascal compatibility, but adds support for further memory models.
Using Free Pascal would also ensure that everyone has access to the compiler, should Mod Master ever become open source software.
Admittedly, using overlays would not be an option, because Free Pascal does not support them.

Reply 687 of 929, by FreddyV

User metadata
Rank Oldbie
Rank
Oldbie

Hi radiance32.

I appreciate your effort to help me 😀

So, yes, Mod Master support EMS and UMB.

Compress samples is of course something I did think about and is not a priority for me, partition compression did help a lot, and lot of files can be played anyway on PC with 640Kb of memory.

Recode the interface, there is no way to go there as I am not a C expert and it will need too many time, for almost no benefits.

Freddy

Reply 688 of 929, by radiance32

User metadata
Rank Member
Rank
Member
FreddyV wrote on 2021-03-05, 12:13:

Recode the interface, there is no way to go there as I am not a C expert and it will need too many time, for almost no benefits.
Freddy

I know this, that's why I suggested you could open-source the UI part of the app, open a GitHub for it,
and have others implement it, while you focus on the engine 😀

I also didn't mean to "compress" any samples (eg with zlib or something), but to resample them to a lower sample rate when loading with the new sample rate determines by an advanced algorithm that does an analysis of the whole song before determining the individual weights for each sample to be loaded and resamples during...

Terrence

Check out my new HP 100/200LX Palmtop YouTube Channel! https://www.youtube.com/channel/UCCVChzZ62a-c4MdJWyRwdCQ

Reply 689 of 929, by FreddyV

User metadata
Rank Oldbie
Rank
Oldbie

Hi,

You don't understand, there is much more than the UI in Pascal : Sound card init, File Loading, memory management.

Change to C is too many work (Months) of code, even for somebody knowing the code (Weeks to read and understand it)

FreddyV

Reply 690 of 929, by Benedikt

User metadata
Rank Oldbie
Rank
Oldbie

Exploring a potential switch to the Free Pascal cross-compiler for 8086 would still make sense, though, because the modern cross-compiler can spend considerably more resources on code optimization.
Turbo Pascal does not really optimize anything, IIRC.
A complex project like this would be an interesting test case for that backend's Turbo Pascal compatibility in combination with real-world code.

Reply 692 of 929, by FreddyV

User metadata
Rank Oldbie
Rank
Oldbie

Hi,

I tested Mod Master on a 286/16MHz

8 Channels : 44KHz, 16Bit working correctly 😀
It is able to play DOPE.XM (Onward, the well known 28 channels module) at 22KHz

I was not able to have MP (ModPlay Pro by Marc Cox) working...

Anybody know a player working on 286 ? I would like to do some more comparison 😀

I also found an old .MOD player code, done in assembly that did give me idea for more code optimization (Mixing Speed increase) so I need to test that..

Reply 693 of 929, by keropi

User metadata
Rank l33t++
Rank
l33t++

I am testing the latest v26 (also tried v25) and for some reason on my system the file selector does not show at all my \MODS\ directory
if I copy said mods to drive D: for example modmaster finds it and plays the files just fine
I have checked the drive with scandisk and no errors were found, the MODS directory is accessible to other players/filemanagers just fine , it's a weird issue
edit: also noticed that subdirectories inside the \MODS\ folder are also not visible in the file selector

How hard would it be to implement a function to also add modules in subdirectories to the playlist? Or perhaps some simple "playlist support" where each line points to a full path of an item to be played?

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 694 of 929, by FreddyV

User metadata
Rank Oldbie
Rank
Oldbie

Hi Keropi,

While writing another software, I checked the Mod Master code for file scan, and I saw it has a filter on the file attributes.
Then, some different attributes may be present on the folder/Files not detected.

I already removed the filters in the current rev I have, but as I did not add functionality, I don't plan to release a new version soon

Reply 695 of 929, by keropi

User metadata
Rank l33t++
Rank
l33t++
FreddyV wrote on 2021-03-26, 10:05:
Hi Keropi, […]
Show full quote

Hi Keropi,

While writing another software, I checked the Mod Master code for file scan, and I saw it has a filter on the file attributes.
Then, some different attributes may be present on the folder/Files not detected.

I already removed the filters in the current rev I have, but as I did not add functionality, I don't plan to release a new version soon

so in the meanwhile what attributes does it need? archive? none?

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 699 of 929, by keropi

User metadata
Rank l33t++
Rank
l33t++

yes there are 😀
also I experimented with attributes, currently file selector needs NO atttributes at all to show the files: all my mods/dirs had the "archive" attribute - this needed to be cleared so the selector can show them

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website