> I have been thinking of sending PCM to my Touch in stead of FLAC from
> the brutefir plugin, but this may not be straight forward.
It *should* be straight forward.
You need to create a template-pcm.conf file in the plugin directory, based on
template-flac.conf, then you can switch between flac and pcm streaming using the
plugin menu. That file defines the conversion pipeline for each file type. For
flac streaming it is:
1. use sox to convert whatever input file to "wavpcm". this is the one specific
variant of wav files which is understood by....
2. brutefirwrapper, which also outputs a wav stream.
3. use flac to convert the wav stream to a flac stream
You need to change step 3 of each pipeline to convert the wav stream to a pcm
stream. I'm sure that sox can do it.... somehow.
Having said that, I strongly suspect it wont objectively make a difference.
There have been posts on the slimdevices forum (which I cant find right now :-(
measuring less than -80dB difference between streaming flac and pcm using audio
diff maker.
--
Toby Dickenson
Yes, I've read many of Phil Leighs posts and agree with most of what he says - but not all. The main reason I want to try PCM streaming is that I still have some clicking while playing 88 and 96 material via the Touch to a HRT music streamer II connected to the USB port. The HRT works asynchronous with the Touch (with some changes to config in the Touch). I have no clicking if I disable Brutefir and also no problems with Brutefir using any of the internal devices of the Touch. Firmware is 7.5.3-r9283
So I want to see if skipping FLAC decoding on the Touch changes og stops the clicking. I can also hear a small improvement in sound quality when Touch receive PCM from the server. Olav
Clicking within the track. I am running 7.5.3 now to test on "production" firmware. I also normally run 7.6*. I'll switch back to 7.6 this evening to test.
I would prefer a mod to Toby's wrapper if that is OK with you. Would be easier to test I believe?
> So would I, but I've looked at Toby's wrapper and the way he handles
> arguments to brutefirwrapper (3 args for older version, 2 args for newer
> players) makes it very difficult for me to modify it without the risk of
> breaking things, or writing ugly code. I'm not that strong a coder
> anyway...
Supporting both argument formats was handy during the transition period when
this was introduced a few years ago, but Im sure it can drop support for the 3
arg version now. I will tidy this up....
If possible I would like to merge the capabilities of brutecat into
brutefirwrapper, so we are all working from the same wrapper script. What is
needed?
1. optional pcm output format.
2. option to use pregenerated drc configuration files for different sample rates,
rather than automatically resample the filter.
3. brutecat doesnt have the tail merging feature, which reduces its latency. I
could get brutefirwrapper to support this option, but would prefer to keep it
simple if brutefirwrapper's latency is now low enough that this is no longer
necessary.
> # convert flc to pcm for hall (wired connection)
> flc pcm * 00:04:20:xx:xx:xx
> # IFT:{START=trim %t}D:{RESAMPLE=-r %d}
> [sox] -q --buffer 65536 -t flac $FILE$ -t wavpcm -c 2 -3 -s
> $RESAMPLE$ - $START$ |
> [brutecat] -m 00:04:20:xx:xx:x
> -f /etc/squeezeboxserver/BrutefirDrc/filters/hall_eq -o pcm
How does squeezeboxserver know whether you are output is 16 bit or 24 bit
samples in this case?
> Do you know how I can upload my wrapper to Google Groups? I'm ready to
> send you something.
How about I add you to the sourceforge project and you push the git repo
directly?
--
Toby Dickenson
One big difference when using brutefir is that your HRT music streamer will
always be receiving 24 bit samples. I have been meaning to implement a 16 bit
output option for a while, to save wireless bandwidth to the player in the
kitchen which occasionally has dropouts.....
> So I want to see if skipping FLAC decoding on the Touch changes og
> stops the clicking.
That makes sense too.
--
Toby Dickenson
Supporting both argument formats was handy during the transition period when this was introduced a few years ago, but Im sure it can drop support for the 3 arg version now. I will tidy this up.... If possible I would like to merge the capabilities of brutecat into brutefirwrapper, so we are all working from the same wrapper script. What is needed?
1. optional pcm output format.
2. option to use pregenerated drc configuration files for different sample rates, rather than automatically resample the filter.
3. brutecat doesnt have the tail merging feature, which reduces its latency. I could get brutefirwrapper to support this option, but would prefer to keep it simple if brutefirwrapper's latency is now low enough that this is no longer necessary.
> # convert flc to pcm for hall (wired connection) > flc pcm * 00:04:20:xx:xx:xx > # IFT:{START=trim %t}D:{RESAMPLE=-r %d} > [sox] -q --buffer 65536 -t flac $FILE$ -t wavpcm -c 2 -3 -s > $RESAMPLE$ - $START$ | > [brutecat] -m 00:04:20:xx:xx:x > -f /etc/squeezeboxserver/BrutefirDrc/filters/hall_eq -o pcm How does squeezeboxserver know whether you are output is 16 bit or 24 bit samples in this case?
> Do you know how I can upload my wrapper to Google Groups? I'm ready to > send you something. How about I add you to the sourceforge project and you push the git repo directly?
This is now implemented. brutefirwrapper still supports the two-argument format
command line as recent versions, but now also supports the same switches are
brutecat.
If replacing brutecat you now *need* to provide a player id (usually mac
address) using the -c command line switch. This is required for the tail mix
functionality.
>> have been meaning to implement a 16 bit
>> output option for a while, to save wireless bandwidth to the player in the
>> kitchen which occasionally has dropouts....
brutefirwrapper now supports 16 and 24 bit output streams, selected using
brutefir's configuration file. 16 bit output uses less than half the bandwidth,
which is still not enough to fix my occasional dropouts :-(
> > 1. optional pcm output format.
>
> Yes, esp. now that Olav says he can hear a difference.
> > How does squeezeboxserver know whether you are output is 16 bit or 24 bit
> > samples in this case?
>
> Great catch. Since I did not want to truncate brutefir output, it was
> mandatory to have all flacs converted to 24-bit. Space-wise in flac it
> does not take up anything. I figured that if I'm fanatic enough to
> resort to raw pcm playback, why limit to 16-bit? My ripper outputs to
> 24-bits automatically, and I have a batch converter too.
In a quick test it seems squeezeboxserver assumes that a pipeline with a pcm
output stream uses the same sample size as its input stream. So I guess you
never listen to internet radio either.
This is inconvenient for the current brutefir conversion pipeline setup. We use
sox to normalise the input stream, so brutefirwrapper cant know what output it
is supposed to produce.
Anyway, brutefirwrapper now supports the "-o pcm" switch which always produces
pcm output of fixed sample size. This should fill Mervin's and Olav's use cases
(but please check on very low volume first), but I cant recommend this as a
general purpose audiophile option since it can easily produce white noise if
the input sample size is different to your configured output sample size.
> > 2. option to use pregenerated drc configuration files for different
> > sample rates, rather than automatically resample the filter.
>
> Nice to have, but lowish priority. A possible strategy that doesn't
> break things:
>
> if IS_DIR(brutefir_filter):
> look for pre-built filters under 44100/brutefir_filter, etc, etc
> else:
> do as before
I have implemented this by performing a search/replace for "SAMPLERATE" in the
filter file name. So for compatibility with brutecat's pregenerated filters you
would also need to change "-f /path/to/my/filter" to
"-f /path/to/my/filterSAMPLERATE" if your filters are named
/path/to/my/filter44100 etc.
> > How about I add you to the sourceforge project and you push the git repo
> > directly?
>
> I'm mer...@sourceforge.net,
Now added.
> but please be aware I am completely new to
> git, so don't hesitate to caution me if I'm doing things that may mess
> up the repository.
Me too. Everything I know about git came from
http://gweezlebur.com/2009/01/19/my-git-workflow.html
In particular the workflow described as "I don’t usually take much advantage of
the power of Git"....
> Thanks for all your good work on this project. More users should be
> enjoying brutefir/ brutefirdrc. It adds $000s to my listening pleasure.
Thanks,
--
Toby Dickenson
> > How does squeezeboxserver know whether you are output is 16 bit or 24 bit > > samples in this case? > > Great catch. Since I did not want to truncate brutefir output, it was > mandatory to have all flacs converted to 24-bit. Space-wise in flac it > does not take up anything. I figured that if I'm fanatic enough to > resort to raw pcm playback, why limit to 16-bit? My ripper outputs to > 24-bits automatically, and I have a batch converter too. In a quick test it seems squeezeboxserver assumes that a pipeline with a pcm output stream uses the same sample size as its input stream. So I guess you never listen to internet radio either.
I only use pcm output for flac, and so far the stations I tune to use mpeg, which I send out as flac.
This is inconvenient for the current brutefir conversion pipeline setup. We use sox to normalise the input stream, so brutefirwrapper cant know what output it is supposed to produce. Anyway, brutefirwrapper now supports the "-o pcm" switch which always produces pcm output of fixed sample size. This should fill Mervin's and Olav's use cases (but please check on very low volume first), but I cant recommend this as a general purpose audiophile option since it can easily produce white noise if the input sample size is different to your configured output sample size.
Yes, I've been caught by this enough times! Safeguard @ line 104, until I get going on git:
if bitspersample==16:
in_format = format_16le()
+ if opts.stream_format=='pcm':
+ sys.exit('%d bit samples are not supported for pcm output'%(bitspersample,))
elif bitspersample==24:
in_format = format_24le()
If I am right about this then....
> This would work in conjunction with sox *not* forcing the .flac to
> 24-bits for pipelines that will output to pcm. If the source is 16-bit,
> it converts to 16-wav, which then gets caught by the code above.
...this is part of the full solution for pcm streams! brutefirwrapper needs to
patch the brutefir configuration file to ensure that sample sizes match up, the
same way it does for sample rates.
--
Toby Dickenson
It sounds perfectly gapless to me (sb3, 44.1kHz)
You can hear something odd at the track transition if using replaygain when
consecutive tracks have different gain values, but I doubt that applies to you.
http://bugs.slimdevices.com/show_bug.cgi?id=9993
Can you post your /var/log/squeezeboxserver/brutefir.log?
--
Toby Dickenson
>>> squeezeboxserver assumes that a
>>> pipeline with a pcm output stream uses the same sample
>>> size as its input stream
This change now uses the same sample size throughout the pipeline, with
brutefirwrapper patching the brutefir configuration file to use 16 or 24 bit
inputs and outputs to match the source stream.
For 16 bit source material this will now be streaming 16 bit samples to the
player (with dithering applied by brutefir). In comparison, when streaming flac
we always send 24 bit samples to the player.
Example configurations are in template-pcm.conf, and you should be able to
select this through the plugin's menu on the player.
If it works right, this should never produce white noise. But for now please
treat this as a beta-quality feature and assume that it might.
--
Toby Dickenson
Do you mean that you get this error when playing a wav file, or when streaming
in wav format?
> "/usr/
> share/squeezeboxserver/Bin/i386-linux/sox FAIL formats: can't open
> input `-': WAVE: RIFF header not found" and then the Touch displays
> "Cannot open file for..."
--
Toby Dickenson
On Mar 4, 9:10 am, Toby Dickenson <t...@tarind.com> wrote:
> On Friday 04 Mar 2011, Olav Sunde wrote:
>
> > Seems to work fine with FLAC, but I get this error with WAV:
>
> Do you mean that you get this error when playing a wav file, or when streaming
> in wav format?
This is when playing a wav file with the new pcm convert.conf
settings.
What does `which sox` show? I presume /usr/bin/sox
Is it the same if running
/usr/share/squeezeboxserver/Bin/i386-linux/sox
?
--
Toby Dickenson
try:
/usr/share/squeezeboxserver/Bin/i386-linux/sox -t wav 2444.wav -t wavpcm -c 2
-s 2444.pcm
--
Toby Dickenson
> [11-03-08 16:10:51.5153] Slim::Player::Source::_readNextChunk (348)
> Didn't stream any bytes for this song; mark it as failed
squeezeboxserver did not receive any bytes out of our pipeline. But we knew
that anyway....
On Friday 04 Mar 2011, Olav Sunde wrote:
> In brutefir.log I also get this:
> ======== brutefirwrapper rev 9 starting at 1299185884 2011-03-03
> 20:58:04
> Input to brutefirwapper too short (0 bytes)
brutefirwrapper did not receive any bytes from the previous stage in the
pipeline, which is sox. But that, in isolation, works fine so I'm not sure
where to look next.
> > /usr/share/squeezeboxserver/Bin/i386-linux/sox -t wav 2444.wav -t wavpcm
> > -c 2 -s 2444.pcm
>
> Works fine.
I havent had a chance to try to reproduce this on my system yet..... maybe
this weekend.
--
Toby Dickenson
wav pcm * $CLIENT_MAC_ADDRESS$
# IFT:{START=trim %t}D:{RESAMPLE=-r %d}
[sox] -q -t wav $FILE$ -t wavpcm -c 2 -s $RESAMPLE$ - $START$ |
[brutefirwrapper] -o pcm --copy-sample-format $CLIENT_MAC_ADDRESS$
$FULL_FILTER_PATH$
We can transparently capture the input to this pipeline by changing this to:
wav pcm * $CLIENT_MAC_ADDRESS$
# IFT:{START=trim %t}D:{RESAMPLE=-r %d}
tee /tmp/input.wav | [sox] -q -t wav $FILE$ -t wavpcm -c 2 -s $RESAMPLE$ -
$START$ | [brutefirwrapper] -o pcm --copy-sample-format $CLIENT_MAC_ADDRESS$
$FULL_FILTER_PATH$
But after starting to play a wav track, /tmp/input.wav is definitely not a
valid wav file. So sox is quite right in aborting without providing any output.
This is definitely a squeezeboxserver bug (squeezeboxserver 7.4.2).
--
Toby Dickenson
It looks like squeezeboxserver is incorrectly seeking past the wav header in
the wav input stream. I have just pushed a workaround for this bug which
involves indicating that this transcoding pipeline can not handle input
streams on stdin. squeezeboxserver gives our pipeline a filename for the wav
file, and we read the file directly.
I dont think this will break anything: Internet radio with wav streams maybe,
but they do not exist.
--
Toby Dickenson
Thanks.
--
Toby Dickenson
> I think there is a problem with track transitions when streaming PCM.
> I hear noise for a couple of seconds mixed with music while changing
> to the next track. Noise is a bit like white noise and is around 10 dB
> down relative to the music. This is when playing an album. 16 an 24bit
> is the same. I first heard it through an external DA converter
> connected via S/PDIF, but it is also present when using the analog
> outs of the Touch.
I would like to think this has the same cause as the "double-take" problem
reported by Mervin. I have not forgotten about the problem, but have only had
a little time to look into it. So far everything has checked out.....
Mervin only hears this on some tracks, and only with linear phase (high
latency) filters. I think that is more to do with the latency making the
problem more or less audible on different tracks (indicating that the problem
depends on the musical signal) rather than there being a problem with linear
phase filters per se.
I can hear the problem in the transition between a pair of tracks which Mervin
sent, but in general do not notice a problem in other music.
Does that sound similar to your problem?
--
Toby Dickenson
When streaming as flac, the output of brutefirwrapper is a wav stream which is
piped into the "flac" binary for encoding. In most cases this does the right
thing, but not always. Sometimes it drops a few samples, as Mervin found here.
Sometimes it adds several minutes of silence to the end of the stream. Ive
seen that two or three times previously over the last year - I need to
manually skip to the next track to resume the music, and had always assumed it
was a squeeboxserver bug. Apparently not.
I suspect the problem occurs because our output stream's wav header indicates
that the stream is infinite length, and we rely on the flac program noticing the
EOF. Indeed flac would be producing a relatively helpful error message which
indicates it might not properly handle this case, except for the
--totally-silent command line option we had been giving it :-(
Switching to sox for encoding seems to make the problem go away.
--
Toby Dickenson