Bad Mood : Falcon030 'Doom'

All 680x0 related coding posts in this section please.

Moderators: Zorro 2, Moderator Team

Dal
Administrator
Administrator
Posts: 4233
Joined: Mon Feb 20, 2006 9:00 pm
Location: Cheltenham, UK

Re: Bad Mood : Falcon030 'Doom'

Post by Dal »

I was thinking if you have several Falcons in a room playing Doom over a MIDI ring, you only want the one MIDI tone generator anyhow (otherwise it would sound pretty awful).

You could perhaps use SYSEX for the networking - Each Falcon is assigned a SYSEX device ID and SYSYEX packets are sent this way. This leaves regular midi performance messages separated. For a couple of Falcons, this might work. Who's got 16 Falcons laying around anyway??
STE: Desktopper case, IDE interface, UltraSatan (8GB + 512Mb) + HXC floppy emulator. Plus some STE's/STFM's
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

Dal wrote:I was thinking if you have several Falcons in a room playing Doom over a MIDI ring, you only want the one MIDI tone generator anyhow (otherwise it would sound pretty awful).

You could perhaps use SYSEX for the networking - Each Falcon is assigned a SYSEX device ID and SYSYEX packets are sent this way. This leaves regular midi performance messages separated. For a couple of Falcons, this might work. Who's got 16 Falcons laying around anyway??
That sounds like it could work. I'm not a MIDI expert but I remember having to do some dummy SYSEX support the last time I went near it. I wasn't sure though how easy it is to make up some custom packet which won't upset the connected devices, or what that costs in terms of traffic.

I'm also unsure about traffic limits for networking on MIDI. Each player will need to send a 'ticcmd' at intervals of 12Hz (sometimes in bursts, but averaging 12Hz) - which is a multibyte packet containing player movement and button/action info. These will all be flying round the MIDI ring and being picked up by all nodes. If that works for - say 4 players - and there is space left it could still work with MIDI music replay.
Dal
Administrator
Administrator
Posts: 4233
Joined: Mon Feb 20, 2006 9:00 pm
Location: Cheltenham, UK

Re: Bad Mood : Falcon030 'Doom'

Post by Dal »

That's the point of SYSEX, it's for custom messages of any length. You form the message using a unique device ID + StartByte + Data + EndByte. Perhaps a rudimentary token ring type network could be created?
STE: Desktopper case, IDE interface, UltraSatan (8GB + 512Mb) + HXC floppy emulator. Plus some STE's/STFM's
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

Dal wrote:That's the point of SYSEX, it's for custom messages of any length. You form the message using a unique device ID + StartByte + Data + EndByte. Perhaps a rudimentary token ring type network could be created?
Then it should fit well with what's needed - and it will just be a matter of traffic and integrating the two things into one handler/stack.
Dal
Administrator
Administrator
Posts: 4233
Joined: Mon Feb 20, 2006 9:00 pm
Location: Cheltenham, UK

Re: Bad Mood : Falcon030 'Doom'

Post by Dal »

The likely problem will be the MIDI tone generator missing events. The most annoying event that can be missed is note-off as a note will ring out until it gets a note-off in the future (sometimes this never happens until the song is looped). Events like missing note ons and program changes are acceptable by comparison. So perhaps an emergency global note-off routine bound to a hot key would be a good thing to implement.
STE: Desktopper case, IDE interface, UltraSatan (8GB + 512Mb) + HXC floppy emulator. Plus some STE's/STFM's
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

Dal wrote:The likely problem will be the MIDI tone generator missing events. The most annoying event that can be missed is note-off as a note will ring out until it gets a note-off in the future (sometimes this never happens until the song is looped). Events like missing note ons and program changes are acceptable by comparison. So perhaps an emergency global note-off routine bound to a hot key would be a good thing to implement.
I can almost feel the pain already :)
Dal
Administrator
Administrator
Posts: 4233
Joined: Mon Feb 20, 2006 9:00 pm
Location: Cheltenham, UK

Re: Bad Mood : Falcon030 'Doom'

Post by Dal »

Yeah - Perhaps the other approach is to support one of the DIY MIDI expanders (plugs into the Serial port)? One for the bottom of the To-Do list I think.
STE: Desktopper case, IDE interface, UltraSatan (8GB + 512Mb) + HXC floppy emulator. Plus some STE's/STFM's
Dal
Administrator
Administrator
Posts: 4233
Joined: Mon Feb 20, 2006 9:00 pm
Location: Cheltenham, UK

