turbo-R PCM?

Par SLotman

Paragon (1242)

Portrait de SLotman

26-01-2011, 22:54

Does anyone knows how to play a sample on the PCM... without using the BIOS?

I tried something like this:

   ld a, 3 
   out (0A5h), a ;Turbo-R PCM DAC mode.

   ld HL, SAMPLE_DATA
   ld bc, SAMPLE_SIZE

SAMPLE_LOOP:
   LD A, (HL)
   OUT (A4h),A

   INC HL
   DEC BC
   LD A, B
   OR C
   CP 0
   JP NZ, SAMPLE_LOOP

but all I hear is a very low noise, nothing like the sample I want to play Sad

!login ou Inscrivez-vous pour poster

Par Daemos

Paragon (2044)

Portrait de Daemos

26-01-2011, 23:00

shouldn't the data of the sample size first be loaded into for example register A? From what I understand here you are setting BC to the adress in the memory part of label SAMPLE_SIZE and then use that value for looping. Is that where it might be going wrong?

Par SLotman

Paragon (1242)

Portrait de SLotman

26-01-2011, 23:13

HL points to the sample data, and it's loaded on A just below the label SAMPLE_LOOP. BC indeed is used to count the bytes of the sample - to know when it's finished playing.

Par ARTRAG

Enlighted (6923)

Portrait de ARTRAG

27-01-2011, 06:53

CP 0 is redundant
I've never used PCMon TR, but you should probably compute the lenght of the loop in cycles to match the sampling frequency of your data
and make sure your data are in the appropriate pcm format (e.g. uchar, signed char,whatever)

Par NYYRIKKI

Enlighted (6016)

Portrait de NYYRIKKI

27-01-2011, 09:58

Par SLotman

Paragon (1242)

Portrait de SLotman

27-01-2011, 13:34

CP 0 is redundant
I've never used PCMon TR, but you should probably compute the lenght of the loop in cycles to match the sampling frequency of your data
and make sure your data are in the appropriate pcm format (e.g. uchar, signed char,whatever)

Yeah, that was the problem - I was playing the loop wayyy too fast Smile

@NYYRIKKI: I looked everywhere for that post and couldn't find it! Thanks for linking it up Smile

Thanks everyone!

Par Huey

Prophet (2694)

Portrait de Huey

27-01-2011, 14:14

Great link NYYRIKI!

We need that MRC2k11 NYYRI-wiki.Big smile

Par sd_snatcher

Prophet (3642)

Portrait de sd_snatcher

27-01-2011, 21:29

@SLotman

One tip: On the MSX Turbo-R you *must* use the SystemTimer (E6h/E7h) to get the correct timing for playing the samples.

But why don't you want to use the BIOS routines for that?

Par NYYRIKKI

Enlighted (6016)

Portrait de NYYRIKKI

27-01-2011, 23:45


But why don't you want to use the BIOS routines for that?

Because PCMPLY routine has this ridiculous unpacking routine embedded that may make your sample to sound like crap. (Easily prevented by editing sample, but making own routine is even more easy) BIOS routine also works only in upper half of memory.

Par SLotman

Paragon (1242)

Portrait de SLotman

28-01-2011, 00:04

My problem was much simpler: I already had stuff that written where the BIOS was, so no access to it at all. Also, BIOS just lock the MSX to play the sample, I wanted to play small chunks - do some other stuff in parallel - and play more chunks Smile

Unfortunately my idea didn't work - I didn't have enough 'free time' to play sample-chunks, without getting gaps in the sample
I even got the sample playing normally, but them the game I was 'inserting' them, slows down a lot Sad

Par SLotman

Paragon (1242)

Portrait de SLotman

28-01-2011, 00:38

Actually, scratch that - I may have found a way to play it Cool