getmusicbee.com

Support => Bug Reports => Topic started by: SpaceKeeper025 on April 10, 2019, 03:18:15 PM

Title: Converting 24 bit wav file to flac changed it into 16 bit
Post by: SpaceKeeper025 on April 10, 2019, 03:18:15 PM
I used libFLAC 1.3.2 to convert a 24 bit wav to flac (Standard compression, lossyWAV not enabled, no volume adjustment) in musicbee (Latest version on Microsoft Store) but the bit depth was changed to 16 bit, its sample rate remained 96 kHz. This doesn't happen when I convert from flac to flac. Please fix it soon
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: sveakul on April 10, 2019, 07:46:21 PM
Are you using the latest patched version of MusicBee (3.3.7038 as of this moment)?  There has been a fix for a WAV to AIFF issue that may be related to yours.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: phred on April 10, 2019, 08:16:05 PM
I may be mistaken, but I don't think you can patch Store versions of MB. Please correct me if I'm wrong.

While the Store version offers the advantage of automatic updates, the updates are far, far behind the Installer and the Portable versions. Unless you're able to patch it.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: sveakul on April 10, 2019, 08:43:31 PM
phred, I stand corrected--missed that the OP said he's using the Store version.  AFAIK that one has never been able to be patched (?).  IMO the main utility of the Windows Store version lies in being able to give Windows 10 users a quick-and-easy way to give MusicBee a try, and then move to the continually updated versions once they acquire the taste.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: phred on April 10, 2019, 09:04:33 PM
IMO the main utility of the Windows Store version lies in being able to give Windows 10 users a quick-and-easy way to give MusicBee a try, and then move to the continually updated versions once they acquire the taste.
Not to hijack this thread, but if a user want's a quick and easy way to try MB, the portable version is the way to go. Simpler to 'install' and no issues with user permissions.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: huoc on July 28, 2020, 08:05:38 PM
Hi!
I am using 3.3.7491 Store version and have encountered the same issue as the OP. Converting a 96/24 wav gave a 96/16 flac result. I did not find a way to fix this. I would appreciate any help.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: phred on July 28, 2020, 09:49:40 PM
Get rid of the Store version and use the Portable. Be sure to place in a directory that is -not- Windows controlled. Create a new folder called MusicBee and place it at the root of one of your drives.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Zak on July 29, 2020, 02:38:59 AM
I don't think you'll be able to do this in MusicBee "out of the box".
The flac.exe converter that MusicBee uses keeps the same bit depth as the input file by default.
This makes me think the bith depth is being reduced before it is passed to the encoder, so no additional tweaking will fix that.

If you use flac.exe from the command line it will work.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: sveakul on July 29, 2020, 03:53:40 AM
Confirmed here with 3.4.7514.  The bit depth reduction looks like it's being caused by libFLAC.dll, which is included in MusicBee's main directory.  That file is called every time a conversion using flac.exe is done using MusicBee, as renaming the dll will result in no conversion and an error about MusicBee being unable to find libFLAC.dll.

The question is why flac.exe isn't being used "on its own", which as Zak indicates would result in a 24-bit conversion to match the source.  Maybe Steven can supply us with info on why libFLAC.dll is being used during this process.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Steven on July 29, 2020, 08:34:21 AM
libFlac is used when storing file tags, not in the conversion itself.
FLAC.exe is used the format conversion
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Bee-liever on July 29, 2020, 01:57:52 PM
@ huoc  Check your .wav files are 24-bit PCM files.  If they are 32-bit PCM or 32-bit float then FLAC conversion automatically defaults to 16 bit.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: sveakul on July 29, 2020, 06:49:39 PM
The test I made was with a 24-bit PCM 96khz wav:

