Opened 17 years ago

Closed 16 years ago

Last modified 7 months ago

#7243 closed enhancement (fixed)

FMTOWNS: Add YM2612 FM synth emulation

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

Description

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 Changed 17 years ago by SF/andrej4000

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 Changed 17 years ago by SF/marticus

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

comment:3 Changed 17 years ago by SF/andrej4000

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

comment:4 Changed 17 years ago by SF/marticus

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

comment:5 Changed 17 years ago by SF/andrej4000

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 Changed 17 years ago by SF/thanius

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 Changed 16 years ago by SF/hibernatus

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 Changed 16 years ago by SF/thanius

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 Changed 16 years ago by SF/hibernatus

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

comment:10 Changed 16 years ago by SF/hibernatus

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

comment:11 Changed 16 years ago by SF/desperatecry

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.

Greetings,

Ferdi

comment:12 Changed 16 years ago by SF/hibernatus

I wrote a few notes about the kazoo tune format.
http://hibernatus34.free.fr/pv/kazoo_tune.txt
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:
http://www.purose.net/befis/download/lib/eupplay.lzh

Here is a rough conversion of the SO block into an EUP file:
http://hibernatus34.free.fr/pv/kazoo.eup
http://hibernatus34.free.fr/pv/kazoo.fmb

FMB files contain FM sounds (for the YM2612). You can find
YM2612 emulators on the web. Example:
http://www.squish.net/cgi-
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: http://www.bea.hi-ho.ne.jp/gaku-
iwa/eup/

comment:13 Changed 16 years ago by SF/ender

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 Changed 16 years ago by SF/ender

Owner: set to SF/jamieson630

comment:15 Changed 16 years ago by SF/hibernatus

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

comment:16 Changed 16 years ago by SF/jamieson630

Priority: normallow

comment:17 Changed 16 years ago by SF/jamieson630

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 Changed 16 years ago by SF/khalek

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 Changed 16 years ago by SF/khalek

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 Changed 16 years ago by SF/jamieson630

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 Changed 16 years ago by SF/jamieson630

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 Changed 16 years ago by SF/andrej4000

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 Changed 16 years ago by SF/jamieson630

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

comment:24 Changed 16 years ago by SF/jamieson630

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 Changed 16 years ago by SF/jamieson630

Owner: set to SF/jamieson630

comment:26 Changed 16 years ago by SF/khalek

Add a relevant url so I don't have to go hunting google for
it in future when I want to find it:
http://www.dennougedougakkai-ndd.org/pub/eupplayer-win32/

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 Changed 16 years ago by SF/khalek

oh and
http://www.smspower.org/maxim/forumstuff/ym2612/ym2612.html
which H-Clone mentioned on irc has some relevant tech details.

comment:28 Changed 16 years ago by SF/jamieson630

Priority: lownormal

comment:29 Changed 16 years ago by SF/jamieson630

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 Changed 16 years ago by SF/jamieson630

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 Changed 16 years ago by SF/cloney

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.

Cloney

comment:32 Changed 16 years ago by SF/cloney

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 Changed 16 years ago by SF/jamieson630

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 Changed 16 years ago by SF/jamieson630

Resolution: fixed
Status: newclosed

comment:35 Changed 7 months ago by digitall

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