suara musik auto turun pas ada yang ngomong di microphone? bukan sulap bukan sihir

Поделиться
HTML-код
  • Опубликовано: 10 июн 2024
  • Tutorial audio ducking : cara mensetting vMix agar supaya salah satu input audio (musik) akan turun volume suaranya pada saat ada yang bicara pada (input) microphone
  • НаукаНаука

Комментарии • 1

  • @yokejr
    @yokejr  Месяц назад

    '--- Many thanks to Kirill Kudryavtsev @ kin0shkin from sbtg.ru/ for the script!
    '--- Begin Script
    dim translateInput as string = "Bicara" 'Input name with Translator
    dim origInput as string = "Lagu" 'Input name with Original audio track
    dim volumeStandart as string = "80" 'Volume Orig. input when the Translator is silent
    dim fadeTimeStandart as string = "2000" 'Duration increase the volume Orig. when the Translator is silent
    dim volumeSpeaking as string = "45" 'Volume of the Original input when the Translator speaks
    dim fadeTimeSpeaking as string = "300" 'Duration fading Orig. when the Translator speaks
    dim voicethreshold as string = "0.02" 'Response threshold to the interpreter's signal, from 0 to 1 (logical scale)
    'Corresponds to the values ​​(not the length) on the volume slider: 0.5 = 50% ~ = -6dB, 0.1 = 10% ~ = -20dB ...
    'Response may not work with a single pulse signal, but works well with a signal such as voice or music
    dim checkingIter as integer = 2 'Number of iterations to check for translator silence before firing
    dim checkingIterTime as integer = 200 'Interval (milliseconds) between check iterations (recommended from 100, default 200)
    'So it lasts. verifying that the translation is silent and you can turn on Orig. = checkingIter * checkingIterTime (milliseconds)
    '---- End of settings ----
    dim voicemeter as string = ""
    dim speaking as boolean = false
    dim silence as boolean = false
    dim silencechecking as integer = 0
    dim muted as boolean = false
    do while true
    dim xml as string = API.XML()
    dim x as new system.xml.xmldocument
    x.loadxml(xml)
    voicemeter = (x.SelectSingleNode("//input[@title='"& translateInput &"']/@meterF1").Value)
    if (x.SelectSingleNode("//input[@title='"& translateInput &"']/@meterF2").Value) > voicemeter
    voicemeter = (x.SelectSingleNode("//input[@title='"& translateInput &"']/@meterF2").Value)
    end if
    Console.WriteLine(voicemeter)
    muted = (x.SelectSingleNode("//input[@title='"& translateInput &"']/@muted").Value)
    'API.Function("SetText",Input:="TextInput",SelectedName:="Timer.Text" ,Value:=voicemeter)
    'console.writeline(voicemeter)
    if voicemeter > voicethreshold And voicemeter.IndexOfAny("[E]".ToCharArray) = -1 And Not muted
    if silencechecking >= checkingIter ' 0 '!=
    'console.writeline("Speaking")
    silencechecking = 0
    'API.Function("SetTextColour",Input:="TextInput",SelectedName:="Timer.Text",Value:="yellow")
    'API.Function("SetText",Input:="TextInput",SelectedName:="Timer.Text" ,Value:="Перевод говорит! " + voicemeter)
    Input.Find(origInput).Function("SetVolumeFade", volumeSpeaking + "," + fadeTimeSpeaking)
    else 'this has initially been missing so silencechecking could never reach the value of "2" unless the translator input has been silenced or turned down
    silencechecking += 1
    end if
    'console.writeline(silencechecking)
    else
    if silencechecking < checkingIter
    silencechecking += 1
    end if
    if silencechecking = checkingIter
    'console.writeline("Silence")
    'API.Function("SetTextColour",Input:="TextInput",SelectedName:="Timer.Text",Value:="white")
    'API.Function("SetText",Input:="TextInput",SelectedName:="Timer.Text" ,Value:="Перевод молчит! " + voicemeter)
    Input.Find(origInput).Function("SetVolumeFade", volumeStandart + "," + fadeTimeStandart)
    silencechecking = checkingIter + 1
    end if
    'console.writeline(silencechecking)
    end if
    sleep(checkingIterTime)
    Loop
    '--- End Script