Discussion:
Upsampling Impressions
JohnSwenson
2013-07-01 02:29:52 UTC
Permalink
In recent versions of CSOS Triode and JackOfAll have added upsampling
capabilities to Squeezelite (at my request). I wanted to start a thread
here for discussing sonic differences people hear between no upsampling
and different upsampling parameters.

I'm also going to give some history of my involvement with DAC
interpolation filters and why I wanted to do this in the first place.

First off this is NOT about bit perfectness, upsampling changes bits! It
is supposed to! There is a real measurable difference in the waveforms,
this is about how you think those changes affect the sound.

First a quick refresher on what this is all about. When a DAC outputs a
signal there are "aliases" above the half Nyquist frequency, these
aliases can inter-modulate with the audio signals to produce spurious
signals in the audio band which ARE audible. The reconstruction filter
is there to get rid of these aliases. With redbook source this is
difficult, the half Nyquist freequency is just barely above the audio
band. In early days this was done with anolog filters, but they really
messed up the sound. Then chip makers came up with using digital filters
to do this. These are called "interpolation" filters because they add
samples in between the original samples.

Every DAC chip manufacturer has used a different approach to these
filters. The metric of filter quality has been "how much does it
attenuate the aliases". At first they could get -60db, then it was
-90db, then -120db, these days there is big contest between DAC
manufacturers to see how far down below -130 they can get. But do you
really need to get down that far? The further down you go the more
computations need to take place. It takes more silicon and faster clock
speeds to do it.

Early on in the process the chip manufacturers realized that
implementing the filters using straight forward simple filters such as
the infamous "windowed sinc" (I'm NOT going to go into details on that
here, look it up if you want the details) would take far too much
silicon real estate and drive up the costs of their chips. So some
massive investigations started looking into how to get these extremely
high alias attenuations without using a pile of silicon. The result has
been some very complex digital filters where multiple filter types are
cascaded together. These do their job, they attenuate the aliases but
they seem to have some side affects.

I first noticed this when I started building my own DACs many years ago,
NOS DACs were coming into vouge so I decided to make my own. I was
startled. They sounded way better in many ways than the traditional ones
with the builtin digital filters, BUT they had the aliases which caused
other problems, I like to call this "dirty sound". So there was a
choice, clean, flat univolved sound, or dirty, alive and exciting sound.
Many people that liked the the NOS sound were convinced that digital
filters were evil and should be expunged from all things audiophile.

This then started one of my infamous journeys of exploration. I'm not
going to go into all the details here, but the upshot is that it's NOT
digital filers per se that are bad, it is those complex digital filters
used in the DAC chips that seem to be the culprit. If the filter
function is implemented by a simple filter (such as the infamous
windowed sinc) you can get the best of both worlds. Note that I really
don't have any idea exactly what it is about these complex digital
filters that humans don't like. I have built a DAC with DAC chips that
don't include digital filters (1704s) and have used an FPGA to implement
simple and complex filters that give roughly the same filter response,
and the simple filter sound vastly better. And I really do mean vastly,
it is NOT something barely distinguishable. Many people are not going to
believe this since they have spent their entire digital audio life
listening to music through these complex filters. And NOS DACs don't
really count since you are trading off one set of sonic issues for
another. Even the DAC chips with several filter curves don't really help
to hear this since all their filters are done with the complex filters.


So what does upsampling have to do with all this? There are quite a few
programs out there that can implement the interpolation filter using
simple filters, you can either run these real time or upsample the
source files so you don't need to run anything at play time. If you have
a NOS DAC you can use these to really hear what a simple filter can do,
you don't have to choose between the above listed issues. But even if
you don't have a NOS DAC, properly done external upsampling can make a
big difference. Many DACs use simpler filters (or NONE!) for the higher
sample rates so using external upsampling can frequently give you better
sound than filters in the chip. Note this is NOT about the asynchronous
sample rate converter (ASRC) chips used in some boxes, these do their
job using multiple complex filters that are even worse sounding than the
ones in DAC chips.

Above I talked about different filter curves, they do make a difference,
but the BIG difference is just getting rid of the complex filters, once
you do THAT then you can start playing with the other parameters.
Particularly if you are doing this with a DAC chip that already has a
digital filter (a non NOS DAC) the parameters that give the best sound
are going to be different than those for a different DAC. Since you are
overlaying the upsampling filter on top of the existing filter the
"best" one is going to be different depending on what that original
filter is.

SoX is a program that does it's upsampling using simple filters AND it
supports many different parameters. SB systems have been including SoX
for quite some time so it seemed like a good choice for doing upsampling
in CSOS. Not only is it good at it, but it has a library that could be
embedded directly into Squeezelite which is what Triode has done.
JackOfAll has implemented a web interface for specifying these
parameters which makes it easy to explore different parameters.

In the next post I'll cover what some of these parameters are and what I
have found sound good to me with my DACs (which of course may not be the
best for YOUR DAC).

John S.


------------------------------------------------------------------------
JohnSwenson's Profile: http://forums.slimdevices.com/member.php?userid=5974
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
Wombat
2013-07-01 03:27:11 UTC
Permalink
Many 44.1 material once was at a higher samplerate and there was already
once a choice what filter to apply. How can you know that a chosen
filter doesnŽt only do better because it fits more to the filter that
was applied before? I did read to much nonsense about magic filters over
the years.



