WOLFRAM

AudioReplace[audio,{t1,t2}new]

replaces the audio signal between t1 and t2 with the new signal new.

AudioReplace[audio,{{t11,t12},}new]

replaces multiple intervals with the same audio new.

AudioReplace[audio,{{t11,t12}new1,}]

replaces multiple intervals.

AudioReplace[audio,{t1,t2}new,fitting]

uses the specified fitting method.

Details

  • AudioReplace can be used to replace a part of an audio signal with a new signal. Typically, the duration of the whole audio stays unchanged.
  • The time t can be any of the following:
  • ttime given in seconds
    Quantity[t,"unit"]time given in "unit" compatible with seconds
    Quantity[t,"Samples"]time given as number of samples
  • The fitting method specifies how new replaces the {t1,t2} interval. Possible settings are:
  • "Fill"pad or trim new to duration t2-t1 (default)
    "Insert"remove audio from t1 to t2 and insert new at t1
    "Stretch"replace {t1,t2} with the time-stretched version of new

Examples

open allclose all

Basic Examples  (1)Summary of the most common use cases

Replace the interval between .5 and 1 seconds with a sinusoid:

Out[3]=3

Scope  (3)Survey of the scope of standard use cases

Basic Uses  (2)

Replace different intervals with the same signal:

Out[3]=3

Insert different signals at different times:

Out[2]=2

Fitting  (1)

Use the fitting to control the behavior of the replacement signal:

Out[2]=2

By default, the replacement audio is trimmed or padded to the specified length:

Out[5]=5

The duration of the input signal stays the same:

Out[5]=5

Use "Insert" to avoid any trimming or padding of the replacement audio:

Out[6]=6

The duration changes if the duration of the replacement is different from the interval:

Out[7]=7

Use "Stretch" to time stretch the replacement audio to the desired duration:

Out[7]=7

The duration of the input signal does not change:

Out[9]=9

Applications  (3)Sample problems that can be solved with this function

Replace the quiet parts of a recording with silence:

Out[1]=1

Find the quiet intervals:

Out[2]=2

Replace the selected intervals with silence:

Out[3]=3
Out[4]=4

Replace parts of a recording with a new audio signal:

Out[1]=1

Find the intervals with a nonzero amplitude and the fundamental frequency in a specified range:

Out[2]=2

Display the resulting intervals:

Out[3]=3

Prepare the replacement audio:

Replace the selected intervals with the replacement audio:

Out[5]=5
Out[6]=6

Correct the pitch of parts of a recording:

Out[1]=1

Find the intervals with a nonzero amplitude and the fundamental frequency in a specified range:

Out[2]=2
Out[3]=3

Define the target frequencies:

Define the pitch-shifting algorithm:

Compute the replacements:

Compute the result:

Out[7]=7
Out[8]=8
Wolfram Research (2017), AudioReplace, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioReplace.html.
Wolfram Research (2017), AudioReplace, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioReplace.html.

Text

Wolfram Research (2017), AudioReplace, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioReplace.html.

Wolfram Research (2017), AudioReplace, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioReplace.html.

CMS

Wolfram Language. 2017. "AudioReplace." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AudioReplace.html.

Wolfram Language. 2017. "AudioReplace." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AudioReplace.html.

APA

Wolfram Language. (2017). AudioReplace. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioReplace.html

Wolfram Language. (2017). AudioReplace. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioReplace.html

BibTeX

@misc{reference.wolfram_2024_audioreplace, author="Wolfram Research", title="{AudioReplace}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/AudioReplace.html}", note=[Accessed: 06-January-2025 ]}

@misc{reference.wolfram_2024_audioreplace, author="Wolfram Research", title="{AudioReplace}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/AudioReplace.html}", note=[Accessed: 06-January-2025 ]}

BibLaTeX

@online{reference.wolfram_2024_audioreplace, organization={Wolfram Research}, title={AudioReplace}, year={2017}, url={https://reference.wolfram.com/language/ref/AudioReplace.html}, note=[Accessed: 06-January-2025 ]}

@online{reference.wolfram_2024_audioreplace, organization={Wolfram Research}, title={AudioReplace}, year={2017}, url={https://reference.wolfram.com/language/ref/AudioReplace.html}, note=[Accessed: 06-January-2025 ]}