Re: Bad Mood : Falcon030 'Doom'

Post by Dal »

STE: Desktopper case, IDE interface, UltraSatan (8GB + 512Mb) + HXC floppy emulator. Plus some STE's/STFM's
Yglika
Atarian
Atarian
Posts: 7
Joined: Fri Mar 07, 2014 7:11 pm

Re: Bad Mood : Falcon030 'Doom'

Post by Yglika »

Most of what needed done for Beta is now finished
When do you (roughly of course) estimate it might be released? :-) I know its a taboo question for a project in development but this is so amazing thing I can't wait for updates. ;-) And from your notes/posts it seems there is already quite a lot of really cool improvements over alpha. :-)
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

Yglika wrote: When do you (roughly of course) estimate it might be released? :-) I know its a taboo question for a project in development but this is so amazing thing I can't wait for updates. ;-) And from your notes/posts it seems there is already quite a lot of really cool improvements over alpha. :-)
I've been quiet recently because a lot of other stuff is going on, but work continues as I find the time. I have committed the recent changes for freelook aiming and SFX upgrades (although some of that depends on a custom WAD which is not yet finished - and there's a different one for Doom I and Doom II which complicates matters).

The new title and intermission graphics only work with Doom II and I'm still trying to figure out if I can do the same with Doom I by changing the game, because the intermission logic is quite different between the two (Doom I has a very basic storyboard thing which I want to bypass - Doom II does not, and is a lot like JagDoom).


In the last few days I received a working sample of the MUS/MIDI conversion and replay modules, and have strung the Falcon030 to my PC with MIDI cables to do some testing (using the PC as a MIDI output device/synth). I had some trouble with this at first but with a bit of good advice ;-) I got the right software set up and it's all working well. The Falcon is happily sending the Doom music down the wire to the synth.


It's probably as good a time as any to announce that Saulot / Nokturnal has been working on this component for BadMood so the result should be good ;-) I didn't say so earlier because I wanted to give him plenty of space if he got too busy (he also has a lot going on).


While that has been happening, I have tried to adapt BMEngine to locate the MUS lumps in the loaded WAD and manage them through the resource cache in the same way as textures and sound samples, and with the necessary conversion events and storing as native (.NKT) midi replay data for use by the Falcon directly. So both sides seem to be working quite well. This is probably not finished because WADs can contain MID files, and I believe MID is also an intermediate step for MUS->MID->NKT so MID handling might need special attention sometime.

There is still lots to do though - Saulot's MUS conversion code is not integrated into the game/engine yet - it remains standalone for now - so the resource cache is generating dummy .NKT files until we tie that together. Same goes for the replay module - it will need integrated into BMEngine and the existing mouse/keyboard code. The game side of things also needs tied up to the music start/stop events etc. etc. So still plenty of work to do and a bit more waiting before that is all finished.


I have been looking at a few other things but will try to finish the important stuff and get Beta out first.

That's a pretty accurate update I think.
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

I just finished a backend for a MIDI parser which turns the MIDI stream into something like soundtracker data. Not exactly soundtracker, but something similar that my SFX replay routine can use (on/off, instrument, pitchstep, volume, decaycount)

There are 16 instrument channels plus polyphony, reduced to (currently) 3 stereo channels, so that's not going to fit :-)

On the positive side, polyphony isn't much used in the Doom tracks and the instrument selection is very narrow, reused among tracks. Most tunes use 5-10 tracks and perhaps 4 to 6 significant ones at once.

The idea is to see if priority competition can be used to get the most important 3 voices audible at any time (e.g. drums interrupting quieter bass track and returning control to bass track on decay). Drums could even be dropped if it helps. The SFX system already works that way, with 16 virtual voices being tracked/updated and the most significant 3 being mixed/heard. This method allows longer/looping sounds to resume after interruption.

Doing this makes 3 channels sound like 6 or more, with some degree of cutoff/interruption.

I'll probably have to edit the MIDI source and collapse/delete some of the tracks before converting but it's interesting to try.

An extra fixed-pitch track can probably be squeezed in just for drums if the attempt seems to be going somewhere.

