Better music capabilities

Page 6/11
1 | 2 | 3 | 4 | 5 | | 7 | 8 | 9 | 10 | 11

By Grauw

Enlighted (7790)

Grauw's picture

30-05-2018, 16:09

DarkSchneider wrote:

We also have that both PSG and VDP are "turned on" at the very moment they are powered, so both should be inherently related (like when using the timers on Atari ST).

The VDP is not fed by the same crystal as the Z80 / PSG on every MSX, so they can drift.

p.s. After some searching the archives I updated my previous post with some extra info.

By DarkSchneider

Paladin (769)

DarkSchneider's picture

30-05-2018, 16:13

So the VDP and PSG "start delays" could be different on each MSX. That's a mess then for the purpose. And I suppose an auto-calibration is not possible, as someone should put the ear and chose when sounds correctly manually then.

So, on Atari the timers are started correctly at the same time, or there must be another way.

By Grauw

Enlighted (7790)

Grauw's picture

30-05-2018, 16:23

I think even when they run off the same clock, there’s no good way to pre-determine a fixed start delay. BIOSes execute for different times. The BIOS can make different beep sounds. Who knows what else will run before your program executes (esp. on DOS).

There must be another way I think. I don’t think one can get away with just ignoring the issue, for a 25% pulse you could, but for PWM it would sound different every time you play… (or maybe that’s actually the case?)

By DarkSchneider

Paladin (769)

DarkSchneider's picture

30-05-2018, 16:44

Grauw wrote:

I think even when they run off the same clock, there’s no good way to pre-determine a fixed start delay. BIOSes execute for different times. The BIOS can make different beep sounds. Who knows what else will run before your program executes (esp. on DOS).

Remember that we talk about power delay. Because at the very moment the PSG clock is powered, it begins to feed to oscilators (even if they are muted). The same for the VDP, at the very moment it is powered, it starts to draw lines, even if they are visible or not. So the software stuff and what it does is not relevant (if really is only clock related). But the electric is.

But the PSG must have a way to "restart" the oscilator behavior. Not sure but if not how can be so precise on Atari ST or even Spectrum?

By Timmy

Expert (77)

Timmy's picture

30-05-2018, 16:48

There is a reason why envelopes on the PSG is regarded as 'useless', and why the best musics on the spectrum don't use them. And that is that you cannot really predict when they will happen.

Well, technically you probably can calucalate when the envelope form finishes, by determining the envelope frequency and using your ears. But it will never be perfect to time this to a interrupt, or to multiple versions of the machines with different clock speeds. And if you don't time it to an interrupt, then you don't need the imprecisions of the envelopes.

The fact that non of the examples shown on this thread actually really used different envelopes proves the fact (yes, despite the claims otherwise, they all are just either blocking or they use a high enough frequency that envelopes won't matter.)

By DarkSchneider

Paladin (769)

DarkSchneider's picture

30-05-2018, 17:08

It is supposed you can predict it.
- Tone: master / 16 * 12-bit value
- Envelope: master / 256 * 16-bit value.

The tone for square and the envelope for one of its shapes. Both can be adjusted perfectly, as both frequency generators are related to the master clock attached, that is the same one.

This can be easily tested. Use the BASIC SOUND instruction to set both tone and envelope generators fitting their frequencies (the same, 1/2, 1/4...). If it always (try it multiple times) produces the same type of periodic sound, then they are synced in phase, so it can be predicted.

You probably mean to use it for PWM purposes. But for that the envelope is not used. The envelope could be to create "instruments", combining frequencies with square forms, generating its own waveforms, not for using it as high-precision wave modifier to use it manually.

By Grauw

Enlighted (7790)

Grauw's picture

30-05-2018, 17:15

Not sure I completely follow, but the envelope and tone rates can be synced perfectly, just shift the envelope frequency to the left by 4 bits (shifting in zeroes) and use that for the tone, and they will be perfectly in tune. Tried this in the past, posted some thoughts here, with a test below it…

By Timmy

Expert (77)

Timmy's picture

30-05-2018, 17:32

DarkSchneider wrote:

You probably mean to use it for PWM purposes. But for that the envelope is not used. The envelope could be to create "instruments", combining frequencies with square forms, generating its own waveforms, not for using it as high-precision wave modifier to use it manually.

Yes, it *could* be used to create "instruments" but, as I said earlier, no one will do it.

Can you explain why anyone would use envelopes to make instruments, if the result cannot be tied to an interrupt? Why not just make the instruments without envelopes, like everyone does on the Spectrum? There is no difference in total clock cycles used and these instruments are easier to code and easier to create, too.

EDIT: I think I should make it clear that even on the Spectrum, nowadays, we can use regular samples to make "instruments". It is not just a steady tone with one of those PSG triangular envelope shape any more.

EDIT 2: Yes, these sampled music use 100% of the Z80, so they are obviously not meant as in-game music and takes up lots of memory.

By Grauw

Enlighted (7790)

Grauw's picture

30-05-2018, 17:33

Timmy: I don’t really understand the issue with interrupts, but I think you are talking about envelopes at LFO rates here, right? I think the primary reason is that the envelopes are pretty simple repetition and one-shot patterns, plus they do not allow volume control. A software ADSR envelope generator will yield much nicer sounds with more flexibility.

I think the only reason to use the envelope generator for LFO frequencies is to benefit from the higher envelope resolution on the YM2149, but that’s fairly subtle and you lose a lot of flexibility in setting the envelopes. I guess you could set a raising envelope on key on and decaying one on key off to go a little beyond just the typical one-shot sound, but… meh.

There are plenty examples where the envelope is used at audio rates, e.g. Six Miles High by Gasman.

By Grauw

Enlighted (7790)

Grauw's picture

30-05-2018, 17:41

Ok, it seems you are talking about 100% CPU use, thus audio rate modulation after all. But then I don’t get your remark about total clock cycles being equal, modulating with envelopes is almost free on the CPU, so they can be used in-game. Or where interrupts come into play with CPU-driven audio rate modulation, surely you would time it by CPU clock cycles since there’s no sufficiently high freq timer?

Page 6/11
1 | 2 | 3 | 4 | 5 | | 7 | 8 | 9 | 10 | 11
My MSX profile