Difference between revisions of "Convolution"

From JRiverWiki
Jump to: navigation, search
(Troubleshooting the Cons)
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
Convolution is a complex digital signal processing method that allows for significant changes to audio that would not be possible with conventional electronic or software filtering.   
 
Convolution is a complex digital signal processing method that allows for significant changes to audio that would not be possible with conventional electronic or software filtering.   
  
Conventional electronic filters are typically [http://en.wikipedia.org/wiki/Minimum_phase Minimum Phase] filters.  This means that any change to the [http://en.wikipedia.org/wiki/Frequency_response Frequency Response] of the audio is accompanied by a corresponding change to the [http://en.wikipedia.org/wiki/Phase_%28waves%29 Phase] (or timing) of that audio; in a minimum phase environment, you can't normally change one without the other.  JRiver's parametric equalizer modules are [http://en.wikipedia.org/wiki/Infinite_impulse_response Infinite Impulse Response] filters that simulate conventional minimum phase electronic filters.  
+
Conventional electronic filters are typically [http://en.wikipedia.org/wiki/Minimum_phase Minimum Phase] filters.  This means that any change to the [http://en.wikipedia.org/wiki/Frequency_response Frequency Response] of the audio is accompanied by a corresponding change to the [http://en.wikipedia.org/wiki/Phase_%28waves%29 Phase] (or timing) of that audio; in a minimum phase environment, you can't normally change one without the other.  Media Center's parametric equalizer modules are [http://en.wikipedia.org/wiki/Infinite_impulse_response Infinite Impulse Response] filters that simulate conventional [http://en.wikipedia.org/wiki/Minimum_phase Minimum Phase] electronic filters.  
  
 
By contrast, Convolution can perform [http://en.wikipedia.org/wiki/Linear_phase Linear Phase] filtering: altering the frequency response of the signal separately from the phase using [http://en.wikipedia.org/wiki/Finite_impulse_response Finite Impulse Response] filters.  In addition to this capability, many automated room correction software suites use convolution filters as an output because it makes a convenient way to bundle a large DSP bank into a single file.
 
By contrast, Convolution can perform [http://en.wikipedia.org/wiki/Linear_phase Linear Phase] filtering: altering the frequency response of the signal separately from the phase using [http://en.wikipedia.org/wiki/Finite_impulse_response Finite Impulse Response] filters.  In addition to this capability, many automated room correction software suites use convolution filters as an output because it makes a convenient way to bundle a large DSP bank into a single file.
Line 9: Line 9:
 
===Filter Generation===
 
===Filter Generation===
  
In order to use Convolution, you'll need to use third party software to generate a filter. Most such software requires a microphone to create the filter.  Many software solutions are available, and the following solutions are used by various JRiver forum members:
+
You'll need to use third party software to generate a filter and most such software requires a (calibrated) microphone to operate. Amongst the many software solutions available, the following solutions are used by various JRiver forum members:
  
#[http://drc-fir.sourceforge.net/ DRC] - Free cross-platform convolution filter generator. Automated filter generation; Requires a microphone; Limited graphical interface.
+
* [http://drc-fir.sourceforge.net/ DRC] - Free cross-platform convolution filter generator. Automated filter generation; Requires a microphone; Limited graphical interface.
#[http://sourceforge.net/projects/rephase/ Rephase] - A no cost convolution filter editing tool. Not automated; no microphone required; Requires more user expertise to get good results.
+
* [http://sourceforge.net/projects/rephase/ Rephase] - A no cost convolution filter editing tool. Not automated; no microphone required; Requires more user expertise to get good results.
#[http://www.roomeqwizard.com/ Room EQ Wizard] - A no cost measurement and filter generation (requires forum registration).  Automated filter generation; Requires a microphone; Does not support linear phase filtering  
+
* [http://www.roomeqwizard.com/ Room EQ Wizard] - A no cost measurement and filter generation (requires forum registration).  Automated filter generation; Requires a microphone; Does not support linear phase filtering  
#[http://www.audiolense.com/ Audiolense] - Commercial software with limited free trial.  Automated filter generation; Requires a microphone
+
* [http://www.audiolense.com/ Audiolense] - Commercial software with limited free trial.  Automated filter generation; Requires a microphone
#[http://www.audiovero.de/en/acourate.php Acourate] - Commercial software with limited free trial.  Automated filter generation; Requires a microphone
+
* [http://www.audiovero.de/en/acourate.php Acourate] - Commercial software with limited free trial.  Automated filter generation; Requires a microphone
  
Additionally there are other convolution solutions that do not generate filters, but instead perform the filtering themselves (such as [http://www.dirac.se/en/online-store.aspx Dirac]), but because they do not generate convolution filters for use with JRiver's convolution DSP they are beyond the scope of this article.
+
Additionally there are other convolution solutions that do not generate filters, but instead perform the filtering themselves (such as [http://www.dirac.se/en/online-store.aspx Dirac]), but because they do not generate convolution filters for use with Media Center's convolution DSP, they are beyond the scope of this article.
  
'''Note:''' This list '''does not''' constitute an endorsement by JRiver of any of these software suites, it is intended as a list of known convolution filter generating utilities for informational purposes
+
'''Note:''' This list '''does not''' constitute an endorsement by JRiver of any of these software suites, it is intended as a list of known convolution filter generating utilities for informational purposes.
  
===Using the Filter in JRiver===
+
=== Using the Filter in Media Center ===
  
To use a single filter in JRiver, just navigate to Tools > Options > Audio > DSP Studio & Output Format > Convolution.  Browse to to your filter location, select it, and make sure that the check box beside the convolution tab is checked. 
+
==== Filter File Formats ====
  
For more complex configurations, JRiver can interpret standard plain-text [http://convolver.sourceforge.net/config.html Convolution Config Files]. See these [http://convolver.sourceforge.net/configegs.html Examples] for how to write one.
+
Filter files can be in any format supported by Media Center (.wav, .ape, .flac, .mp3, 16bit, 32bit, etc.)
  
Convolution filters are created at a specific sample rate, which means that they will only work correctly with that sample rate.  However, JRiver offers two solutions to that issue:
+
==== Using a Single Filter ====
  
# JRiver will automatically resample the filters on the fly; this solves the problem for most use cases.
+
To use a single filter in Media Center, just navigate to Tools > Options > Audio > DSP Studio & Output Format > Convolution.  Browse to to your filter location, select it, and make sure that the check box beside the convolution tab is checked. 
# If you want more control over what happens with different sample rates and channel configurations, you can generate separate filters at each sample rate, and JRiver will automatically switch between them, but you must use the following naming format for your filters: Name2.0_441 or Name5.1_48, etc. The regular expression is: ^(.+)(\\d{1}.\\d{1})_(\\d{2,3}).cfg$ , which outputs: Name Channels Sample rate.
+
 
 +
The file must map 1:1 to the supplied channels, e.g. if sending 8 channel output then the file must contain 8 channels, one for each input channel.
 +
 
 +
==== Using a Config File ====
 +
 
 +
MC can interpret a standard plain text [http://convolver.sourceforge.net/config.html config file] format for more complex configurations.  Some [http://convolver.sourceforge.net/configegs.html examples] are provided on the convolver site however note that not every single features of the cfg file format are supported by JRiver.
 +
 
 +
===== Cfg File Format Features =====
 +
 
 +
Further discussion can be found in https://yabb.jriver.com/interact/index.php?topic=95806.msg710067#msg710067
 +
 
 +
The supported features are:
 +
 
 +
* Input channel weights
 +
* Summing input channels to a single output path
 +
 
 +
The unsupported feature are:
 +
 
 +
* Input line delays
 +
* Multiple output channels in a path
 +
* Output channel weights
 +
* Multi pass convolution
 +
 
 +
==== Automatic Resampling ====
 +
 
 +
Convolution filters are created at a specific sample rate which means they will only work correctly at only that sample rate. 
 +
 
 +
MC provides two solutions to this issue:
 +
 
 +
# MC will automatically resample the filters on the fly
 +
# If you want more control over what happens with different sample rates and channel configurations, you can generate separate filters at each sample rate, and MC will automatically switch between them.
 +
#* This requires a specific file name format for that filter: Name2.0_441.cfg or Name5.1_48.cfg and so on
 +
#* i.e. the format is <name><channel count>_<sample rate>.cfg
 +
#* the regular expression for the above format is <code>^(.+)(\\d{1}.\\d{1})_(\\d{2,3}).cfg$</code>
 +
#* the supported sample rates (and their associated file name format) are:
 +
#** 441: 44.1kHz
 +
#** 48: 48kHz
 +
#** 882: 88.2kHz
 +
#** 96: 96kHz
 +
#** 176: 176kHz
 +
#** 192: 192kHz
 +
#** 352: 352kHz
 +
#** 384: 384kHz
 +
 
 +
==== Volume Normalization ====
 +
 
 +
The "Normalize Filter Volume" option applies a fixed -6dB cut to the overall gain.
  
 
==Pros and Cons==
 
==Pros and Cons==
Line 36: Line 82:
 
Because convolution is very flexible and very powerful, it can be used for many audio tasks including room correction, speaker correction, active crossovers, and sub integration. There some potential downsides to using convolution.
 
Because convolution is very flexible and very powerful, it can be used for many audio tasks including room correction, speaker correction, active crossovers, and sub integration. There some potential downsides to using convolution.
  
'''Pros'''
+
=== Pros ===
 +
 
 +
* Flexibility- FIR filters can make changes that simply aren't possible in other DSP.
 +
* Convenience- While audio tuning is never entirely easy, many of the automated utilities described above take microphone measurements and generate a single convolution filter that you can use in Media Center, which is much easier than doing the math and working out your own filter banks.
  
# Flexibility- FIR filters can make changes that simply aren't possible in other DSP.
+
=== Cons ===
# Convenience- While audio tuning is never entirely easy, many of the automated utilities described above take microphone measurements and generate a single convolution filter that you can use in JRiver, which is much easier than doing the math and working out your own filter banks.
 
  
'''Cons'''
+
* Latency- FIR fltering necessarily entails some delay.  In pure audio applications, this isn't very relevant, but in live playback applications or applications using Media Center's [[WDM  Driver]] the delay introduced by convolution can be meaningful.   
# Latency- FIR fltering necessarily entails some delay.  In pure audio applications, this isn't very relevant, but in live playback applications or applications using JRiver's [[WDM  Driver]] the delay introduced by convolution can be meaningful.   
+
* Processor Usage- Most modern PCs can handle fairly sophisticated convolution filters without problems.  However, older or low-powered PCs or very long/complex convolution filters can sometimes create problems.   
# Processor Usage- Most modern PCs can handle fairly sophisticated convolution filters without problems.  However, older or low-powered PCs or very long/complex convolution filters can sometimes create problems.   
+
* Videoclock- Because convolution involves minute changes to audio timing, [[VideoClock]] can sometimes interfere with convolution.  VideoClock adjusts the timing of the audio signal to maintain a perfect sync with the video and this can cause problems for convolution. Most Media Center users do not experience issues when using Convolution and Videoclock together, but see the troubleshooting section below for some ways to tell if you're experiencing an issue.
# Videoclock- Because convolution involves minute changes to audio timing, [[VideoClock]] can sometimes interfere with convolution.  VideoClock adjusts the timing of the audio signal to maintain a perfect sync with the video and this can cause problems for convolution. Most JRiver users do not experience issues when using Convolution and Videoclock together, but see the troubleshooting section below for some ways to tell if you're experiencing an issue.
 
  
===Troubleshooting the Cons===
+
=== Troubleshooting the Cons===
  
'''Latency'''
+
==== Latency ====
  
Because JRiver's implementation of convolution is not partitioned, the delay introduced by a convolution filter can be calculated using the following formula: (Taps / 2) / Sampling Rate (expressed in seconds). So a 22000 tap filter sampled at 44100Hz would introduce about 1/4 of a second of delay, which is significant.  While JRiver generally takes it's own DSP latency into account when playing back video internally, external video sources that are using JRiver's [[WDM Driver]] for playback may have lipsync issues when using convolution.  The film standard for lipsync is about 25ms; more delay than that will potentially begin to introduce lipsync issues.  For that reason, it's advised to create low-tap convolution filters if you plan to use them for live playback or WDM audio.
+
The delay introduced by a convolution filter can be calculated using the following formula: <code>(Taps / 2) / Sampling Rate</code> (expressed in seconds). So a 22000 tap filter sampled at 44100Hz would introduce about 1/4 of a second of delay, which is significant.  While Media Center generally takes it's own DSP latency into account when playing back video internally, external video sources that are using Media Center's [[WDM Driver]] for playback may have lipsync issues when using convolution.  The film standard for lipsync is about 25ms; more delay than that will potentially begin to introduce lipsync issues.  For that reason, it's advised to create low-tap convolution filters if you plan to use them for live playback or WDM audio.
  
'''CPU usage'''
+
==== CPU usage ====
  
 
If you're getting drop outs or unexpected behavior from your filters, open the convolution pane in DSP studio and look at the status display at the bottom.  It will include a performance measurement indicating how many times faster than real-time your CPU is processing the filters.  Typical modern PCs often show performance ratings better than 30x real-time, but the performance can fluctuate widely based on what else the PC is doing.  If you see that your performance multiplier is in the single digits or task manager is showing significant CPU usage, that may be an indicator that your processor isn't up to the task.  You can lighten the load by using shorter (lower taps) or less complex convolution filters.
 
If you're getting drop outs or unexpected behavior from your filters, open the convolution pane in DSP studio and look at the status display at the bottom.  It will include a performance measurement indicating how many times faster than real-time your CPU is processing the filters.  Typical modern PCs often show performance ratings better than 30x real-time, but the performance can fluctuate widely based on what else the PC is doing.  If you see that your performance multiplier is in the single digits or task manager is showing significant CPU usage, that may be an indicator that your processor isn't up to the task.  You can lighten the load by using shorter (lower taps) or less complex convolution filters.
  
'''Video Clock'''
+
==== Video Clock ====
  
 
If you have a [http://en.wikipedia.org/wiki/Phantom_center Phantom Center] speaker, you may find that video clock destabilizes the center image.  Not everyone experiences this, but if you find that your phantom center image is not stable, or if you have other inexplicable spatialization/imaging issues, try turning off VideoClock to troubleshoot.
 
If you have a [http://en.wikipedia.org/wiki/Phantom_center Phantom Center] speaker, you may find that video clock destabilizes the center image.  Not everyone experiences this, but if you find that your phantom center image is not stable, or if you have other inexplicable spatialization/imaging issues, try turning off VideoClock to troubleshoot.
  
==Links==
+
== Known Issues ==
A guide to speaker measurement and correction which includes some discussion of convolution can be found here:
+
 
 +
=== Config File Reloading ===
 +
 
 +
This issue was raised in https://yabb.jriver.com/interact/index.php/topic,102394.msg710066.html#msg710066
  
http://yabb.jriver.com/interact/index.php?topic=87538.0
+
In short, once a config file has been loaded by jriver then any changes (to the file or the referenced filters) are ignored until the MC process is completely restarted.  
  
The Convolution feature was proposed and discussed in this thread on Interact:
+
=== Filter must not have inherent gain ===
  
http://yabb.jriver.com/interact/index.php?topic=69312.0
+
See https://yabb.jriver.com/interact/index.php?topic=93578.msg646661#msg646661 for details
  
Additional discussion of measuring techniques and filter generation software can be found in these threads:
+
Inherent gain means "impulse peak is greater than 1"
  
http://yabb.jriver.com/interact/index.php?topic=69312.0
+
=== Channel Routing is Buggy when more than 10 output channels are present ===
  
http://yabb.jriver.com/interact/index.php?topic=85631.0
+
Full details in https://yabb.jriver.com/interact/index.php?topic=99073.msg688023#msg688023
  
 +
== Further Reading ==
  
 +
* [http://yabb.jriver.com/interact/index.php?topic=87538.0 A guide to speaker measurement and correction which includes some discussion of convolution]
 +
* [http://yabb.jriver.com/interact/index.php?topic=69312.0 The Convolution feature was proposed and discussed in this thread on Interact]
 +
* Additional discussion of measuring techniques and filter generation software can be found in these threads:
 +
** [http://yabb.jriver.com/interact/index.php?topic=69312.0 Microphone measurements and convolution setup]
 +
** [http://yabb.jriver.com/interact/index.php?topic=85631.0 Room Correction]
  
[[Category: Frequently Asked Questions]]
+
[[Category:Frequently Asked Questions]]
 
[[Category:Audio]]
 
[[Category:Audio]]
 
[[Category:DSP]]
 
[[Category:DSP]]

Latest revision as of 16:42, 25 February 2018

Convolution is a complex digital signal processing method that allows for significant changes to audio that would not be possible with conventional electronic or software filtering.

Conventional electronic filters are typically Minimum Phase filters. This means that any change to the Frequency Response of the audio is accompanied by a corresponding change to the Phase (or timing) of that audio; in a minimum phase environment, you can't normally change one without the other. Media Center's parametric equalizer modules are Infinite Impulse Response filters that simulate conventional Minimum Phase electronic filters.

By contrast, Convolution can perform Linear Phase filtering: altering the frequency response of the signal separately from the phase using Finite Impulse Response filters. In addition to this capability, many automated room correction software suites use convolution filters as an output because it makes a convenient way to bundle a large DSP bank into a single file.

How to Use Convolution

Filter Generation

You'll need to use third party software to generate a filter and most such software requires a (calibrated) microphone to operate. Amongst the many software solutions available, the following solutions are used by various JRiver forum members:

  • DRC - Free cross-platform convolution filter generator. Automated filter generation; Requires a microphone; Limited graphical interface.
  • Rephase - A no cost convolution filter editing tool. Not automated; no microphone required; Requires more user expertise to get good results.
  • Room EQ Wizard - A no cost measurement and filter generation (requires forum registration). Automated filter generation; Requires a microphone; Does not support linear phase filtering
  • Audiolense - Commercial software with limited free trial. Automated filter generation; Requires a microphone
  • Acourate - Commercial software with limited free trial. Automated filter generation; Requires a microphone

Additionally there are other convolution solutions that do not generate filters, but instead perform the filtering themselves (such as Dirac), but because they do not generate convolution filters for use with Media Center's convolution DSP, they are beyond the scope of this article.

Note: This list does not constitute an endorsement by JRiver of any of these software suites, it is intended as a list of known convolution filter generating utilities for informational purposes.

Using the Filter in Media Center

Filter File Formats

Filter files can be in any format supported by Media Center (.wav, .ape, .flac, .mp3, 16bit, 32bit, etc.)

Using a Single Filter

To use a single filter in Media Center, just navigate to Tools > Options > Audio > DSP Studio & Output Format > Convolution. Browse to to your filter location, select it, and make sure that the check box beside the convolution tab is checked.

The file must map 1:1 to the supplied channels, e.g. if sending 8 channel output then the file must contain 8 channels, one for each input channel.

Using a Config File

MC can interpret a standard plain text config file format for more complex configurations. Some examples are provided on the convolver site however note that not every single features of the cfg file format are supported by JRiver.

Cfg File Format Features

Further discussion can be found in https://yabb.jriver.com/interact/index.php?topic=95806.msg710067#msg710067

The supported features are:

  • Input channel weights
  • Summing input channels to a single output path

The unsupported feature are:

  • Input line delays
  • Multiple output channels in a path
  • Output channel weights
  • Multi pass convolution

Automatic Resampling

Convolution filters are created at a specific sample rate which means they will only work correctly at only that sample rate.

MC provides two solutions to this issue:

  1. MC will automatically resample the filters on the fly
  2. If you want more control over what happens with different sample rates and channel configurations, you can generate separate filters at each sample rate, and MC will automatically switch between them.
    • This requires a specific file name format for that filter: Name2.0_441.cfg or Name5.1_48.cfg and so on
    • i.e. the format is <name><channel count>_<sample rate>.cfg
    • the regular expression for the above format is ^(.+)(\\d{1}.\\d{1})_(\\d{2,3}).cfg$
    • the supported sample rates (and their associated file name format) are:
      • 441: 44.1kHz
      • 48: 48kHz
      • 882: 88.2kHz
      • 96: 96kHz
      • 176: 176kHz
      • 192: 192kHz
      • 352: 352kHz
      • 384: 384kHz

Volume Normalization

The "Normalize Filter Volume" option applies a fixed -6dB cut to the overall gain.

Pros and Cons

Because convolution is very flexible and very powerful, it can be used for many audio tasks including room correction, speaker correction, active crossovers, and sub integration. There some potential downsides to using convolution.

Pros

  • Flexibility- FIR filters can make changes that simply aren't possible in other DSP.
  • Convenience- While audio tuning is never entirely easy, many of the automated utilities described above take microphone measurements and generate a single convolution filter that you can use in Media Center, which is much easier than doing the math and working out your own filter banks.

Cons

  • Latency- FIR fltering necessarily entails some delay. In pure audio applications, this isn't very relevant, but in live playback applications or applications using Media Center's WDM Driver the delay introduced by convolution can be meaningful.
  • Processor Usage- Most modern PCs can handle fairly sophisticated convolution filters without problems. However, older or low-powered PCs or very long/complex convolution filters can sometimes create problems.
  • Videoclock- Because convolution involves minute changes to audio timing, VideoClock can sometimes interfere with convolution. VideoClock adjusts the timing of the audio signal to maintain a perfect sync with the video and this can cause problems for convolution. Most Media Center users do not experience issues when using Convolution and Videoclock together, but see the troubleshooting section below for some ways to tell if you're experiencing an issue.

Troubleshooting the Cons

Latency

The delay introduced by a convolution filter can be calculated using the following formula: (Taps / 2) / Sampling Rate (expressed in seconds). So a 22000 tap filter sampled at 44100Hz would introduce about 1/4 of a second of delay, which is significant. While Media Center generally takes it's own DSP latency into account when playing back video internally, external video sources that are using Media Center's WDM Driver for playback may have lipsync issues when using convolution. The film standard for lipsync is about 25ms; more delay than that will potentially begin to introduce lipsync issues. For that reason, it's advised to create low-tap convolution filters if you plan to use them for live playback or WDM audio.

CPU usage

If you're getting drop outs or unexpected behavior from your filters, open the convolution pane in DSP studio and look at the status display at the bottom. It will include a performance measurement indicating how many times faster than real-time your CPU is processing the filters. Typical modern PCs often show performance ratings better than 30x real-time, but the performance can fluctuate widely based on what else the PC is doing. If you see that your performance multiplier is in the single digits or task manager is showing significant CPU usage, that may be an indicator that your processor isn't up to the task. You can lighten the load by using shorter (lower taps) or less complex convolution filters.

Video Clock

If you have a Phantom Center speaker, you may find that video clock destabilizes the center image. Not everyone experiences this, but if you find that your phantom center image is not stable, or if you have other inexplicable spatialization/imaging issues, try turning off VideoClock to troubleshoot.

Known Issues

Config File Reloading

This issue was raised in https://yabb.jriver.com/interact/index.php/topic,102394.msg710066.html#msg710066

In short, once a config file has been loaded by jriver then any changes (to the file or the referenced filters) are ignored until the MC process is completely restarted.

Filter must not have inherent gain

See https://yabb.jriver.com/interact/index.php?topic=93578.msg646661#msg646661 for details

Inherent gain means "impulse peak is greater than 1"

Channel Routing is Buggy when more than 10 output channels are present

Full details in https://yabb.jriver.com/interact/index.php?topic=99073.msg688023#msg688023

Further Reading