VOGONS


my own OPL player - a bit weird?

Topic actions

First post, by deeped

User metadata
Rank Newbie
Rank
Newbie

Good evening,

Im here with my OPL problems again =)

firtly it succeed to "compile" fmopl to DLL so I can use it with delphi 😊
second, some simple test program sounded very good.

And the problem is now when Im trying to make my own DRO player. I attached the sample what my program produced, sadly its rubbish. Very bad result 🙁

still, DOSBO)( emulates it perfectly. Lets see what I do:

YM3812Init (2, 3600000, 44100);

YM3812UpdateOne (0, buffer, length / 2);

void WriteReg(port, val: byte);
{
YM3812Write(0, 0, port);
YM3812Write(0, 1, val);
}

if I just use "YM3812Write(0, port, val);" nothing sounds. Whats wrong? 😖

Reply 1 of 23, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Well there's sound, so it does something.
At some places it sounds like the delay between the commands is wrong,
but hard to tell without any code, without any comparison how it should
sound and everything.

Reply 2 of 23, by deeped

User metadata
Rank Newbie
Rank
Newbie

I thought everyone know the Doom's music =)

http://pastebin.com/f4ab8a0de

ok I attached the original song (what DosBOX produces, and not from an original chip).

Reply 3 of 23, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I thought everyone know the Doom's music

Not if it's seriously messed up.

Reply 4 of 23, by deeped

User metadata
Rank Newbie
Rank
Newbie

as I see you dont see the problem - can I give any further information?

Reply 5 of 23, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

How shall i derive what is wrong in your code listening to one example?
The only thing i noticed i've already written above:

At some places it sounds like the delay between the commands is wrong

Reply 6 of 23, by deeped

User metadata
Rank Newbie
Rank
Newbie

Okay, then here is all code: http://pastebin.com/f47aff5e3 written in MVS 2005.

And some new records: DOTT - which sounded a bit accuracly, 90% DNUKEM2 - whics is a bit worser, 60% and dont forget DOOM wich was catastropha 😮

So, it do works with some songs but DOSBOX does it almost 100% with all games. I hope I could help 😀

Reply 7 of 23, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Well could be that the timers are simply not precise, check the delphi docs.

Is WriteStream called at millisecond resolution with appropriate parameters?

Reply 8 of 23, by deeped

User metadata
Rank Newbie
Rank
Newbie

Well could be that the timers are simply not precise, check the delphi docs.

sadly not, its laggy in C++ too, but its not matter yet.

Is WriteStream called at millisecond resolution with appropriate parameters?

No and its not predictable when its called. Its called when the stream can accept "lenght" amount of data. "Lenght" is never the same, each calling its got another value.

Reply 9 of 23, by deeped

User metadata
Rank Newbie
Rank
Newbie

ummm nevermind it can be set to millisecond resolution SO the speed/timing is perfect now, STILL the quality is bad 😖

Reply 10 of 23, by leileilol

User metadata
Rank l33t++
Rank
l33t++

For reference here's a rather noisy recording of Doom E1M1, ymf262. The waveforms in this should be your target 😀

A bigger challenge is Heretic E1M5, which no emulator gets right ever!

apsosig.png
long live PCem

Reply 11 of 23, by Sephiroth

User metadata
Rank Member
Rank
Member

I have all of the Doom, Doom II, Heretic, and Hexen MIDIs extracted right out of the original WADs if you want a recording of any of them. I can also fire them up on one of my old systems if you want the original sound.

486 Launcher v2.0 is now under development!

Reply 12 of 23, by leileilol

User metadata
Rank l33t++
Rank
l33t++
Sephiroth wrote:

I have all of the Doom, Doom II, Heretic, and Hexen MIDIs extracted right out of the original WADs if you want a recording of any of them.

Playing them externally wouldn't use Doom's GENMIDI lump for defined opl instruments.

apsosig.png
long live PCem

Reply 13 of 23, by deeped

User metadata
Rank Newbie
Rank
Newbie

Then this is the sollution? ymf262 instead YM3812?

Reply 14 of 23, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

If you're recording opl3, it might.

Reply 15 of 23, by deeped

User metadata
Rank Newbie
Rank
Newbie

but for a while lets just stick with opl2.

hm as I overviewed DOSBOX source again, I see the mixer do something after creating the FM sound. What is that? Its the Addsamples method

Reply 16 of 23, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Moves the data stream into an audio buffer depending on its type.

If you stick to opl2 be sure your recording is opl2, too (see dosbox.conf)

Reply 17 of 23, by deeped

User metadata
Rank Newbie
Rank
Newbie

we dont understand each other 😢

I see dosbox uses M3812UpdateOne, YM3812Init... in cases of OPL2. Thats why I only use them too. Still, it sounds different for me

EDIT: and since the ADPLUG+WINAMP plays it perfectly back, and DRO cant even record opl3 music, Im sure the mistake is not with it

Reply 18 of 23, by Grom PE

User metadata
Rank Newbie
Rank
Newbie

deeped, I think you would be interested in my opl2wav, dro/raw/imf/got player written in Delphi.
Source included, feel free to adapt it to your needs (and tell me if you make anything cool with it).

Reply 19 of 23, by deeped

User metadata
Rank Newbie
Rank
Newbie

hmm very fucking good job - especially that the .obj files can be used. I didnt know that 😮