What's the YM setup overhead?

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

Post Reply
cero
Very interested
Posts: 222
Joined: Mon Nov 30, 2015 1:55 pm

What's the YM setup overhead?

Post by cero » Sat Nov 19, 2016 6:28 pm

I've been playing with ValleyBell's midi converter. It fails to convert the midi I want, and it's in VB6 so Windows only.

It fails because the midi is polyphonic, ie playing two notes using the same instrument at the same time. But it never plays more than five notes at any one time.

So, what is the YM instrument setup overhead? Would it be possible to switch the instrument between notes, without any audible issues?

--

I'm also confused on what mid2psg does exactly. I'm guessing it handles drums, but the code is using magic numbers with no explanations.

User avatar
Sik
Very interested
Posts: 682
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: What's the YM setup overhead?

Post by Sik » Sun Nov 20, 2016 7:28 am

cero wrote:So, what is the YM instrument setup overhead? Would it be possible to switch the instrument between notes, without any audible issues?
It's... quite a bunch. Bad enough that Echo loads all instrument values into Z80 RAM before actually using them to reduce the amount of bank switching when PCM is playing. You have to write to 29 registers and each register write is pretty slow (forgot the exact cycle amount, Echo does something absurdly tight that made us double check the timings posted here since it shouldn't have worked according to them - tl;dr Echo is 3 cycles away from breaking hell)

GEMS does what you say, but final results vary on the developer (it was practically a full blown VM running on the Z80 after all). Though it's not necessarily bad, just look at Jelly Boy, the only giveaway of it being GEMS is that many sound effects can play at the same time which can starve BGM from channels (tends to happen when you grab a lot of notes or fruits at once).
cero wrote:I'm also confused on what mid2psg does exactly. I'm guessing it handles drums, but the code is using magic numbers with no explanations.
For a moment I misread and thought you were talking about midi2esf ^-^; Though it's also full of magic numbers >.>; (...actually now that I look at it again there are a lot less magic numbers than I recalled, huh)
Sik is pronounced as "seek", not as "sick".

cero
Very interested
Posts: 222
Joined: Mon Nov 30, 2015 1:55 pm

Re: What's the YM setup overhead?

Post by cero » Sun Nov 20, 2016 11:00 am

Ah, crap. Well, no midis for me then.

User avatar
Sik
Very interested
Posts: 682
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: What's the YM setup overhead?

Post by Sik » Sun Nov 20, 2016 12:28 pm

Well, it's a problem mostly when PCM is involved, since PCM is going to eat up quite a bunch of CPU time for the Z80 - it's doable, but not trivial. If PCM isn't in use then you have lots of free room to do it.

The safest option would be still to preprocess the MIDI somehow to split the notes into other channels though.

EDIT: there's also the question of how many instruments are loaded at the same time. If only one channel needs to get updated at a time it's not a big deal. If you upload instruments to all five channels simultaneously though... (which in your case would be five notes starting to play at the same time all changing the instrument)
Sik is pronounced as "seek", not as "sick".

cero
Very interested
Posts: 222
Joined: Mon Nov 30, 2015 1:55 pm

Re: What's the YM setup overhead?

Post by cero » Sun Nov 20, 2016 2:59 pm

The midi already has five instruments, so splitting would go over the YM five channel limit.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest