milkytracker / MilkyTracker

An FT2 compatible music tracker
http://milkytracker.github.io/
Other
1.67k stars 159 forks source link

add (toggleable) support for more than 32 channels without the need to recompile from source #62

Closed FyiurAmron closed 6 years ago

FyiurAmron commented 7 years ago

Preamble: I'm aware of the reasons why MT supports only 32 channels out-of-the-box ("real" FT2-ish XMs supporting only that much, MT being used on low-end platforms without CPU power to mix more channels, the "don't just double the channel amounts by 2" doctrine from FT2, already having the ability to use more channels with quite simple source hacks etc.) Still, I'd like to propose adding a support for more channels (at least 64) in master branch.

My points are: a) more than 32 channels have been and already used by many (if not most) of the other contemporary trackers & players, including, but not limited to, IT, MPT, Skale, XMPlay etc., since increasing the amount of channels in XM-stored modules to e.g. 64 doesn't really require any other code changes than upping the constants in the application, so doesn't have any real cost other than making the XM incompatible with legacy software, and can (and does) provide real benefits (see below), b) 32 channels for modules is simply too little for format without multilayered instruments or stereo samples; it happens for me regardless of the genre, both for e.g. orchestral music & chiptunes - it takes about 4 layers for a fat synth or a fat drum - double or triple that to 8 or 12 to make it possible to use stereo effects. I hit 32 channels before I'm even able to lay out the synths. It takes about 16 channels to have a properly sounding piano emulating two hands with chords played, 6 channels to emulate a guitar etc. ... so that's a real blocker. 64 channels usually leave you with some spare place, but 32 channels often leave you with not enough space for real layering and with the need to stack couple of instruments on single channel, killing the reverb/echo/ambience possibilities, c) MT works properly (including GUI) recompiled with constants upped to 64/128 channels, at least on Win32 as far as the couple of weeks of testing I've done went, so there's no real effort needed here, d) FT2 did that mostly because 32 channels with 48k sampling, effects and live playback was already pushing the hardware available at the time to the limit, and because 32 channels was an increase from FT1 and MOD format anyway; today, even an ARM smartphone has more CPU power than needed to mix 64 (or more) channels properly, e) switching to 64/128 max could've been done with platform-dependent compilation, so that it only happens for those platforms where it's completely not an issue, f) it could be/should be made an option (with a 1st time warning popping possibly), that XMs done in more-than-32-channels-mode are incompatible with legacy XM players/trackers, g) I (and probably other people in similar situation to me) wouldn't have to maintain a fork and wouldn't have to port changes from master constantly just for the sake of having that particular feature.

IMO there would be no harm done, no kittens killed and no rainforests destroyed in the process. I can volunteer to do the PR with relevant changes myself, if nobody else wants to patch it together BTW.

tl;dr please give us the ability to enable 64 (or more) channels out-of-the-box, so that the community gets the most of MT, which is awesome already, but can be even more awesome by having a killer feature other trackers already have for like 10 years.

alugarius commented 7 years ago

I'd like to see that too, I downloaded a lot of IT files and most of them are useless because the artificial limitation. So I sadly depend on SchismTracker for that files.

I am not a good developer but I try to help where its possible: I contacted the libsdl4android to update the android build to ver 1.0.0, I want to treat MT like a professional music studio (because it basically is). I try to set up a monthly donation and to a bit PR for milkytracker if that helps. But all that would be easier if I wouldn't depend on other trackers.

@FyiurAmron has stated a good point and I saw this on your website -- http://milkytracker.titandemo.org/docs/Vhiiula-TechniquesOfChipping.txt : ""3. Mixing --------- As in any other tune, try to have your chipsounds cover as many pitches as possible, i.e. have a bass line, a high lead, some chords in between, or however you like it, just make sure you create a "full" sound. (I'm not saying that you have to do it this way. But it's just the easiest approach to creating a pleasant mixing.) Some old tracking tutorials say that you should try to use as few channels as possible, or at least try to erase anything remotely unneeded from your track. This might have been true in the days when those tutorials were written, the mixing quality being 8-bit and 22.1 khz. But these are the days of 32-bit mixing, so you will not have to worry about quality decreases anymore. Moreover, when making "newschool" chiptunes you are more of an engineer actually, having 64 channels at his/her disposal to synthesize the best sounds possible. And notice: Chipsounds are weak, they cannot be played alone. So, try to avoid doing that too often. "" -- if you argue against 64/128 channel support, you should remove the tutorial from your website that recommends using more than 32 channels to have a better sound ... just saying :) .

