PSG samples

Page 1/15
| 2 | 3 | 4 | 5 | 6

By pitpan

Prophet (3155)

pitpan's picture

27-01-2003, 12:27

I have been wondering how can you use the PSG to play samples. Anyone has any idea or source code? It was quite usual in 80's games: from Oh-Shit! to Rune Master 2. By the way, Rune Master 2 samples have an excellent quality. This is also true for Bandwagon demos.

I suppose that you should write constantly to the PSG to produce the wave, but no idea of amplitude, tone, envelope, etc. I am completly new to sound programming, but I feel that FM-PAC programming is quite easier than PSG or SCC. Anyway, first of all I want to code for the PSG.

Thanks!

Login or register to post comments

By Latok

msx guru (3938)

Latok's picture

27-01-2003, 12:31

You should try out PSG Sampler from Michel Shuqair Smile

By wolf_

Ambassador_ (10109)

wolf_'s picture

27-01-2003, 13:15

If can may make a very wild guess:

The psg has 16 volume steps, if you use a psg signal (essentially a square) to generate that sample, you get a sample with 4bit quality.

Compare it with the M and S commands from basic psg-mml.. You can make things like saw-type things and other amplitude modulated stuff. Same thing..

By nf

Supporter (4)

nf's picture

21-07-2003, 19:14

Actually, our samples were 8-bit or even 12-bit. We used this method someone came up with the Atari ST: you've got three channels with 4 bit volumes, so each value of an 8-bit sample is mapped with a different combination of the three channels. I got the table straight from some Atari guy, so don't know how it works exactly.

By anonymous

incognito ergo sum (116)

anonymous's picture

21-07-2003, 19:37

nf, would you please introduce yourself in the who=who forum? I'm sure I'm not the only one interested in knowing more about you Smile

By wolf_

Ambassador_ (10109)

wolf_'s picture

21-07-2003, 20:32

yeah.. that's true.. wouldn't expect this to work as I thought that using 3 channels, each with their 'own' sample (-part), would freeze the z80.

I wonder.. imagine that you filter:
1 all superhigh freqs of a sample,
2 all lo-freq freqs of a samples,

play 1 using the psg-noise, and play 2 using 3 psg channels.. what would the result be? I guess it's not 100% authentic since noise is just noise.. you can't control the contents (except the nosiecolor), only the amp.

anyone ?

By Grauw

Ascended (10772)

Grauw's picture

21-07-2003, 21:50

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

22-07-2003, 13:06

Actually, our samples were 8-bit or even 12-bit. We used this method someone came up with the Atari ST: you've got three channels with 4 bit volumes, so each value of an 8-bit sample is mapped with a different combination of the three channels. I got the table straight from some Atari guy, so don't know how it works exactly.

Hi, nf! Long time no C Smile Actually I asked this table from you few years ago, but I got only the replay routine. I anyway think, that I already figured that out (Correct me, if I'm wrong) as I think this is what the article in map.tni.nl/?p=articles/psg_sample.html is telling about the 5.5bit samples...

The volume controll of PSG seems to be linear, as you can directly play 4bit samples on it. If you use all 3 channels, they are just added to each other, so you get the range of 0-45. (It may be anyway more usefull to use these channels to play 3 samples at a same time.) Here is, example of the table, where N is the sample value (0-45) and A, B and C are the volume controls to each channel of PSG:

N: A B C
0-15 N 0 0
16-30 15 N-15 0
31-45 15 15 N-30

If you use this table, it is recommended to output the values to PSG in order of A,B,C or C,B,A to get minimum amount of unwanted click sounds.

As 0-45 is not any kind of vice table it is usefull to expand the table to 0-255, like it was made in your demos. This takes a bit more memory, but you can easyly use RAW samples created on any sample program without modifying the sample data.

If you would add also "Key click sound output" to the sample playing routine, you could get even more accurate sample playing, but I don't know if volume between PSG and key click is standard, so if it is not, then that might cause the sample to sound dissorted on some MSX models.

On SCC you have two different possibilitys... You can try to write the 32 byte sample RAM in same speed as it is playing, but I think, that it is VERY hard to get it in sync... or then you can use a bit modifyed version of the abowe mentioned method.

In SCC you have to fill the sample first with only one byte (#7F) to get the sound output up. Then you can choose sample rate. I don't know if the sample rate affects to volume setting in anyway, so pick just something.

SCC volume is not linear, so makeing a table for that will need oscilloscope (Or maybe PC with a good soundcard can do the trick). Anyway using different sample bytes on different channels, you can probably get the whole 8bit sample out of SCC, or maybe even more...

I have also heard very good quality samples played with FM-PAC, but I don't know details about that. I think, that the theory behind is about same, there is just more channels to use...

Note: All of this is just theory and I have not tried any of these methods.

~NYYRIKKI

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

22-07-2003, 13:56

I just checked out, that Amiga volume can be converted to dB using formula:
dB=20*log10(Volume/64)

I think, that this can be quite a close also with SCC:
dB=20*log10(Volume/16)

Don't shoot me, if I'm wrong Smile

~NYYRIKKI

By Grauw

Ascended (10772)

Grauw's picture

22-07-2003, 14:22

About the FM-PAC, apparantly you can set a bit somewhere in the test register, and that will enable you to write 6-bit sample data directly to the DAC. It is an undocumented feature of the FM-PAC. Although I don't know the exact details yet we intend to use this in our upcoming game aswell.

And thanks for the explaining text about '5.5-bit' samples and samples on the SCC. I'll add it to the MAP sometime (when I have more time Smile).

~Grauw

By ms

Rookie (20)

ms's picture

13-03-2004, 20:36

As Latok suggests, you could try the PSG Sampler. It comes with a driver file, called psgdrv.bin which has call routines (also in MSX-BASIC) to load samples and play them using SCC, PSG, FM-PAC and MSX-Music. This file can also be found on most Sunrise Picture Discs (but is named SRPSYS.BIN).

Some extra basic statements include:
CALL PSGPLAY(Device)
CALL PSGLOAD("Filename")

Samples can be imported, recorded and saved within PSG Sampler.

If you're interested I could provide you with the original disc, since I am the original author of the application. BUT, I need some time to figure out the copy-protection. Apparently I have not documented it and even I can't just copy the Original discs onto a blank disc. I need an MSX with Philips Drive Controller and Philips Disc Diagnostic software to create the copy.

Page 1/15
| 2 | 3 | 4 | 5 | 6