PCM/WAV output to PSG

Page 1/2
| 2

By Eugeny_Brychkov

Paragon (1232)

Eugeny_Brychkov's picture

29-12-2011, 12:27

Hello guys, Wikipedia says

Quote:

In 2006 two MSX developers created an advanced encoder that converts a wave file to optimal PSG channel transitions using Viterbi search.

Is there source code available? Anyone knows those guys?

Login or register to post comments

By mars2000you

Enlighted (6428)

mars2000you's picture

29-12-2011, 12:35

Check here :

http://www.dvik-joyrex.com/tools.html

Go to PCM Encoder ! ;)

By Eugeny_Brychkov

Paragon (1232)

Eugeny_Brychkov's picture

29-12-2011, 14:20

I am trying to get wav file processed - have it 8 bit mono, in versions 44kHz, 22kHz, 11kHz and 5.5kHz. For any file pcmenc says

Encoding PSG samples at 11047Hz

Failed to load wav file: ___.wav

44kHz file size is 16.8MiB, 11kHz - 4.21MiB.

 

By mars2000you

Enlighted (6428)

mars2000you's picture

29-12-2011, 14:22

Maybe it's just a problem with the name of the wav file ...

By ARTRAG

Enlighted (6923)

ARTRAG's picture

29-12-2011, 14:30

what commandline parameters do you pass?

By Eugeny_Brychkov

Paragon (1232)

Eugeny_Brychkov's picture

29-12-2011, 15:07

no parameters. I looked through the readme, and think exe reads file config from the its wav record. What should I specify?

 

Edit: here's the wav file header
00000000  52 49 46 46  24 A6 1B 02  57 41 56 45  66 6D 74 20
00000010  10 00 00 00  01 00 01 00  11 2B 00 00  11 2B 00 00
00000020  01 00 08 00  64 61 74 61  C0 74 43 00

By ARTRAG

Enlighted (6923)

ARTRAG's picture

29-12-2011, 15:43

IIRC you have to specify the timing of you replayer
The sampling period of the input has to match the sum of the 3 phases (dt1+dt2+dt3)
Try -dt1 32 -dt2 27 -dt3 266 for input at 11kHz

 

By Eugeny_Brychkov

Paragon (1232)

Eugeny_Brychkov's picture

29-12-2011, 15:58

Thanks. Now output is little different - frequency is less 34 Hz Smile

Encoding PSG samples at 11013Hz
Failed to load wav file: bd.wav

By ARTRAG

Enlighted (6923)

ARTRAG's picture

29-12-2011, 22:30

I just tested on my wav files: the header is

0x52,0x49,0x46,0x46,0xD6,0x7B,0x02,0x00,0x57,0x41,0x56,0x45,0x66,0x6D,0x74,0x20,
0x12,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x11,0x2B,0x00,0x00,0x22,0x56,0x00,0x00,
0x02,0x00,0x10,0x00,0x00,0x00,0x66,0x61,0x63,0x74,0x04,0x00,0x00,0x00,0xD2,0x3D

and my encoder works perfectly.
Here follows dump of the terminal screen:

C:\Documents and Settings\PC\Documenti\msx\pcmenc>pcmenc -rto 1 aaaaaaa.wav
Encoding PSG samples at 11047Hz
Viterbi SNR optimization:
   1 input samples per PSG tripplet output
   dt1 = 156  (Normalized: 0.481)
   dt2 = 27  (Normalized: 0.083)
   dt3 = 141  (Normalized: 0.435)
   Resampling using Lagrange interpolation on 11 points
   Using cost function: L2
Processing 100.00%

The cost metric in Viterbi is about 11.511

SNR is about 22.86
Encoding samples for original player

C:\Documents and Settings\PC\Documenti\msx\pcmenc>

Send me one of you wav files and I'll try to see why they do not work with the pcm encoder

By Gradius2

Hero (652)

Gradius2's picture

30-12-2011, 19:51

We did this back in 1986.  We got some code from a game where it shout "Oh shit!" everytime you die.

http://www.youtube.com/watch?v=_Nlcrh4reWc

Yes, it was THAT funny!

 

By ARTRAG

Enlighted (6923)

ARTRAG's picture

31-12-2011, 15:39

problem solved,
header fixed in the data

Page 1/2
| 2