MixAudio: Difference between revisions
From Avisynth wiki
Jump to navigationJump to search
Raffriff42 (talk | contribs) m added category |
add link to avs+ documentation |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
{{ | <div style="max-width:62em" > | ||
<div {{BlueBox2|40|0|3px solid purple}} > | |||
{{AvsPlusFullname}}<br> | |||
Up-to-date documentation: [https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/mixaudio.html https://avisynthplus.readthedocs.io] | |||
</div> | |||
{{FuncDef | |||
|MixAudio(clip ''clip1'', clip ''clip2'', float ''clip1_factor'', float ''clip2_factor'') | |||
}} | |||
Mixes audio from two clips. A ''volume factor'' for the two clips can be given, but is optional. | |||
:{{Par2|clip1, clip2|clip|}} | |||
::Source clips. Output video is copied from {{FuncArg|clip1}}. | |||
:{{Par2|clip1_factor, clip2_factor|float|(auto)}} | |||
::Set the volume of each clip's audio, where 0.0 is no audio from that clip, and 1.0 is 100% audio. | |||
::Default is 0.5/0.5; if only one factor is given, the other will be 1.0-(factor). | |||
::If {{FuncArg|clip1_factor}}+{{FuncArg|clip2_factor}} > 1.0, you risk clipping your signal if sample type is not [[Float]]. | |||
The sample rate of the two clips needs to be the same – use [[ResampleAudio]] if necessary. | |||
Your clips need to have the same number of channels – use [[ConvertToMono]], [[MonoToStereo]] or [[MergeChannels]] if necessary. | |||
'''Example:''' | '''Example:''' | ||
<div {{BoxWidthIndent|56|0}} > | |||
# mixes two sources, with one source slightly lower than the other. | # mixes two sources, with one source slightly lower than the other. | ||
video = AviSource("c:\movie.avi") | video = AviSource("c:\movie.avi") | ||
Soundtrack = WavSource("c:\soundtrack.wav") | Soundtrack = WavSource("c:\soundtrack.wav") | ||
Speak = WavSource("c:\speak.wav") | Speak = WavSource("c:\speak.wav") | ||
audio = MixAudio(Soundtrack, Speak, 0.75, 0.25) # | audio = MixAudio(Soundtrack, Speak, 0.75, 0.25) | ||
# (the Expert may notice that the last 0.25 is actually redundant here) | |||
return AudioDub(video, audio) | return AudioDub(video, audio) | ||
</div> | |||
</div> | |||
[[Category:Internal filters]] | [[Category:Internal filters]] | ||
[[Category:Audio_filters]] | [[Category:Audio_filters]] | ||
Latest revision as of 06:38, 18 September 2022
AviSynth+
Up-to-date documentation: https://avisynthplus.readthedocs.io
MixAudio(clip clip1, clip clip2, float clip1_factor, float clip2_factor)
Mixes audio from two clips. A volume factor for the two clips can be given, but is optional.
- clip clip1, clip2 =
- Source clips. Output video is copied from clip1.
- float clip1_factor, clip2_factor = (auto)
- Set the volume of each clip's audio, where 0.0 is no audio from that clip, and 1.0 is 100% audio.
- Default is 0.5/0.5; if only one factor is given, the other will be 1.0-(factor).
- If clip1_factor+clip2_factor > 1.0, you risk clipping your signal if sample type is not Float.
The sample rate of the two clips needs to be the same – use ResampleAudio if necessary.
Your clips need to have the same number of channels – use ConvertToMono, MonoToStereo or MergeChannels if necessary.
Example:
# mixes two sources, with one source slightly lower than the other.
video = AviSource("c:\movie.avi")
Soundtrack = WavSource("c:\soundtrack.wav")
Speak = WavSource("c:\speak.wav")
audio = MixAudio(Soundtrack, Speak, 0.75, 0.25)
# (the Expert may notice that the last 0.25 is actually redundant here)
return AudioDub(video, audio)