Transporter (modded) -> RG142 -> Avantgarde Acoustic based 500VA
monoblocks -> Sommer SPK240 -> self-made speakers
------------------------------------------------------------------------
Wombat's Profile: http://forums.slimdevices.com/member.php?userid=4113
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
Archimago
2013-07-01 15:46:14 UTC
Permalink
Thanks for sharing John! I look forward to hearing your thoughts on
this. You've certainly got a lot of experience in this area so I'll
certainly be giving the suggestions a try listening (as you noted, this
isn't about bit-perfection but rather subjective experience).

Also, thanks for donating your time and experience with the
CommunitySqueeze project! Looking forward to the hardware design for
sure.



Archimago's Musings: (archimago.blogspot.com) A 'more objective'
audiophile blog.
------------------------------------------------------------------------
Archimago's Profile: http://forums.slimdevices.com/member.php?userid=2207
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
JohnSwenson
2013-07-02 21:56:34 UTC
Permalink
As promised here is post number two on external upsampling. This post is
going to focus on the upsampling capability recently included in
Squeezelite which is based on the SoX resampling code. These filters
can also be used offline with SoX, but the command line arguments for
SoX are very different, even if they are implementing the same thing.
I'm just going to go over the options for Squeezelite, if you want to
try SoX by itself, read the documentation for the filter arguments.

All of these adjustments you can make here are essentially "tweaks",
they are fine tuning the sound. The biggest improvement by far is just
geting out from under the complex filters in the DAC chip.

Before getting into details I want to talk about sample rate. The
filters in many DAC chips get simpler the higher up the sample rate is.
For example the chip I'm using in the CSP player has a very simple
filter at 176.4/192 and NO filter at 352.8/384. So in general you want
to upsample to the highest sample rate you can get to work reliably,
this will probably give you the best advantage from the upsampling. But
if at all possible keep it to an integer upsampling, for example
upsample 44.1 to 176.4 not 192. If your DAC doesn't do 176.4 but does do
192 and 88.2, you have a choice, upsample to 88.2 or 192, which is best
is going to be system dependant, try both and see which you prefer..

The current implementation in Squeezelite does upsampling to the
highest interger rate your DAC cupports. Thus if your DAC's maximum
rate is 192, it will upsample to 44.1 to 176.4. If your DAC does not
support 176.4, you can use the -r option (or max sample rate in the gui)
to set the max rate to 96, then squeezlite will upsample to 88.2. Even
upsampling to 88.2 will usually make a significant improvement. There
has been talk about giving the upsampling more flexibility so you could
choose 192 in this case.

The SoX resampling gives you several different parameters to adjust,
choosing the right one can be a daunting task so they came up with
what are usually called "recipes", predefined combinations of
parameters. These are good places to start your exploration. When you
give Squeezelite a set of paramters you first give a recipe, then you
can add modifiers that over ride the parameters in the recipe.

The upsampling "argumnt" consists of several fields separated by colons
(:). If there is nothing specified for a particular field the default
for the chosen recipe is used. There are up to 7 fields. If you are not
specifying any of the later fields you do not need to include all the
colons. Some examples:
abc first field only, all others default
abc:xyz first and second field, others default
abc:::def first and fourth fields, others default
:xyz:::def default first field, fourth field and others default

The first field is the basic recipe. It is special, it is made up of
three subfields, each specified by a letter.
The first letter is the "quality", it can be one of these characters:
v h m l q Note the fourth character is the lower case "ell".
These stand for "very high", "high", "medium", "low" and "q"

A word on these, the differences are not necessarily related to how they
sound, they refer to how far the aliases are attenuated (remember the
engineering community regards the alias attenuation as the primary
figure of merit for a filter). These primarily relate to how long the
filters are. All these filters work by performing calculations on a
series of samples in the file, the longer filters use more samples, the
shorter filters use fewer samples. The greater the alias attenuation
the longer the filter has to be. This CAN affect what you hear. Do not
just blindly use the "very high" setting, it may not be the best
sounding.

The second leter is the "phase". You have a choice of: L M I (that
is upper case "eye"). L is linear phase, M is minimum phase, I is
intermediate phase. There are LOTS of descriptions of what these are
out there on the web so I won't go into detail.

The third letter is: s It is either included or not. This specifies
a very steep filter curve. If the s is not included a slightly shallower
filter is used.

The deault is hL (no s). If a letter is left off the default is used.
Thus 'v' is the same as 'vL'. 's' is the same as 'hLs'. 'Ms' is the same
as 'hMs'.

All that just for the first field!

The second field contains flags. Nobody really knows what these do so
its safest to leave this field blank.

The third field is attenuation. It is possible that the upsampling can
clip on signals that are at or very close to maximum, this attenuates
the input so this clipping doesn't happen. The argument is a number,
which is the attenuation in db. Thus '6' is 6db of attenuation. The
defualt is '1', which is probably good most of the time.

The fourth field is "precision", it is the number of bits used in
calculations. We know that 20 and 28 are sometimes used depending on
other parameters, this over rides that and uses the value for
everything. I'm not sure if values other than 20 and 28 actually do
anything.

The next two fields let you tweak the filter curve, how steep it is and
where it starts. You specify a start frequency and a stop frequency.
This is done by a ratio of the Nyquist frequency, NOT an actual
frequency. Both parameters are in the range 0-100. Thus for a 44.1
input a start of 90 means starting to roll off at 19.845KHz. An end
(where the curve bottoms out) of 100 would be at 22.05KHz.

The fifth field is the end of the passband (or the point where the curve
starts falling)

The sixth field is the stop band start (or the point where the curve
bottoms out)

The seventh field is the phase. This lets you specify exactly what you
want the phase to be. 0 is minumum phase, 25 is intermediate phase and
50 is linear phase (these are equivalemt to the M, I and L defined
above). 100 is maximum phase, but that is not really used. The phase
relates to how much pre and post ringing there is. 0 has just post
ringing, 50 is equal amounts post and pre, 25 is in-between, 100 is all
pre-ringing.

When exploring options its probably a good idea to just limit yourself
to the first field at first. See if you can hear a difference between
very high, high, medium etc. Find the one you like the best then try
that with L M or I. The other I would recommend trying is the precision.
Try a variety of music with each setting.

So what do I like? I have not done a full test of all the parameters,
preliminary tests have led to :

mI:::28

I encourage you to do your own exploration, this seems to work well for
my DAC, but something else might sound best to YOU.

Have fun!

John S.


------------------------------------------------------------------------
JohnSwenson's Profile: http://forums.slimdevices.com/member.php?userid=5974
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
michaelvv
2013-07-03 06:40:29 UTC
Permalink
Hi John.

Thank you very much for your detailed information.

We're 3 persons here in Denmark, who now are using upsampling
with the squeezelite and sox library.

Very are all having different audio-gd DACS, and even they all have
a limitation on max 96Khz, I think we can all conclude that it does
something very interesting to the music.

I just have tried these settings "vL::1.5" , But after yours
explanation
I'll try to do some more experiment.

It's a little hard for me "lack of english skills" to describe what my
first impression was, but for sure I will go on using upsampling.

Have just tried to do the upsampling up to the 384Khz limit on
the SWAMP05 board, and how does it effect the load, stability on
the WAND-dual board.

I'm running on the newest squeezelite, kernel etc etc, has disabled
the cpu throttling, and the updatesd-f service, and now it's 100%
stable but I'm only capable of doing up to the 96Khz.

/Thanks a Lot Michael.


------------------------------------------------------------------------
michaelvv's Profile: http://forums.slimdevices.com/member.php?userid=59321
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
pippin
2013-07-06 19:29:48 UTC
Permalink
JohnSwenson wrote:
>
> Before getting into details I want to talk about sample rate. The
> filters in many DAC chips get simpler the higher up the sample rate is.
> For example the chip I'm using in the CSP player has a very simple
> filter at 176.4/192 and NO filter at 352.8/384.

So what you are saying is that if you use these kind of DACs with "real"
(that is: unfiltered) HD material like actual HD recordings you will
have all the aliasing down there in the audible band?
This means you have to actually run "real" HD material through a filter
to get a useful reproduction with this kind of DAC at all?



---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox
and
*New: Logitech UE Smart Radio* as well as iPeng Party, the free
Party-App,
at penguinlovesmusic.com
------------------------------------------------------------------------
pippin's Profile: http://forums.slimdevices.com/member.php?userid=13777
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
JohnSwenson
2013-07-07 07:19:16 UTC
Permalink
pippin wrote:
> So what you are saying is that if you use these kind of DACs with "real"
> (that is: unfiltered) HD material like actual HD recordings you will
> have all the aliasing down there in the audible band?
> This means you have to actually run "real" HD material through a filter
> to get a useful reproduction with this kind of DAC at all?
>
> Oh, and I did not fully understand what you mean with a "simple" vs. a
> "complex" filter. Interpolation will certainly lead to rather complex
> harmonics so from a purely signal theory POV I would find that way more
> complex than what you'd usually do in an anti-aliasing filter.

Let me see if I understand your first question. As long as the highest
frequency of the audio data is small relative to the sample rate (say
40KHz maximum signal frequency for a 192 sample rate) you do not need
much if any filtering. There are going to be very little aliasing and
its going to be above the audio range. The big problem comes with 44.1
where the audio data is right next to the aliases.

By a complex filter I mean multiple filters cascaded together
(especially different types of filters) rather than one filter (even if
it has a large number of taps). All of the DAC chips with filters have
at least three (some 4) different digital filters cascaded together.
They do this because the individual filters can be a fairly small number
of taps. To implement the same amount of alias suppression with a simple
single filter would take a lot more hardware.

Again I have no idea why the complex filters cause sonic issues, but it
does seem like they do. Every time I have replaced a complex filter with
a simple filter the resulting music sounds much better.

John S.


------------------------------------------------------------------------
JohnSwenson's Profile: http://forums.slimdevices.com/member.php?userid=5974
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
pippin
2013-07-07 11:00:10 UTC
Permalink
JohnSwenson wrote:
> Let me see if I understand your first question. As long as the highest
> frequency of the audio data is small relative to the sample rate (say
> 40KHz maximum signal frequency for a 192 sample rate) you do not need
> much if any filtering. There are going to be very little aliasing and
> its going to be above the audio range. The big problem comes with 44.1
> where the audio data is right next to the aliases.
>
But then you've got all these high frequencies still in there on the
analog side. Isn't the biggest problem with the high frequencies that
power amps (especially ones filtering through intermediate frequencies
like "Class D" amps) tend to create artifacts if you have signal in
multiples of the audible range?

>
> By a complex filter I mean multiple filters cascaded together
> (especially different types of filters) rather than one filter (even if
> it has a large number of taps). All of the DAC chips with filters have
> at least three (some 4) different digital filters cascaded together.
> They do this because the individual filters can be a fairly small number
> of taps. To implement the same amount of alias suppression with a simple
> single filter would take a lot more hardware.
>
> Again I have no idea why the complex filters cause sonic issues, but it
> does seem like they do. Every time I have replaced a complex filter with
> a simple filter the resulting music sounds much better.
>

What kind of filters do they use? I do know that kind of stuff for
analog filters where both the reason for their use and the negative
impact are quite obvious.

But then... like for the windowed sinc filter you mentioned even digital
filters are not perfectly discrete if you need finite impulse response
and linear phase so it makes sense that they will also flatten the
frequencies within your filter/below your cutoff frequency.
But isn't that the same for your interpolation filter in sox? Of course,
the interpolation filter doesn't window so it keeps all the harmonics in
there (and creates some arbitrary new ones) but why is that better than
leaving the simple harmonics of the 44.1 kHz samples in?
What kind of filters does sox use?



---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox
and
*New: Logitech UE Smart Radio* as well as iPeng Party, the free
Party-App,
at penguinlovesmusic.com
------------------------------------------------------------------------
pippin's Profile: http://forums.slimdevices.com/member.php?userid=13777
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
Wombat
2013-07-07 15:24:31 UTC
Permalink
Yeah sometiomes the aliasing doesnŽt matter if it fits the world of the
supporter, the next one will tell you it is evil. The same goes for
ringing, some will hear all kind of problems with ringing at even 192khz
others wonŽt. Advocats of dsd will never hear the problems caused by
shaping noise while others filter it out sharp.

I am pretty sure this is rarely a problem with the gear they use. People
will use what fits their wonderland.



Transporter (modded) -> RG142 -> Avantgarde Acoustic based 500VA
monoblocks -> Sommer SPK240 -> self-made speakers
------------------------------------------------------------------------
Wombat's Profile: http://forums.slimdevices.com/member.php?userid=4113
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
JohnSwenson
2013-07-08 02:42:52 UTC
Permalink
pippin wrote:
> But then you've got all these high frequencies still in there on the
> analog side. Isn't the biggest problem with the high frequencies that
> power amps (especially ones filtering through intermediate frequencies
> like "Class D" amps) tend to create artifacts if you have signal in
> multiples of the audible range?
>
>
>
> What kind of filters do they use? I do know that kind of stuff for
> analog filters where both the reason for their use and the negative
> impact are quite obvious.
>
> But then... like for the windowed sinc filter you mentioned even digital
> filters are not perfectly discrete if you need finite impulse response
> and linear phase so it makes sense that they will also flatten the
> frequencies within your filter/below your cutoff frequency.
> But isn't that the same for your interpolation filter in sox? Of course,
> the interpolation filter doesn't window so it keeps all the harmonics in
> there (and creates some arbitrary new ones) but why is that better than
> leaving the simple harmonics of the 44.1 kHz samples in?
> What kind of filters does sox use?

Hi Pippin,
very good questions BTW. It turns out that with high bit depth (24) and
high sample rates relative to the bandwidth of the signal the aliases
are very low in amplitude. If this was not true a digtal filter would
not work for this purpose at all. The amplitude of the alias is
determined by the "height" of the "stair step" in the signal. At 16/44.1
those stair steps can get pretty high. Very easy to see in a scope from
a NOS DAC. The filter adds steps in between the originals steps, because
of the increased samples and the increased bit depth the height of the
steps is much less, thus producing much lower amplitude aliases. Another
way to think of it is because the bandwidth of the signal has not
changed, the maximum amount of change for a given sample is also less,
thus the maximum possible height for a stair step is also decreased.

The reason to do the digital filtering at all is that for 16/44.1 the
stair steps are large, thus producing high amplitude aliases, and those
aliases are close to the audio band. There are two methods by which an
alias can cause an image in the audio band: intermodulate with signal,
or intermodulate with another alias. It turns out that the aliases
produced by a given signal are lower in amplitude than the original
signal, thus on average the intermodulation of aliases with signals is
going to produce higher amplitude images in the audio band that alises
intermodulating with other aliases. For example a 25KHz alias
intermodulating with a 15KHz signal (thus producing a 10KHz image) will
be greater in amplitude than the same 25KHz alias intermodulating with a
35KHz alias. They both exist, but the intermodulation with the signal
will usually produce a higher amplitude image.

Now let's look at what happens with the signal upsampled to 176.4, the
aliases start at 88.2. So lets look at what happens to a 90KHz alias.
First that alias is going to be much lower amplitude in the first place
(see the above) and the lowest frequency image it can produce from
intermodulating with signal is 70KHz, way above the audio band. Now you
certainly can get images in the audio band from aliases intermodulating
with other aliases, BUT because the aliases are so much lower in
amplitude, the image between two is going to be very low in amplitude.

The net result is that the images in the audio band are drastically
reduced (not completely eliminated) by the upsampling and filtering. A
high sample rate high bit depth original recording already has these
advantages built in.

Now the fun part is to do this filtering in such a way that it preserves
the flavor of the original recording.

John S.


------------------------------------------------------------------------
JohnSwenson's Profile: http://forums.slimdevices.com/member.php?userid=5974
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
pippin
2013-07-08 03:16:07 UTC
Permalink
Please excuse my ignorance on DAC design and related digital filtering.
While I do believe I understand the signal theory part and the way the
DACs fundamentally work I don't know a lot about how digital filters in
these things are actually implemented.

JohnSwenson wrote:
> The amplitude of the alias is determined by the "height" of the "stair
> step" in the signal.
>
Which "stair step"????
In the filter function?
I mean... there are no "stair steps" in the sampled signal itself
(unless you create artificial samples for oversampling which, of course,
are not "stair steps" but simply potentially wrong samples creating
harmonics....)

I know... all those hifi mags and high-end manufacturers always show
this stair-step graph over the sine wave but you and me know that's
nonsense and that sine wave in that example can actually be perfectly
reproduced from only two samples...

Now, here's what I don't get:
>
> The filter adds steps in between the originals steps, because of the
> increased samples and the increased bit depth the height of the steps is
> much less, thus producing much lower amplitude aliases.
>
But to do that, it needs to know _how_ to interpolate to get a "better"
interpolation value.
I mean.... in that nonsensical sine wave image from the hifi mags things
look easy, but in real life the wavform looks something like this
https://soundcloud.com/barbnerdy/lets-go-dancing-june-2013

So if your first sample has a value of, say, "50", and the second one
has a value of, say, "100", you have no way to say that "75" is a good
interpolation value. The "correct" value might as well be "4096" or "0",
unless you do a full spectral analysis over the resulting signal you
just can't know whether "75" is any better than just duplicating "50" so
a linear or logarithmic or whatever arithmetic interpolation will with
all likelihood just as bad and the chances for it improving your signal
are exactly the same as the chances for worsening it.
On average, you just add the same amount of noise as with simple
duplication.

Unless, of course, your interpolation filter _does_ some sort of
spectral analysis but then that's quite a task which is why I asked what
exactly sox is doing to interpolate...

>
> The reason to do the digital filtering at all is that for 16/44.1 the
> stair steps are large
>
But only due to oversampling, right?. I still don't get how that affects
NOS DACs.

I thought NOS DACs will have all the wrong excess signal beyond your
cutoff frequency still in there and you need to use analog filters to
get rid of it or rely on intermodulation filters in your power amp?

>
> Now let's look at what happens with the signal upsampled to 176.4, the
> aliases start at 88.2.
>
Ah... OK, so the idea here is that instead of having an alias above your
cutoff frequency you just get white or pink noise which can't
intermodulate with your actual signal?

The part I still don't understand is how the interpolation actually
reduces the aliasing. Because if it doesn't, wouldn't you just get the
same amount of aliasing in your upsampled signal as you would have in
any oversampled signal?

How does the interpolation filter do something else than the low-pass
you would usually use for anti-aliasing and still be effective?

Or does it just add more noise so that...
>
> Now the fun part is to do this filtering in such a way that it preserves
> the flavor of the original recording.
>



---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox
and
*New: Logitech UE Smart Radio* as well as iPeng Party, the free
Party-App,
at penguinlovesmusic.com
------------------------------------------------------------------------
pippin's Profile: http://forums.slimdevices.com/member.php?userid=13777
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
darrenyeats
2013-07-08 10:50:00 UTC
Permalink
John, I agree with Pippin that it's best to avoid the term "stair steps"
for digital audio as this is misleading. Samples are valid only for
moments in time.
Darren



Check it, add to it! http://www.dr.loudness-war.info/

http://www.amazon.co.uk/gp/richpub/listmania/byauthor/A3H57URKQB8AQO/ref=cm_pdp_content_listmania/203-7606506-5721503.

SB Touch
------------------------------------------------------------------------
darrenyeats's Profile: http://forums.slimdevices.com/member.php?userid=10799
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
flimflam
2013-07-08 17:51:32 UTC
Permalink
darrenyeats wrote:
> John, I agree with Pippin that it's best to avoid the term "stair steps"
> for digital audio as this is misleading. Each sample pertains to an
> instant ... between those instants is an analogue waveform that we are
> sampling or attempting to re-create.
> Darren

But what are the "steps" undertaken in re-creating the waveform? Clue:
it's not called a smoothing filter for nothing!


------------------------------------------------------------------------
flimflam's Profile: http://forums.slimdevices.com/member.php?userid=56891
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
pippin
2013-07-08 22:22:36 UTC
Permalink
flimflam wrote:
> But what are the "steps" undertaken in re-creating the waveform? Clue:
> it's not called a smoothing filter for nothing!

Yea. But that was my point. Unless you know exactly what your waveform
is you are just as likely to AMPLIFY your noise than to SMOOTH your
signal. To really be able to "smooth" you'd have to analyse the whole
signal spectrum and you'd have to do that over some time - ideally the
whole file(to know the dynamic range). But sox doesn't do that it just
looks at a few samples. For the same reason DACs don't do it: it would
introduce too much delay and require too much buffering and processing
power.

I mean... I can call everything a "smoothing" filter, I can also call
lead "grey gold". What it actually does is another story, though.



---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox
and
*New: Logitech UE Smart Radio* as well as iPeng Party, the free
Party-App,
at penguinlovesmusic.com
------------------------------------------------------------------------
pippin's Profile: http://forums.slimdevices.com/member.php?userid=13777
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
flimflam
2013-07-08 23:24:44 UTC
Permalink
pippin wrote:
> Yea. But that was my point. Unless you know exactly what your waveform
> is you are just as likely to AMPLIFY your noise than to SMOOTH your
> signal. To really be able to "smooth" you'd have to analyse the whole
> signal spectrum and you'd have to do that over some time - ideally the
> whole file(to know the dynamic range). But sox doesn't do that it just
> looks at a few samples. For the same reason DACs don't do it: it would
> introduce too much delay and require too much buffering and processing
> power.
>
> I mean... I can call everything a "smoothing" filter, I can also call
> lead "grey gold". What it actually does is another story, though.

Hi Pippin

You were asking about the algorithm used in digital interpolation
filters for up/oversampling.

I was talking about something else, the smoothing filter (aka
reconstruction, anti-imaging filter). This was in relation to your and
Darren's objection to the term stair steps. In practice, a DAC does not
attempt to recreate voltage impulses, instead it uses a zero-order hold
process - i.e. it does in fact output stair stepped voltages. The end
results is much the same, with quantisation error and infinite Nyquist
images, but with a deterministic roll-off. The smoothing filter is then
the low-pass filter 'at' Nyquist - which if (and all stages of sampling)
ideal, would perfectly recreate the sampled function.


------------------------------------------------------------------------
flimflam's Profile: http://forums.slimdevices.com/member.php?userid=56891
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
pippin
2013-07-08 23:50:31 UTC
Permalink
OK, but that's not "smoothing", that's just low-pass filtering, which
ideally removes ALL effects of the "stair-steps".

However, here we are not talking about analog processing BEHIND the DAC,
we talk about digital processing BEFORE the DAC.
And here "smoothing" is not simple and any kind of arithmetic
"interpolation" doesn't necessarily have to create a "better"
reproduction but instead - just as likely - can create a worse one.

Look at these images:
14972
Here, for a low sampling frequency, e.g. 44.1 kHz, there are two samples
A and B which - just looking at these two samples, might result in a
waveform as the one shown.
Now if you go to a higher sampling frequency, the usual process of
oversampling would just duplicate the samples A and B resulting in A'
and B'. A resulting waveform then might be as shown in the second image
which looks much worse.
So one might be tempted do calculate some "intermediate" values A" and
B" and hope that the result might more closely match.

Now here's the problem: unless you've looked at the whole signal (which
you can't do due to time and processing requirements), you don't know
whether the first waveform given above is correct, it could just as well
be one like this:

14973

What you see here is that now your "intermediate" steps A" and B" are a
much worse match for the original waveform than A' and B' - you get more
noise.

Now, what might come as a surprise is that all of this does NOT matter
at all as long as in the end you filter at your cutoff frequency again.
The reason for this is that all the noise and distortion added above
actually happens in higher frequency ranges, it's only in harmonics to
the original waveform. Since these higher frequencies are inaudible (as
in: definitely, completely, undisputedly inaudible; not even a bat will
hear them), you can filter them and the result of this is, again, the
perfect copy of the first waveform. For BOTH of the right-hand side
curves. Actually this would still hold if you throw in random samples in
place of A', A", B' and B".

This is what you do with oversampling. The reason for this is that the
filters you use to do this are not perfect. They will either distort
your audible signal or not perfectly filter out the higher frequencies
but they get better the higher the sampling frequencies you use are. So
you accept the added noise due to oversampling because the end result
will still be less distorted due to simpler and better filters.

Now what John is talking about is something else. The problem with these
images above is that while the anaolg low-pass filter behind the DAC can
perfectly reproduce the signal, the same unfortunately is NOT true of
the DAC itself. The DAC itself is a filter, too, and depending on the
waveforms above those higher frequencies CAN actually have an impact on
the way the DAC reproduces you AUDIBLE signal (imaging).
To avoid this, you usually try to filter your signal even BEFORE it
reaches the DAC to avoid having your artifacts distort your signal.
These are the filters John and I are talking about. And the question it
all boils down to is: what makes the filter in sox better than the ones
in the DAC? Sox is a very simple interpolation software so if it can do
better: why don't the DAC makers just do the same thing?


+-------------------------------------------------------------------+
|Filename: waveform2.jpg |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=14973|
+-------------------------------------------------------------------+


---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox
and
*New: Logitech UE Smart Radio* as well as iPeng Party, the free
Party-App,
at penguinlovesmusic.com
------------------------------------------------------------------------
pippin's Profile: http://forums.slimdevices.com/member.php?userid=13777
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
flimflam
2013-07-09 00:35:38 UTC
Permalink
pippin wrote:
> OK, but that's not "smoothing", that's just low-pass filtering
Same thing! Smoothing filter is a specific and recognised term for this
filter - whether you like it or not :-) ! The term is used by many,
Analog Devices refer to it by this name a lot. That the stair steps are
smoothed seems obvious, the term does not mean to imply anything else.

pippin wrote:
> However, here we are not talking about analog processing BEHIND the DAC,
> we talk about digital processing BEFORE the DAC.
The latter is all about the former though, of course! It is the raison
d'ï¿œtre, as you say yourself, behind oversampling. John was explaining
this in relation to stair steps of the ZOH but you did not seem to
understand and asked what stair steps, I was trying to explain, that's
all.

pippin wrote:
> These are the filters John and I are talking about. And the question it
> all boils down to is: what makes the filter in sox better than the ones
> in the DAC?

I agree 100% with you. I would avoid external resampling, and deliver
bit-perfect to the DAC, preferring to let the extremely capable
designers at Analog, Cirrus Logic, TI, Wolfson etc do their job. If a
DAC/ADC loop cannot be distinguished from the original, it says a lot I
think. That's my opinion, it's not a very positive contribution to the
thread and its undoubtedly hard work, so I didn't say it loud before.


------------------------------------------------------------------------
flimflam's Profile: http://forums.slimdevices.com/member.php?userid=56891
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
pippin
2013-07-09 01:06:27 UTC
Permalink
flimflam wrote:
> Same thing! Smoothing filter is a specific and recognised term for this
> filter - whether you like it or not :-) ! The term is used by many,
> Analog Devices refer to it by this name a lot. That the stair steps are
> smoothed seems obvious, the term does not mean to imply anything else.
>
OK, may be. I learned all my signal theory in German so terminology
might not be my strong point here.

