new theory, see problem description below. and sorry for the essay
my values in my events are [0, 127] it appears. the channel pan effect only wants values [-1, 1]
feeding it values way over 1 may be causing an issue. im imaging writing a function that turns the numbers [0-127] into their relative position between [-1, 1] but im assuming this is what interpolate is supposed to do?
i wrote something that loops through the events of the control signal, and i can print out individual values for 'step,' 'value,' and 'interpolate.' But when I try to reset their values using the =
operator I don't see any changes reflected in the events.
my theory is that if i could change, or interpolate, the event values to between -1 and 1 that might fix my issue.
hey thank you for the quick and actionable reply. really means a lot when stuck on a project. switching between 1 and 0 indexed languages is... let's call it fun! sorry to bother you with more but here's my results.
im getting some changes to audio now but they are bizarre. I took video, VOLUME JUMP WARNING.
with the addEvent line added to this code, I do hear a change. that's good. it's registering it exists. but the change is kinda crazy. rather than affecting the channel's pan, I get a huge jump in volume and distortion on what otherwise is a soft sine wave.
let me know if im doing anything you'd do differently.
more misc info
- im on mac m1, simulator only for now
- im automating the control signals inside of ableton
- i am exporting midi files from ableton, then merging them via this method
-- from SDK example, slight modifications
function newsynth()
local s = sfx.synth.new(sfx.kWaveSine)
s:setVolume(0.3)
s:setAttack(.4303)
s:setDecay(0.37)
s:setSustain(0.4)
s:setRelease(.257)
return s
end
function newinst(n)
local inst = sfx.instrument.new()
for i=1,n do
inst:addVoice(newsynth())
end
return inst
end
-- my code
function mergeMidiTest()
local midi = 'sounds/output.mid'
s = sfx.sequence.new(midi)
ch00 = sfx.channel.new()
ch00:setVolume(.35)
local track1 = s:getTrackAtIndex(1)
track1_control_signals = track1:getControlSignals()
for i=1,#track1_control_signals do
track1_control_signals[i]:addEvent(0,0, false)
print("controller type: "..track1_control_signals[i]:getControllerType())
if track1_control_signals[i]:getControllerType() == 10 then -- Pan
local newMod = track1_control_signals[i]
ch00:setPanMod(newMod)
end
end
local newInst1 = newinst(1)
track1:setInstrument(newInst1)
ch00:addSource(newInst1)
s:setTempo(666)
s:setLoops(1, s:getLength()+300, 0)
printTable(track1_control_signals)
print(track1_control_signals[1])
s:play()
end
mergeMidiTest()