• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

DSP

amirm

Founder/Admin
Staff Member
CFO (Chief Fun Officer)
Joined
Feb 13, 2016
Messages
44,563
Likes
238,999
Location
Seattle Area
hmmm...

Ok, so a tune has been going through the filter, and then we stop Time for moment...

so 1024 samples are loaded, which one of those 1024 am I recalculating with all the multiplying and summing?
No, you stop time at the start. You slurp up those 1024 samples and then start to process and output, hence the latency.

You can start right away but then your starting processed samples would behave oddly/be wrong since you don't have the past samples to do it right. This is sometimes done in video at the line boundaries but not in audio.
 

The Smokester

Active Member
Joined
May 11, 2017
Messages
136
Likes
39
Location
SF Bay
No, you stop time at the start. You slurp up those 1024 samples and then start to process and output, hence the latency.

You can start right away but then your starting processed samples would behave oddly/be wrong since you don't have the past samples to do it right. This is sometimes done in video at the line boundaries but not in audio.

Does this mean the first 1023 samples don't get played?
 

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,868
Likes
16,622
Location
Monument, CO
As Amir said, the very first sample does get played, and every one after that, but in his example there is a delay of ~1024 more samples before that first sample is output. That is the latency getting through the filter. So the first sample goes in, the filter starts "filling", and that first sample ripples through until it pops out the other end 1024 samples later. Once the first one pops out, the next comes right after, bit by bit, in a continuous stream, but again all are delayed by 1024 samples from the time when they entered the filter.

HTH - Don
 

The Smokester

Active Member
Joined
May 11, 2017
Messages
136
Likes
39
Location
SF Bay
No, they do get played.

Welcome to the forum by the way.

Thank you, Amirm. I belonged to WTB from inception up to a few years ago when I sold my audio system and went sail-about. Starting to re-engage.

I remember, and always enjoy, the clarity of your posts.
 

The Smokester

Active Member
Joined
May 11, 2017
Messages
136
Likes
39
Location
SF Bay
As Amir said, the very first sample does get played, and every one after that, but in his example there is a delay of ~1024 more samples before that first sample is output. That is the latency getting through the filter. So the first sample goes in, the filter starts "filling", and that first sample ripples through until it pops out the other end 1024 samples later. Once the first one pops out, the next comes right after, bit by bit, in a continuous stream, but again all are delayed by 1024 samples from the time when they entered the filter.

HTH - Don

Thank you. How does one initialize the coefficients in the filter for the first sample? I thought the filter for sample i depended on the previous i-1023 samples.
 

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,868
Likes
16,622
Location
Monument, CO
Here's a hand-waving explanation that might help; see figure below. The coefficients Ck, or tap weights, are defined by the filter design and loaded in registers at start-of-day (power-up; they may be reloaded if you change the filter, or by the room correction algorithm, etc.) They are usually fixed (static) in normal operation. The input data is loaded sample-by-sample (Sk = Sample 1 to n) and is clocked through the filter. The output of each sample (tap) in the filter is multiplied by a coefficient that is the tap weight -- the amount each sample contributes to the output. Then all the weighted samples are summed (added) to produce the output signal. The weighting function determines the transfer function of the filter -- how it modified and shapes the input.

upload_2017-5-12_22-14-33.png


Initially all samples are typically set to zero. The first data point, S1, starts at the left and is clocked all the way through to the right, and then disappears (is clocked out of the filter), to be replaced by the following data samples in the stream. The filter's output is suppressed (or not, depends upon the design) until the entire filter is filled with samples, then the output is sent downstream and eventually to the digital-to-analog converter (DAC) to produce the analog output.

HTH - Don
 

Attachments

  • upload_2017-5-12_22-1-39.png
    upload_2017-5-12_22-1-39.png
    45.4 KB · Views: 133

The Smokester

Active Member
Joined
May 11, 2017
Messages
136
Likes
39
Location
SF Bay
Don, Many thanks for the explanation. I thought the filter was adapting to the music but was just confused and conflated.
 

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,868
Likes
16,622
Location
Monument, CO
NP. There are dynamic filters but AFAIK the ones used in audio, at least as typically discussed for room correction and crossovers, are not. No real need nor desire -- you'd be changing the sound on the fly. A good example of a filter that adapts to the signal is probably in your computer -- the disk drive's receiver almost certainly includes a decision feedback equalizer, DFE, that looks something like the picture above. The output of the filter goes to some logic that looks at the signal eye (height and width) and then uses an (almost certainly proprietary) algorithm to adapt the coefficients on the fly to achieve the best signal integrity.
 
Top Bottom