But it's still something different from the interpolation filter we were
talking about above.
>
> The latter is all about the former though, of course! It is the raison
> d'etre, as you say yourself, behind oversampling. John was explaining
> this in relation to stair steps of the ZOH but you did not seem to
> understand and asked what stair steps, I was trying to explain, that's
> all.
>
Um. Sorry. Again, I fail to see it.
Again: Why does interpolation filtering on the digital side improve the
analog filtering and how is the interpolation even correlated to your
desired filter response.

I can find a lot of prosa about this on the internet, mainly by makers
of such filters, but I haven't found a single explanation that makes
sense. All I find is stuff like this:
http://www.ni.com/white-paper/5515/en/
Which - sorry - is nonsense (the digital interpolation part. The analog
and imaging explanations are OK). I mean: it's not if your goal is to
reproduce ideal sine waves generated by a signal generator as shown in
the example, fine. But to do that you'd not have to take such an effort,
perfectly reproducing sine waves from a few samples is the easiest thing
you could ever do in signal processing.

For a real world signal like music I fail to see how an interpolation
filter will be effective and valid because - unlike in these sine wave
examples - you do NOT know the exact waveform. The only reason the
"interpolation filter" in that example is effective is because whoever
drew that diagram did EXACTLY know the parameters of the sine wave PLUS,
these parameters didn't change at all over the duration of the signal.
Under these circumstances it's of course easy to fill in the added
samples with perfectly fitting interpolations hence not creating any
harmonics. However, that's NOT what you have in real life, ESPECIALLY
not with a software like sox that can only look at a few samples at a
time (you COULD theoretically do this right when you did an analysis of
the whole audio file but we are talking about a LOT of digital signal
processing here).

