PCM/WAV output to PSG
By Google
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.
Maybe it's just a problem with the name of the wav file ...
what commandline parameters do you pass?
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
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
Thanks. Now output is little different - frequency is less 34 Hz 
Encoding PSG samples at 11013Hz
Failed to load wav file: bd.wav
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
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!
problem solved,
header fixed in the data

By Eugeny_Brychkov
Champion (457)
29-12-2011, 12:27