PCM samples

Page 1/2
| 2

By Daemos

Paragon (2044)

Daemos's picture

08-04-2014, 11:41

So I am experimenting around with playing samples on the turbo-R's PCM chip and like to know about a few details that I wonder about:

1.) assuming in this point that I have raw uncompressed PCM data at any location. It means that at a sample rate of for example 8 Khz I need to trow out 8Kb of data to the chip per second?
So if like to do the playback using the lineint at 60 hz I need to output the stream at 8000/60 bytes per interrupt?

2.) Any tool in the universe in exsistense that can for example make raw PCM data from WAV files?

3.) should the HLD bit be 1 or 0 if we are aiming for the best result in playback?

Login or register to post comments

By NYYRIKKI

Enlighted (6016)

NYYRIKKI's picture

08-04-2014, 13:42

Daemos wrote:

So I am experimenting around with playing samples on the turbo-R's PCM chip and like to know about a few details that I wonder about:

I don't think that you should think it as "PCM chip". It is just a simple 8-bit D/A converter... Just like ie. Covox.

Quote:

1.) assuming in this point that I have raw uncompressed PCM data at any location. It means that at a sample rate of for example 8 Khz I need to trow out 8Kb of data to the chip per second?

Correct

Quote:

So if like to do the playback using the lineint at 60 hz I need to output the stream at 8000/60 bytes per interrupt?

Yes, your math is correct = Line int is a no go... You probably want to disable all interrupts to avoid jitter while playing sample. (Jitter causes noise)

Quote:

2.) Any tool in the universe in exsistense that can for example make raw PCM data from WAV files?

I think most of the sample editing tools can save data in compatible format... The file format you should look is "8-bit unsigned mono PCM. If you save file as WAV, it will add a header to the file, therefore it is good idea to check, if save format "RAW" can be selected. Some of the tools that I've used for conversion on PC are "Gold wave" and "Audacity".

Quote:

3.) should the HLD bit be 1 or 0 if we are aiming for the best result in playback?

Sorry, I didn't get what you mean.

By giangiacomo.zaffini

Champion (267)

giangiacomo.zaffini's picture

08-04-2014, 13:47

1.) At least You should take case of sample bit-resolution (in the URL below it is named bit depth) and number of channels

http://wiki.audacityteam.org/wiki/WAV

2.) WAV can be nade up of uncompressed PCM sample chunks (most of the times it is the case), so it is easy to strip down a WAV file into a PCM stream of samples. Cutting its header a WAV file is an array of PCM samples. See URL reference below

http://en.wikipedia.org/wiki/WAV

3.) no idea what is it

By Daemos

Paragon (2044)

Daemos's picture

08-04-2014, 13:54

Quote:

Yes, your math is correct = Line int is a no go... You probably want to disable all interrupts to avoid jitter while playing sample. (Jitter causes noise).

In a game this would be a problem in my perception. Playing the whole sample would cause a 2 second delay for each sfx that is played. How can it be done so that the samples are played correctly?

Quote:

3.) no idea what is it

yeah me too. this is the source article (dutch only)

By Grauw

Ascended (10699)

Grauw's picture

08-04-2014, 14:06

Daemos wrote:

In a game this would be a problem in my perception. Playing the whole sample would cause a 2 second delay for each sfx that is played. How can it be done so that the samples are played correctly?

I would use MSX-AUDIO or MoonSound for sample playback. They have sample memory and their own hardware to play back the sample independently, so you just load the sample in memory once and then trigger it when you need it to play.

The HLD bit is for sampling, not playback.

By Daemos

Paragon (2044)

Daemos's picture

08-04-2014, 18:56

I see. Well I was not really planning anything big but since I have the HW at hand and lack MSX-AUDIO or MoonSound I was thinking to experiment around with the built in PCM. How did they get away with it in Zone terra?

By ARTRAG

Enlighted (6923)

ARTRAG's picture

08-04-2014, 19:30

You can use SCC to play pcm samples in background (8 bit/sample at 7,6KHz)
https://sites.google.com/site/testmsx/Home/Intruder_SCC.rom?...

By Grauw

Ascended (10699)

Grauw's picture

08-04-2014, 20:03

@Daemos All their sound effects are very noisy so I suppose they could run the game on the interrupt and output sample data in the remaining time in the main loop… because it’s so noisy, maybe you don’t notice that the sample playback gets interrupted continuously.

Looking at Zone Terra I see nothing that couldn’t be done on MSX2+ so maybe that’s the reason the game is for turboR only; so that they have enough free time to waste in the main loop to do somewhat decent sample playback?

However, to be honest from listening to a video on Youtube I think it would’ve sounded better if they had just used PSG sound effects… It sounds like a giant puddle of noise to me.

By Daemos

Paragon (2044)

Daemos's picture

08-04-2014, 20:01

yes PSG sounds the best.

Just tried that intruder rom and that game reminds me of a old PC classic named cyberdogs. Addictive. However, the samples are not what I had in mind for tryout.

Well end of that brainstorm session. Thank you all for your input folks.

By Grauw

Ascended (10699)

Grauw's picture

08-04-2014, 20:16

You could have samples at specific moments when it’s ok to pause the visuals… like “it’s a-me, mario” after you press start at the title screen, or a sample when you die or you’ve completed the level. Could even play them on the PSG then. (Like Oh Shit :).)

p.s. that intruder game is frustrating yet addictive! :)

By ARTRAG

Enlighted (6923)

ARTRAG's picture

08-04-2014, 20:47

Well if the problem is the sample set, try this "Jungle" version
https://sites.google.com/site/testmsx/Home/sccED79.rom?attre...
Il the problem is the quality of the sound, the player is tuned on 60Hz machines, so on PAL machines the quality will be not the wanted. Try it on NTSC machines.

Page 1/2
| 2