>
> I agree 100% with you. I would avoid external resampling, and deliver
> bit-perfect to the DAC, preferring to let the extremely capable
> designers at Analog, Cirrus Logic, TI, Wolfson etc do their job. If a
> DAC/ADC loop cannot be distinguished from the original, it says a lot I
> think. That's my opinion, it's not a very positive contribution to the
> thread and its undoubtedly hard work, so I didn't say it loud before.

Now... THAT's a statement I understand :)



---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox
and
*New: Logitech UE Smart Radio* as well as iPeng Party, the free
Party-App,
at penguinlovesmusic.com
------------------------------------------------------------------------
pippin's Profile: http://forums.slimdevices.com/member.php?userid=13777
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
flimflam
2013-07-09 13:35:18 UTC
Permalink
pippin wrote:
> Um. Sorry. Again, I fail to see it.
> Again: Why does interpolation filtering on the digital side improve the
> analog filtering and how is the interpolation even correlated to your
> desired filter response.
>
> I can find a lot of prosa about this on the internet, mainly by makers
> of such filters, but I haven't found a single explanation that makes
> sense. All I find is stuff like this:
> http://www.ni.com/white-paper/5515/en/
> Which - sorry - is nonsense (the digital interpolation part. The analog
> and imaging explanations are OK).