It would be fine to hide the setting deep into the config with a warning that I break FT2 compatibility (I don't have FT2 so its fine by me), but it should be accessible.

Deltafire commented 7 years ago

I have no objection to this. I would suggest that a warning box is displayed when initially increasing the channels past 32, so the user knows they are creating an .XM file that is incompatible with FT2.

SyntaxErrol commented 7 years ago

I wonder if FT2 would still load and play the 32 first channels, and if so, would it kill the rest on save. I know it doesn't discard any pattern data when you for example reduce a 8 channel file to 4 and save. The channels can be restored on reload simply by upping the count again.

alugarius commented 7 years ago

@Deltafire I agree, if someone wants to use FT2, there should be a notification.

@SyntaxErrol I could try to get FT2 in a VM on my Debian machine and test it. I don't know how FT2 handles the data. If compatibility breaks, we have to save <= 32 channels files as before, and >32channel files in some sort of different format (we could leave the xm format as it is and the mod file format can be >32 ). We also could create a whole new format to seperate MT from FT2, opening an issue to a new file format and what name it should have. For example : extension = .mt or .mlky Thanks for comeing BTW :)

alugarius commented 7 years ago

I tested some music created with milkyTracker on Fastracker2, and some files are already incompatible. They are played on every tracker/player normally, but fastracker plays some files in "slowmotion"

SyntaxErrol commented 7 years ago

Just tested: Neither FT2 nor MT can open a 33-channel .XM created in OpenMPT citing "Corrupt file" and "Error while loading/unknown format" respectively.

If compatibility breaks, we have to save <= 32 channels files as before, and >32channel files in some sort of different format (we could leave the xm format as it is and the mod file format can be >32 ).

This should probably follow OpenMPT, or is there another gold standard for nonstandard .XMs?

We also could create a whole new format to seperate MT from FT2, opening an issue to a new file format and what name it should have. For example : extension = .mt or .mlky

Despite how much I love the Milky UI (nobody else seems to get the keyboard mapping "right" despite having "FT2 like" configurations) and having championed a hypothetical ".X3M" format in the past, it's hard for me to see a thing like this fit in the scope of the project. There was .SKM, there was .RNS which lives on as .XRNS and OpenMPT did the right thing to depart from .IT into .MPTM for their enhancements and the list goes on. We already have several more advanced trackers in existence so what could a MilkyTracker born format bring to the table that's different?

some files are already incompatible. They are played on every tracker/player normally, but fastracker plays some files in "slowmotion"

That sounds strange. Did you try another setup (DOSBox maybe) or rendering to wav to rule out any realtime/VM specific shenanigans?

alugarius commented 7 years ago

@SyntaxErrol " We already have several more advanced trackers in existence so what could a MilkyTracker born format bring to the table that's different? "

In the view of other trackers there is not so much difference, but in the view of milkytracker: beeing able to open not just 30% of impulse tracker files and have double of channels, would be cool. Also OpenMPT is windows only.

...How about using a format like IT to save a track up to 64 channels? No new format, just a new saving option.

We have at least to solve following problem. MilkyTracker claims to beeing able to open Impulse tracker files... but IT files are natively able to save 64 channels. If the final answer is "no, we are not extending the channel range", then we should at least remove the file formats from MT that are able to contain more than 32 channels.

So what about that offer? Using IT(or another 64 ch format) files if the channelrange +32. Or keep 32 CH limit and remove it and other +32ch formats from MT

SyntaxErrol commented 7 years ago

Also OpenMPT is windows only.

Wow, somehow I thought that wasn't the case these days.

IT features with a familiar UI was always a common wish among FT2 users. Doubling the channel cap to match IT's would only be the start of supporting them. There are no virtual channels, no New Note Actions and no filters. And I don't think adding them is a matter of just adding code but changing a lot of what is already there possibly sacrificing FT2 compatibility - one of the project's main aspirations - in the process. That is without discrete feature/playback modes for different formats like there currently are for .XM and .MOD.

As I understand the FT2 and IT paradigms are somewhat at odds neither one being a superset of the other. Take instruments for example: FT2's contain a set of samples sharing the same instrument settings and IT being able to define several instruments utilizing a single instance of sample data.

MilkyTracker claims to beeing able to open Impulse tracker files

Actually .IT is just one on a list of many formats that MilkyTracker is able to import, but is clear about

since Milky is a FT2 clone, modules are replayed in an FT2 environment which means not all features of different formats are supported.

Importing (and exporting) are considered lossy operations so for example while Milky's .S3M import and even playback is pretty good, features like channel panning and AdLib instruments just aren't supported. Bummer, especially for the latter. And I can't even guess what's lost in translation of all those more exotic formats.

To be fair the manual doesn't explicitly say .XM and for the most part .MOD are the formats that are supposed to be fully, losslessly, supported.

I think that adding .IT export just to enable >32 channel support a) would be misleading and b) could still mean a disproportionate amount of work. An existing method of extending the channel range would of course still be preferable to maintain some interoperability. By the sound of OpenMPT's "hack" (as they call it), I'm inclined to think it'd be a more lightweight and feasible solution to the issue.

