Flac -> Wav conversion

Posted by: Graham Russell on 27 September 2008

Hi,

I've been comparing Flac vs Wav versions of a few tracks (via Sonos ZP90 & Chord Signature phono cable) into 552/500. Wav sounds better and closes the gap on CD555. I have just finished converting all my CDs (approx 800) into Flac. If I convert Flac files into Wav will they sound the same as if the original tracks were ripped as Wav?

I'm considering batch converting everything from Flac to Wav if the resulting files are the same as directly ripped Wavs.

Assuming Flac really is lossless then it will be possible to recreate the Wav files.

I'd appreciate feedback from those who have experience with this.

Cheers
Graham
Posted on: 27 September 2008 by garyi
How do you suppose you reached the conclusion that two identical files sound different?

I think the big risk for the audiophile with all this Computer business is that we may be made fools of with proof.
Posted on: 27 September 2008 by Cjones
I think when you compress WAV to FlAC, you loose certain Metadata. You might not care, but you asked.

As for the other question, it does seem odd, did you do the ripping of the flac files yourself? Did you do it with exact copy, allowing for verification of the file vs. the WAV. file?
Posted on: 27 September 2008 by Graham Russell
The original CDs were ripped to Flac using EAC on PC. I am trying to avoid re-ripping to Wav if I can betch convert the Flac files.

I've found the Flac installation has a command line decompression capability. Testing decompressing a Flac to Wav it is the same file size as an original Wav ripped from the same CD. It looks like it is possible to decompress Flac to Wav OK. Time to write a bit of code to rip through the folders containing Flac files. Luckily the software is the easy bit.

I'm not trying to find out if two identical files sound different. I am trying to find out is Flac really is lossless and that the original Wav file can be recreated OK. It looks like it can.
Posted on: 27 September 2008 by goldfinch
Somewhere I read that if really FLAC would sounds worse than WAV it would be only because a compressed file needs more computing processing (and this can compromise sound under some circunstances).

As far as FLAC is lossless and assuming the ripping is perfect (it should be using EAC) you can convert it back to wav without compromising quality. Any program would do the job. But conversions are always exposed to possible different computer errors (HD reading-writing, memory). AFAIK the ripping task is much more important than format conversions (flac is just a compressed format).

Your findings between wav and flac quality are a great surprise, I have never compared them and as you I have lots of albums in flac.
Posted on: 27 September 2008 by Graham Russell
quote:
Originally posted by goldfinch:
Somewhere I read that if really FLAC would sounds worse than WAV it would be only because a compressed file needs more computing processing (and this can compromise sound under some circunstances).


I think this is exactly the issue. At playback time whichever device is responsible to streaming the flac file off the disk/network also has to deal with the decompression. This seems to be extra "overhead" in the replay path that affects sound quality. It's easy enough to try it out with a few tracks to see if this is an issue in your set up.

I've just set off my short program to rip through all my flacs and convert them to wavs in the same directories. Hopefully will be done in the morning.

I need to investigate if tags are affected by this process....

I'm trying to avoid having to re-rip with EAC into wav if possible.
Posted on: 27 September 2008 by gary1 (US)
Ask PC Stockton-- he will know the right answer for sure. I hope he's around and can respond to your query. The guy definitely knows his stuff on this material.
Posted on: 27 September 2008 by pcstockton
WAV = no tags

FLAC = smaller (about 50%)

I cannot hear a difference between the two.

You can endlessly convert wav to flac and back and forth without any loss. Hence lossless.

When you intially ripped your disc. You did not technically "rip to flac". It ripped as a wav and then converted, on the fly, to a flac.

You can easily convert to wav. Although im am not sure why you would want to.

Tags are quite nice after all.