Hi Pippin

Let's have a look at this.

Without oversampling, the analog anti-imaging filter requirements are
obviously difficult - especially for the audio passband and 44.1khz
sample rate.

With oversampling however, the analog anti-imaging filter requirements
are relaxed, because now the stopband begins at the original Nyquist
multiplied by the oversampling ratio. The images in-between have been
low-passed by the digital interpolation/oversampling filter, the exact
parameters and usual filter tradeoffs of which are by design. This is
what Figure 4 is trying to show in your link.

The interpolation algorithm can therefore be compared to an analogue
low-pass filter but in the digital domain. Neither of these need to
analyse an hour in advance to perform reconstruction of the complex
musical waveform according to sampling theory, although you are quite
right, more than the one preceding sample would be necessary to
interpolate, as your pictures nicely show.

Regarding noise: oversampling actually increases the SNR as quantisation
noise is spread over a wider frequency range, further enhanced by noise
shaping and sigma delta process.


------------------------------------------------------------------------
flimflam's Profile: http://forums.slimdevices.com/member.php?userid=56891
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
pippin
2013-07-09 15:30:06 UTC
Permalink
I didn't mean to question the sense behind upsampling. I fully
understand why that makes the (analog) filter design easier and the
result better.

But John's argument was that you get a better result by using a NOS DAC
and do the oversampling through sox because the interpolation filter in
sox is simpler than the multiple ones in oversampling DAC designs and I
was wondering why that is and what kind of filter sox is using.
Intuitively I still feel just duplicating the samples as "normal"
oversampling does it should give the best results but that's just a
feeling in an area where I really don't have a lot of experience, that's
why I asked.
But to me it looks like this: while the "duplication" strategy is
assured to create quite powerful images at the same time you can be sure
to have all of that going on beyond your cutoff frequency while I feel
arithmetic interpolation should create noise over a broader spectrum.



---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox
and
*New: Logitech UE Smart Radio* as well as iPeng Party, the free
Party-App,
at penguinlovesmusic.com
------------------------------------------------------------------------
pippin's Profile: http://forums.slimdevices.com/member.php?userid=13777
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
flimflam
2013-07-09 16:46:24 UTC
Permalink
pippin wrote:
> Intuitively I still feel just duplicating the samples as "normal"
> oversampling does it should give the best results

This is not how oversampling operates in a DAC (or ADC) - which would
basically achieve nothing. Oversampling operates exactly as described in
the NI link you gave, and in my summary above: the new sample values are
determined by an interpolation filter.


------------------------------------------------------------------------
flimflam's Profile: http://forums.slimdevices.com/member.php?userid=56891
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
pippin
2013-07-09 20:06:32 UTC
Permalink
Ah. OK. So how does this interpolation filter work? In the NI link they
show a filter curve that nicely follows the sine wave which will not be
so simple for music.



---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox
and
*New: Logitech UE Smart Radio* as well as iPeng Party, the free
Party-App,
at penguinlovesmusic.com
------------------------------------------------------------------------
pippin's Profile: http://forums.slimdevices.com/member.php?userid=13777
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
JohnSwenson
2013-07-09 23:54:33 UTC
Permalink
Hi Pippin,
to your underlying question: why do the filtering externally rather than
in the DAC chip? The answer is "I don't know". When I bypass the
internal filter and do it externally using a basic simple filter it
sounds much better. And it's not just me. I've done this in blind
fashion with a number of people and they all came to the same
conclusion, the external filter sounded much better.

Looking at the spec sheets for the DAC chips you can tell that they are
using cascaded filters. When I use an external FPGA to implement a
filter and program it to be cascaded multiple filters, I hear a similar
sound, when I implement a simple filter (no cascading) I get the better
sound. The conclusion seems to be that it is somehow the cascading of
filters that causes the problem. Again no clue at all why this is so,
what the mechanism is etc.

They ARE different filter functions, they do output different bits, but
they are very close to each other. Whatever it is, its not a big
difference in the waveform.

John S.


------------------------------------------------------------------------
JohnSwenson's Profile: http://forums.slimdevices.com/member.php?userid=5974
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
flimflam
2013-07-10 07:44:11 UTC
Permalink
pippin wrote:
> Ah. OK. So how does this interpolation filter work? In the NI link they
> show a filter curve that nicely follows the sine wave which will not be
> so simple for music.

The new samples are inserted and given zero-values. The result is then
low-pass filtered.

Remember, we have a special case of a bandlimited signal. Sampling
theory means we can recover this signal - in all its complex, musical
glory, no matter how unintuitive and surprising this first seems.


------------------------------------------------------------------------
flimflam's Profile: http://forums.slimdevices.com/member.php?userid=56891
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
soundcheck
2013-07-10 08:09:33 UTC
Permalink
Hi there/John.

A lot of writing and reading.

I tried resampling with SOX and other (reference) tools as discussed at
Audio Asylum and elsewhere several times in the past.


http://soundcheck-audio.blogspot.de/2011/04/tt-resampling.html


I never managed to get it working to my satisfaction. Neither realtime,
nor offline. The SQ was always worse then the original.
Maybe I missed something out.


Issues:

1. You need to attenuate the "digital" signal before you apply the
filters to avoid clipping.
2. Realtime SRC is causing higher load on the processor and higher
traffic on the entire path. That might translate into audible losses on
most of the systems out there.
3. Offline SRC is kind of inflexible, if you change your DAC devices
once in a while or if you feed different DACs at home. You always have
to keep copies of the originals and the resampled materials.
You might have a player which does offline SRC prior to playback and
caches a full track/CD on e.g. a ramdisk. But that's not possible in a
LMS environment.
4. No filter is lossless.
5. If you stay with 16bit you have to re-dither the already dithered
material. E.g. You can't do 16 bit to 24bit conversions on LMS if you
stream PCM. You need to re-encode PCM to flac again.

6. I've never seen somebody offering an to me acceptable sample rate
conversion setting. -- John. Shoot. I'm listening.


To me SRC is a questionable workaround to cover the deficiency of rather
poor or inflexible HW (firmware + HW) implementations. If your HW
implementation is that bad, that SW SRC with all its issues as described
above (maybe more) sounds better than your HW SRC, I'd look for a better
HW.


Please let me know your favorite SOX settings.

Cheers



::: ' Touch Toolbox and more' (http://soundcheck-audio.blogspot.com) :::
by soundcheck
------------------------------------------------------------------------
soundcheck's Profile: http://forums.slimdevices.com/member.php?userid=34383
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
edwardian
2013-07-11 06:05:31 UTC
Permalink
soundcheck wrote:
>
> I tried resampling with SOX and other (reference) tools as discussed at
> Audio Asylum and elsewhere several times in the past.
>
>
> http://soundcheck-audio.blogspot.de/2011/04/tt-resampling.html
>
>
> I never managed to get it working to my satisfaction. Neither realtime,
> nor offline. The SQ was always worse then the original.
> Maybe I missed something out.
>

Klaus, I read your document, and unless I missed something, you were
resampling from 16/44.1 to 24/96? Is that correct? Did you ever try
going from 16/44.1 to 24/88.2 or 24/176.4? If so, did you hear any
difference (compared to 24/96)?

And I also tried SOX upsampling in LMS a while ago, but I remember at
the time that I didn't like the idea that it only output FLAC (as all my
music is WAV). But are you saying that was only because it was going
from 16 bit to 24 bit? IOW, if I first convert some files to 24bit
(offline) and then use SOX in LMS to upsample in realtime (say from
24/44.1 to 24/176.4), will it output PCM? Or is there any other method
to use SOX in LMS and have it output PCM?

Thanks.
edward


------------------------------------------------------------------------
edwardian's Profile: http://forums.slimdevices.com/member.php?userid=55804
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
Julf
2013-07-11 08:11:11 UTC
Permalink
edwardian wrote:
> I didn't like the idea that it only output FLAC (as all my music is WAV)

