Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Detecting whether a 24-bit file has been upconverted from 16-bit? (Read 50344 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #25
I downloaded a FLAC album from online web store and it appears that the files I've downloaded are 24-bit. it's not a hd web store like hdtracks, it's generally a CD 16-bit 44.1kHz store with either FLAC or MP3 to choose from in its offerings.

I'm wondering whether the 24-bit files are real and were supplied as 24-bit from the label and they just didn't label it correctly on the download page, or whether there was an encoding error or just somehow it made its way from 16-bit files to 24-bit FLACs.

Is there a way I can definitively tell or analyze it (looking at spectral maybe) to see if it's been upconverted? Are there certain algorithms and 'good jobs' that can be done to make its 16->24 upconversion undetectable?


Many of the actual upconversions are going to be pretty hard to determine by simple means. For example it is pretty well known that about half of all so-called HD tracks started out as analog tapes or non-CD digital recordings that either came from or passed through the analog domain during the transcription process.

Catching only the clerical errors and obvious transcription errors  is only a partial solution.

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #26
Code: [Select]
flac -ac foo.flac | findstr wasted_bits (for windows)

fbits:
Code: [Select]
#!/bin/bash

me="${0##*/}"

if [ -w "$TMPDIR" ]; then
tdir="$TMPDIR"
elif [ -w '/tmp' ]; then
tdir='/tmp'
elif [ -w "$HOME" ]; then
tdir="$HOME"
elif [ -w "$PWD" ]; then
tdir="$PWD"
else
echo "$me: error: can't find a writable directory for creating the temporary file" 1>&2 ; exit 1
fi

tf="$( TMPDIR="$tdir" mktemp "${tdir}/${me}.XXXX" 2>/dev/null )"
if [ -z "$tf" ]; then
echo "$me: error: can't create temporary file" 1>&2 ; exit 1
fi

checkbits ()
{
local bps abps tbps=0 n=0
bps="$( metaflac --show-bps "$1" )"
flac -ac "$1" 2>/dev/null | fgrep 'wasted_bits' | cut -d '=' -f 3 | cut -f 1 > "$tf"
while read wb; do
tbps=$(( tbps + ( bps - wb ) ))
((n++))
done < "$tf"
abps=$(( ( ( tbps * 10 / n) + 5 ) / 10 )) # (* 10 + 5) / 10 for proper rounding
printf "%2u/%2u bits\t%s\n" "$abps" "$bps" "$1"
}

for f in "$@"; do
case "$f" in
*.flac) checkbits "$f" ;;
*) continue ;;
esac
done

rm -f "$tf"

Usage:
Code: [Select]
fbits *.flac

Can anyone convert that Unix BASH script for Windows BATCH script?
I don't want to install anything more, I've got so much installed already.

Windows 7 (x64) and Windows XP (x86) user.

Using what nu774 provided gives me over 4,000 lines of text.
It would be more convenient to have summarized results in a printed text file.

Thanks for any help.

PS: I've ready looked at a few threads where people were trying, miserably, to install software to use BASH scripts on a Windows environment.
Those threads didn't seem entirely successful and were incomplete in instructions.
I like to use "HD audio" in PaulStretch. "HD audio", lol.

 

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #27
Maybe Greynol can help?

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #28
Here's a quick Windows .cmd script trying to do the same thing: [attachment=7493:fbits.zip]

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #29
Here's a quick Windows .cmd script trying to do the same thing: [attachment=7493:fbits.zip]


Thank you! But it's hard to figure out why it's not working.
I've replaced the only isntance of the program call with the filepath of the actual program.

It just opens and then closes right away.
I like to use "HD audio" in PaulStretch. "HD audio", lol.

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #30
It's meant to be used from command prompt when flac.exe and metaflac.exe are in search path. You can add "pause" command as the last line and then you can drag and drop .flac files over it. For drag and drop use it's enough to have flac.exe and metaflac.exe in the same dir as the .cmd file.

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #31
Thanks for the .cmd version.