(https://i.imgur.com/EUoBpPv.png)

Using the flac.exe supplied in the MusicBee/Codec folder, I did a command line conversion of the wav to flac using the stock options supplied in the MB configuration.xml file:   C:\MusicBee\Codec>flac -s -5 -o 24-96.flac 24-96.wav .  This resulted in a 24-bit FLAC as shown below:

(https://i.imgur.com/kTpBZav.png)

I then repeated the operation with the original wav added to my library, and this time within the MusicBee File Converter GUI with the same options set (resample is NOT checked):

(https://i.imgur.com/o0wyviB.png)

But this results in a 16-bit FLAC:

(https://i.imgur.com/tnRJyaR.png)

So the question is, what exactly could MusicBee be doing that is disallowing a 24-bit wav to 24-bit FLAC conversion when attempted through its GUI?
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: huoc on July 29, 2020, 08:34:59 PM
I did some testing as well.

original wav file (for reference it was downloaded from here: https://www.nilsfrahm.com/works/sol/ )
Size 33,84 MB  (0% Compressed)
Original Size 33,84 MB
Length 1 minute 1 second
Channels 2  (stereo)
Sample Rate 96 KHz;
Sample Size 24 bit
Bit Rate 4 608 kbps  (DVD)
Encoder
Encoder Settings PCM
Audio Quality DVD  (Lossless)
Contains ID Tag [list & ID3]
Channel Mapping Left, Right
Type WAV Audio File    [.wav]

converting in a command line "flac -s -8 -o d:\test.flac d:\test.wav" gives two warnings:
test.wav: WARNING: skipping unknown chunk 'JUNK' (use --keep-foreign-metadata to keep)
test.wav: WARNING: legacy WAVE file has format type 1 but bits-per-sample=24

however, it still completes the conversion and results in this:
Size 19,47 MB  (43% Compressed)
Original Size 33,84 MB
Length 1 minute 1 second
Channels 2  (stereo)
Sample Rate 96 KHz;
Sample Size 24 bit
Bit Rate 4 608 kbps  (DVD)
Encoder FLAC reference libFLAC 1.3.2 20170101
Encoder Settings
Audio Quality Perfect (Lossless)
Contains CRC
Channel Mapping
Type FLAC Audio File    [.flac]

Converting in musicbee results in this:
Size 8,26 MB  (64% Compressed)
Original Size 22,56 MB
Length 1 minute 1 second
Channels 2  (stereo)
Sample Rate 96 KHz;
Sample Size 16 bit
Bit Rate 3 072 kbps  (DVD)
Encoder FLAC reference libFLAC 1.3.2 20170101
Encoder Settings
Audio Quality Perfect (Lossless)
Contains CRC, ID Tag [Vorbis Comments]
Channel Mapping
Type FLAC Audio File    [.flac]

What I note here without deep (as a matter of fact - any) knowledge on the subject is that if the file was being converted with musicbee, 'file properties' reports the original file size incorrectly (22,56 MB versus the real 33,84 MB which is exactly the ratio of 16:24)[/list]
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Bee-liever on July 30, 2020, 01:05:47 AM
MB is not recognising the files as 24 bit.
Look in the tag editor> Properties tab> type: and it shows Wave audio file
when it should show Wave audio file, 24 bit.

Adding --force-raw-format --bps=24 to the beginning of the encoding parameters should force 24 bit output, but unfortunately MB only produces an error with these settings
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: sveakul on July 30, 2020, 02:39:58 AM
The "kicker" for me is that even if MusicBee can't identify the wav as 24-bit, if it's actually sending the original file to flac.exe for the conversion then how is it ending up being changed to 16-bit for the result?  It's almost like MB is doing some kind of conversion of its own before the file goes to flac.exe's hands, or applying some other option not actually in the parameters box.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Zak on July 30, 2020, 06:40:36 AM
...if it's actually sending the original file to flac.exe for the conversion ...

That's what I was alluding to in my earlier post. I don't think it is sending the original file. The flac.exe conversion reads its data from the standard input stream, and I think that stream has been converted to 16-bit.

Adding --force-raw-format --bps=24 to the beginning of the encoding parameters should force 24 bit output, but unfortunately MB only produces an error with these settings

There are two reasons why that won't work, and it's nothing to do with MusicBee.

The flac.exe encoder doesn't work with just those parameters either. A true raw file has no information about what it contains, so you need to specify all of that information, not just the bits per sample.
The second reason is that a WAV file and a raw file aren't interchangeable - even with the extra parameters, you can't just feed flac.exe a WAV file and pretend it's a raw file.

In short, never work with raw files.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: sveakul on July 30, 2020, 07:15:39 AM
...if it's actually sending the original file to flac.exe for the conversion ...

That's what I was alluding to in my earlier post. I don't think it is sending the original file. The flac.exe conversion reads its data from the standard input stream, and I think that stream has been converted to 16-bit.

It's possible this conversion to 16-bit may be taking place when MusicBee moves the file to the Windows Temp folder during the work process shown in the FileMoveLog.dat file created in MusicBee/AppData, which although binary shows in my example from above <C:\Users\(username)\AppData\Local\Temp\MusicBee_000001.flacE:\New Mx\24-96.flac€Ø̵N4Ø

I can't resist a good mystery, haha..  Our Hercule Poirot will need to be Steven in this case.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Steven on July 30, 2020, 08:17:28 AM
it will probably be a bug with detecting the wav file as 24 bit

edit:
https://getmusicbee.com/patches/MusicBee34_Patched.zip
unzip and replace the existing musicbee application files

you will need to right click/ send to/ rescan files for existing files
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Bee-liever on July 30, 2020, 10:40:53 AM
files recognised as 24 bit and convert correctly for me.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Bee-liever on July 30, 2020, 12:16:09 PM
just a small extra...
Some EDM/Trance .wav files I've purchased are in 32/96 quality.
MB now recognises those as 'Wave audio file, 32 bit' but when converting to flac, they default to 16 bit.
Shouldn't they default to 24 bit?
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: sveakul on July 30, 2020, 07:49:16 PM
MB now recognises those as 'Wave audio file, 32 bit' but when converting to flac, they default to 16 bit.
Shouldn't they default to 24 bit?

@Bee-liever:  Isn't that though in accordance with the flac.exe behavior you posted about here?:

If they are 32-bit PCM or 32-bit float then FLAC conversion automatically defaults to 16 bit.

@Steven:  thanks for solving this mystery so quickly!
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: huoc on July 30, 2020, 09:05:46 PM
Unfortunately I could not try it. I am running the store version and simply could not get permission to replace the files. I googled and googled, used icacls, tinkered around with all the permissions windows I could find, took ownership of the folder, none seems to work and after an hour and some reboots I gave up. So unless someone can help me how to get write access to the folder, I unfortunately am not able to test the patched version.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: sveakul on July 30, 2020, 09:29:45 PM
Unfortunately I could not try it. I am running the store version and simply could not get permission to replace the files. I googled and googled, used icacls, tinkered around with all the permissions windows I could find, took ownership of the folder, none seems to work and after an hour and some reboots I gave up. So unless someone can help me how to get write access to the folder, I unfortunately am not able to test the patched version.

This is a case in point of why the best bet is always to use the Installer or Portable versions of MusicBee.  The Store version is incapable of being patched manually, among other issues (use of certain plugins, etc), due to the lock-down Microsoft places on these things  The fix does indeed work for MB 3.4.x on the 24-bit example I previously described, as so for Bee-liever.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: huoc on July 30, 2020, 10:14:42 PM
This is a case in point of why the best bet is always to use the Installer or Portable versions of MusicBee.  The Store version is incapable of being patched manually, among other issues (use of certain plugins, etc), due to the lock-down Microsoft places on these things  The fix does indeed work for MB 3.4.x on the 24-bit example I previously described, as so for Bee-liever.
Off-topic: Well, this was the first issue I encountered, so I am not sure how often a quick patching for testing purposes is needed, but there can be a Beta/Test/Patched/Release Candidate version in the store besides the stable version, can't it? This can replace manual tinkering, as the patched version would update itself in the background as well, independent of the stable production version. This is just me thinking out loud, without knowing anything about how the ecosystem of the Windows Store works, and also going waaaay off-topic :D
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Zak on July 31, 2020, 02:10:04 AM
That's highly unlikely to happen, if only because MusicBee is maintained by a development team of one.
Keeping a Windows Store version up to date would just take up more time, and as mentioned by others I don't think Microsoft makes it convenient to do, for reasons.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Bee-liever on July 31, 2020, 02:54:40 AM
@Bee-liever:  Isn't that though in accordance with the flac.exe behavior you posted about here...

Yes, but I was hoping Steven could work some of his code "magic" with something in bassenc.
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Steven on July 31, 2020, 08:19:19 AM
Yes, but I was hoping Steven could work some of his code "magic" with something in bassenc.
are you requesting your 32 bit wave files be converted to 24 bit flac (instead of 16 bit as now) ?
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Bee-liever on July 31, 2020, 12:23:28 PM
are you requesting your 32 bit wave files be converted to 24 bit flac (instead of 16 bit as now) ?
Yes please!
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Steven on August 02, 2020, 01:16:50 AM
are you requesting your 32 bit wave files be converted to 24 bit flac (instead of 16 bit as now) ?
Yes please!
the latest v3.4 patch has the change
Title: Re: Converting 24 bit wav file to flac changed it into 16 bit
Post by: Bee-liever on August 09, 2020, 12:31:22 PM
the latest v3.4 patch has the change
Thank you.