-p
Posted on: 27 September 2008 by John R.
Based on my experiences using differnt programs for ripping a CD (EAC is by far the best in my oppinion) and using different software player (Media Player, Media Monkey, Wavelab, pp)for paying back the same WAV file I know how much the software used brings into play, although on paper they all do the very same. Therefore I would recommend using a few programs for FLAC to WAV conversion as I am sure that there are audible differences using different programs. When you found the best program I would then rip one test CD again directly to WAV and make a comparison with the FLAC to WAV file. This will tell you whether you have to rip all your CDs, again. I hope for you that you do not need to rip them all again! In case you do, I would stronly advice you to use a PLEXTOR PREMIUM 2 for ripping: Soundwise the best drive for ripping and I tried a lot with different Plextor, Pioneer, LG, and TEAC.
Posted on: 28 September 2008 by Steve S1
quote:
Originally posted by pcstockton:
WAV = no tags

FLAC = smaller (about 50%)

I cannot hear a difference between the two.


-p


Covers it neatly ime.

Steve
Posted on: 28 September 2008 by garyi
in terms of 'over head to decompress' this is not an issue. The file is decompressed then played, its not decompressed as it plays.

There was a little experiment done with lossless where by it was created and then restored then played back mirror image against the original, where byt he wave forms would be cancelled out if they were the same, and sure enough the line was flat throughout the entire track.

Time to face it, if you want to geek, you are going to need to find something else, you are just showing yourself up if you Believe you hear a difference, because you don't hear a difference, a wav and its lossless brother are exactly the same at the point of play, exactly, therefore it does not sound different.
Posted on: 28 September 2008 by james n
quote:
in terms of 'over head to decompress' this is not an issue. The file is decompressed then played, its not decompressed as it plays.


If the file is in FLAC format then the files are decompressed when played. So in Grahams original question then processor overhead and other factors come into play when comparing a FLAC file to a WAV file playing in realtime. I agree though if you were to compress a WAV file to FLAC and then reconvert back to WAV it would be identical.
Posted on: 28 September 2008 by Paul Hutchings
It's lossless, there is no difference - forget that it's music what you're saying is akin to suggesting your Excel or Word documents have different data in them after they've been zipped and unzipped.

I've tested before by ripping tracks from a CD to WAV, making a note of the md5 checksum, converting them to FLAC or ALAC and then converting them back to WAV and the checksums are the same.

Is it possible there are differences in playback codecs?
Posted on: 28 September 2008 by garyi
James, the file is decompressed, then played, where is the over head? At most you might have a pause before it starts, not that I have seen this.

To clarify all devices will be compressing the file to send over a network stream anyhow.
Posted on: 28 September 2008 by james n
Gary - Surely its decompressed whilst playing - if i play a flac file it's done on the fly. It doesnt decompress the whole file (say a track) and then start playing it.

James
Posted on: 28 September 2008 by js
quote:
Originally posted by Paul Hutchings:
It's lossless, there is no difference - forget that it's music what you're saying is akin to suggesting your Excel or Word documents have different data in them after they've been zipped and unzipped.

I've tested before by ripping tracks from a CD to WAV, making a note of the md5 checksum, converting them to FLAC or ALAC and then converting them back to WAV and the checksums are the same.