I suggest modifying it to use flac -acs rather than flac -ac, so you don't get the copyright/warranty/license header after every file it processes. (Maybe this varies by flac build?)

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #32
I downloaded a FLAC album from online web store and it appears that the files I've downloaded are 24-bit. it's not a hd web store like hdtracks, it's generally a CD 16-bit 44.1kHz store with either FLAC or MP3 to choose from in its offerings.

I'm wondering whether the 24-bit files are real and were supplied as 24-bit from the label and they just didn't label it correctly on the download page, or whether there was an encoding error or just somehow it made its way from 16-bit files to 24-bit FLACs.

Is there a way I can definitively tell or analyze it (looking at spectral maybe) to see if it's been upconverted? Are there certain algorithms and 'good jobs' that can be done to make its 16->24 upconversion undetectable?


It all depends on how the file was upconverted.

If a schlock job was done, and the file was converted from 16 to 24 by simply padding with zeroes, then that would be detectable by obvious means.

If a good job was done with a properly dithered conversion, then I don't know of a reliable numerical test for that.

I'd like to see people explain why their code fragments should be reliable, and then demonstrate that their code fragments are reliable detectors of upsampling if the file was upsampled correctly.


Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #34
I'd like to see people explain why their code fragments should be reliable, and then demonstrate that their code fragments are reliable detectors of upsampling if the file was upsampled correctly.


Is that directed at me? I make no such claim.


Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #36
Anyone know how to adjust Skamp's script to work with wavpack files (hybrid in my case)? Wvunpack -ss doesn't seem to supply the needed information

Thanks
Music lover and recovering high end audiophile

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #37
I don't see the point in adding dither when increasing the bit-depth.
Cover up. Keep it from being easy to detect your trickery.
I suppose you mean: make bits 17-24 active because them being static zeros would reveal that they are not part of the original signal.
To make sure all 8 bits are effected, a tiny bit of DSP (e.g. a level change of -0.01dB) would be more effective IME since dither might not toggle all 8 bits.

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #38
How would this technique rate a file consisting of a single loud piano note every few seconds with some softly spoken voice?

How do different masterings come out, something lower level vs the loud nonoise version?

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #39
Regarding the Windows fbits.cmd, I lost the version I had.

I downloaded the one provided and made some changes to it so it would not only scan the entire directory, but also print logs for each file (the detailed logs) and then pretty much keep the CMD screen clean (reporting only final results) and then printing those displayed results.

I don't know where I put the modified version and I can't remember what I did for the life of me, either.

My cmd skills aren't nearly enough to recreate the existing fbits.cmd and figure out how I did it before.

I remember taking a long time just to try things out and spend hours googling about cmd usage.

I've added FLAC folder (flac/metaflac) to the system_path (not user_path) and I frequently use "open CMD here" on directories via context menu, if that helps.

Whatever's going on in the current cmd doesn't process/summerize whole directory for me and all logs disappear.
I like to use "HD audio" in PaulStretch. "HD audio", lol.

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #40
Anyone??
I can't even get the original one to work anymore.

I've the flac.exe and metaflac.exe in the same folder as fbits.cmd.

Is there anyone who can start from scratch who doesn't assume everyone who uses it will know automatically what to do?
Not everyone is advanced in batch/command scripting.
I like to use "HD audio" in PaulStretch. "HD audio", lol.

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #41
It's not clear what you're asking for. You just want the original to work? Still works for me on the command line. I am using the original one provided here.

For one file in somefolder:
Code: [Select]
fbits "\somefolder\some FLAC file.flac"


For all files starting with "Don" in somefolder
Code: [Select]
fbits "\somefolder\Don*.flac


This isn't working for you?

Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #42
Batch files require some special care when dealing with variables that hold special characters like parenthesis or percentage sign. The attached fbits script is modified to handle files and dirs with these characters properly. It also recursively scans all FLAC files in a directory if you pass it a directory. And it pauses at the end automatically so it's directly suitable for drag & drop use. If you prefer to use it from the command prompt remove the "pause" near the end.
[attachment=8138:fbits2.zip]

