PDA

View Full Version : Reducing the Sample Rates of FLAC files (DAC related question)



mandryka
2017-09-09, 08:25
Hello everyone

First, I want to say I'm sorry if this isn't the right forum for this type of question.

I have just bought a new DAC, a Museatec IDAT 44. I'm planning to use it to play files streamed through a Squeezebox Classic 2. But I've hit a problem.

The DAC can deal with files ripped with a sample rate of 44.1KHz, but there's is very bad distortion if the sample rate is 48KHz. Most of my files seem to be at the smaller sample rate, but worryingly I've found quite a few at 48KHz.

My question is, is there any way I can search my file system by the sample rate of the files? And then convert then to a lower rate?

I'm using Windows 10.

Howard

drmatt
2017-09-09, 08:44
Easiest is to tell LMS to resample for you on the fly. Very unusual DAC that can't do 48k these days though, even a Chromecast can do anything up to 24b/96k..


Transcoded from Matt's brain by Tapatalk

mandryka
2017-09-09, 09:04
That's fabulous if there's a simple way, but what do I do? Do I need to install a plugin or change a setting?

The DAC is outstandingly good, that's why I'm so keen to find a way. I was really surprised at how big a difference it made.

Apesbrain
2017-09-09, 10:09
Create a text file with the contents below and save it as "custom-convert.conf" (note no .TXT at end). Replace "00.00.00.00.00.00" with the MAC address of the Squeezebox connected to your new DAC; you can get this on the "Settings" > "Information" page of LMS web GUI. Put the file in the same folder on your server where "convert.conf" is located. Restart server and test one of your 48kHz files.



flc flc * 00.00.00.00.00.00
# FT:{START=--skip=%t}U:{END=--until=%v}
[flac] -dcs $START$ $END$ -- $FILE$ | [sox] -q -t wav - -t flac -C 0 -r 44100 -

mandryka
2017-09-09, 12:44
Thank you for these clear instructions. It has worked. I can now play 48 KHz :D

However as soon as one problem gets solved another surfaces. I now find there are files which are sampled at 96 kHz and 24 bits, and they won't play!

Is there some code for them?

mandryka
2017-09-09, 12:58
In this discussion

http://forums.slimdevices.com/archive/index.php/t-81252.html

I found this code


flc flc * 00:00:00:00:00:1f
# FT:{START=--skip=%t}U:{END=--until=%v}
[flac] -dcs $START$ $END$ -- $FILE$ | [sox] -q -t wav - -t flac -C 0 -b 16 -r 44.1k -

-- before I make the change it would be nice if someone would confirm, and should I make a separate conf file?

Apesbrain
2017-09-09, 12:58
Is there some code for them?
Should convert all FLAC sent to that Squeezebox to 16/44:


flc flc * 00.00.00.00.00.00
# FT:{START=--skip=%t}U:{END=--until=%v}
[flac] -dcs $START$ $END$ -- $FILE$ | [sox] -q -t wav - -t flac -C 0 -b 16 -r 44100 -

Just edit the custom-convert.conf file you already have working to add the extra "-b 16". Remember to restart your server.

For security sake, I'd suggest editing your post above to remove the MAC address.

mandryka
2017-09-09, 13:37
Thanks so much, but as before a new problem has come up. I still can't play some files because the bit rate is 4608 kbps. The ones that play are at 1411 kbps.

I'm keeping my fingers crossed that there's another parameter I can change!

drmatt
2017-09-09, 23:22
Do they contain more than two channels?


Transcoded from Matt's brain by Tapatalk

mandryka
2017-09-10, 00:14
Do they contain more than two channels?


Transcoded from Matt's brain by Tapatalk

No

mandryka
2017-09-10, 00:23
Here are the audio properties of one of the files which won't play


Artist Stephen Farr
Title Kyrie, Gott Vater in Ewigkeit, BWV 672
Album J.S. Bach: Clavier-Übung III
Track 5
Disc
Genre Classique
Year 2013
Rating
Composer Johann Sebastian Bach
Size 28.25 MB (55% Compressed)
Original Size 62.4 MB
Length 1 minute 53 seconds
Channels 2 (stereo)
Sample Rate 96 KHz{CR}
Sample Size 24 bit
Bit Rate 4,608 kbps (DVD)
Encoder FLAC reference libFLAC 1.3.1 20141125
Encoder Settings
Audio Quality Perfect (Lossless)
Contains CRC, ID Tag [Vorbis Comments]
Channel Mapping
File 05. Kyrie, Gott Vater in Ewigkeit, BWV 672
Type VLC media file (.flac) [.flac]

And one of the files which will play


Artist Gustav Leonhardt
Title 01 1. C-dur, BWV 870
Album J.S. Bach WTC 2 CD 1 (SACD)
Track 1
Disc 1
Genre Classical
Year 1973
Rating
Composer Johann Sebastian Bach
Size 26.2 MB (41% Compressed)
Original Size 43.99 MB
Length 4 minutes 21 seconds
Channels 2 (stereo)
Sample Rate 44.1 KHz{CR}
Sample Size 16 bit
Bit Rate 1,411 kbps
Encoder FLAC reference libFLAC 1.2.1 20070917
Encoder Settings
Audio Quality Perfect (Lossless)
Contains Album Art, CRC, ID Tag [Vorbis Comments]
Channel Mapping
File 01 Gustav Leonhardt SACD - Dur BWV 870
Type VLC media file (.flac) [.flac]

