playing samples on msx

Page 3/4
1 | 2 | | 4

By SolidEric

Champion (332)

SolidEric's picture

09-09-2005, 22:42

And with hardware acceleration you mean 7mhz??

By norakomi

Paragon (1102)

norakomi's picture

10-09-2005, 00:06

i read some of the article, very interesting.
So I can actualy play samples using the fm-pac or scc !!!! thats great.
I remember pennant race, by konami, which has some voice in the game.
Is this actualy "playing a sample"??

NYYRIKKI do you have some (real simple) examples (in basic, or assembly)
of how to load a sample (psg, scc, fm-pac, whatever) which I can listen to.

Id like to listen to the quality, and look at the size of those samples.....

By norakomi

Paragon (1102)

norakomi's picture

10-09-2005, 00:07

btw, yours IS the biggest forum post ever man !! Tongue

By NYYRIKKI

Enlighted (5898)

NYYRIKKI's picture

10-09-2005, 10:39

With hardware acceleration I actually meant device, that can play samples without CPU usage (Like moonsound) I think, that even 7MHz is too slow. MSX tR can mix at 11KHz samplerate and I think that it is the absolute minimun to get any reasonable output.


NYYRIKKI do you have some (real simple) examples (in basic, or assembly)
of how to load a sample (psg, scc, fm-pac, whatever) which I can listen to.

Any file loading routine will do the trick. Important thing is, that the sample data is 8bit unsigned mono data. Here is example, how to make this SAMPLE.DAT file mentioned in documentation with Windows standard tools: (This file can be loaded with BLOAD, see example)

- Select Start/Programs/Accessories/Entertainment/Sound Recorder and record few seconds of something.
- Select Save, and as savetype select PCM: 8kHz ; 8bit ; mono.
- Save the file as SAMPLE.WAV to C:\TEMP
- Select Start/Programs/Accessories/Command prompt
- Type following:

CD C:\TEMP
DEBUG SAMPLE.WAV
E 133 FE 00 C0 FF CF 00 C0
RBX
0
RCX
1007
W 133
Q
REN SAMPLE.WAV SAMPLE.DAT

By ARTRAG

Enlighted (6703)

ARTRAG's picture

10-09-2005, 11:23

@NYYRIKKI

A note on PSG:

PSG
Now you can play sample by changing volume. This is anyway a bit problematic
as volume in PSG is not linear but can be calculated from formula: output
level = 2^-((15-volume)/2)

for volume = 0 the output level is zero


This means that we need to find combinations that cause output level to be as
close as possible to 8bit values. Luckily Arturo Ragozini has already done
these calculations for us, so that we can use ready tables

Grauw has done a lot of work as well and the tables you posted are from his programs.

A note on SCC (!!!!!):

If the level is linear and each channel has 16 levels (0-15), in order to get 8bit quality you cannot
simply combine two channels!!! You need to tack into account the replicate values !!! 1 + 2 = 2 + 1 =3

2 channels give you only 30 levels!!!! (5 bit => 32 levels)
3 channels give you 45 levels!!! (+/- 5.5 bits...)
4 channels give you 60 levels!!! (6 bit => 64 levels)

6 channels give you 90 levels!!! (+/- 6.5 bit ...)

etc etc

I haven't a formula, but I think that in order to get 8 bit quality
you need more than 9 channels playing at the same time !! ! (Not an SCC Smile )

You routine could be incorrect if you didn't considerd this!

Actually reading better you post, your method IS incorrect.
If you play 4 bit in a channel and 4 bit in a different one,
your output wave is distorted.

By ARTRAG

Enlighted (6703)

ARTRAG's picture

10-09-2005, 11:36

@NYYRIKKI

I am interested to the timing matter on MSX2

I need more details....

Do the HR bit in the VDP work also during in the Vblank and the border tracing?
What is the HR frequency?

What is the RTC on the MSX2, how does it work?? What is its resolution?

By Edwin

Paragon (1182)

Edwin's picture

10-09-2005, 11:41

btw, yours IS the biggest forum post ever man !! Tongue

Probably also the one with the most MSX related information Smile

Cool to have all this info together though.

By Edwin

Paragon (1182)

Edwin's picture

10-09-2005, 11:48

I haven't a formula, but I think that in order to get 8 bit linear
quality you need more o less 8 or 9 channels at the same time !!

Actually, that'd be 17 channels. (255/15)

By ARTRAG

Enlighted (6703)

ARTRAG's picture

10-09-2005, 11:59

OK I was wrong!!
Reading the code I see the ponit.
You have also altered the level of the samples in the two channels!
This allows you to get the full 8 bit range.
sorry

By NYYRIKKI

Enlighted (5898)

NYYRIKKI's picture

10-09-2005, 12:38

> Do the HR bit in the VDP work also during in the Vblank and the border tracing?

Yes

> What is the HR frequency?

I'm not sure, but I think it is 15625Hz

> What is the RTC on the MSX2

RP-5C01.

> , how does it work??

It is connected to I/O ports #B4 (register select) and #B5 (data)
You can also use it trough MSX2 SUB-ROM calls REDCLK (01F5H) and WRTCLK (01F9H)

> What is its resolution?

Normally it is 1Hz (second) , but using test register you can make it run on 16384Hz speed.

Page 3/4
1 | 2 | | 4