Re: Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #43
The script fails to detect whether files have been upconverted from 16 bits to 24 bits if dither is used. Is there any way to circumvent this and modify the script in order to bypass this dither masking files as actual 24 bits files?

Please, this is important. There are some files I really need to know whether they were upconverted.

Re: Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #44
Quote
Is there any way to circumvent this
I don't know anything about the script but I assume the script isn't the problem...   If there is non-zero data in all 24-bits there's no way to know if the 8 least significant bits contain original data or un-original data.  

If it's "cleanly" upsampled every sample will have zeros in 8 of the 24-bits.     But all it takes is something like a 0.1dB level reduction (or increase) and all of those bits get filled-in.  Or you could re-sample to a higher sample rate.   You don't have to dither or use any complicated tricks.   

I've played-around with some of these tools in the past and they were easy to fool and I recently downloaded Bitter (which I tried in Audacity).     MP3s from ripped CDs show about 30-bits (which is true depending on the MP3 decoder).

Re: Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #45
I've played-around with some of these tools in the past and they were easy to fool and I recently downloaded Bitter (which I tried in Audacity).     MP3s from ripped CDs show about 30-bits (which is true depending on the MP3 decoder).
bitter can't even survive simple dithering, let alone mp3.
https://hydrogenaud.io/index.php?topic=114816.msg992983#msg992983
My software cannot survive lossy compression either, but for basic operations like volume adjustment and dithering, it works.

Re: Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #46
"Simple" dithering alone without a volume adjustment will fill in bars 22-24, and 17-21 will show less frequency. If the noise shaping is moderate it is even possible to recover the original 16-bit values for something like a compressed SPDIF signal. None of these tools can survive someone intentionally fooling them. Integrated into an audio editor, they are convenient to use to discover accidental problems within the signal chain.

Re: Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #47
I've played-around with some of these tools in the past and they were easy to fool and I recently downloaded Bitter (which I tried in Audacity).     MP3s from ripped CDs show about 30-bits (which is true depending on the MP3 decoder).
bitter can't even survive simple dithering, let alone mp3.
https://hydrogenaud.io/index.php?topic=114816.msg992983#msg992983
My software cannot survive lossy compression either, but for basic operations like volume adjustment and dithering, it works.
...and here are some examples of my software scanning some MQA files:
https://www.audiosciencereview.com/forum/index.php?threads/usb-dac-that-shows-bit-depth-on-display.23349/post-781422
The software doesn't really know what MQA is. For this specific purpose, mansr's mqascan tool should be used.

But then something as simple as playing a 16-bit file and re-digitize the analog output at 24-bit is good enough to hide everything, and I wonder how someone can determine the "true" bit-depth of tracker music or wavetable synthesizer with 4MB of PCM ROM :D

Re: Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #48
With a rompler, you would talk about the quality of each sample, if it hisses, clicks while looping or otherwise distorts. A sample can be played quietly where its problems don't stand out, but the mix then requires more bits. A wavetable synthesizer has a mixing bit depth. For example the old SYXG-50 drivers were 13 bits and hissed noticeably with tonal sounds like solo piano.

If you took an MP3 file and re-digitized it, a spectrogram would show where the encoder has preserve the original noise floor. If the noise of a given file is always high, then the bit depth can be reduced without any practical loss, without investigating how the noise came to be there.

Re: Detecting whether a 24-bit file has been upconverted from 16-bit?

Reply #49
But how about S-YXG50 vs MU50 vs DB50XG? I don't have any hardware XG synth but I have a Roland SC-D70 and SC-VA.

https://forums.cockos.com/showpost.php?p=1861656&postcount=11

Some people also said the "PCM" ROM of these Roland synthesizers involved lossy compression, but then there is no way to know apart from hacking and dumping the ROM data with detailed analysis.

Don't know if those old XG hardware have decent analog output or not, otherwise there is no way to know if the noise is more related to digital or analog. For a daughterboard it is more related to the noise floor of the soundcard I suppose?

At the end the whole thing is more like ENOB.