Author Topic: Strong pop and scrach with AZ Lua MFX  (Read 577 times)

Offline xmanoux

  • Newbie
  • *
  • Posts: 1
Strong pop and scrach with AZ Lua MFX
« on: May 01, 2020, 12:41:42 PM »
Hello
AZ Lua MFX is a wonderful tool, I use it to humanize my violon kontakt track : add vibrato, crescendos, automaticaly : it works great !
But : it seems to have a realtime process priorisation process : indeed when I use it, even with only one plugin activated : I have lot of pop, crashs, on the main sound output.
Just for the info : If I use a web browser in another windows during playback, it's a pop crash feast festival. ( not the case if I disable the Lua Plugin )

This sound problem does not appears during export.

I have windows 7, Last Cakewalk Sonar (not the Bandlab version ), 8 cores AMD CPU, 16go ram. The cpu is not overloaded at all during my playback/

Have you any advices ?

Here is my code : when I find a "long" note, I add a vibrato curve, and a volume curve.


--[[ http://www.azslow.com/index.php?topic=286.0 ]]--
local channel = 3


--[[ Copy Paste Below ]]--

local timeTriggerVibrato = 1500

local floor = math.floor
math.randomseed(1234)
local lastVolume = 100
local launched = 0

function OnInput(pqIn, pqOut)
  local time = 0 ;
  local firsttime = 0 ;

  for i = 1, #pqIn do
    e = pqIn
    pqOut.add(e)
    time =  e.Time
    if ( firsttime == 0 ) then
       firsttime = time
    end
    if e.Type == Note and e.Chan == channel and ( e.Duration > timeTriggerVibrato  ) then
        RegisterVibrato( e.Time,e.Duration,pqOut)
    elseif e.Type == Note and e.Chan  == channel then
        CancelVibrato( e.Time,e.Duration,pqOut)
    end
  end
  if ( launched == 1 ) then
     launched = 0
     local ec = MfxEvent.new( Control )
          ec.Time = firsttime
          ec.Chan = channel 
          ec.Num = 1
          ec.Val = 100
          pqOut.add(ec)
  end
end

function OnStart( )
   launched = 1
end
 
OnEvents = function ( From, To, pqIn, pqOut)
 OnInput(pqIn, pqOut)
end
 
function CancelVibrato(timeStart,duration,pqOut)
        local ec = MfxEvent.new( Control )
        ec.Time = timeStart+1
        ec.Chan = channel
        ec.Num = 21
        ec.Val = 60
        pqOut.add(ec)
        local k = 0
        local volume = lastVolume
        while ( volume <= 100 ) do
            k = k + 30
            volume = volume + 5

            ec = MfxEvent.new( Control )
            ec.Time = timeStart + k
            ec.Chan = channel 
            ec.Num = 11
            ec.Val = volume
            pqOut.add(ec) 
        end
        lastVolume = 100
end

function RegisterVibrato(timeStart,duration,pqOut)
     local k = 0
     -- discretisation de la montee du vibrato
     local nbsteps = 20
     local endNote = timeStart + duration
    local kDureeDeplacementVibrato = 0.75 + 0.25*2*(math.random()-0.5)
     local dureeDeplacementVibrato = floor(kDureeDeplacementVibrato*duration)
     local endMonteeVibrato = floor(timeStart+dureeDeplacementVibrato )
     local startCompVolume = floor(timeStart+0.67*dureeDeplacementVibrato )
     local endCompVolume = floor(timeStart+dureeDeplacementVibrato )
     -- taille abcisse cellule step
     local stepVibrato = floor(dureeDeplacementVibrato /nbsteps)
     local i = timeStart
     -- etape ou on commence
     local startBaisse = floor(nbsteps/8)
     -- palier ordonnee dajout de vibrato
     local StepMoreVibrato = 40/nbsteps
     local StepVolume = floor(0.6*StepMoreVibrato)
 

     while ( i <= endMonteeVibrato ) do
        i = i + stepVibrato
        k = k + 1 
        if( k > startBaisse ) then

          local ec = MfxEvent.new( Control )
          ec.Time = i
          ec.Chan = channel 
          ec.Num = 21
          ec.Val = floor(60+ k*StepMoreVibrato)
          pqOut.add(ec)

          if( i >= startCompVolume and i <= endCompVolume ) then
              ec = MfxEvent.new( Control )
              ec.Time = i
              ec.Chan = channel 
              ec.Num = 11
              lastVolume = floor( 100 - k*StepVolume )
              ec.Val = lastVolume
              pqOut.add(ec)
          end


        end
     end

end




« Last Edit: May 01, 2020, 01:01:59 PM by xmanoux »

Offline azslow3

  • Administrator
  • Hero Member
  • *****
  • Posts: 1342
Re: Strong pop and scrach with AZ Lua MFX
« Reply #1 on: May 05, 2020, 07:49:14 AM »
Hi,

I could not reproduce. I think something is corrupted by copy/paste or forum text processor. I am not Lua expert, but at least "e = pqIn" is not working like "e = pqIn". I mean I do not get any changes when running it with notes on channel 3 (except initial modulation setting added).

In general, AZLua should prevent scripts to run more then 2ms (in one go). But that is not strong real time limit.

But I suggest first to check the problem is from AZLua+script and not from resulting MIDI in Kontakt. I mean try to "Process/Apply effect/MIDI effects" on the track in question.

In playback, MFXes are called each "Prepare" buffer size, if I remember correctly around 200ms by default (Sonar preference). Probably not even in real-time thread.