Any specific reasons to prefer WAV? I think the general view is that
with lower-end processors (such as those in the squeezeboxes) that don't
have dedicated I/O processors the additional network load caused by the
wasted bits in WAV files causes more CPU load (and thus theoretically
sound degradation) than the FLAC decoding, and the usual WAV problems of
lack of tagging standards etc. are always a hassle.



"To try to judge the real from the false will always be hard. In this
fast-growing art of 'high fidelity' the quackery will bear a solid gilt
edge that will fool many people" - Paul W Klipsch, 1953
------------------------------------------------------------------------
Julf's Profile: http://forums.slimdevices.com/member.php?userid=42050
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
edwardian
2013-07-11 16:46:46 UTC
Permalink
Julf wrote:
> Any specific reasons to prefer WAV? I think the general view is that
> with lower-end processors (such as those in the squeezeboxes) that don't
> have dedicated I/O processors the additional network load caused by the
> wasted bits in WAV files causes more CPU load (and thus theoretically
> sound degradation) than the FLAC decoding, and the usual WAV problems of
> lack of tagging standards etc. are always a hassle.

For me, there's no hassle tagging WAV files. I use dBpoweramp to tag the
WAV files and LMS/Squeezebox Touch has no problem reading them. And the
choice to stream PCM over FLAC was simply to avoid FLAC decoding on the
Touch. I never heard before that WAV files cause more CPU load than FLAC
decoding. Maybe I'll have to reconsider and perform another listening
test. I wonder if John's new design will behave differently.


------------------------------------------------------------------------
edwardian's Profile: http://forums.slimdevices.com/member.php?userid=55804
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
Julf
2013-07-11 18:57:27 UTC
Permalink
edwardian wrote:
> For me, there's no hassle tagging WAV files. I use dBpoweramp to tag the
> WAV files and LMS/Squeezebox Touch has no problem reading them.

Problem is that that might or might not work if you ever switch to some
other software.



"To try to judge the real from the false will always be hard. In this
fast-growing art of 'high fidelity' the quackery will bear a solid gilt
edge that will fool many people" - Paul W Klipsch, 1953
------------------------------------------------------------------------
Julf's Profile: http://forums.slimdevices.com/member.php?userid=42050
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
edwardian
2013-07-12 04:25:45 UTC
Permalink
Julf wrote:
> Problem is that that might or might not work if you ever switch to some
> other software.

Understood. Thanks for the information. I've been organizing my music
collection over the past few months and my intention was to have a copy
as WAV and a copy as FLAC to take advantage of checksum, so this
information is very timely for me.

Anyway, I don't want to hijack this thread anymore, I'd love to hear
what John thinks about this (SOX / CPU Load, SOX in LMS vs in the new
Streamer) in relation to his new design.


------------------------------------------------------------------------
edwardian's Profile: http://forums.slimdevices.com/member.php?userid=55804
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
SBGK
2013-07-12 12:09:20 UTC
Permalink
Julf wrote:
> Any specific reasons to prefer WAV? I think the general view is that
> with lower-end processors (such as those in the squeezeboxes) that don't
> have dedicated I/O processors the additional network load caused by the
> wasted bits in WAV files causes more CPU load (and thus theoretically
> sound degradation) than the FLAC decoding, and the usual WAV problems of
> lack of tagging standards etc. are always a hassle.

what are these wasted bits ?

wav decoding is find the headers, work out the bit rate/depth, find the
data section, render pcm to output device

flac decoding is as above plus decoding flac to pcm

is there any more to it than that ?

do you have any measurements to support the theoretical sound
degradation ? I've always found WAVs sound better.



Touch optimisations http://touchsgotrythm.blogspot.co.uk/
------------------------------------------------------------------------
SBGK's Profile: http://forums.slimdevices.com/member.php?userid=52003
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
soundcheck
2013-07-12 12:35:06 UTC
Permalink
Guys. Don't highjack this thread.

My main question still is:

What's your preferred least intrusive and highest quality Sox SRC
setting?

It seems that not anybody is able or willing to come up with a
recommendation!?!?



::: ' Touch Toolbox and more' (http://soundcheck-audio.blogspot.com) :::
by soundcheck
------------------------------------------------------------------------
soundcheck's Profile: http://forums.slimdevices.com/member.php?userid=34383
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
Julf
2013-07-12 15:54:25 UTC
Permalink
SBGK wrote:
> what are these wasted bits?

The ones that need to be unnecessarily transmitted and received (and
possibly encrypted and decrypted) on the network. FLAC usually achieves
a compression factor close to 2:1.
handling those data packets require CPU power.

> I've always found WAVs sound better.

Do you have any measurements or controlled listening logs?

If we want to continue the debate of FLAC vs WAV, I suggest starting a
new thread instead of polluting this one.



"To try to judge the real from the false will always be hard. In this
fast-growing art of 'high fidelity' the quackery will bear a solid gilt
edge that will fool many people" - Paul W Klipsch, 1953
------------------------------------------------------------------------
Julf's Profile: http://forums.slimdevices.com/member.php?userid=42050
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
JohnSwenson
2013-07-12 20:40:37 UTC
Permalink
I started this because I was using the upsampling built into
Squeezelite(libsoxr), not using SoX in LMS so I can't offer any clues as
to how to get that to work properly. The Squeezelite resampling option
is not the same as in SoX the program arguments, although the underlying
code is the same.

The one I'm using right now is mI:::28, which is medium quality,
intermediate phase and 28 bit depth. I'm not quite sure exactly how this
translates to SoX arguments.

The upsampling is done in Squeezelite on the Wanboard and then sent to
my own USB DAC, which uses a standard XMOS UAC2 interface, I2S is run
through isolators, on isolated side are low jitter clocks, reclocker and
the DAC chip is PCM5142 with very low noise regulators on all of this.
The low jitter clock is sent back through an isolator to the XMOS
interface.

The PCM5142 has several builtin filters, some of which are better than
others. If you feed it 352.8/384 it turns off the internal filters. So
by using resampling in Squeezelite to 352/384 I can bypass the
implementation in the chip and just the software.

Even if upsampling to a lower rate it can still be advantageous,
upsampling to 88.2 with the above paramters is a significant
improvement. Going to 176.4 is even better but the best canbe
achieved by going high enough that the built in filters are completely
bypassed.

In all these cases the network traffic stays the same, but the USB data
rate goes up since the upsampling is being done in squeezelite.

I have not had time to go into depth trying all kinds of different
parameters, I spent a few nights trying different things and came up
with the above. I've been listening to it for some time now and am
still enthralled with what it is doing.

BTW the load on the Wandboard processor is about 8% when using this
setting. When using the default 20 bit setting it is about 4% and when
not doing any upsampling its about 2%.

Klaus, to your statement that upsampling should not be necessary, the
answer is of course YES. The issue is that as far as I can tell all DAC
chips with builtin filters are compromised sonically, the upsampling is
an attempt to bypass these filters with an external filter that is more
sonically "transparent". So yep it IS a band-aid, but one that is
currently necessary for most DACs.

If the internal filters are not disabled, exactly how the internal
filters interact with the external filter are going to be very DAC
specific. In the case of the chip I'm using the filters get simpler as
the sample rate goes up so even though they are still there if you
upsample to an intermediate rate, the total result sounds better than
the builtin filter going from 44.1.

The best sounding parameters for going all the wayto 352.8 and 88.2 will
almost certainly be different, but I have not explored it yet.

John S.


------------------------------------------------------------------------
JohnSwenson's Profile: http://forums.slimdevices.com/member.php?userid=5974
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
edwardian
2013-07-12 21:54:00 UTC
Permalink
JohnSwenson wrote:
>
> BTW the load on the Wandboard processor is about 8% when using this
> setting. When using the default 20 bit setting it is about 4% and when
> not doing any upsampling its about 2%.
>

Cool. Thanks for the info. Do those percentages include FLAC decoding,
or are you feeding it PCM?


------------------------------------------------------------------------
edwardian's Profile: http://forums.slimdevices.com/member.php?userid=55804
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
JohnSwenson
2013-07-13 05:11:12 UTC
Permalink
edwardian wrote:
> Cool. Thanks for the info. Do those percentages include FLAC decoding,
> or are you feeding it PCM?

I'm usually sending flac over the network these days since I don't have
a new enough server to handle 176 and 192 pcm. The above numbers were
for sending flac at 44.1 over ethernet cable.

John S.


------------------------------------------------------------------------
JohnSwenson's Profile: http://forums.slimdevices.com/member.php?userid=5974
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
marcoc1712
2013-10-08 20:18:10 UTC
Permalink
John,


could I ask You witch USB DAC are you using? If is kind of a KIt or a
commercial product, could you point me to the source?

is a kind of the one you'll be using in CSP1?

thx a lot.

p.s.

I could not understand why if you upsample at i.e. 352.8 you still need
a software filter, is not assured this way that aliasing is far away
from the audible spectrum (reason why the hardware filter is disabled, I
suppose)?


Marco.



____________________________________________________________
SB+, Klimo Merlino + Kent Gold, Monitor Audio Studio 20 Gold SE+, Klimo
reference and DIS Interconnect.
------------------------------------------------------------------------
marcoc1712's Profile: http://forums.slimdevices.com/member.php?userid=34842
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
JohnSwenson
2013-11-02 13:34:51 UTC
Permalink
marcoc1712 wrote:
> John,
>
>
> could I ask You witch USB DAC are you using? If is kind of a KIt or a
> commercial product, could you point me to the source?
>
> is a kind of the one you'll be using in CSP1?
>
> thx a lot.
>
> p.s.
>
> I could not understand why if you upsample at i.e. 352.8 you still need
> a software filter, is not assured this way that aliasing is far away
> from the audible spectrum (reason why the hardware filter is disabled, I
> suppose)?
>
>
> Marco.

The DAC I am using is a custom design I have done so you can't get it
anywhere. Speaking of kits, I am designing a somewhat similar DAC for
Bottlehead, it will be a kit, but all the hard work is already done on
one PCB. It's not available yet, but hopefully will be out sometime
early next year.

Or just get a CSP!

As to upsampling, all (usefull) upsampling has to use a filter, that is
just part of the upsampling process. If you just resample the data
without applying the filter you haven't actually done anything. This is
best with a picture, I don't have one handy (I'm on vacation), maybe
someone else can post a picture of this.

