SSRC

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (added category)
(note AVS+ differences)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Template:FuncDef|SSRC(clip, int samplerate [, bool fast])}}
+
<div style="max-width:62em" >
 +
High quality audio sample rate converter by [http://shibatch.sourceforge.net/ Naoki Shibata]. This filter should result in better audio quality than [[ResampleAudio]] when converting between 44100&harr;48000 Hz.
 +
<div {{BoxWidthIndent|52|1}} >
 +
{{BoldColor|blue|120|“}}44.1kHz sampling rate is used for a CD, and 48kHz is used for a DVD... Converting between these frequencies is hard, because the ratio between these two frequencies is 147:160, which are not small numbers. Accordingly, we need a very long FIR filter in order not to degrade the sound quality during conversion. This program utilizes FFTs to apply the FIR filter in order to reduce the amount of computation.{{BoldColor|blue|120|”}} <sup>[http://shibatch.sourceforge.net/]</sup>
 +
</div>
 +
Unlike [[ResampleAudio]], '''SSRC''' doesn't work for arbitrary sample rate ratios. If it cannot handle resampling between the two sample rates, an error is raised.
 +
</div>
  
''SSRC'' resampling. Audio is always converted to float. This filter will result in better audio quality than [[ResampleAudio]]. It uses SSRC by [http://shibatch.sourceforge.net/ Naoki Shibata], which offers the best resample quality available.
 
  
Sampling rates of 44.1kHz and 48kHz are popularly used, but the ratio of these two frequencies is 147:160, and they are not a small numbers. Therefore, sampling rate conversion without degradation of sound quality requires filter with very large order, and it's difficult to achieve both quality and speed. This program achieves relatively fast and high quality with two different kinds of filters combined skillfully.
+
== Syntax and Parameters ==
 +
<div style="max-width:62em" >
 +
{{FuncDef
 +
|SSRC(clip, int samplerate [, bool fast])
 +
}}
  
'''Parameter:'''
+
:{{Par2|clip|clip|}}
{| border="1"
+
::Source clip. Audio is always converted to [[Float]].
|-
+
::{{AvsPluscon}} no conversion is performed. Accepts [[Float]] audio only.
| samplerate
+
| samplerate must be an integer.
+
|-
+
| fast
+
| This will enable faster processing at slightly lower quality. Set this to false if you are doing large sample rate conversions (more than a factor 2). Default: true.
+
|}
+
  
SSRC doesn't work for arbitrary ratios of the samplerate of the source and target clip. The following ratios are allowed (see SSRC.cpp):
+
:{{Par2|samplerate|int|}}
 +
::Target sample rate.
  
sfrq = samplerate of source clip
+
:{{Par2|fast|bool|true}}
dfrq = samplerate of destination clip
+
::Enable faster processing at slightly lower quality.
frqgcd = gcd(sfrq,dfrq) # Greatest Common Divisor
+
::Set this to ''false'' if you are doing large-ratio rate conversions (more than a factor 2).  
fs1 = (dfrq > sfrq) ? sfrq / frqgcd : dfrq / frggcd
+
</div>
Resampling is possible if: (fs1 == 1) or (fs1 % 2 == 0) or (fs1 % 3 == 0)
+
+
example for which resampling is possible:
+
sfrq = 44.1 kHz
+
dfrq = 48 kHz
+
frqgcd = gcd(44100,48000) = 300
+
dfrq > sfrq, hence
+
fs1 = sfrq / frqgcd = sfrq / gcd(sfrq,dfrq) = 44100/300 = 147
+
and 147%3=0 since 147 = 3 * 49
+
  
The samplerate of your source clip can be found as follows
 
  
AviSource(...)
+
== Examples ==
Subtitle(string(AssumeFPS(23.976,sync_audio=true).AudioRate))
+
<div style="max-width:62em" >
 
+
* Downsampling to 44.1 kHz:
 
+
<div {{BoxWidthIndent|24|2}} >
'''Example:'''
+
 
+
# Downsampling to 44.1 kHz:
+
 
  AviSource("c:\file.avi")
 
  AviSource("c:\file.avi")
 
  SSRC(44100)
 
  SSRC(44100)
 +
</div>
 +
</div>
 +
  
'''Changes:'''
+
== Changes ==
 +
<div style="max-width:62em" >
 
{| border="1"
 
{| border="1"
 
|-  
 
|-  
Line 54: Line 49:
 
Copyright (C) 2001-2003, Peter Pawlowski
 
Copyright (C) 2001-2003, Peter Pawlowski
 
All rights reserved.
 
All rights reserved.
 +
</div>
  
  
 
[[Category:Internal filters]]
 
[[Category:Internal filters]]
 
[[Category:Audio_filters]]
 
[[Category:Audio_filters]]

Latest revision as of 15:15, 4 July 2017

High quality audio sample rate converter by Naoki Shibata. This filter should result in better audio quality than ResampleAudio when converting between 44100↔48000 Hz.

44.1kHz sampling rate is used for a CD, and 48kHz is used for a DVD... Converting between these frequencies is hard, because the ratio between these two frequencies is 147:160, which are not small numbers. Accordingly, we need a very long FIR filter in order not to degrade the sound quality during conversion. This program utilizes FFTs to apply the FIR filter in order to reduce the amount of computation. [1]

Unlike ResampleAudio, SSRC doesn't work for arbitrary sample rate ratios. If it cannot handle resampling between the two sample rates, an error is raised.


[edit] Syntax and Parameters

SSRC(clip, int samplerate [, bool fast])

clip  clip =
Source clip. Audio is always converted to Float.
AVS+ no conversion is performed. Accepts Float audio only.
int  samplerate =
Target sample rate.
bool  fast = true
Enable faster processing at slightly lower quality.
Set this to false if you are doing large-ratio rate conversions (more than a factor 2).


[edit] Examples

  • Downsampling to 44.1 kHz:
AviSource("c:\file.avi")
SSRC(44100)


[edit] Changes

v2.54 Initial Release.

Some parts of SSRC is:

Copyright (C) 2001-2003, Peter Pawlowski All rights reserved.

Personal tools