On Mon, 22 Jun 1998, Laurens Holst wrote:
> === How to replay samples via the PSG??? ===
>
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 this 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 don't change with time.
Now comes the trick. This "1" is affected by the register 8
(volume register). This way, if you change very quickly the value of
register 8, you can modulate the output and generate a nice 4-bit PCM.
This method is used in the game "Aleste 2".
I made a program to test this feature, it's called "readwav" and
it can play .WAV files of 11 kHz. It can be found at
http://www.lsi.usp.br/~ricardo/msx.htm. The maximum wave size is about
50kb but Walter "Marujo" made a new version that play files up to 100kb,
I'll try to add it to the home page as soon as possible.
There is no source code included, but my original source doesn't
have any comment, the best you can do is disassemble it by hand (it has
only 512 bytes anyway). Oh, this 11kHz is arbitrary: by removing a
void-loop in the middle of the code you can reach up to 35 kHz.
Please note this is not the only way to generate samples in MSX-1.
You can also use the keyclick to generate 1-bit PCM (used in the game
"Super Laydock", for example).
Another undocumented feature of the PSG permits a variation on the
first method. Most people thinks the lower bits of register 7 are used to
send the volume of a channel to zero. This is not true. This bit actually
controls the oscillator. So, by disabling a channel in register 7, you can
write any values you want in registers 1 and 0 and still use the
initial method (btw, this is used in "Oh Shit").
A last method is to select a sound with very low frequency, and
change the volume faster this frequency. This method is not used in any
MSX game that I know, since it is very unaccurate. But it's used a lot in
the Sega Master System, in games like "Afterburner". The Sega Master
System, for those who don't know, is a videogame heavily based in the MSX.
It uses a Z80 and a sound chip with the same characteristics as the
AY-3-8910 (but it doesn't have envelopes).
------------------------------------------------------------
Ricardo Bittencourt http://www.lsi.usp.br/~ricardo
[EMAIL PROTECTED] "Save the trees: eat more woodpeckers"
****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
****
Re: A question about the PSG & samples
Ricardo Bittencourt Vidigal Leitao Tue, 9 Feb 1999 16:43:31 -0500
- RE: A question about the PSG & samp... Erik Maas
- Re: A question about the PSG &... Egor Voznessenski
- Re: A question about the PSG &... Kari Lammassaari
- Re: A question about the P... Egor Voznessenski
- A question about the PSG & sam... Laurens Holst
- Re: A question about the PSG &... Ricardo Bittencourt Vidigal Leitao
- Re: A question about the P... Alex Wulms
- Re: A question about t... Ricardo Bittencourt Vidigal Leitao
