Crystal clean PCM 8bit samples on the poor PSG

Pagina 11/14
4 | 5 | 6 | 7 | 8 | 9 | 10 | | 12 | 13 | 14

Van aoineko

Paladin (899)

afbeelding van aoineko

08-01-2022, 23:55

I integrated the pcmenc replayer in my C library.
Everything works fine, but I just didn't understand the length parameter.
The source code says "Sample length (#pcm samples)", but I don't know how to interpret it.
I thought it was the size of the data since I use a 8-bit PCM, but if I set the size as length, I have the sound that plays normally but after I have a glitch noise. If I put half the size of the data, the sound seems to cuts at the right place.
Is this the right value?

PS: Bravo for this great work!

Van ARTRAG

Enlighted (6933)

afbeelding van ARTRAG

09-01-2022, 17:52

@aoineko
Where do you find the parameter length ? Input parameters are (from the source pcmenc.cpp):

        printf("pcmenc.exe [-r] [-e ] [-cpuf ] [-p ]\n");
        printf("           [-dt1 ] [-dt2 ] [-dt3 ]\n");
        printf("           [-a ] [-rto ] \n");

Van aoineko

Paladin (899)

afbeelding van aoineko

10-01-2022, 00:08

I was speaking about the assembler replayer.

;-------------------------------------
; Plays one sample
; IN   HL - Encoded sample start address
;      DE - Sample length (#pcm samples)
;-------------------------------------

Van ARTRAG

Enlighted (6933)

afbeelding van ARTRAG

10-01-2022, 00:38

That parameter is the number of pcm samples to be executed. The RLE data do not include a terminator, so the player has to know in advance how many samples have to be executes.

Van aoineko

Paladin (899)

afbeelding van aoineko

10-01-2022, 09:07

For a 8-bits source wave file I though that the number of "samples" was equal to the size of the data in bytes. But the right value for replayer seem to be half the size of the data.

Oh, perhaps it is the "size of data" / "number of channel in use"?

Van ARTRAG

Enlighted (6933)

afbeelding van ARTRAG

10-01-2022, 18:07

IIRC it should be the number of PCM samples. You should consider just the payload in the wav file.
Moreover the encoder can accept both 16 bit and 8 bit data (not float). The fact you find that the number of samples is about half the size of the wav file in bytes could be due to the fact you have samples as 16 bit data

Van aoineko

Paladin (899)

afbeelding van aoineko

11-01-2022, 00:21

However, the file seems to be in 8-bit... ¯\_(ツ)_/¯

Van ARTRAG

Enlighted (6933)

afbeelding van ARTRAG

11-01-2022, 09:52

I see... Could you send me one of the wav files you are are testing ? I can try to resurrect my files and test it
You can use ragozini at google's email domain

Van thegeps

Paragon (1175)

afbeelding van thegeps

25-01-2022, 12:43

Hi ARTRAG, yesterdey I was messing around with pcmenc (I want to add on Turrican the digitized voice sample at the beginning) but I've encountered some problems: the encoder supports only 8K mapper (I use ASCII16) and the player can't be assembled with Glass (after removing the macros I've obtained an "out of range" error).

And starting from an 8bit 67KB PCM file I had a 128KB bin file (but this I suppose is due to the 8KB chunks encoding)

Van ARTRAG

Enlighted (6933)

afbeelding van ARTRAG

25-01-2022, 13:09

Send me an email, my address is my surname at google's email domain

Pagina 11/14
4 | 5 | 6 | 7 | 8 | 9 | 10 | | 12 | 13 | 14