Opened 21 years ago

Closed 21 years ago

Last modified 5 years ago

#7243 closed feature request (fixed)

FMTOWNS: Add YM2612 FM synth emulation

Reported by: SF/marticus Owned by: SF/jamieson630
Priority: normal Component: Engine: SCUMM
Version: Keywords:
Cc: Game: Zak McKracken


First, apologies if this bug is the same cause as the no looping audio; but in zak256 when you use the kazoo it just plays a blip, whereas using the fm towns emulator he plays the indy theme.

Ticket imported from: #636985. Ticket imported from: feature-requests/59.

Change History (35)

comment:1 by SF/andrej4000, 21 years ago

Hm... I think the kazoo-sound is stored as an audio-track. If you don't have it, you can't hear it.

If I'm right, this thread can be colsed.

comment:2 by SF/marticus, 21 years ago

No, because when I had the ISO for the FM-Towns emulator it was only 4 meg and no audio tracks.

comment:3 by SF/andrej4000, 21 years ago

So of course you can't hear the sound... That's not a bug. This thread can be closed...

comment:4 by SF/marticus, 21 years ago

Yes but I played it on the FM-Towns emulator and heard the sound there.

comment:5 by SF/andrej4000, 21 years ago

You were right!

This sound is stored in the LFL-Files and isn't played. The same problem is e.g. with the souind of the alien 60-Hz- Machine.

comment:6 by SF/thanius, 21 years ago

The kazoo-sound is not on an audiotrack, I've checked them all out. There's a cool orchestrated Indy-theme there, though. Too bad that they've changed the kazoo-tune from "Pop goes the weasel". ;(

comment:7 by SF/hibernatus, 21 years ago

At 0xD (from the start of the SO block), there is the type of sound (a byte). 0 is for sound effects 1 is for musics 2 is for CD tracks

You should test that instead of the size of the block to know what is a CD track. And also you'll be able to ignore the kazoo tune until you understand the format.

comment:8 by SF/thanius, 21 years ago

That blip should stop the backgroundmusic and play the Indy-tune (also an audiotrack), but it doesn't. Btw, if it's any help, the Indy-tune is track 22 on the CD.

comment:9 by SF/hibernatus, 21 years ago

No, that track is for the indy3 demo on the same CD.

comment:10 by SF/hibernatus, 21 years ago

No, that track is for the indy3 demo on the same CD.

comment:11 by SF/desperatecry, 21 years ago

The kaazoo sound is not an audio-track!

using the UNZ-fmtowns-emulator you will recognize, that it is defenitely a MIDI-sound or something like that.



comment:12 by SF/hibernatus, 21 years ago

I wrote a few notes about the kazoo tune format. Not much, but anyway, i've just found the name of the format (Euphony) and there's no need for RE anymore. Thanks to google, here is a link to the sources of a program which can read Euphony files:

Here is a rough conversion of the SO block into an EUP file:

FMB files contain FM sounds (for the YM2612). You can find YM2612 emulators on the web. Example: bin/cvsweb.cgi/generator/ym2612/fm.c?rev=1.4&content- type=text/x-cvsweb-markup PMB files contain PCM sounds (for the RF5C68). And i think it's what is used for sound effects in fm towns scumm games. There is just one instrument and no music in the SO block.

EUP files and player: iwa/eup/

comment:13 by SF/ender, 21 years ago

Jamieson, please let me know if you are able to look at this - as your really the only sound person we have at the moment. :)

Hibernatus has pretty much worked everything out, so it shouldn't be too much work.

comment:14 by SF/ender, 21 years ago

Owner: set to SF/jamieson630

comment:15 by SF/hibernatus, 21 years ago

other examples: sound 29 40 54 and 66 in Indy3 FM Towns. but nobody has it anyway :/

comment:16 by SF/jamieson630, 21 years ago

Priority: normallow

comment:17 by SF/jamieson630, 21 years ago

I have to find another decent window in which to sit down and look at this. But my first impression, looking through the Euphony player code in the link, is that it requires that we include a second FM chipset emulator in order to generate proper sound output. That's not something I intend to just slam into ScummVM in an hour or two. Since we're talking about a 6-note, 2-second ditty, this will be pretty low on the TODO list.

comment:18 by SF/khalek, 21 years ago

Euphony tunes are also used for the notes on the distaff in loom, possibly other places in the game. Only looked at the very start so far.

comment:19 by SF/khalek, 21 years ago

Just a note that the YM2612 was used for FM synth on the Sega megadrive/genesis so there should be quite a bunch of code to pick from under a range of licenses, assuming they aren't all pinching it off MAME :)

comment:20 by SF/jamieson630, 21 years ago

I've implemented a Euphony parser, per Hibernatus' notes. Since the FM Town synth chip is not being emulated yet, the instruments in the music tracks are not being used. Instead, a stock Adlib (OPL2) instrument is being used for all channels.

This at least makes the music audible, which is especially important for the Loom distaff. Instrument support, as well as tempo/timing validation, are still pending.

