Skip to content

Commit

Permalink
Merge pull request #27 from braheezy/warn-high-bitrates
Browse files Browse the repository at this point in the history
feat: Warn about high bitrates for lossless encodings
  • Loading branch information
braheezy authored Apr 13, 2024
2 parents 3dad9b2 + d96942b commit ffd9763
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions cmd/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,16 @@ func convertAudio(inputFile, outputFile string) {
numSamples,
)

logger.Debug(inputFile, "channels", pcmBuffer.Format.NumChannels, "samplerate(hz)", pcmBuffer.Format.SampleRate, "samples/channel", numSamples, "size", formatSize(len(inputData)))
logger.Debug(
inputFile,
"channels", pcmBuffer.Format.NumChannels,
"samplerate(hz)", pcmBuffer.Format.SampleRate,
"samples/channel", numSamples,
"bit depth", wavDecoder.SampleBitDepth(),
"size", formatSize(len(inputData)))
if wavDecoder.SampleBitDepth() > 16 {
logger.Warn("Bit depth is greater than 16, this may result in loss of precision and sound quality!")
}
case ".mp3":
decodedData, q = decodeMp3(&inputData, inputFile)
case ".ogg":
Expand Down Expand Up @@ -192,7 +201,17 @@ func convertAudio(inputFile, outputFile string) {
uint32(numSamples),
)

logger.Debug(inputFile, "channels", flacMetadata.NChannels, "samplerate(hz)", flacMetadata.SampleRate, "samples/channel", numSamples, "size", formatSize(len(inputData)))
logger.Debug(
inputFile,
"channels", flacMetadata.NChannels,
"samplerate(hz)", flacMetadata.SampleRate,
"samples/channel", numSamples,
"bit depth", flacMetadata.BitsPerSample,
"size", formatSize(len(inputData)),
)
if flacMetadata.BitsPerSample > 16 {
logger.Warn("Bit depth is greater than 16, this may result in loss of precision and sound quality!")
}
}

outExt := filepath.Ext(outputFile)
Expand Down

0 comments on commit ffd9763

Please sign in to comment.