Is it possible there are differences in playback codecs?
Shouldn't be if you have the latest version of FLAC.
The thread was started because Graham hears a difference as do I when played back. The debate whether he does or not or can be made a fool of with proof doesn't seem appropriate. What proof is there other than listening? If you don't hear a difference, that is great too. In theory there should be no difference but here, for me, is situation where my ears tell me the same as Graham's. PC/TC/SN in ASIO and, for me, it's rather obvious. Restoring the file to wave should take care of any on the fly proccessing and bring it back to original quality but I haven't tried it myself. A while ago I rebuilt a more compressed file back to wave just for fun and it was better than playing the compressed file on the run though obviously not as good as the original so I suspect if Graham rebuilds, he'll be OK because this file should be able to be brought all the way back without approximations. I'm sure he'll try one and report back vs a fresh rip. Please do Graham. Fortunately storage is becoming so cheap that any form of compression is becoming unneccessary for most of us. When you can hear changing the buffer size in the playback portion of computer programs, it shouldn't be too difficult to at least consider that additional proccessing along with an additional buffer may also be audible whether the resulting file is bit perfect or not. It probably isn't just about data.
It seems many that have pointed at things getting too technical when trying to explain what I and others have heard in a particular audition also use a technical overview here as to why we couldn't possibly hear a difference. I don't disagree with pcstockton at all here other than personally having heard what Graham is now on a few different setups. Your not crazy Graham. Let us know how it goes.
Posted on: 28 September 2008 by Paul Hutchings
quote:
Originally posted by js:
The thread was started because Graham hears a difference as do I when played back. The debate whether he does or not or can be made a fool of with proof doesn't seem appropriate.


I'm simply saying that lossless is lossless, the data is the same, so the only difference can be something that's happening between hitting "Play" and the music coming out the speakers - all other things being equal it would suggest the codec?

I know with video files on my computer that using different players/codecs with the exact same file result in different quality, so with audio this also seems the most likely explanation?
Posted on: 28 September 2008 by js
quote:
Originally posted by Paul Hutchings:
quote:
Originally posted by js:
The thread was started because Graham hears a difference as do I when played back. The debate whether he does or not or can be made a fool of with proof doesn't seem appropriate.


I'm simply saying that lossless is lossless, the data is the same, so the only difference can be something that's happening between hitting "Play" and the music coming out the speakers - all other things being equal it would suggest the codec?

I know with video files on my computer that using different players/codecs with the exact same file result in different quality, so with audio this also seems the most likely explanation?
Paul, I wasn't referring to your very sensible post in any way. I don't think Flac has more than 1 current codec at any time so I suspect it's something else if you stay in the same player for both files. If your saying that we might be hearing the codec in real time playback than we're saying the same thing in different ways. Sorry, the codec between my ears may not be very good at converting American into English. Smile
Posted on: 28 September 2008 by Paul Hutchings
quote:
Originally posted by js:
If your saying that we might be hearing the codec in real time playback than we're saying the same thing in different ways. Sorry, the codec between my ears may not be very good at converting American into English. Smile


No worries.

I guess that's what I am saying, since we know the FLAC file contains the exact same data as the WAV file once decompressed.
Posted on: 28 September 2008 by js
quote:
Originally posted by Paul Hutchings:
quote:
Originally posted by js:
If your saying that we might be hearing the codec in real time playback than we're saying the same thing in different ways. Sorry, the codec between my ears may not be very good at converting American into English. Smile


No worries.

I guess that's what I am saying, since we know the FLAC file contains the exact same data as the WAV file once decompressed.
Plenty of people on the net saying the same things as Graham and expected no difference so were predisposed to not hearing one. They are presented with the same bit perfect responce. We're not unique in this. Here's a quote from my very first hit on a quick search.
"How acurate is MD5 checksum data and SHA-1 Hash data? The reason why I am asking is because I am trying to figure out if the FLAC codec/compression for music files is really lossless. I took a wav, compress it with into FLAC, and then uncompressed it and then I did a MD5 calculation of the originial wav file and the wav file that I uncompressed. They both turned out to have the same MD5 number. I also did a SHA-1 Hash calculation and it showed both of the files are the same. But when I listen to the originial wav file and listen to the compressed-then-uncompressed wav file and compare the two, it sounds like there is slight difference."
Not using this quote as any kind of proof and just pointing out that Graham isn't unique here. That there would be a difference after rebuilding a Flac file and taking the other variables away, doesn't make sense to me either. I'm very interseted to hear Graham's findings.
Maybe I'll revisit next week as I don't have a DAC at home on weekends but I tried a few different lossless codecs in the past with the same file and like APE the best but nat as much as the original. I didn't rebuild them however and my preference for APE may just have been due to real time codec/buffer considerations.
Posted on: 28 September 2008 by Graham Russell
To reiterate I am hearing a difference playing a Flac and Wav version of the same tracks. Playback is being handled via a borrowed Sonos ZP90 which is hard wired to my home network and connected to the 552 via Chord Signature phono cable.