For the wordy explanation, lets take the output of a basic DAC chip,
without any digital or analog filtering you get a stairstep. Upsampling
without the filter is just subdividing each of those stairsteps into
smaller pieces, but keeping the same values. Lets say you have a sample
at .5V level, 8X upsampling gives you 8 shorter samples all at the same
.5V, you haven't changed anything.

What you want is the upsampler to make a "guess" at filling in the
intermediate values between the .5V sample and the next sample. The
filter defines exactly how that is done. The human hearing system seems
to be quite sensitive to exactly what that filter does, slight
differences in that filter can make significant differences in what we
hear.

All modern DAC chips do this filtering process builtin to the chip, and
every one of them does it in such a way that does not sound so good.
This thread is all about doing that filtering externally in order to
bypass the not so good version in the DAC chip.

John S.


------------------------------------------------------------------------
JohnSwenson's Profile: http://forums.slimdevices.com/member.php?userid=5974
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
darrenyeats
2013-11-02 14:27:38 UTC
Permalink
JohnSwenson wrote:
>
> What you want is the upsampler to make a "guess" at filling in the
> intermediate values between the .5V sample and the next sample.

John,
I've no doubt you know more about the subject than me but I think your
language, namely the appearance of "want" and "guess" in the same
sentence, might fan prejudices about digital audio!

Do you mean DAC designers are use cheap short-cuts that aren't in fact
even trying for the correct sampling-theory ideal, but instead cheap,
expedient replacements of it? Perhaps you're suggesting your way is
actually a theoretically more correct way. I am not here arguing with
these assertions.

All I'm worried about is the wording of the above sentence, since
guessing is not something we really -want-, if we are trying to
implement sampling theory faithfully (I am sure you agree by the way!)

Regards, Darren



Check it, add to it! http://www.dr.loudness-war.info/

http://www.amazon.co.uk/gp/richpub/listmania/byauthor/A3H57URKQB8AQO/ref=cm_pdp_content_listmania/203-7606506-5721503.

SB Touch
------------------------------------------------------------------------
darrenyeats's Profile: http://forums.slimdevices.com/member.php?userid=10799
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
soundcheck
2013-07-11 08:13:51 UTC
Permalink
This post might be inappropriate. Click to display it.
darrenyeats
2013-07-08 22:38:01 UTC
Permalink
flimflam wrote:
> But what are the "steps" undertaken in re-creating the waveform? Clue:
> it's not called a smoothing filter for nothing!

The whole point of the sampling theorem is that the samples define ALL
of a complete and continuous analogue waveform of any complexity, as
long as the original waveform was band limited when was sampled! You
imply the smoothing is done using a best guess algorithm but there is no
guesswork, only one analogue re-creation is a valid solution.

E.g. a 20kHz sine wave will have only about two samples per cycle yet
the re-created wave will look like a perfect sine, not a saw tooth. To
repeat, as long as it was band limited to begin with, this is the magic
of the sampling theorem.
Darren



Sent from my HTC Sensation Z710e using Tapatalk 4 Beta



Check it, add to it! http://www.dr.loudness-war.info/

http://www.amazon.co.uk/gp/richpub/listmania/byauthor/A3H57URKQB8AQO/ref=cm_pdp_content_listmania/203-7606506-5721503.

SB Touch
------------------------------------------------------------------------
darrenyeats's Profile: http://forums.slimdevices.com/member.php?userid=10799
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
JohnSwenson
2013-07-02 20:03:20 UTC
Permalink
Wombat wrote:
> Many 44.1 material once was at a higher samplerate and there was already
> once a choice what filter to apply. How can you know that a chosen
> filter doesnŽt only do better because it fits more to the filter that
> was applied before? I did read to much nonsense about the sound of magic
> filters over the years.

The listening tests with different filters were done with a wide variety
of music from different labels. The presumption is that not all of these
recordings were made with the same filters. We did not find an effect
where the sound of a simple or complex filter was influenced by the
recording. The simple filter sounded better on everything. I was a bit
surprised by this, the effects of the simple filter are things like
increase audibility of the recording acoustic environment. I expected
that close miced multi trac, overdubbed recordings would show little
difference, but this was not the case. They too seemed much fuller, more
open, more alive.

So while there may very well be an interaction with filters used in the
production of the recording, these interactions seem to be much smaller
than the difference between complex and simple filters.

John S.


------------------------------------------------------------------------
JohnSwenson's Profile: http://forums.slimdevices.com/member.php?userid=5974
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
pippin
2013-07-11 18:51:00 UTC
Permalink
I can confirm that WAV actually causes a LOT more load than FLAC
decoding, at least on an iPhone.
Of course, an iPhone will always uses WiFi but then I believe there have
been similar measurements on the SB Touch as well.

Especially is we talk about upsampled material, we are talking about a
LOT of data for a WAV stream, at 192 kHz sample rate it's several times
the data rate required for an HD video stream!



---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox
and
*New: Logitech UE Smart Radio* as well as iPeng Party, the free
Party-App,
at penguinlovesmusic.com
------------------------------------------------------------------------
pippin's Profile: http://forums.slimdevices.com/member.php?userid=13777
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
pippin
2013-07-12 14:33:18 UTC
Permalink
First of all: WAV means: transport twice the number of bits over the
network which causes twice the load in all your network interfaces (NIC,
buffers,...). If you use WiFi it also means: decrypt twice the number of
bits, a process that needs much more CPU cycles than the simple FLAC
decoding.

I have made measurements on the load but not on the effect on sound, my
output was through an asynchronous USB DAC, there probably was no
difference at all.



---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox
and
*New: Logitech UE Smart Radio* as well as iPeng Party, the free
Party-App,
at penguinlovesmusic.com
------------------------------------------------------------------------
pippin's Profile: http://forums.slimdevices.com/member.php?userid=13777
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
soundcheck
2013-07-12 15:31:19 UTC
Permalink
This thread is about resampling qualities resp. differences between
filter settings.

And NOT about file formats.



