Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 7 123 ... LastLast
Results 1 to 10 of 66
  1. #1
    Senior Member
    Join Date
    Jun 2006
    Posts
    1,690

    Upsampling Impressions

    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.

  2. #2
    Senior Member Wombat's Avatar
    Join Date
    Feb 2006
    Posts
    1,151
    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.
    Last edited by Wombat; 2013-06-30 at 20:40.
    Transporter (modded) -> RG142 -> Avantgarde Acoustic based 500VA monoblocks -> Sommer SPK240 -> self-made speakers

  3. #3
    Senior Member Archimago's Avatar
    Join Date
    Nov 2005
    Posts
    1,110
    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.

  4. #4
    Senior Member
    Join Date
    Jun 2006
    Posts
    1,690
    Quote Originally Posted by Wombat View Post
    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.

  5. #5
    Senior Member
    Join Date
    Jun 2006
    Posts
    1,690
    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.

  6. #6
    Senior Member
    Join Date
    Mar 2013
    Posts
    128
    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.

  7. #7
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,656
    Quote Originally Posted by JohnSwenson View Post
    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?

    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.
    Last edited by pippin; 2013-07-06 at 12:47.
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  8. #8
    Senior Member
    Join Date
    Jun 2006
    Posts
    1,690
    Quote Originally Posted by pippin View Post
    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.

  9. #9
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,656
    Quote Originally Posted by JohnSwenson View Post
    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
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  10. #10
    Senior Member Wombat's Avatar
    Join Date
    Feb 2006
    Posts
    1,151
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •