Better music capabilities

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

By hit9918

Prophet (2824)

hit9918's picture

29-05-2018, 21:33

that was practicaly not the PSG because the Atari ST has a TIMER INTERRUPT

By yzi

Champion (438)

yzi's picture

30-05-2018, 00:06

Exactly, Atari ST with audio-rate timer interrupts, is not "PSG". With audio rate timer interrupts, it becomes a different animal, and the PSG's role changes. If you use an MSX computer as a stick to push the keys of your PC's keyboard, would you say you "typed with an MSX". You could have used a potato just as well.

By DarkSchneider

Paladin (769)

DarkSchneider's picture

30-05-2018, 08:21

But the timer interrupt is for non-blocking YM digital, that is a different thing. For getting the waveforms is the built-in PSG envelope capability. Also the squared allegro (the one that sounds bouncing) was used on Spectrum on demos and even on games, so the VBLANK is enough for that.
In this video you can see how many waveforms can be played with the envelope, that can be alone or even combined with the squared one on the same channel.
https://youtu.be/HkcGTz0r9kU

Examples of the YM digital:
https://youtu.be/8fEW8n5ZhB8
https://youtu.be/-I6ZIu9rv1E
Even on a Speccy (but blocking):
https://youtu.be/3MNHP-hBMLI

That is a totally different thing.

Maybe the most advanced ones could require timer, but in any case it can produce many more sounds than the usually listened (that is always the pure square form).

By DarkSchneider

Paladin (769)

DarkSchneider's picture

30-05-2018, 09:45