It may be the Flac decompression is not too good with the Sonos???

I completely agree that lossless compression allows the original data to be recreated with no errors. However, when playing Flac files there is no way the whole track is decompressed before it is played. The start up time is instantaneous so the Flac file is not being copied from my NAS RAID to the Sonos. It has to be decompressed in real-time. I believe this is where processing overheads are impacting the sonic replay. Mathematically the original Wav file may be being recreated but the sound just isn't as good.

I have recreated a bunch of Wav files from the Flac versions and they sound exactly the same of freshly ripped Wavs.

Sometime this weeks I hoping that James N will be bringing round his Mac/Lavry kit so we can compare and contrast what I'm hearing. It will be interesting to put the DAC onto the Sonos box to see firstly how it sounds but to see if this impacts the Flac vs Wav findings.

For those who are hearing Flac and Wav exactly the same then just sit back and enjoy the music. Each setup is different and you're having more luck than me. I'm interested in trying to squeeze every ounce of performance from this audio streaming lark. I want to see just how close it can come to the CD555 (now with two PSUs Smile ).
Posted on: 28 September 2008 by js
I expect Sonos to be very sound technically as even their US factory reps are engineers. FLAC should be right in it's wheelhouse. If you use it's DIG out for instance, it will have converted everything to 16 bit. More compressed WMA or AAC files need more proccessing so Flac shouldn't be overstressing the Sonos. I believe it has a dig volume control so fixed is the way to go. Not the absolute best but a nice musical piece for those that like the interface and the wireless distribution capability which are excellent. I don't think that the Sonos would be at fault here as long as you're using it for both. I believe the improvements made in the last few versions of Flac have nothing to do with sound quality so even an older codec shouldn't cause issues.
Posted on: 28 September 2008 by Graham Russell
quote:
Originally posted by js:
Sonos is very sound technically and FLAC should be right in it's wheelhouse. If you use it's DIG out for instance, it will have converted everything to 16 bit. More compressed WMA or AAC files need more proccessing so Flac shouldn't be overstressing the Sonos. I believe it has a dig volume control so fixed is the way to go. Not the absolute best but a nice musical piece for those that like the interface and the wireless distribution capability which are excellent. I don't think that the Sonos would be at fault here as long as you're using it for both. I believe the improvements made in the last few versions of Flac have nothing to do with sound quality so even an older codec shouldn't cause issues.


The line level output has been set to fixed which I assume gives us the best analogue quality possible.
Posted on: 28 September 2008 by james n
Looks like it could be an interesting evening Graham - i'll drop you a mail in the morning.

Cheers

James

PS - Great Pics Cool
Posted on: 28 September 2008 by Graham Russell
quote:
Originally posted by james n:
Looks like it could be an interesting evening Graham - i'll dr Big Grin op you a mail in the morning.

Cheers

James

PS - Great Pics Cool


Glad you like them Smile The girls were a lot more relaxed later on and it really shows in the pics. Hopefully not too many to choose from!!!
Posted on: 29 September 2008 by Mark R
quote:
WAV = no tags


I'm not entirely sure it's this black and white; after all, the HDX 'tags' WAV files. I think it might be a format issue in that each encoding format has its own tag layout e.g. MP3 uses ID3 and I believe RIFF chunks can be used to store tag information in WAV files. The challenge probably lies in finding software that is rich enough to transcode tags as well as format. The blurb for MediaMonkey for Windows suggests it can transcode *and* preserve tags when converting between formats. I can't vouch for it myself, not owning a PC, but it might be worth some investigation.