Join also our Discord channel! Click here.

Extract FLAC audio from MAME CHDs

Get help on any and all audio formats, or chip in and help others!
Post Reply
keystothemaxim
beginner
Posts: 23
Joined: Mon Oct 21, 2013 11:19 am
Has thanked: 6 times
Been thanked: 1 time

Extract FLAC audio from MAME CHDs

Post by keystothemaxim » Fri Jan 10, 2014 2:41 am

Is it possible to extract audio from MAME CHDs? They are typically compressed in FLAC with the latest version (CHDv5). There are some CHDs that are CD image files and can be easily converted to bin/cue with CHDMAN, howeer the CHDs I'm trying to extract are hard disk image files. I tried decompressing them to raw .img files and mounting them, but nothing worked.

Darkstar
advanced
Posts: 67
Joined: Thu Jun 14, 2007 1:14 pm
Location: Southern Germany
Has thanked: 7 times
Been thanked: 1 time
Contact:

Re: Extract FLAC audio from MAME CHDs

Post by Darkstar » Fri Jan 10, 2014 11:40 am

CHD harddisks are not compressed with FLAC. Only audio CDs and (maybe) Laserdiscs. FLAC wouldn't make sense on a harddisk now, would it?

It's however possible (if very unlikely) that the (uncompressed) harddisk image contains *.flac files, in that case you should be able to mount them (if it's a well-known filesystem) and copy the FLAC files off. I doubt any games use FLAC for audio though

Which chd in particular are you having trouble with?
Check out the REWiki!

keystothemaxim
beginner
Posts: 23
Joined: Mon Oct 21, 2013 11:19 am
Has thanked: 6 times
Been thanked: 1 time

Re: Extract FLAC audio from MAME CHDs

Post by keystothemaxim » Fri Jan 10, 2014 11:49 am

Darkstar wrote:CHD harddisks are not compressed with FLAC. Only audio CDs and (maybe) Laserdiscs. FLAC wouldn't make sense on a harddisk now, would it?

It's however possible (if very unlikely) that the (uncompressed) harddisk image contains *.flac files, in that case you should be able to mount them (if it's a well-known filesystem) and copy the FLAC files off. I doubt any games use FLAC for audio though

Which chd in particular are you having trouble with?
CarnEvil. The CHDMAN info command shows that the audio of the CHD has been compressed with FLAC. The FLAC codec was introduced to CHD compression when the CHD version 5 was released. More details here.

I tried to mount the hard disk several times using virtual drives, and none of them worked. I read somewhere that I should try to mount it on an SD card, but I'm afraid to do that.

Darkstar
advanced
Posts: 67
Joined: Thu Jun 14, 2007 1:14 pm
Location: Southern Germany
Has thanked: 7 times
Been thanked: 1 time
Contact:

Re: Extract FLAC audio from MAME CHDs

Post by Darkstar » Fri Jan 10, 2014 1:56 pm

This is what I get:

Code: Select all

g:\MAME\CHDs>chdman info -v -i carnevil.chd
chdman - MAME Compressed Hunks of Data (CHD) manager 0.152 (Dec 25 2013)
Input file:   carnevil.chd
File Version: 5
Logical size: 4,310,046,720 bytes
Hunk Size:    4,096 bytes
Total Hunks:  1,052,258
Unit Size:    512 bytes
Total Units:  8,418,060
Compression:  lzma (LZMA), zlib (Deflate), huff (Huffman), flac (FLAC)
CHD size:     1,465,496,818 bytes
Ratio:        34.0%
SHA1:         5cffb0de63ad36eb01c5951bab04d3f8a9e23e16
Data SHA1:    ba32b7ef9721d730ce58bd753d47fb947b6ae9b6
Metadata:     Tag='GDDD'  Index=0  Length=35 bytes
              CYLS:524,HEADS:255,SECS:63,BPS:512.

     Hunks  Percent  Name
----------  -------  ------------------------------------
     1,803     0.2%  Uncompressed
   318,771    30.3%  Copy from self
   682,769    64.9%  LZMA
    23,510     2.2%  Deflate
     1,752     0.2%  Huffman
    23,653     2.2%  FLAC
There's indeed some small percentage compressed with FLAC, but it's only 2.2%... So it seems when uncompressed there's at least a small bit of PCM wave data in the hard disk image, and opening the file as RAW in a sound editor shows that there are various musical parts splattered all over the file (you just have to find them):
Image

So your best bet is to either find someone who'll decipher the hard disk file system for you and writes an unpacker, or simply hunt for these fragments in Audacity or any other sound editor...
Check out the REWiki!

keystothemaxim
beginner
Posts: 23
Joined: Mon Oct 21, 2013 11:19 am
Has thanked: 6 times
Been thanked: 1 time

Re: Extract FLAC audio from MAME CHDs

Post by keystothemaxim » Fri Jan 10, 2014 11:52 pm

Thank you very much!

Post Reply