alugarius commented 7 years ago

Peter send me an email, he will look into it next week. (Thanks again:) If we add more channels, should .mod be used or an own format? edit: or xm and mod for 64 channels since I found this what is love.zip I could create a collection of >32channel XM files

alugarius commented 7 years ago

i saw the commit in the testing branch, id like to do some testing

FyiurAmron commented 7 years ago

If we add more channels, should .mod be used or an own format? edit: or xm and mod for 64 channels since I found this

If the file is XM-compatible with >32 channels, the extension should probably be simply XM. If the file is MOD-compatible with >32 channels, the extension should probably be simply MOD.

The main reason is that that's AFAIK the way existing software (XMPlay, BASS, OpenMPT, Sk@le etc.) works.

IMO there's no need (and never was) for any format additional to XM in regard to this. The limitation of 32 channels was done on the side of FastTracker 2 itself (which didn't ever support >32), and not the XM format (which clearly was able to support it from the very beginning by design, storing the channel count in 2-byte word, and having a layout allowing >32 without any design changes; even in case a signed byte was used in FT2 or other software internally somewhere - which I highly doubt - that'd still give at least 126 channels usable). Same goes with MODs, AFAIR.

Deltafire commented 7 years ago

@alugarius - you should be able to obtain a Windows build from AppVeyor:

https://ci.appveyor.com/project/Deltafire/milkytracker

Select a configuration/job, you'll find the binary under the Artifacts tab.

alugarius commented 7 years ago

@FyiurAmron Yeah, same here. Just thought about it... @Deltafire I tested with the AppVeyor builds, i cant add more than 32 channels and i cant load the testfile menioned above.

Deltafire commented 7 years ago

You have to enable it first, it's a config setting under the IO section (I think), it's not visible on the lower screen resulutions.

alugarius commented 7 years ago

I LOVE IT <3 also loads IT files

on windows its crashing sometimes, deleting appdata repairs that

FyiurAmron commented 7 years ago

tl;dr both 64 ch. or any setting in range of [32,99] channels max works perfectly, including scopes. Any setting in range of [100,128] crashes MT dead on arrival.

it (both debug & release, both x64 & x86) crashes on my box as soon as 128 ch. is enabled in options (immediately after clicking 'apply'; if I save the config instead, it crashes on app reload), with "heap corruption" error. Also, I couldn't increase the channels to 128 actually - 126 seems to be the max as far as the scopes went when I forced the CRT to ignore the crash, but 99 seems to be the max as far as normal operation (no crash) goes (note that 99 is odd, so it ain't as good of a max channel value as it should, due to e.g. leaving an empty scope, general FT2-ish compatibility etc.). I'll try to debug it further if/when I have a spare minute. FWIW, I recall from my kludges to make MilkyTracker use >32 that it actually went only to 99/98 channels for some obscure reason related to, AFAIR, some memory alloc issues (https://github.com/milkytracker/MilkyTracker/commit/e949202ae83d5055f4ce4da2712fffa9ff416ba6#diff-b31d4351793be162648b0bfd32473034L76 hints that this particular value had some rationale behind it). If there are some more severe underlying problems, maybe just leave it at that for the moment, i.e. having settable max to be either 32, 64 or 98.

Also, FWIW, OpenMPT only goes up to 127 channels for any non-MOD format, including XM, and to 99 channels in Protracker MOD in stock version.

Deltafire commented 7 years ago

Tagging @milkypailes

Deltafire commented 6 years ago

Feature added in PR #104