MOD playback

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
User avatar
danboid
Posts: 1881
Joined: Sun Jun 14, 2020 12:14 am

MOD playback

Post by danboid »

It seems that the UB kernel supports MOD playback. Is this only 4 channel, 8 bit MODs? Any support for 8 track MODs?

Can they be played directly from the UB menu? If not, has anyone written a MOD player?

Are any other audio channels available for use by the UB kernel when MODs are being played?
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: MOD playback

Post by Artcfox »

It is in the kernel, but I don't think it is documented. I believe it was written specifically for Tornado 2000, and I believe that is the only game that uses it. It would be great if it got some documentation.

I don't know much about it, but you might be able to find some comments about it hidden within forum posts here.

The latest music advancement that I remember is Lee's compressed streaming midi support that can play compressed uzebox-converted midi data from flash ram, spi ram, or streamed in from the sd card: viewtopic.php?f=3&t=7788
User avatar
danboid
Posts: 1881
Joined: Sun Jun 14, 2020 12:14 am

Re: MOD playback

Post by danboid »

Even if its restricted to 4 channels of 8 bit audio, that's great but it'd be nice to have at least one UB channel for SFX on top of that.

Hopefully CunningFellow will tell us more!
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: MOD playback

Post by Artcfox »

For the MOD file that I used as a source, I just hand-transcribed it into a MIDI file using Rosegarden, and if you use the BB_triggerFx() function from BlockBoy in combination with the 2,waves+256 trick used in its PatchStruct (in patches.inc in BlockBoy), you can have 4 channel sound for music (3 instrument, 1 percussion) + a 5th dedicated sfx channel. You need to also change a flag in the Makefile to use 5 channels, but that should be in the BlockBoy Makefile as a kernel option.

One of these days when I have the time, I should make another sound effects tutorial. I had one planned for using PCM sound effects (the code example for it is already on my Github, I just didn't make the video tutorial part) It continues where the project in the Rosegarden tutorial left off, layering PCM sfx on top of midi music, but I could see addimg a 5th sound channel to that example and showing off a dedicated wavetable sfx channel that doesn't make any notes from a song cut out when played.

There are a lot of neat tricks that games do beyond the official API. There are a lot of common ones that most games use, like having a custom sounds.inc so you get back a ton of flash space. I am not sure if they are all cataloged in the same spot though. I just like reading through other people's code to find the hidden gems like that.

Rosegarden tutorial: https://www.youtube.com/watch?v=sf4cVNM_tdo
User avatar
Jubatian
Posts: 1560
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: MOD playback

Post by Jubatian »

The channel count depends on how you configure the kernel, there are up to 5 channels: 3 wave (256 byte sample), 1 noise and 1 PCM.

Some nice music demos presumably using the normal unmodified kernel:
Tron music demo (Forum topic)
Shadowgate music demo
Music demo (Part of main repo, here, uses the 3 wave + 1 noise channel).

But it is also possible to do music differently. Flight of a Dragon, although its soundtrack could probably be a lot better, uses a customized inline mixer with 5 wave channels, 3 are for the in-game music, 2 are for the effects.
User avatar
danboid
Posts: 1881
Joined: Sun Jun 14, 2020 12:14 am

Re: MOD playback

Post by danboid »

I was looking at the Tornado2000 source earlier and I can see that if it is using MODs, they are not stored in a regular mod file.

I presume that Uze wrote a tool to convert mod files into .inc files that can be played on the UB but did it ever get released?
User avatar
D3thAdd3r
Posts: 3173
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: MOD playback

Post by D3thAdd3r »

I don't believe it is released unfortunately.
User avatar
uze6666
Site Admin
Posts: 4778
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: MOD playback

Post by uze6666 »

D3thAdd3r wrote: Sun Mar 07, 2021 6:04 pm I don't believe it is released unfortunately.
Thanks Lee again for bringing me back, I saw the thread while browsing on my proto uzebox computer :ugeek:. It's been a long time since the code was written but I believe it was actually released as the XM module processor, a superset of the MOD format. I would have to check for the exact recipe I used to convert the music but I'd say check that out first. BTW, that was one of my favorite music conversion of all time (thanks CunningFellow!). I attached the original OpenMPT file for you guys to enjoy.
Attachments
tempest_music_v3.zip
(119.37 KiB) Downloaded 335 times
User avatar
danboid
Posts: 1881
Joined: Sun Jun 14, 2020 12:14 am

Re: MOD playback

Post by danboid »

Hi Uze

Thanks for highlighting the XM converter. I've not tried running it yet but I've had a quick look at the source and my guess is that we can have up to 5 channels/tracks and we can either use UB patches or xm (xi) instruments but not samples, correct?

"browsing on my proto uzebox computer"? Please explain. There's obviously no chance of running even the most stripped down of browsers on the UB so is this a new project sharing the Uzebox name or what?

I've found quite a few open source consoles and computers online. Have you found another open source hardware platform (console or computer) that interests you Uze?

DA:

Have you had chance to look at that adding that serial code yet? Might you get a chance soon? I think it might be useful for debugging as well as writing chiptunes and multi player games. Stunt Car Racer!
User avatar
D3thAdd3r
Posts: 3173
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: MOD playback

Post by D3thAdd3r »

@Uze I need to see this proto Uzebox computer! If it's '644 hardware...I'm thinking Telnet to a Linux shell to get the output from Lynx browser?

@dan Not yet. It's one of my top priorities when I get back to Uzebox. I have the ESP8266 simulator more or less, but an additional command line or config argument like "COM3" in windows or "dev/ttys0" would make everything possible.
Post Reply