SRC - Sample Rate Conversion
Sample rate conversion is a common requirement when integrating diverse systems into a single system. While some DSP hardware vendors provide standard libraries for SRC, these are often less than fully optimal for a given application. Many solutions are not even well optimized for the unique features of the DSP hardware, even when the solution is provided by the hardware vendor. Finally, some of the solutions out there come without the necessary filter coefficients known as the 'filter kernel'.
Requirements sometimes call for high quality conversions, keeping the noise floor below -110dB, or minimizing ripple or total harmonic distortion. Designing such a SRC can require several passes at the coefficients, Furthermore, the kernel length can be long and at high sample rates, the performance can be a problem.
When considering performance, the better approaches are multirate conversions. Each stage should be designed to make best use of band-folding which gets eliminated in the next stage. This needs to be done somewhat differently for various ratios of conversion, and therefore, having a single section of code that handles all the rates is not the most efficient approach, DSPWIdgets.com DSP Consulting services can help you find a better solution.
Advanced techniques can be used such as IIR stages at the front end, when some phase non-linearity is permitted. By using elliptical filters the greater non-linear portion is pushed into the upper end of the passband, and this part of the spectrum is removed during the next stage. In some cases it is possible to design a zero-phase shift IIR, which gives the efficiency of an IIR with the linearity of an FIR filter (in fact better than an FIR, its not just phase linear, its zero phase).
On a reasonable featured DSP processor, it is possible to perform 96K to 44.1K rate conversion with a -100dB noise floor to run in 7 MCPS or less by our DSP consultants. In cases where hardware extensions are possible (customization of the DSP hardware), 4 MCPS has been obtained. Advanced techniques to improve performance can also save power, something that should concern designers of mobile applications.
Yes - you can get sample rate converters almost for free, but when you consider the total cost of squeezing other parts of the system to fit in the remaining MCPS of the system, or the cost of going to a multi-processor system, or when you have stringent requirements, the cost of hiring a consultant with years of experience will be repaid by other project economies.
Sample rate conversion is a common requirement when integrating diverse systems into a single system. While some DSP hardware vendors provide standard libraries for SRC, these are often less than fully optimal for a given application. Many solutions are not even well optimized for the unique features of the DSP hardware, even when the solution is provided by the hardware vendor. Finally, some of the solutions out there come without the necessary filter coefficients known as the 'filter kernel'.
Requirements sometimes call for high quality conversions, keeping the noise floor below -110dB, or minimizing ripple or total harmonic distortion. Designing such a SRC can require several passes at the coefficients, Furthermore, the kernel length can be long and at high sample rates, the performance can be a problem.
When considering performance, the better approaches are multirate conversions. Each stage should be designed to make best use of band-folding which gets eliminated in the next stage. This needs to be done somewhat differently for various ratios of conversion, and therefore, having a single section of code that handles all the rates is not the most efficient approach, DSPWIdgets.com DSP Consulting services can help you find a better solution.
Advanced techniques can be used such as IIR stages at the front end, when some phase non-linearity is permitted. By using elliptical filters the greater non-linear portion is pushed into the upper end of the passband, and this part of the spectrum is removed during the next stage. In some cases it is possible to design a zero-phase shift IIR, which gives the efficiency of an IIR with the linearity of an FIR filter (in fact better than an FIR, its not just phase linear, its zero phase).
On a reasonable featured DSP processor, it is possible to perform 96K to 44.1K rate conversion with a -100dB noise floor to run in 7 MCPS or less by our DSP consultants. In cases where hardware extensions are possible (customization of the DSP hardware), 4 MCPS has been obtained. Advanced techniques to improve performance can also save power, something that should concern designers of mobile applications.
Yes - you can get sample rate converters almost for free, but when you consider the total cost of squeezing other parts of the system to fit in the remaining MCPS of the system, or the cost of going to a multi-processor system, or when you have stringent requirements, the cost of hiring a consultant with years of experience will be repaid by other project economies.
Asynchronous SRC
Sometimes you need to import a stream from external hardware, and use it on your platform. This stream may need to be converted to a different sample rate, or not. The bigger issue is when the remote stream is captured against a different clock than is used on the local platform. Since the stream is digital and therefore consist of discrete samples, the number of samples produced by the stream and delivered must exactly match the demand rate of the local platform.
If the local platform and the remote source have two different clocks, one of them will be ever so slightly running at a different rate, and therefore, the production verses the consumption rate will not match. A type of sample rate converter known as asynchronous is used to match the two systems. If the remote system nominally produces at 48K (for example) and the local system consumes at 48K, then the nominal conversion ratio is 1:1, however this ratio may need to actually be 1.00000001 to 1. Further since no clock is 100% stable, this ration may need to vary a little over time.
The trick to designing these algorithms is to keep the buffering requirements and the latency low, and being able to adjust the ratio in small increments, without consuming large amounts of the DSP. Further the system has to self adjust as samples come in and are consumed.
Experience is key in getting these algorithms to perform well. It is likely that using DSPWidgets.com as your DSP Consulting service will provide a faster solution working well out of the box.
Sometimes you need to import a stream from external hardware, and use it on your platform. This stream may need to be converted to a different sample rate, or not. The bigger issue is when the remote stream is captured against a different clock than is used on the local platform. Since the stream is digital and therefore consist of discrete samples, the number of samples produced by the stream and delivered must exactly match the demand rate of the local platform.
If the local platform and the remote source have two different clocks, one of them will be ever so slightly running at a different rate, and therefore, the production verses the consumption rate will not match. A type of sample rate converter known as asynchronous is used to match the two systems. If the remote system nominally produces at 48K (for example) and the local system consumes at 48K, then the nominal conversion ratio is 1:1, however this ratio may need to actually be 1.00000001 to 1. Further since no clock is 100% stable, this ration may need to vary a little over time.
The trick to designing these algorithms is to keep the buffering requirements and the latency low, and being able to adjust the ratio in small increments, without consuming large amounts of the DSP. Further the system has to self adjust as samples come in and are consumed.
Experience is key in getting these algorithms to perform well. It is likely that using DSPWidgets.com as your DSP Consulting service will provide a faster solution working well out of the box.
Frequency Filters
Frequency filters remove some portion of the spectrum, or alter the amount of energy as a function of frequency. This is useful to remove noise, separate parts of the band for separate processing, artifact removal, compensation for speakers, mics or their acoustic enclosures, or general enhancement of a signal. Filtering can be performed in the time or frequency domain, and which is best depends on the overall requirements.
Several types of filters exist:
Low Pass
High Pass
Band Pass
Notch Filters
Narrow band comb based filters
Shelf Filters (both low pass and high pass)
Peaking filters of various Q factors
1st and 2nd order low pass or high pass filters
The code to execute the time domain filters is not complex, and care in construction is necessary to improve performance. The difficulty here is in computing the coefficients. Some of these filters require changing the filter coefficients on the fly, in response to user preferences. More stringent requirements should consider multi-stage or multi-rate techniques, or even sub-sampling.
,
Frequency domain filters allow for a complete customization of the filter response, but can introduce a lot more latency. The performance is some cases can be improved using a frequency domain filter. Attention to details such as circular convolution is essential. Attention to detail is a benefit of using DSP Consulting vs In-House.
Frequency filters remove some portion of the spectrum, or alter the amount of energy as a function of frequency. This is useful to remove noise, separate parts of the band for separate processing, artifact removal, compensation for speakers, mics or their acoustic enclosures, or general enhancement of a signal. Filtering can be performed in the time or frequency domain, and which is best depends on the overall requirements.
Several types of filters exist:
Low Pass
High Pass
Band Pass
Notch Filters
Narrow band comb based filters
Shelf Filters (both low pass and high pass)
Peaking filters of various Q factors
1st and 2nd order low pass or high pass filters
The code to execute the time domain filters is not complex, and care in construction is necessary to improve performance. The difficulty here is in computing the coefficients. Some of these filters require changing the filter coefficients on the fly, in response to user preferences. More stringent requirements should consider multi-stage or multi-rate techniques, or even sub-sampling.
,
Frequency domain filters allow for a complete customization of the filter response, but can introduce a lot more latency. The performance is some cases can be improved using a frequency domain filter. Attention to details such as circular convolution is essential. Attention to detail is a benefit of using DSP Consulting vs In-House.
Magnitude and Phase Compensation
The processing of some signals results in an undesired change in the spectrum. This is the case in processing the PWM signal of a MEMS microphone and turning it into a PCM signal.
Compensation is more easily performed when the impulse response that created the distortion is known. This can be the impulse response of the algorithm, or the overall system impulse response which includes transducer performance, obtained in a sound chamber.
Magnitude compensation is usually more the concern in audio, however an exception occurs when using a multi-microphone array, especially in beamforming applications. In this case, phase differences in the transducer output can interfere with the intended compensation. This issue is not to be confused with phase linearity - usually the signal can be very non linear in phase if the microphones all exhibit the same phase non-linearity. Its when differences in the phase for different frequencies exist in the microphone or transducer output.
DSPWidgets DSP Consulting can provide filters that compensate for magnitude, as well as pass band magnitude flat filters that compensate for phase.
The processing of some signals results in an undesired change in the spectrum. This is the case in processing the PWM signal of a MEMS microphone and turning it into a PCM signal.
Compensation is more easily performed when the impulse response that created the distortion is known. This can be the impulse response of the algorithm, or the overall system impulse response which includes transducer performance, obtained in a sound chamber.
Magnitude compensation is usually more the concern in audio, however an exception occurs when using a multi-microphone array, especially in beamforming applications. In this case, phase differences in the transducer output can interfere with the intended compensation. This issue is not to be confused with phase linearity - usually the signal can be very non linear in phase if the microphones all exhibit the same phase non-linearity. Its when differences in the phase for different frequencies exist in the microphone or transducer output.
DSPWidgets DSP Consulting can provide filters that compensate for magnitude, as well as pass band magnitude flat filters that compensate for phase.
Perceptual Bass Boost
Small speakers found in laptops and phones are at a disadvantage in producing frequencies below 200Hz. However, normally in nature sounds occur as a series of harmonics, each with decreasing energy. By shifting the frequencies below 200Hz to a higher harmonic frequency, the ear hears the 'pattern' of harmonic frequencies, and perceives a fundamental that isn't present. In this way, base sound below the speaker threshold can be perceptually boosted.
Small speakers found in laptops and phones are at a disadvantage in producing frequencies below 200Hz. However, normally in nature sounds occur as a series of harmonics, each with decreasing energy. By shifting the frequencies below 200Hz to a higher harmonic frequency, the ear hears the 'pattern' of harmonic frequencies, and perceives a fundamental that isn't present. In this way, base sound below the speaker threshold can be perceptually boosted.
Optimization and Porting
We also provide DSP Optimization and porting. If you have your own DSP code, or vendor code that you have licensed, we can help you port it.
If the code is floating point, and your processor supports fixed point, the porting can get complex. Care must be taken not to overrun the fixed precision of the registers, without giving up resolution. DSPWidgets can provide expert DSP consulting advice to insure a timely and sucessful port.
If your code runs slow, we can identify the bottlenecks, this usually isn't a very difficult task, but fixing it is. Often, DSP engines have advanced features such as VLIW or SIMD instructions. Taking full advantage of these instructions sometimes requires assembly code, and even if intrinsics are supported, having good knowledge of the underlying architecture is essential. Often a very small portion of the code, less than 15 percent is responsible for 90 percent of the CPU. Adapting this code to assembly, or at least well tuned instrinsics results in a big improvement. The success of this depends on the performance tools provided by the vendor, and the instruction set of the processor. The more optimization oriented both of these are, the more expertise on using these features is required.
Sometimes the overall structure of how something is done can be improved, and this may require an algorithm substitution. Perhaps the SRC needs to be replaced with a multirate SRC, or there is a more efficient FFT, such as radix 4 verses radix 2.
If you have MatLab m-code, we can optimize its run time as well. Often simple things can be done to get a big performance boost in the execution time for matlab. We can also build solutions in matlab for proof of concept, or provide a user friendly translation from Matlab to C code.
We also provide DSP Optimization and porting. If you have your own DSP code, or vendor code that you have licensed, we can help you port it.
If the code is floating point, and your processor supports fixed point, the porting can get complex. Care must be taken not to overrun the fixed precision of the registers, without giving up resolution. DSPWidgets can provide expert DSP consulting advice to insure a timely and sucessful port.
If your code runs slow, we can identify the bottlenecks, this usually isn't a very difficult task, but fixing it is. Often, DSP engines have advanced features such as VLIW or SIMD instructions. Taking full advantage of these instructions sometimes requires assembly code, and even if intrinsics are supported, having good knowledge of the underlying architecture is essential. Often a very small portion of the code, less than 15 percent is responsible for 90 percent of the CPU. Adapting this code to assembly, or at least well tuned instrinsics results in a big improvement. The success of this depends on the performance tools provided by the vendor, and the instruction set of the processor. The more optimization oriented both of these are, the more expertise on using these features is required.
Sometimes the overall structure of how something is done can be improved, and this may require an algorithm substitution. Perhaps the SRC needs to be replaced with a multirate SRC, or there is a more efficient FFT, such as radix 4 verses radix 2.
If you have MatLab m-code, we can optimize its run time as well. Often simple things can be done to get a big performance boost in the execution time for matlab. We can also build solutions in matlab for proof of concept, or provide a user friendly translation from Matlab to C code.