Hi,
I have been trying to get an MFM file encoded. RetroCode appears to be happy with the input [mono 8KHz WAV] and produces a file of roughly the right size. In my example a 48KB. I have attempted to play the output on a PC emulator, however, it doesn't like the result. Using said player to convert the same WAV input produces a file marginally smaller, at 47KB.
I was wondering if I was missing anything obvious? The type of WAV file or a switch somewhere? Any help appreciated!
I am using; code in.wav out.mfm -o 5
Located library "retroPanasonic" at /usr/local/libexec/Retro/codecs/retroPanasonic.so
Located library "retroBeatnik" at /usr/local/libexec/Retro/codecs/retroBeatnik.so
Located library "retroYamaha" at /usr/local/libexec/Retro/codecs/retroYamaha.so
Located library "retroWave" at /usr/local/libexec/Retro/codecs/retroWave.so
Located library "retroApple" at /usr/local/libexec/Retro/codecs/retroApple.so
Located library "retroG711" at /usr/local/libexec/Retro/codecs/retroG711.so
Located library "retroQualcomm" at /usr/local/libexec/Retro/codecs/retroQualcomm.so
Library "retroPanasonic" validated
Library "retroBeatnik" validated
Library "retroYamaha" validated
Library "retroWave" validated
Library "retroApple" validated
Library "retroG711" validated
Library "retroQualcomm" validated
Running on a little-endian machine
using default title: out
reading in.wav...
pReadAnyFormat : opening file "in.wav"...
pReadAnyFormat : identifying file-magix...
pMagicHeads : test using 8CMFMFile
pMagicHeads : magic head (bMagicHead @ 8075A88h)...
bMagicHead : comparing 4 byte with: "mfmp"
pMagicHeads : test using 8CVOXFile
pMagicHeads : magic head (bMagicHead @ 8075A88h)...
pMagicHeads : test using 8CRMFFile
pMagicHeads : magic head (bMagicHead @ 8075A88h)...
bMagicHead : comparing 4 byte with: "IREZ"
pMagicHeads : test using 9CSMAFFile
pMagicHeads : magic head (bMagicHead @ 8075A88h)...
bMagicHead : comparing 4 byte with: "MMMD"
pMagicHeads : test using 8CAVIFile
pMagicHeads : magic head (bMagicHead @ 8075A88h)...
pMagicHeads : test using 9CWaveFile
pMagicHeads : magic head (bMagicHead @ 8075A88h)...
file format identified as: Wave
ReadHeader : format length 16
ReadHeader : format tag 1
ReadHeader : channels 1
ReadHeader : rate 8000
ReadHeader : avg byte per sec 16000
ReadHeader : block align 2
ReadHeader : bits per sample 16
ReadHeader : data tag located...
ReadHeader : data size 191982,filesize 192026,limit 192026
Read : trying to read 191982 bytes...
format is pcm (01h)
sample size: 191982
bits per sample: 16, sample rate: 8000Hz, channels: 1, file data: 192026 byte, PCM data: 191982 byte
metadata:
title out
pInstanceByExtension : searching for codec able to create mfm - files
pInstanceByExtension : testing module from /usr/local/libexec/Retro/codecs/retroPanasonic.so
pInstanceByExtension : compare with default extension for "Panasonic MxxFxxMxx (MFM)": mfm
pInstanceByExtension : destination format chosen "Panasonic MxxFxxMxx (MFM)"
creating destination file out.mfm...
bConvertSample : destination format chosen "Panasonic MxxFxxMxx (MFM)"
bConvertSample : creating file "out.mfm"...
tool:
Panasonic MxxFxxMxx (MFM) encoded and written successfully
bits per sample: 4, sample rate: 8000Hz, channels: 1, file data: 48158 byte, PCM data: 47996 byte
main : returning: 1
RetroCode Processing Status: OK
/////////////////////////////////
Successfully converted files: 1, Files that failed conversion: 0
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After some more investigation and looking really closely at the MFM files you provided (thanks a bunch again!) I can, without a doubt say that RetroCode currently does not support those.
Its a bit of a mystery for me how the MFM-format has been changed / upgraded / diversified. If I remember correctly when originally developing the MFM codec for RetroCode, I had a bunch of sample files and a commandline tool that was producing them. At the end, RetroCode produced bit-identical files to those. At that time, those were used on Panasonic handsets only - and according to my customers, things worked fine with RetroCode's results.
These "new" mfm-files are very very similar to the "old" ones. They just have a few extra chunks with information that doesnt seem to be too important. The big bummer is that the "new" compression is slightly differing from the "old" one. It still is ADPCM but there are differences. The "old" ones used the OKI-ADPCM codec. The "new" ones use the ROHM-ADPCM codec. The confusion is getting bigger and better since those companies appear to have merged in some ways. That somehow leads me to the assumption that the algorithm might be identical, but obviously that is not correct.
Now I did update RetroCode and RetroFID to parse those file you have provided correctly. Unfortunately, the ADPCM compression differs slightly and the results from RetroCode when decoding the "new" mfm files are slightly corrupt (not garbeled but also not correct).
So to make RetroCode compatible with those, I need to find more information on the ROHM ADPCM algorithm or reverse-engineer it. That takes time and I am currently not sure if its worth the efford.
If anybody could provide me with more information on the ROHM ADPCM algorithm, things could become a lot easier - HELP! :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have been trying to get an MFM file encoded. RetroCode appears to be happy with the input [mono 8KHz WAV] and produces a file of roughly the right size. In my example a 48KB. I have attempted to play the output on a PC emulator, however, it doesn't like the result. Using said player to convert the same WAV input produces a file marginally smaller, at 47KB.
I was wondering if I was missing anything obvious? The type of WAV file or a switch somewhere? Any help appreciated!
I am using; code in.wav out.mfm -o 5
Located library "retroPanasonic" at /usr/local/libexec/Retro/codecs/retroPanasonic.so
Located library "retroBeatnik" at /usr/local/libexec/Retro/codecs/retroBeatnik.so
Located library "retroYamaha" at /usr/local/libexec/Retro/codecs/retroYamaha.so
Located library "retroWave" at /usr/local/libexec/Retro/codecs/retroWave.so
Located library "retroApple" at /usr/local/libexec/Retro/codecs/retroApple.so
Located library "retroG711" at /usr/local/libexec/Retro/codecs/retroG711.so
Located library "retroQualcomm" at /usr/local/libexec/Retro/codecs/retroQualcomm.so
Library "retroPanasonic" validated
Library "retroBeatnik" validated
Library "retroYamaha" validated
Library "retroWave" validated
Library "retroApple" validated
Library "retroG711" validated
Library "retroQualcomm" validated
Running on a little-endian machine
using default title: out
reading in.wav...
pReadAnyFormat : opening file "in.wav"...
pReadAnyFormat : identifying file-magix...
pMagicHeads : test using 8CMFMFile
pMagicHeads : magic head (bMagicHead @ 8075A88h)...
bMagicHead : comparing 4 byte with: "mfmp"
pMagicHeads : test using 8CVOXFile
pMagicHeads : magic head (bMagicHead @ 8075A88h)...
pMagicHeads : test using 8CRMFFile
pMagicHeads : magic head (bMagicHead @ 8075A88h)...
bMagicHead : comparing 4 byte with: "IREZ"
pMagicHeads : test using 9CSMAFFile
pMagicHeads : magic head (bMagicHead @ 8075A88h)...
bMagicHead : comparing 4 byte with: "MMMD"
pMagicHeads : test using 8CAVIFile
pMagicHeads : magic head (bMagicHead @ 8075A88h)...
pMagicHeads : test using 9CWaveFile
pMagicHeads : magic head (bMagicHead @ 8075A88h)...
file format identified as: Wave
ReadHeader : format length 16
ReadHeader : format tag 1
ReadHeader : channels 1
ReadHeader : rate 8000
ReadHeader : avg byte per sec 16000
ReadHeader : block align 2
ReadHeader : bits per sample 16
ReadHeader : data tag located...
ReadHeader : data size 191982,filesize 192026,limit 192026
Read : trying to read 191982 bytes...
format is pcm (01h)
sample size: 191982
bits per sample: 16, sample rate: 8000Hz, channels: 1, file data: 192026 byte, PCM data: 191982 byte
metadata:
title out
pInstanceByExtension : searching for codec able to create mfm - files
pInstanceByExtension : testing module from /usr/local/libexec/Retro/codecs/retroPanasonic.so
pInstanceByExtension : compare with default extension for "Panasonic MxxFxxMxx (MFM)": mfm
pInstanceByExtension : destination format chosen "Panasonic MxxFxxMxx (MFM)"
creating destination file out.mfm...
bConvertSample : destination format chosen "Panasonic MxxFxxMxx (MFM)"
bConvertSample : creating file "out.mfm"...
tool:
Panasonic MxxFxxMxx (MFM) encoded and written successfully
bits per sample: 4, sample rate: 8000Hz, channels: 1, file data: 48158 byte, PCM data: 47996 byte
main : returning: 1
RetroCode Processing Status: OK
/////////////////////////////////
Successfully converted files: 1, Files that failed conversion: 0
Interesting - could you please mail all files involved:
- source wave
- RetroCode rendered mfm
- other tool's redered mfm
Please mail everything to:
me at mmsguru.de
One more thing, please try RetroFID on the MFM results - is it identifying both of them correctly?
ty!
After some more investigation and looking really closely at the MFM files you provided (thanks a bunch again!) I can, without a doubt say that RetroCode currently does not support those.
Its a bit of a mystery for me how the MFM-format has been changed / upgraded / diversified. If I remember correctly when originally developing the MFM codec for RetroCode, I had a bunch of sample files and a commandline tool that was producing them. At the end, RetroCode produced bit-identical files to those. At that time, those were used on Panasonic handsets only - and according to my customers, things worked fine with RetroCode's results.
These "new" mfm-files are very very similar to the "old" ones. They just have a few extra chunks with information that doesnt seem to be too important. The big bummer is that the "new" compression is slightly differing from the "old" one. It still is ADPCM but there are differences. The "old" ones used the OKI-ADPCM codec. The "new" ones use the ROHM-ADPCM codec. The confusion is getting bigger and better since those companies appear to have merged in some ways. That somehow leads me to the assumption that the algorithm might be identical, but obviously that is not correct.
Now I did update RetroCode and RetroFID to parse those file you have provided correctly. Unfortunately, the ADPCM compression differs slightly and the results from RetroCode when decoding the "new" mfm files are slightly corrupt (not garbeled but also not correct).
So to make RetroCode compatible with those, I need to find more information on the ROHM ADPCM algorithm or reverse-engineer it. That takes time and I am currently not sure if its worth the efford.
If anybody could provide me with more information on the ROHM ADPCM algorithm, things could become a lot easier - HELP! :)