This is of course aimed at ingame music. Title music doesn't have to be so constrained.
User avatar
dma
Atari God
Atari God
Posts: 1223
Joined: Wed Nov 20, 2002 11:22 pm
Location: France

Re: Bad Mood : Falcon030 'Doom'

Post by dma »

dml : Ah nice, that's how i was imagining things for some Falcon specific music system still based on the original MIDI music data.
So it will need some kind of instrument prioritisation config for each tune then? (even maybe for sections of each tune)
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

dma wrote:dml : Ah nice, that's how i was imagining things for some Falcon specific music system still based on the original MIDI music data.
So it will need some kind of instrument prioritisation config for each tune then? (even maybe for sections of each tune)
Yes it will need a predefined instrument mapping with known instruments, roughly approximating the original mapping. Some priority information and priority decay envelope will have to be done by hand.

So it is a kind of hack but its nice if we can use the original MIDI data to drive something ingame even if it ends up being an approximation - so long as the end result is good enough. Probably will involve cherry picking tracks which work with it :)


The really nice thing about the *direct* MIDI driver is that it will be very close to the original, and all tracks will work as per the original.
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

I'm beginning to get notes out of the Falcon's codec using the method described above. It's still very wrong, and only from the first channel. But getting any note data through the SFX system is a good start. I think there are still bugs in my convertor causing some of the problems.
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

I now have all 16 MIDI tracks outputting to the 3 SFX channels in good time, using 2 sample instruments. It doesn't sound great but it's getting there - the music is identifiable and a bit chippy. The priority competition approach seems to work well enough to continue with the effort - adding more instruments, phase separation for polyphony, getting the volume info through, fixing bugs etc.

The low kHz rate is probably more of a limiting factor than the channel count - was kept low to keep the CPU free at a few % while still providing 16bit stereo pan. Works well for SFX but on the low side for music. Careful instrument selection will help here I think.
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

Today I have the map09 MIDI track from Doom II playing ingame - minus drums - using samples taken from the same WT synth library. There were originally 10 source channels in the track and I removed 3 (including drums, for now). One chord track was collapsed from two polyphonic notes into a single instrument sample. A few other hacks were done to assist.

The test version has 7 input channels and 8 instruments competing for 3 stereo mix channels with the sfx and it is already quite recognizable, if not decent.

I picked this track because it seems tougher than many of the others, with several long notes held on separate channels at once - if this one can be made to work many of the others should too (!)

There are some sound quality issues - clicks and stuff - but I'll retest on real HW to make sure it's me and not an emulation thing. I already confirmed that HW sounds a lot different (better) than the emulated playback, but haven't looked into how/why questions yet - maybe just down to scaling/filtering.
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

Another update...

This week Saulot helped me integrate his latest AMIDI library into BM/Doom, which he has been upgrading to support conversion from Doom's MUS format via MID into his internal NKT format for direct replay. Later we should be able to play MID files from the WAD as well (later WADs use these instead of MUS).

I got perhaps 50% of the integration work done for that so we're probably not far from being able to play MIDI music from the game WADs through the MIDI ports on the Falcon.

There is still some work to do and I'm not getting as much time in the evenings as before but it may be integrated and working as soon as next week.
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

A more detailed update.

I may be quiet - and more busy - but work has not stopped when I find the time. Everything being done is related to audio.

Direct MIDI music replay via MIDI OUT:
- Saulot's latest MIDI library AMIDILIB with MUS conversion and replay integrated, conversion part tested
(special 'light' version of this library with only the necessary features has been prepared for BM now, being integrated next)
- MIDI memory/cache management implemented, tested
- MIDI replay driver code being worked on, integrated
- replay control events for music has been scoped out in Doom source, will be done next


SFX/sample replay:
- rework of mixing event control
- fixed some bugs in SFX system, related to quality, channel management and looping/ending events
- started using priority info from SFX definitions (was not being used in original code)
- experimenting with a method to increase channel count from 3x2=6 separate channels to 5x2=10 channels using a source frequency cache, hashtable and a special mixer (still using CPU)
- burned a bit of extra time searching for an audio bug in Hatari, now identified and worked around


