PowerSDR Buffers and Sample Rate Relationship

Expand / Collapse

PowerSDR Buffers and Sample Rate Relationship

PowerSDR Buffers and Sample Rate Relationship

  System Dependencies
  Minimum PowerSDR Version:     1.X.0  
  Applicable Hardware:     All SDR transceivers  

Content provided by: FlexRadio Systems Engineering and Joe AB1DO

Rather than a theoretical discourse on the consequences of Buffer Size and Sample Rate settings, this article will attempt to illustrate how these settings effect both the minimum possible filter bandwidth, filter slope or steepness and latency for each of the settings available in PowerSDR. We will start with the filter effects and then move on to latency. Finally a little underlying theory is offered to help gain some more insight without the need to delve into a DSP tomb.

Filter Effects
The minimum filter width possible at a given DSP Buffer Size N and a Sample Rate fs equals 1.5*fs/N, where the factor 1.5 is due to the additional roll-off due to the Blackman-Harris window function. Therefore, for the steepest and narrowest filters we want a low Sample Rate and a high DSP Buffer Size. Exactly how this effects the filter shapes is shown on the following two pages in Figure 1 through 3 for a 2.7kHz LSB filter and in Figure 4 through 6 for a 25Hz CW filter. It is clear that as the Sample Rate increases and/or the DSP Buffer size decreases, the filter skirts become less “brick-wall” and more “roll-off”, thus reducing a filter's effectiveness.

 Graph Legend
 Color DSP Buffer Size 
 Red  512
 Green  1024
 Blue  2048
 Black  4096

Figure 1: 2.7kHz LSB Filter at 48kHz Sampling Rate

Figure 2: 2.7kHz LSB Filter at 96kHz Sample Rate

Figure 3: 2.7kHz LSB Filter at 192kHz Sample Rate

Figure 4: 25Hz CWL Filter at 48kHz Sample Rate

Figure 5: 25Hz CWL filter at 96kHz Sample Rate

Figure 6: 25Hz CWL Filter at 192kHz Sample Rate

Latency Effects
The latency in the system will be at least equal to the minimum of the Audio and DSP Buffer Sizes divided by the Sample Rate. Because both the DSP Buffer and the Sample Rate also determine the minimum filter width, setting the Audio Buffer as small as your computer system will tolerate is preferable. That way, latency will not be unnecessarily long. If latency is an issue with your computer system, you may have to resort to a smaller Buffer Size and/or a higher Sample Rate than you would otherwise prefer based on filter shapes.

Underlying Theory
To transform signals from the time domain to the frequency domain we start with the Discrete Fourier Transform (DFT), which is the Fourier Transform for time sampled signals (The FFT or Fast Fourier Transform is an efficient algorithm to calculate the DFT). It is important to realize that the result of the DFT is a continuous function of the frequency, from –infinity to +infinity. The annoying thing about this transform, however, is that it needs to “know” the temporal signal over a time domain of ±infinity. Needless to say, this is not practical.

We can limit the time domain T to a limited number of samples (equal to the “slice” of time represented by the DSP Buffer) if we assume the temporal signal to repeat continuously, with a period T. The result is, however, no longer a continuous function of the frequency, but a discrete function, that is, the power spectrum is only calculated at frequency intervals equal to 1/T. These discrete frequencies are called bins. These bins can be envisioned as a series of 1/T Hz wide parallel filters, spaced every 1/T Hz. Each bin “fills” with the average power at its center frequency and averaged over 1/T Hz. The frequency resolution is therefore limited to 1/T Hz.

  • Because we assume the time domain signal at hand to repeat with period T, any discontinuity between the last sample in a buffer and the first sample in the next buffer will violate this condition. To understand this, it helps to know that the result of an FFT is complex, including magnitude and phase information (this is even true if the temporal signal is real). In other words, rather than on a straight line, the FFT writes the data on a circle in the complex plane, where one revolution represents N/T Hz (N being the number of samples in the DSP Buffer). When the last sample in the DSP Buffer meets the first sample in the next DSP Buffer, chances are they will not meet in a continuous fashion. Any discontinuity will lead to a wide associated spectrum across multiple bins, a phenomenon known as “bleed-through”.
  • Another way of looking at this is that a signal with period T (and any harmonic thereof), can be represented as a combination of its fundamental frequency 1/T Hz and higher order harmonics, all spaced at multiples of its fundamental frequency. These spectral components are therefore at the center of each FFT bin. If on the other hand, the temporal signal does not have a periodicity equal to (an integer multiple of )the fundamental frequency, it's spectral components will not be centered on each bin and bleed through will occur from one bin to the next, resulting in a loss of frequency resolution.
  • To avoid this happening, the samples in the DSP Buffer are first multiplied by a window function  such that the spectral smearing is limited, but it is not completely eliminated. Each window function has advantages and disadvantages depending on the situation at hand. For our purposes, the Blackman-Harris window offers the best trade-off between loss of frequency resolution and stop-band characteristics.

The time slice T that the DSP buffer represents, often called the FFT size, equals the number of samples it can hold (the Buffer size N) divided by the Sample Rate fs, e.g. if the Buffer size equals 1024 and the sample rate 96kHz, the DSP Buffer represents a time slice of 1024/96kHz = 10.67ms.

  • If a signal suddenly appears, we will need to wait until the Buffer is filled, at which time it can be processed by the FFT. Waiting for the buffer to fill limits our resolution in the time domain (we have to wait T seconds). This temporal resolution is also known as latency: a high temporal resolution equals a low latency. To decrease our latency (increase our temporal resolution), we therefore need to keep T small by either reducing the Buffer size or increasing the Sample Rate, or both.
  • However, we have already seen that the frequency resolution equals 1/T Hz (ignoring effects due to windowing). Therefore to increase frequency resolution, we need to increase T as much as possible by using a large Buffer Size and a low Sample Rate. It is this frequency resolution that determines the possible steepness and narrowness of our filters. A higher resolution enables steeper and narrower filters.
  • Clearly we cannot have both a high temporal and a high frequency resolution. We must make a trade-off by setting the temporal resolution (latency) to an acceptable level and accepting the resulting frequency resolution (minimum filter width).

This KB article may reference additional files that are available on the FlexRadio Systems web site Downloads page. Please use the URL(s) below to download the referenced materials.

An Adobe Acrobat Reader may be required to open the file. You can download Adobe Acrobat from here.

KB Source Document(s):

None Referenced

Rate this Article:

Add Your Comments

Comment require login or registration.

Last Modified:Tuesday, February 23, 2010
Last Modified By: Administrator
Type: INFO
Level: Advanced
Rated 4 stars based on 6 votes.
Article has been viewed 11,659 times.