Also, seems that some of the advanced non-digital ways on the Atari ST was made for up to only 200Hz required.
http://atari-forum.com/viewtopic.php?f=18&t=14204
(links broken :( )
It seems that uses the Timer C that runs at 200Hz.

This can be achieved with a few line interrupts and supposes very low CPU usage.

The program is this (musicmon):
https://www.youtube.com/results?search_query=atari+st+musicmon
Ignore the channles that are drawn with a wave, that are samples.
Some good examples of "usable on MSX" (no sample channels) setting 4 line interrupts (200Hz for PAL and 240Hz for NTSC):
https://www.youtube.com/watch?v=Ht8RcBE_STE
https://youtu.be/hlXyyW7W9VI
Seems that PWM is a powerful tool even for only 200Hz.

By Grauw

Enlighted (7792)

Grauw's picture

30-05-2018, 13:27

At least the “SID effect” on the Atari ST, meaning a pulse wave or pulse width modulation, is done by toggling the channel volume from a timer at a rate equal to or nearly equal to the PSG tone period. Essentially passing two square waves through an AND gate with a slightly different offset (phase) and / or frequency, cutting off part of the first wave with the second as it were.

You can get a similar modulation effect by playing two tones with a slight detune, or an audio-rate envelope, but it’s not the same thing because the waveforms are different (the PSG does not have a square wave envelope).

Whether you must use a variable-rate timer, or you can also use a fixed-rate timer which toggles by a counter with fractional part, I’m not sure. The latter would create jitter but maybe it’s sufficient. On MSX2 a 300 Hz timer is fairly easy to achieve using line interrupts on both 50 Hz and 60 Hz.

By the way, if someone can tell me how to make sure that the PSG phase is 0º when a tone starts playing, I’d like to know how to achieve that. In my experiments with reproducing a pulse waveform on MSX, it would always depend on the timing of when the note is triggered, even though I do synchronously start the tone (by briefly setting period to 1) and modulation. Only a 25% pulse width was reliable since it doesn’t matter if the phase is 0º or 180º.

By DarkSchneider

Paladin (769)

DarkSchneider's picture

30-05-2018, 15:38

Grauw wrote:

Whether you must use a variable-rate timer, or you can also use a fixed-rate timer which toggles by a counter with fractional part, I’m not sure. The latter would create jitter but maybe it’s sufficient. On MSX2 a 300 Hz timer is fairly easy to achieve using line interrupts on both 50 Hz and 60 Hz.

By the way, if someone can tell me how to make sure that the PSG phase is 0º when a tone starts playing, I’d like to know how to achieve that. In my experiments with reproducing a pulse waveform on MSX, it would always depend on the timing of when the note is triggered, even though I do synchronously start the tone (by briefly setting period to 1) and modulation. Only a 25% pulse width was reliable since it doesn’t matter if the phase is 0º or 180º.

Great things can be done at 300Hz.

About phase, have you tried to set both tone registers of the chanel to 0 (i.e. R0 and R1 for channel A), and then put a value?. With both at 0 is disable oscilator (used to play samples), so maybe when setting a value it activates at that precise moment.
Not sure what you mean with:

Quote:

by briefly setting period to 1

Is setting the R7 tone value to 1 for that channel to disable tone? If that, then probably R7 works like muting instead disabling.

If not, you could try to ask on Atari ST sites, as it seems they already studied the case because the platform is full of PSG trackers, so they faced that problem for sure.

A good PSG tracker and player would be great on MSX, to take advantage of the most than capable built-in chip. In that case it would be a real temptation to use 2 PSG, one for music and the other one for sfx, as many loaders include another PSG.

By Grauw

Enlighted (7792)

Grauw's picture

30-05-2018, 15:38

Afaik using period 0 does not disable the oscillator, it just oscillates really quickly, same as 1. Pretty sure I’ve confirmed this. So when you change the period to the actual tone you want to play, it’s still a 50/50 chance whether the phase is 0º or 180º…

Disabling the channel in the mixer means it will output 1 (high) but still has volume control, so that’s great for samples. Disabling the mixer channel does not reset the oscillator unfortunately, so no use for PWM either.

Re. asking on Atari ST sites, yeah, guess so… I was hoping someone here knew Smile.

By DarkSchneider

Paladin (769)

DarkSchneider's picture

30-05-2018, 15:43

Grauw wrote:

Afaik using period 0 does not disable the oscillator, it just oscillates really quickly, same as 1. Pretty sure I’ve confirmed this. So when you change the period to the actual tone you want to play, it’s still a 50/50 chance whether the phase is 0º or 180º…

Hi, are you completely sure about that? I was guiding by the PSG sample playback documentation.
http://map.grauw.nl/articles/psg_sample.php

Quote:

You have to use an undocumented feature of the PSG. When you select a period of 0 in the register 6, the noise produced is just like the noise when you select 1 in the same register. But this does not apply to the square wave generators. When you write a 0 to registers 0 and 1, what’s happening is that you TURN OFF THE OSCILLATORS. Since the PSG uses active low logic, the signal on the output is set to “1” and doesn’t change with time. Now comes the trick. This “1” is affected by the register 8 (volume register). This way, if you change the value of register 8 very quickly, you can modulate the output and generate a nice 4-bit PCM. This method is used in the game “Aleste 2”.

Let's try it. If the phase does not works, probably is related to its clock attached.

By Grauw

Enlighted (7792)

Grauw's picture

30-05-2018, 16:03

That message (the capitalised bit) is wrong. I think back in the day when information was scarce it could well have been perceived as turning off the oscillator, because since it oscillates way out of audible range (111861 Hz), and then gets filtered by the computer, it ends up being averaged to a semi-constant output of half of the logic level 1. Suitable for sampling, but you lose half the amplitude compared to the other method.

However I’ve observed with my oscilloscope that it still oscillates (at the same frequency for periods 0 and 1), and others have also found this before me. I’ve also observed in my PWM test that the phase is still 0º or 180º 50% of the time no matter if I select a period of 0 or 1. This was a while back, so forgive me if I don’t have links ready Smile, but iirc I also mentioned it back then on this forum…

I’ve done a whole bunch of tests with this stuff in the past, and I think for PWM I got stuck on the phase thing, but it was also quite a while back (PWM a couple of years, samples closer to a decade). So I hesitate to say anything with certainty without linking to posts I may have written about it here, but at the same time I’m pretty sure I remember the way it works correctly.

p.s. I found this old #openmsx chat log from 2014:

Quote:

18:35 grauw: I checked the PSG output for period 0 with my new oscilloscope
18:35 grauw: it is indeed identical to period 1 so the openMSX implementation is correct
18:35 grauw: (and Ricardo Bittencourt was wrong ;p)

Also two related threads, the latter also links to my PWM test:
https://www.msx.org/forum/msx-talk/general-discussion/what-t...
https://www.msx.org/forum/msx-talk/development/ay3-psg-duty-...

By DarkSchneider

Paladin (769)

DarkSchneider's picture

30-05-2018, 16:04

Well, we have to suppose that is then related to the master clock (page 2):
http://ym2149.com/ym2149.pdf

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).
Then, as we are limited to line-by-line, you could try to use the oscilloscope, and changing setting the tone line-by-line, determine the exact line they are synced.
The frequency is set dividing by 16, so it should have some use in this math.
Try to find the sync point for the higest and lower freqs, as the pulse should start at the same point.

Could sounds a bit brute but, anything should be tried.

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