Native music replay via Codec:
- MIDI->BMM (tracker-like event stream for BM) music compiler working, but not compressing
- BMM replay feeding music events to SFX engine on 16 available channels, highest priority get mixed
- working on envelope control for 'note off' events so samples don't stop abruptly
- trying to find balance of MIDI editing and channel management that results in decent version of original tunes using this method (this isn't easy - will take some time)
User avatar
dma
Atari God
Atari God
Posts: 1223
Joined: Wed Nov 20, 2002 11:22 pm
Location: France

Re: Bad Mood : Falcon030 'Doom'

Post by dma »

All this sound work will result in a very lively game, that's precious. :)
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

dma wrote:All this sound work will result in a very lively game, that's precious. :)
It has delayed things quite a lot but hopefully will have been worthwhile in the end :-)

It should be possible to add new MIDI arrangements to the game, for both direct replay to MIDI hardware (should 'just work'), and natively via Codec (bit more effort to prepare) - better results can be expected from the codec version if the music is carefully made for it, not to use too many competing channels at once and sticking to a few select instruments. However it does at least mean the music can be arranged in MIDI format and should be compatible with both schemes.

Direct MIDI replay can handle most of the base MIDI spec.

Codec replay is more limited - it can handle note on/off, volume and (to an extent) polyphony within the same track, on separate notes and across 16 input tracks maximum. Looping instruments get interrupted by short notes (if output channels exhausted) and recover afterwards. Doesn't do pitch slide yet but will be added. Note-off will soon cause the sample to leap to a decay point if one has been specified.

Trying to make it as easy as possible to add new music after beta. (hint hint ;-) hint! ;;-)

It's not too difficult to add more channels to the Codec replay side to manage the original tunes, but so far I'm trying to do it without slowing things down :)
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

doublepost
User avatar
dma
Atari God
Atari God
Posts: 1223
Joined: Wed Nov 20, 2002 11:22 pm
Location: France

Re: Bad Mood : Falcon030 'Doom'

Post by dma »

Playing MIDI internally (without any additional device) on Falcon, is quite an independent achievement by itself.
I'm quite eager to hear the results.
It could be used in some other projects and game ports.
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

dma wrote:Playing MIDI internally (without any additional device) on Falcon, is quite an independent achievement by itself.
I'm quite eager to hear the results.
It could be used in some other projects and game ports.
It started out sounding awful but is gradually improving. :-) When I return to the Codec version it should be approaching respectable. It's probably still a bit too expensive but working on that also.

The last test was 12 channels (6x2 with stereo panning) combining SFX and music via Codec on base Falcon without dropouts (but some reduction in FPS when things get busy). This sounds nice, but the default for a base Falcon is probably going to be 4x2 assuming this JIT-style mixer is kept (or 3x2 if the old mixer is used), with the option of 1x2 through to 6x2 via config file. Codec MIDI replay will probably require 4x2 absolute minimum.
AnthonyJ
Captain Atari
Captain Atari
Posts: 165
Joined: Sat Jan 26, 2013 8:16 am

Re: Bad Mood : Falcon030 'Doom'

Post by AnthonyJ »

Despite following this thread quite closely and finding news of the optimisations interesting, I hadn't actually found time to set up hatari and get BM running until a couple of weeks ago (unlikely to find time to get my real falcon up and running any time soon).

All I can say is, wow.

I went back and ran 1.32 (flat shaded) and 3.07 (last old build), as well as the current alpha release, and the improvement with the current release is amazing. I knew Doug had been optimising things, but it is quite staggering that the full game is running smoother than the old flat shaded version, which back in 1995 was considered impressive!
User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3991
Joined: Sat Jun 30, 2012 9:33 am

Re: Bad Mood : Falcon030 'Doom'

Post by dml »

Hi Anthony,

Glad you found the time/space to try it out.

I haven't posted here in ages but things are still crawling forward.

While I haven't had a lot of time for coding, I do now have two (!) of the original MIDI tracks replaying 90% correctly via Codec, with nearly all of the SFX replay hacks removed. So the other tracks should follow quite quickly. I started with those tracks having the greatest number of channels and instruments active so it would be all downhill after the first few :)

I am still optimizing this as I find the time, as it has collected a lot of garbage and mess over many sessions doing a little at a time, and having fixed a lot of annoying bugs. There does seem to be one bug left which is puzzling me - but hopefully I'll get enough time in one block to identify and fix it soon.

The Codec and HW MIDI replay systems are on different code branches and these will need to be brought together before long.

Not much else to report, that's all for now.

Return to “680x0”