drmatt
2017-09-10, 01:28
So Sox is refusing to convert it? What's the CPU you are asking to do this downsample job?


Transcoded from Matt's brain by Tapatalk

mandryka
2017-09-10, 01:59
AMD E-350 Processor

bpa
2017-09-10, 02:04
I think LMS will be trying to resample the stream from 96Khz to 48Khz (as that is max for Sb2) which means it will be applying the "flc flc transcode *" rule and not the "flc flc * *" rule.

You need to add a "flc flc transcode 00:00:00:00:00" simialr to your your "flc flc * 00:00:00:00:00" rule.

To be sure you understand and can see what is really happening enable logging player.source to INFO.

mandryka
2017-09-10, 02:16
I think LMS will be trying to resample the stream from 96Khz to 48Khz (as that is max for Sb2) which means it will be applying the "flc flc transcode *" rule and not the "flc flc * *" rule.

You need to add a "flc flc transcode 00:00:00:00:00" simialr to your your "flc flc * 00:00:00:00:00" rule.

To be sure you understand and can see what is really happening enable logging player.source to INFO.

Thanks for thinking about this.

So should I delete my existing conf file and replace it with this?




flc flc transcode 00:00:00:00:00
# FT:{START=--skip=%t}U:{END=--until=%v}
[flac] -dcs $START$ $END$ -- $FILE$ | [sox] -q -t wav - -t flac -C 0 -b 16 -r 44100 -


And how do I enable logging player.source to INFO?

bpa
2017-09-10, 02:51
Thanks for thinking about this.

So should I delete my existing conf file and replace it with this?
No it should be in addition to the existing "Flc flc " in your custom-convert.conf




flc flc transcode 00:00:00:00:00
# FT:{START=--skip=%t}U:{END=--until=%v}
[flac] -dcs $START$ $END$ -- $FILE$ | [sox] -q -t wav - -t flac -C 0 -b 16 -r 44100 -


Looks OK but I haven't double checked. Rememebr the MAC addres is the address of your player not 00:00...


And how do I enable logging player.source to INFO?

WebUI Settings/Advanced/Logging

mandryka
2017-09-10, 04:26
No it should be in addition to the existing "Flc flc " in your custom-convert.conf




flc flc transcode 00:00:00:00:00
# FT:{START=--skip=%t}U:{END=--until=%v}
[flac] -dcs $START$ $END$ -- $FILE$ | [sox] -q -t wav - -t flac -C 0 -b 16 -r 44100 -


Looks OK but I haven't double checked. Rememebr the MAC addres is the address of your player not 00:00...



WebUI Settings/Advanced/Logging

Well I don't know if this is what you meant, but replacing the file with this doesn't solve the problem.




flc flc * 00:00:00:00:00:00
# FT:{START=--skip=%t}U:{END=--until=%v}
[flac] -dcs $START$ $END$ -- $FILE$ | [sox] -q -t wav - -t flac -C 0 -b 16 -r 44100 -

flc flc transcode * 00:00:00:00:00:00
# FT:{START=--skip=%t}U:{END=--until=%v}
[flac] -dcs $START$ $END$ -- $FILE$ | [sox] -q -t wav - -t flac -C 0 -b 16 -r 44100 -

bpa
2017-09-10, 05:10
The "00:00:00:00:00:00" must match the MAC address of your player - it is on the label of your SB2 playter. The rule will only apply to players whose MAC address matches.

IIRC The address 00:00:00:00:00:00 is technically invalid but many users of softplayers will use it incorrectly.

Apesbrain
2017-09-10, 05:19
The "00:00:00:00:00:00" must match the MAC address of your player...
And the code OP pasted above has an extraneous "*" in the "transcode" line.

mandryka
2017-09-10, 05:24
And the code OP pasted above has an extraneous "*" in the "transcode" line.

I've left the * in there, it is working to transcode down to a sample rate of 44.1 kHz. As far as I can see the problem is only with files with a bit rate of 4,608 kHz

It has the correct MAC address!

bpa
2017-09-10, 05:25
And the code OP pasted above has an extraneous "*" in the "transcode" line.

Well spotted - the prbable cause. I hope the 00:00:00:00:00:00 is just an example and the user has in fact been using the proper MAC address in the original 48Khz to 44.1Khz resampling - otherwise something else is happening.

mandryka
2017-09-10, 06:05
Well spotted - the prbable cause. I hope the 00:00:00:00:00:00 is just an example and the user has in fact been using the proper MAC address in the original 48Khz to 44.1Khz resampling - otherwise something else is happening.

You need the star

bpa
2017-09-10, 06:10
You need the star

If you have the asterisk after "transcode" then the MAC address is ignored and so it will apply to all Flac streams on ALL your players not just the one with the Museatec IDAT 44 .