comment:21 by SF/jamieson630, 21 years ago

Maybe this comes way too late, but.... In response to andrej4000's post from 2002-11-24, the problem with the 60-Hz sound from the big machine is NOT the same as the problem with the kazoo tune. The machine sound is a Type 0 (digital sample) resource. And it's pretty short. Though I've not heard the sound on the original FM Towns or an emulator, my first guess would be that on Zak Towns, it was meant to be just a short blip instead of a constant hum.

comment:22 by SF/andrej4000, 21 years ago

Well, the "blip" seems to work properly since some months. The sounds is heard everytime you see the machine working, so this should be solved.

comment:23 by SF/jamieson630, 21 years ago

Component: Engine: SCUMM
Game: Zak McKracken
Owner: SF/jamieson630 removed
Summary: ZAK256: No kazoo tuneFMTOWNS: Add YM2612 FM synth emulation

comment:24 by SF/jamieson630, 21 years ago

Ah, I guess I missed out on what it sounded like when it was broken. Glad it's fixed.

The remainder of this "bug" is adding proper instrumentation support for the Euphony music. I am moving this to the FRs and renaming it to that effect. Now that game-critical sounds (e.g. Loom distaff) can at least be heard, this is once again pretty low priority.

comment:25 by SF/jamieson630, 21 years ago

Owner: set to SF/jamieson630

comment:26 by SF/khalek, 21 years ago

Add a relevant url so I don't have to go hunting google for it in future when I want to find it:

An update for those not on irc, it seems that all the genesis/mega drive emulators use the MAME code which is under a non GPL compat license. Jamieson is looking into the eupplayer code currently as its licensed under the GPL.

comment:27 by SF/khalek, 21 years ago

oh and which H-Clone mentioned on irc has some relevant tech details.

comment:28 by SF/jamieson630, 21 years ago

Priority: lownormal

comment:29 by SF/jamieson630, 21 years ago

A status report -- I got EUPPlayer (GPL) hotwired to ScummVM and playing tunes. It needs a lot of work before it's ready to deploy, but I'll try to get a work-in-progress into CVS once the worst hacks are cleaned up. Main issues:

(1) The instruments don't seem to be getting set up quite right. The same song can sound slightly different depending on what was played before it.

(2) The music for Indy3-Towns plays, as does Zak-Towns, but the distaff in Loom-Towns is not making any sound.

(3) The code is using 64-bit integers (or fixed-point decimal numbers), which is slow and not real portable.

(4) The parser is presently hotwired to the MidiDriver wrapper such that iMuse is bypassed, hence EOT is not detected by the Player and getSoundStatus() returns bad results.

Hopefully I can get this cleaned up and in CVS for review in the next 48 hours.

comment:30 by SF/jamieson630, 21 years ago

Okay, all the hooks for the YM2612 MidiDriver are in CVS, and a stub factory function is currently returning 0. The actual YM2612 implementation has been submitted as a patch (#818175), and will be committed once all portability issues have been worked out. (Right now I'd say it probably won't compile outside MSVC.) Stay tuned....

comment:31 by SF/cloney, 21 years ago

I've just run Zak and Indy 3 through UNZ, the FM Towns emulator that uses the MAME code for the YM2612. I'm running this through a pre-optimised YM2612 Win32 build of ScummVM that Jamieson630 gave me yesterday.

Assuming UNZ is correct, the instrumentation contained ScummVM seems to be spot on. However, ScummVM seems to be missing out some channels in comparison to UNZ.

For example, the Kazoo theme from Zak and the whip theme from Indy (same tune, different instruments) splits into two channels in UNZ, but not in ScummVM. I've made MP3s of both of these.

UNZ can't seem to play midi at the same time as a digital sound loop, so the music for Berlin (where there's a fire sound loop) and for the Piano in the Zeppelin (where there's an engine sound loop) are both fairly messed up in UNZ. I've made MP3s of both - they both start properly, but gradually drop channels as the song goes on. Not sure if there's any way around this, really. At any rate, the start of the Berlin music sounds identical to ScummVM.

I'll send the MP3s next time I see someone on IRC. UNZ is one of the most awful things I've ever used, by the way.


comment:32 by SF/cloney, 21 years ago

Meh. That first paragraph is supposed to read that I'm -also- running the FM Towns games through afforementioned ScummVM build for comparison.

comment:33 by SF/jamieson630, 21 years ago

YM2612 implementation is complete, albeit with a few little behavioral quirks that will need to be ironed out. The polyphony issue has been corrected, so tracks such as the Indy theme are now properly playing the two-part harmony at the end. On the other hand, the generous polyphony seems to cause some notes to keep going longer than intended. We'll keep tweaking....

comment:34 by SF/jamieson630, 21 years ago

Resolution: fixed
Status: newclosed

comment:35 by digitall, 5 years ago

Component: Engine: SCUMM
Game: Zak McKracken
Note: See TracTickets for help on using tickets.