Ask the Expert: DSP and the Basics of Sampling
Digital Signal Processing. It’s a field that has divided opinions for many years. And sometimes filled with misconceptions. Nonetheless, it's the next topic in our recurring series: Ask the Expert.
To explore these waters safely, we needed an experienced guide and none other than our CTO, Jan Abildgaard Pedersen would do. He has navigated the crossroads between acoustics and digital signal processing for years and is considered one of the leading experts within the field. We are in good hands – enjoy!
This episode's questions
In this episode of Ask the Expert, we start to investigate Digital Signal Processing and in the process answer questions about:
- Balance Control
- Compensating for flaws in the signal chain
- Time domain issues in the frequency domain
As we started to get into the conversation, Jan rolls out the whiteboard for a straight-up lesson in the fundamentals of Digital Signal Processing and why we can do it without any loss of information. In the video below, you can watch all of Jan’s answers and his introduction to DSP.
Subscribe now: Ask The Expert on YouTube
Questions and answers
What about balance control in the Xeo speakers?
Erik Miner: Would it be possible to add balance control to the Xeo speakers - and if so, why haven't you?
Flaws and imperfections in the signal chain?
Ernst van Kleij: How - if at all - can Digital Signal Processing compensate for known flaws and imperfections in the signal chain?
Time domain problems in the frequency domain?
Ernst van Kleij: Trying to solve a time domain issue in the frequency domain seems incompatible. How can you compensate for these changing variables with math?
DFT, the Z-transform, and convolution. Let's talk the foundation of Digital Signal Processing first.
Sebastian Roy's many insightful questions led to an explanation of sampling and perhaps another visit from Jan Abildgaard Pedersen...
We want to give a big thanks to all of those who posted questions. We have dipped our toes into this exciting topic, and Jan is excited to come back and share more about the possibilities of Digital Signal Processing. As always, we'll make sure keep an eye out for any interesting questions to bring to the next episode of Ask The Expert.
Subscribe now: Ask The Expert on YouTube
If you have any more questions, please share them with us - and the rest of our community - on our Facebook page or directly in the comment section on YouTube.
All the best,
Jan and Christopher
Christopher Kjærulff: Welcome to Ask the Expert. My name is Christopher and today we are going to talk about digital signal processing. I am very excited to introduce Jan. We have been fortunate enough to get an audience today with you. Jan, Can you talk a little bit about what you do in Dynaudio?
Jan A. Pedersen: Yes. Hello. Thank you for inviting me.
Christopher: No Problem.
Jan: Yes I am the CTO of Dynaudio. That means I am the Chief Technical Officer and as such, I am overall responsible for all our technologies and all our research activities. So everything that has to do with what kind of technology do we use in the products, What kind of technology do we buy from outside or modify or what do we do internally in the research projects
Christopher: And as I said we are really really excited to have you here. But... Let’s get started with the first question.
Jan, we have a question from Erik Miner, and he asks why we haven’t included or implemented balance control in the Xeo series of loudspeakers.
Jan: Well, first of all, it is perfectly doable. No problem. But what we assume when we designed the Xeo speakers is that usually you have a pre-amplifier where you have a balance control or you have an app or something like where there is also a mix on your phone for instance. So there is usually a lot other ways to do the balance control. So usually we don’t consider the balance control as a part of the speaker system. And it also makes me think a little more about why a balance control in the first place because actually balance control is meant for that situation where you are not seated directly in the middle, in front of your speakers. That’s what we call a sweet spot. And if you are off to one of the sides then you are closer to one of the speakers. And the speaker you are closer to is louder, but it is also earlier in time. So there is a... Sound travels faster... It takes a shorter time to go to the listening position.
Jan: Yes. So there is both a level difference and a time difference. And with an ordinary balance control you only cure one only one of them, the level differences. And since our human brain use both the time difference and the level difference in different frequency bands figure out where is the sound image then you only cure part of it. So I would say that if we were to implement such a balance control in the Xeo series or other of our loud speakers, we would certainly do a better job so we would do a more advanced balance control where we actually cure both the level difference and the time difference.
Christopher: Yeah. Just do it right...
Christopher: Cool. Ernst von Kleij. He asked whether it would be possible to cure flaws, imperfections in the signal chain.
Jan: You mean like in the DA Converter or things like that?
Jan: Yes... Well if we focus on the DA converter; a lot of the flaws in the DA converter is actually predictable, and that is the key word here. Anything in that signal chain that is perfectly predictable or you could say stable, is perfectly curable. Even non-linear problems can be cured as long as they are stable so that we can make a model of it. And that is actually also known for that MQA. An MQA is a system where you can have high-res in normal resolution files. And in part of this system its actually to also calibrate the DA converter. So to try to compensate some of the flaws in the DA converter. But that is perfectly possible, yes, and we do it to a large extend.
Christopher: Ok. Ehm. My brain starts thinking instantly so how can you do that? Can you maybe elaborate a little bit on some of the methods you use?
Jan: As I said the fundamental thing is, first to find out is its stable. It’s predictable. If it is so, and you can do that by simply taking a lot of samples, you know, different speakers and measure the things and see if it is the same all the time.
If it is the same all the time, you have to make a mathematical model of what is going on. For instance, if it is simply a chain depending on frequency, a filter it is perfectly curable by just an inverse filter.
But even non-linear things can be cured as well as long as you have a model that actually fits the physics that you are operating it. So it is the part of the system we are talking about.
Christopher: So it is about filling out the stable flaws and trying to cure them.
Jan: Exactly. It could also be like non-linear in the drive unit and things like this. That can ultimately also be cured in DSP.
Christopher: Ok There is a lot of thing we can do.
Jan: Oh yeah. We are only at the very beginning at this stage.
Christopher: It is a very exciting...
Ernst, he has another question for us Jan. It is about the time domain. He asks whether or not its possible to solve time domain issue in the frequency domain by math.
Jan: Yes. Well that is a very good question. Actually what you have to understand is that the time domain, the frequency domain is actually the same thing. IT is just two different things to see the same object. Where in mathematical terms we say that - a full duality between the two domains. That means that anything in one domain has the same – has a dual situation in the other domain. SO for instance when the dual time domain filter low pass filter you can do that by implementing the convolution of an impulse response while you can also do the same thing also in frequency domain where there convolution actually turns into multiplication. So sometimes it’s more efficient, more practical to do in one domain rather than the other domain. But if you really want to if you are really passionate about one domain you can stay in that domain after all your stuff – all go to the other domain. Sometimes it also depends what is the more practical what is the more efficient way. For instance, let me just give one example. If you have a very very long impulse response it would be very in efficient to do it in time domain. Whereas if you do it in the frequency domain, the longer the impulse response is the more efficient is this in frequency domain.
Christopher: So in the end...
Jan: But in effect everything that can be done in one domain also can be done in another domain. Can be more complicated. It can be more inefficient. Things like that. But you can also always do in both domains.
Christopher: So in the end it is about either being passionate about one domain or the other or being focused on practicality.
Jan: Or how you general lay out of your signal flow is. So maybe you already do other processes in the frequency domain then you tend to stay in the frequency domain. Or the rest of the signal chain – all the operations done in time domain. You might stay in time domain.
Christopher: Great! As you can see guys we have moved the tables out and brought the white board in. That is because, Jan, he is about to draw. And that is because we have some questions from Sebastian Roy.
Actually have a lot of questions that are about the DFT. It is about the set transform and it is about convolution. And you have something that you want to show us Jan?
Jan: Yes. Because before diving into any of these questions I just think it would be nice for us to actually remind ourselves what is fundamentals of DSP. Why can we do it without loss of any information.
It all usually starts with analogue. Then we made it digital. To do that DSP in the digital domain. And then we usually go back to analogue to the power and you fire the drive unit. We can look at things in time domain or in frequency domain - and let’s just take one random example. If we take a time signal it could look like, it could be something like this. On purpose, I have not drawn just a simple sinusoid But it is more complicated.
If you take this signal into the frequency domain then in frequency domain it looks like this. In the middle, usually you have the 0 Hz. Then you have usually have different levels. Something like this. Then you actually have something which is.. It is symmetrical. Excuse my drawing up here. It has to be actually completely symmetrical because if it is symmetrical here then this is a purely real signal. So it is not complex so it doesn’t have an imaginary part to it. So that is why this is symmetrical and when we do it in digital what we actually do is to sample. You have heard about this before. SO we go in at certain times...
Christopher: And measure the signal…
Jan: What is the signal? And we note what is the signal at these instances of time. We do this usually in a much regular way. So For instance at 44.1 kHz that is 44100 times a second. This is the sampling rate we know from our old CD- compact disc. In more modern systems we have 96kHz or 192 kHz or 384 kHz. So nowadays it is more than 100 000 times a second.
Christopher: That is a lot.
Jan: Yeah it is. So you can see, now we just note in digital it is simply... it is a point now. So it is just a point, a level at that time. And another level at this time. And so on and so forth. So Something like this. Right? So that is in digital.
What happens over here? And now I am drawing a bigger frequency. What is this? This is because now everything is actually just like before but it repeats.
Christopher: It repeats now.
Jan: So if you have the sampling frequency that was the number of times per second that we note what is the signal. You can actually make a duplicate of this over here. So a perfect copy... I am not that good at doing perfect here but something like this. So for every sampling frequency actually to infinity – so it continues off - and down as well.
Christopher: We get duplicates.
Jan: Yeah. And this actually shows us a fundamental problem in digital. That is if the frequency content is too wide in frequency then these two would overlap. And in this particular instance it is actually ok and actually there is a theorem called the Shannon’s sampling frequency - the Shannon sampling theorem.
That tells us that if the signal has a content up to a certain frequency then we must sample at least double that amount. So, you know normal acoustic signals - we say that the ear goes up to 20 kHz that means we should at least sample 40 kHz. This has led to the CD standard 44.1
Christopher: Ok and that is to retain the detail in the recorder?
Jan: Let me go on because what usually happens is that we then apply a low pass filter. To make sure that there is no frequency content above the Nyquist frequency. This is... This frequency is actually called as Nyquist frequency whereas the sampling rate is also called the Nyquist rate. And the Nyquist rate has to be at least double that of the Nyquist frequency. And with a low pass filter we make sure that the signal is contained below this Nyquist frequency.
If that was not the case, it would be as I say... Let’s just try to apply to this... if it would have continued then this would also have continued and down here they would add and go up like this so you get something completely different. This is aliasing. So things begins to look like something that it is not anymore. So it has an alias.
Christopher: And I guess that sounds terrible.
Jan: It is completely terrible. Completely unacceptable that is why we apply the low pass filter to avoid the aliasing to be significant. Because no filter can attenuate Infinitely. But as long as it is a very much so you don’t hear then it is no problem. But now I would actually go one step further and explain why the chain is solid and we don’t lose any information by using the DSP. If we just apply this simple rule that you have to sample at the double frequency. That is because we cannot make these things – this is actually a sequence of numbers. And usually the numbers would go between 0 and 1.
Down here we can say now we go back to analogue. What would happen then? Well from the very beginning let me just make a little indication what are the digital values at these instances of time. Something like this. If you actually obey this rule and there is no aliasing and you make another low pass filter again over here because I need to again – have the Frequency domain like this. And over here now you have all these instances of frequencies and if you make a low pass filter. So let me just draw it again. It is difficult to make the same drawing over and over again right?
Christopher: It is.
Jan: But I think everybody can see that I am trying to at least.
Christopher: At least I get it, Jan. I get it.
Jan: Ok. That is good. That is good. Then the point, when you go from digital to analogue is actually to apply the low pass filter once more and capture only the original spectrum not these extra spectrums that actually spectra that came just because it is digital and in digital everything is circling so it comes back and comes back and it comes back again.
So if you do a perfect low pass filter here again, what you get – and this surprises some people actually- what you actually get between the points now is actually the exact same as before. So let me try this time. Yes. It was something like this. Although you get these details in between- you see you look up here. Then it goes down steeply down to the point and then a little wriggle here and little wriggle there - up and down – like this. Actually, if you actually just obey the Shannon theorem the sampling theorem.
You actually get back the exact same signal. Not just a straight point or some smooth point between these digital values you actually get everything back because you have retained the exact information in the frequency domain.
Christopher: Because you abide to the rules?
Jan: Of course if you zoom in – not everything is completely ideal. We cannot make an ideal low pass filter that does not chains things up here. That is actually a very good example of – a lot of people ask me – why do we go to that high sampling frequency.
Well, that is exactly because of this. Because usually if I just indicate again the Nyquist frequency. So that was the half of the sampling frequency. At that frequency this low pass filter must be way down. 90 decibels, 120 decibels. Something like this - Way down. But on the other hand it must continue long enough that it does not alter the original music. So if for instance – at an old fashion like a CD player- you go to... you have signals up to 20 kHz.
So the low pass filter cannot start doing something until 20 kHz but at the half of the sampling frequency that is 22.05 kHz. Then it has to be very very steep because it starts going down at 20 kHz and already at 22 it must be very very down. This is the reason why we then have a higher sampling frequency because now the Nyquist frequency also doubles or triples or quadruples and so on.
Christopher: To have more...
Jan: Much more room to do a more general filtering and also we can push the filter so much above the frequencies of the music. So it does not change the music too much. Because one thing is the amplitude response which is the level here. But any filter also changes the time.
That is what is called the phase response and the phase response usually go one decade below the cut-off frequency. So if the cut-off frequency was 20 kHz as low as 2 kHz there will be slight phase distortion. But I think all of these points to – actually explains much better – how can you make a better perfect copy because once you get into the digital domain everything can be copied completely because it is numbers. It is easy to copy a number. '
A series of numbers then as you saw, while I was trying to do the drawing. It is difficult to do a perfect copy of an analogue signal. Right?
Christopher: Exactly. And it’s way easier to copy a zero
Jan: And this is why, once we are in the digital we can do as many copies as we like and do a full control. The surprising thing is that if we really do it the right way we can actually get all the details back, not just the straight lines between the sampling points.
Christopher: Yeah. Because that surprised me a bit right? How can we go from that to – you know – retaining all of the curves and all of the small dips and ...
Jan: Yeah but that is the information that is found in this figure. All the information here was the same as up here. And up here was the frequency content of the whole signal with all these wriggles and stuff
Jan: It is to the extent that this spectrum is the same as below here. Then analogue to digital and then analogue again can be perfect. So, it’s all a matter of doing it the right way and having full control.
Christopher: Yeah. That is impressive.
Guys we are fast approaching to the end of today’s episode. As you can see we have only started to dip our toes in this topic. And I think there is a lot more to say.
Jan: Well, actually to be honest I am more than eager to come back and tell much more about what DSP can do because it is a multitude of possibilities. It is only... the sky is the limit really. And there is so much more and I think we have just covered the very basics of why DSP has a home in high performance audio.
Christopher: And it has been a pleasure to have you on here. We tried something new with the white board today and I really look forward to doing that again. And thank you guys for all of the great questions that we got, it has been a pleasure to host this episode. Thank you.