::: ' Touch Toolbox and more' (http://soundcheck-audio.blogspot.com) :::
by soundcheck
------------------------------------------------------------------------
soundcheck's Profile: http://forums.slimdevices.com/member.php?userid=34383
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
pippin
2013-07-12 15:40:52 UTC
Permalink
yep. And one effect of server-side upsampling is a dramatic increase of
bandwidth requirements. Going from 44.1/16 to 192/24 means you increase
the bandwidth required by a factor of 8!



---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox
and
*New: Logitech UE Smart Radio* as well as iPeng Party, the free
Party-App,
at penguinlovesmusic.com
------------------------------------------------------------------------
pippin's Profile: http://forums.slimdevices.com/member.php?userid=13777
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
edwardian
2013-07-12 20:07:43 UTC
Permalink
pippin wrote:
> yep. And one effect of server-side upsampling is a dramatic increase of
> bandwidth requirements. Going from 44.1/16 to 192/24 means you increase
> the bandwidth required by almost a factor of 7!

OK fair enough.

For uncompressed PCM:
16/44.1 = 1,411 Kbps
24/192 = 9,216 Kbps

Your earlier claim, though, about being more than HD Video doesn't jive
with me. My HD programming on my TV is around 15Mbps (for 1080i 60) and
Blu-Rays (1080p 24) are around 30Mbps.

But that's neither here nor there. If we talk about server-side SoX,
then bandwidth is an issue. But John, please chime in here, aren't you
talking about SoX in the streamer? Or did I misread that. What's the CPU
load effect at that point (compared to doing it server-side)?


------------------------------------------------------------------------
edwardian's Profile: http://forums.slimdevices.com/member.php?userid=55804
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
pippin
2013-07-12 20:23:03 UTC
Permalink
Don't want to distract this even more, but you are correct, I caught an
additional factor of two for PCM but your video streams are MPEG rates,
I was talking about H.264 which runs at around half the rate.

So it's about the same as a 1080p stream, the ones I looked at here were
all in the 10 MBit range.



---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox
and
*New: Logitech UE Smart Radio* as well as iPeng Party, the free
Party-App,
at penguinlovesmusic.com
------------------------------------------------------------------------
pippin's Profile: http://forums.slimdevices.com/member.php?userid=13777
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
bennyboyph
2013-10-30 07:38:03 UTC
Permalink
Can anyone provide me with covert.conf codes to do this within LMS?




------------------------------------------------------------------------
bennyboyph's Profile: http://forums.slimdevices.com/member.php?userid=43607
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
soundcheck
2013-10-30 08:10:27 UTC
Permalink
Try this:

The file needs to be called :

custom-convert.conf

It just has to have these 3 lines


Code:
--------------------

flc flc * *
# FT:{START=--skip=%t}U:{END=--until=%v}
[flac] -dcs $START$ $END$ -- $FILE$ | [sox] -D -q -t wav - -t flac -e signed -C 0 -b 24 - rate -v -I -a -b 98 96000

--------------------



inside for flac only resampling. You can play with the resampling
options. I think above is close to what John suggested earlier.

You

1. need to restart the server to activate it and
2. you have to make sure you've got flac flac decoding activaded in
advanced server settings / file formats.

Good luck.



::: ' Touch Toolbox and more' (http://soundcheck-audio.blogspot.com) :::
by soundcheck
------------------------------------------------------------------------
soundcheck's Profile: http://forums.slimdevices.com/member.php?userid=34383
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
bennyboyph
2013-10-30 16:43:46 UTC
Permalink
soundcheck wrote:
> Try this:
>
> The file needs to be called :
>
> custom-convert.conf
>
> The custom-convert.conf overrides convert.conf.
>
> It just has to have these 3 lines
>
> >
Code:
--------------------
> >
> flc flc * *
> # FT:{START=--skip=%t}U:{END=--until=%v}
> [flac] -dcs $START$ $END$ -- $FILE$ | [sox] -D -q -t wav - -t flac -e signed -C 0 -b 24 - rate -v -I -a -b 98 96000
>
--------------------
> >
>
>
> inside for flac only resampling. You can play with the resampling
> options. I think above is close to what John suggested earlier.
>
> You might realize that I output a 24bit (-b 24) stream. That's
> important to avoid additional dithering, when feeding 16 bit material.
>
> We need to recode to flac again since bit and sample rate changes can
> not be streamed as PCM, which is a weakness
> of the LMS server.
>
> You
>
> 1. need to restart the server to activate above changes and
> 2. you have to make sure you've got flac flac decoding activaded in
> advanced server settings / file formats.
> Under flc/flc you'll see the option showing flac/sox. All options
> above need to be disabled!
>
>
> You'll find more in depth infos 'here'
> (http://soundcheck-audio.blogspot.de/2011/04/tt-resampling.html).
>
>
> Good luck.

Cheers - it doesn't want to work at 352.8 or 384kHz, which is what I
need to bypass the digital filters of my PCM5102 chip :-(




------------------------------------------------------------------------
bennyboyph's Profile: http://forums.slimdevices.com/member.php?userid=43607
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
soundcheck
2013-11-02 15:37:14 UTC
Permalink
bennyboyph wrote:
> Cheers - it doesn't want to work at 352.8 or 384kHz, which is what I
> need to bypass the digital filters of my PCM5102 chip :-(

OK. Sox maxrate is 192khz afaik. And your Squeezebox environment
(server and client) would have to support 384khz too.



::: ' Touch Toolbox and more' (http://soundcheck-audio.blogspot.com) :::
by soundcheck
------------------------------------------------------------------------
soundcheck's Profile: http://forums.slimdevices.com/member.php?userid=34383
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
murrays
2013-11-03 07:02:31 UTC
Permalink
Hi John,

I've been following all this and understand where you're coming from.
But what is a CSP?



Murray (N.Z.)
------------------------------------------------------------------------
murrays's Profile: http://forums.slimdevices.com/member.php?userid=60066
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
ralphy
2013-11-03 09:47:19 UTC
Permalink
murrays wrote:
> Hi John,
>
> I've been following all this and understand where you're coming from.
> But what is a CSP?

'Community Squeeze Project' (http://www.communitysqueeze.org/)



Ralphy

*1*-Touch, *4*-Classics, *2*-Booms, *1*-Reverted UE Radio
*1*-Squeezeslave, *2*-Squeezeplays, *5*-Squeezelites
'Squeezeslave' (http://code.google.com/p/squeezeslave/) 'donations'
(https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=LL5P6365KQEXN&lc=CA&item_name=Squeezeslave&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted)
always appreciated.
------------------------------------------------------------------------
ralphy's Profile: http://forums.slimdevices.com/member.php?userid=3484
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
murrays
2013-11-04 06:06:44 UTC
Permalink
ralphy wrote:
> 'Community Squeeze Project' (http://www.communitysqueeze.org/)

Ah, thanks. That's something interesting to look into. Strange it
didn't come up in the search.



Murray (N.Z.)
------------------------------------------------------------------------
murrays's Profile: http://forums.slimdevices.com/member.php?userid=60066
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
tubesguy
2013-11-04 15:49:34 UTC
Permalink
Not really. Nothing comes up in the search, in the majority of searches
that I've conducted.:(


------------------------------------------------------------------------
tubesguy's Profile: http://forums.slimdevices.com/member.php?userid=1703
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
mfsoa
2016-02-07 19:20:58 UTC
Permalink
I know this thread died out a long time ago but I think that there are
still many of us who would like a deeper understanding of the upsampling
options offered in piCorePlayer and I assume other linux-based players.
My linux skills are close to zero. My hope is to help others get the
most from the options at hand.

If there is a better thread, forum or site to follow for this please let
me know.

I have found these two links that have some detailed information:

http://manpages.ubuntu.com/manpages/vivid/man1/squeezelite.1.html
http://manpages.ubuntu.com/manpages/vivid/man1/sox.1.html

Two specific questions, both related to John Swenson's recipe of
"mI:::28" (post #5)
1) If I leave off the "28" what happens? What's the default? IIRC
piCorePlayer uses 32 bit processing - If we specify the 28, does that
actually reduce the processing from 32 to 28 bit?

2) If I want to use a filter option different from M(inimum),
I(ntermediate) or L(inear), (lets say "17" on the scale from 0 to 100)
do you leave out the M, I or L from the recipe and use "m:::28:::17" or
mI:::28:::17" - Does the "17" supercede the "I" ?

Thanks for any advice

-Mike


------------------------------------------------------------------------
mfsoa's Profile: http://forums.slimdevices.com/member.php?userid=65172
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
AlexHS
2013-10-30 13:56:12 UTC
Permalink
Dear Mr Swenson,
My name is Alex and I am a Master student (Media Management and
Entrepreneurship) at the University Fresenius, Cologne. I have seen you
in this fantastic blog and was really impressed by your ideas and
facts.

My team of three is looking for hardware experts who could help us with
the hardware design of our product. We are currently developing a Smart
Home Solution, which offers an all in one solution for media content and
transfers it all to your tv or sound system.

About our Product:
Our product is a HDMI-stick or -box and also an application. The stick
is for a television or a sound stereo system. The application runs also
on smartphones. The stick transfers audio (spotify, simfy and other
audio online services) and video (netflix, videoload and other video
services) content, own content (videos, fotos from dropbox for example)
and free tv to your television screen. The smartphone would be the
remote.

Our project team consists of business modell experts (economic experts)
and we need people, who can design our hardware and realize our product.
For software developing, we are in contact with the ipeng developers.
For the user interface, we have some experts from Germany. The business
modell is running too.

However we would need hardware experts to create a wonderful product.

We hope you will be interested in our idea and would like to know more
about it. For more information I could also send you a presentation,
just let me know.

Best wishes
Alex


------------------------------------------------------------------------
AlexHS's Profile: http://forums.slimdevices.com/member.php?userid=61972
View this thread: http://forums.slimdevices.com/showthread.php?t=99088
Continue reading on narkive:
Loading...