Csound Csound-dev Csound-tekno Search About

[Csnd] Strange channel dropout problem

Date2009-12-29 18:20
FromJ
Subject[Csnd] Strange channel dropout problem
Hello.

I am experiencing a strange, inexplicable (to me anyway ;)  problem with a crossfading effects unit I'm building. The unit is designed to crossfade between effects which process a common input. I have tried sending the input both via the mixer opcodes as well as just using a global signal.

The problem that happens is this: randomly, after running the .csd for awhile, one channel will go silent, and the other channel will get really loud. It doesn't seem to be happening on any particular DSP block - it does seem to be happening only to the right channel. Any suggestions would be much appreciated, as this is a real head scratcher for me at this point, as I've tried everything I can think of and scoured the board archives. I will include sections of my code just to show how I am doing things, the whole csd is too big to post and would clog the board a bit I think.

Best, Jeremy

I'm sending audio like this (as you can see, I first used mixer send, then tried a gasig solution)>


;GLOBALISED AUDIO INS
gasig = asig  * gkvolumefactor  
gasig2 = asig2 * gkvolumefactor  
gasig3= asig3 * gkvolumefactor  
gasig4 = asig4 * gkvolumefactor  

;MIXER SENDS
;MixerSetLevel           1, 11, gkvolumefactor   
;MixerSend        asig, 1, 11, 0 ; change first number to be the instrument number
;MixerSend        asig2, 1, 11, 1 ; change first number to be the instrument number
;MixerSetLevel           1, 12, gkvolumefactor   
;MixerSend        asig3, 1, 12, 0 ; change first number to be the instrument number
;MixerSend        asig4, 1, 12, 1 ; change first number to be the instrument number

endin

The effects are scheduled like this: 

instr 2 ;Effects Scheduler

ktrigger init 0 ;NO INITIAL TRIGGER 


gkeffect chnget "gkeffect" ; TURNS ON NEW EFFECT IF CHANGED
ktrigger changed gkeffect ; IF gkeffect CHANGES GENERATE AN TRIGGER IMPULSE

;START NEW EFFECT
 kmintim = 0 ; MINIMUM TIME BETWEEN INSTANCE TRIGGERS
 kmaxnum = 3 ; MAX NUMBER OF SIMULTANEOUS INSTANCES (PER INSTRUMENT)
 kwhen = 0 ; TRIGGER TIME OFFSET
 kdur = 36000 ; DURATION OF INSTRUMENT

schedkwhen ktrigger, kmintim, kmaxnum, gkeffect, kwhen, kdur

endin

Here's an effect:

instr 6; PVADSYN
;TURNOFF CONDITION
       if gkeffect !=6 then ; REMEMBER TO SWITCH THIS TO INSTR NUMBER WHEN BUILDING NEW EFFECTS
                 turnoff2 6, 0, 1  ; REMEMBER TO SWITCH THIS TO INSTR NUMBER WHEN BUILDING NEW EFFECTS
        endif

;FADING
         afade       madsr i (gkattack), 0, 1, i (gkrelease)
      
;MAPPING

kratL = gkrootNoteCps/gkglobrootNoteCps; DIVIDE DESIRED PITCH BY BASE PITCH TO GET RATIO
kratR = gkrootNoteCps2/gkglobrootNoteCps ; DIVIDE DESIRED PITCH BY BASE PITCH TO GET RATIO

;ROUTING
;asig   MixerReceive 11, 0
;asig2 MixerReceive 11, 1
asig = gasig
asig2 = gasig2

;DSP
fsig1          pvsanal        asig,   1024,     256,       1024,      1    
fsig2           pvsanal       asig2, 1024,     256,       1024,      1
        
a1      pvsadsyn  fsig1, 100,kratL  ,1,2
a2      pvsadsyn  fsig2, 100,kratR ,1,2

;OUTPUT CALCULATIONS
asigL = a1* afade; FADE
asigR = a2* afade; FADE
MixerSetLevel           6, 111, gkvolumefactor   
MixerSend        asigL, 6, 111, 0 ; change first number to be the instrument number
MixerSend        asigR, 6, 111, 1 ; change first number to be the instrument number


endin

Then it goes to the mixer:

;OUTS AND POSTPROCESSING

instr 111 

aOutL  MixerReceive 111, 0
aOutR   MixerReceive 111, 1
denorm aOutL, aOutR
;aOutL dcblock2 aOutL
;aOutR dcblock2  aOutR

outq aOutL, aOutR, aOutL, aOutR
MixerClear
endin


Date2009-12-29 21:20
Fromdp51
Subject[Csnd] Re: Strange channel dropout problem
I don't know if this helps, but I would protect the call to turnoff2
so that it only executes once:

kOnce init 1
if (gkeffect !=6) && (kOnce == 1) then
    kOnce = 0
    turnoff2 6, 0, 1
endif

Davis

Date2009-12-30 11:04
FromJ
Subject[Csnd] Re: Re: Strange channel dropout problem
Thank you Davis, I will try this later today and report back. Do you think that it could be double triggering somehow?

On Tue, Dec 29, 2009 at 9:20 PM, dp51 <dmpyon@yahoo.com> wrote:

I don't know if this helps, but I would protect the call to turnoff2
so that it only executes once:

kOnce init 1
if (gkeffect !=6) && (kOnce == 1) then
   kOnce = 0
   turnoff2 6, 0, 1
endif

Davis
--
View this message in context: http://old.nabble.com/Strange-channel-dropout-problem-tp26958032p26960571.html
Sent from the Csound - General mailing list archive at Nabble.com.



Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2009-12-30 11:19
FromOeyvind Brandtsegg
Subject[Csnd] Re: Strange channel dropout problem
I can't see anything obvious errors in the code snippets you sent,
but since this is part of a large csd the error might lurk "anywhere".
The only sane method for finding errors like this in a large orchestra
is to strip it down until the error disappears. In your eaxmple,
perhaps limiting the number of different effects (taking away one by
one until you oly have one effect type, and see if the error still
occurs). If it's still there, try to use "direct out" audio routing
(audio out from each instrument instead of using globals and a mixer).
Then if it's still there, you probably have something quite small now,
one audio generating instr and one audio effect, and you isolate each
of those to see where the error is. You should be able to debug
anything by breaking it down into smaller pieces like this.

it can take some time, sorry, but more often than not it's the way to go ;-)
Oeyvind


2009/12/29 J :
> Hello.
> I am experiencing a strange, inexplicable (to me anyway ;)  problem with a
> crossfading effects unit I'm building. The unit is designed to crossfade
> between effects which process a common input. I have tried sending the input
> both via the mixer opcodes as well as just using a global signal.
> The problem that happens is this: randomly, after running the .csd for
> awhile, one channel will go silent, and the other channel will get really
> loud. It doesn't seem to be happening on any particular DSP block - it does
> seem to be happening only to the right channel. Any suggestions would be
> much appreciated, as this is a real head scratcher for me at this point, as
> I've tried everything I can think of and scoured the board archives. I will
> include sections of my code just to show how I am doing things, the whole
> csd is too big to post and would clog the board a bit I think.
> Best, Jeremy
> I'm sending audio like this (as you can see, I first used mixer send, then
> tried a gasig solution)>
>
> ;GLOBALISED AUDIO INS
> gasig = asig  * gkvolumefactor
> gasig2 = asig2 * gkvolumefactor
> gasig3= asig3 * gkvolumefactor
> gasig4 = asig4 * gkvolumefactor
> ;MIXER SENDS
> ;MixerSetLevel           1, 11, gkvolumefactor
> ;MixerSend        asig, 1, 11, 0 ; change first number to be the instrument
> number
> ;MixerSend        asig2, 1, 11, 1 ; change first number to be the instrument
> number
> ;MixerSetLevel           1, 12, gkvolumefactor
> ;MixerSend        asig3, 1, 12, 0 ; change first number to be the instrument
> number
> ;MixerSend        asig4, 1, 12, 1 ; change first number to be the instrument
> number
> endin
> The effects are scheduled like this:
> instr 2 ;Effects Scheduler
> ktrigger init 0 ;NO INITIAL TRIGGER
>
> gkeffect chnget "gkeffect" ; TURNS ON NEW EFFECT IF CHANGED
> ktrigger changed gkeffect ; IF gkeffect CHANGES GENERATE AN TRIGGER IMPULSE
> ;START NEW EFFECT
>  kmintim = 0 ; MINIMUM TIME BETWEEN INSTANCE TRIGGERS
>  kmaxnum = 3 ; MAX NUMBER OF SIMULTANEOUS INSTANCES (PER INSTRUMENT)
>  kwhen = 0 ; TRIGGER TIME OFFSET
>  kdur = 36000 ; DURATION OF INSTRUMENT
> schedkwhen ktrigger, kmintim, kmaxnum, gkeffect, kwhen, kdur
> endin
> Here's an effect:
> instr 6; PVADSYN
> ;TURNOFF CONDITION
>        if gkeffect !=6 then ; REMEMBER TO SWITCH THIS TO INSTR NUMBER WHEN
> BUILDING NEW EFFECTS
>                  turnoff2 6, 0, 1  ; REMEMBER TO SWITCH THIS TO INSTR NUMBER
> WHEN BUILDING NEW EFFECTS
>         endif
> ;FADING
>          afade       madsr i (gkattack), 0, 1, i (gkrelease)
>
> ;MAPPING
> kratL = gkrootNoteCps/gkglobrootNoteCps; DIVIDE DESIRED PITCH BY BASE PITCH
> TO GET RATIO
> kratR = gkrootNoteCps2/gkglobrootNoteCps ; DIVIDE DESIRED PITCH BY BASE
> PITCH TO GET RATIO
> ;ROUTING
> ;asig   MixerReceive 11, 0
> ;asig2 MixerReceive 11, 1
> asig = gasig
> asig2 = gasig2
> ;DSP
> fsig1          pvsanal        asig,   1024,     256,       1024,      1
> fsig2           pvsanal       asig2, 1024,     256,       1024,      1
>
> a1      pvsadsyn  fsig1, 100,kratL  ,1,2
> a2      pvsadsyn  fsig2, 100,kratR ,1,2
> ;OUTPUT CALCULATIONS
> asigL = a1* afade; FADE
> asigR = a2* afade; FADE
> MixerSetLevel           6, 111, gkvolumefactor
> MixerSend        asigL, 6, 111, 0 ; change first number to be the instrument
> number
> MixerSend        asigR, 6, 111, 1 ; change first number to be the instrument
> number
>
> endin
> Then it goes to the mixer:
> ;OUTS AND POSTPROCESSING
> instr 111
> aOutL  MixerReceive 111, 0
> aOutR   MixerReceive 111, 1
> denorm aOutL, aOutR
> ;aOutL dcblock2 aOutL
> ;aOutR dcblock2  aOutR
> outq aOutL, aOutR, aOutL, aOutR
> MixerClear
> endin
>


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2009-12-30 14:44
FromJ
Subject[Csnd] Re: Re: Strange channel dropout problem
Thank you for looking it over Oeyvind - it is just as I feared ;) I think the first thing I will try is to use direct i/o, as instinctively I think that may be a part of the problem - I also haven't tried that yet, only globals vs. mixer sends. Will report back when I get to the bottom of it!

Best, Jeremy

On Wed, Dec 30, 2009 at 11:19 AM, Oeyvind Brandtsegg <obrandts@gmail.com> wrote:
I can't see anything obvious errors in the code snippets you sent,
but since this is part of a large csd the error might lurk "anywhere".
The only sane method for finding errors like this in a large orchestra
is to strip it down until the error disappears. In your eaxmple,
perhaps limiting the number of different effects (taking away one by
one until you oly have one effect type, and see if the error still
occurs). If it's still there, try to use "direct out" audio routing
(audio out from each instrument instead of using globals and a mixer).
Then if it's still there, you probably have something quite small now,
one audio generating instr and one audio effect, and you isolate each
of those to see where the error is. You should be able to debug
anything by breaking it down into smaller pieces like this.

it can take some time, sorry, but more often than not it's the way to go ;-)
Oeyvind


2009/12/29 J <falabala66@gmail.com>:
> Hello.
> I am experiencing a strange, inexplicable (to me anyway ;)  problem with a
> crossfading effects unit I'm building. The unit is designed to crossfade
> between effects which process a common input. I have tried sending the input
> both via the mixer opcodes as well as just using a global signal.
> The problem that happens is this: randomly, after running the .csd for
> awhile, one channel will go silent, and the other channel will get really
> loud. It doesn't seem to be happening on any particular DSP block - it does
> seem to be happening only to the right channel. Any suggestions would be
> much appreciated, as this is a real head scratcher for me at this point, as
> I've tried everything I can think of and scoured the board archives. I will
> include sections of my code just to show how I am doing things, the whole
> csd is too big to post and would clog the board a bit I think.
> Best, Jeremy
> I'm sending audio like this (as you can see, I first used mixer send, then
> tried a gasig solution)>
>
> ;GLOBALISED AUDIO INS
> gasig = asig  * gkvolumefactor
> gasig2 = asig2 * gkvolumefactor
> gasig3= asig3 * gkvolumefactor
> gasig4 = asig4 * gkvolumefactor
> ;MIXER SENDS
> ;MixerSetLevel           1, 11, gkvolumefactor
> ;MixerSend        asig, 1, 11, 0 ; change first number to be the instrument
> number
> ;MixerSend        asig2, 1, 11, 1 ; change first number to be the instrument
> number
> ;MixerSetLevel           1, 12, gkvolumefactor
> ;MixerSend        asig3, 1, 12, 0 ; change first number to be the instrument
> number
> ;MixerSend        asig4, 1, 12, 1 ; change first number to be the instrument
> number
> endin
> The effects are scheduled like this:
> instr 2 ;Effects Scheduler
> ktrigger init 0 ;NO INITIAL TRIGGER
>
> gkeffect chnget "gkeffect" ; TURNS ON NEW EFFECT IF CHANGED
> ktrigger changed gkeffect ; IF gkeffect CHANGES GENERATE AN TRIGGER IMPULSE
> ;START NEW EFFECT
>  kmintim = 0 ; MINIMUM TIME BETWEEN INSTANCE TRIGGERS
>  kmaxnum = 3 ; MAX NUMBER OF SIMULTANEOUS INSTANCES (PER INSTRUMENT)
>  kwhen = 0 ; TRIGGER TIME OFFSET
>  kdur = 36000 ; DURATION OF INSTRUMENT
> schedkwhen ktrigger, kmintim, kmaxnum, gkeffect, kwhen, kdur
> endin
> Here's an effect:
> instr 6; PVADSYN
> ;TURNOFF CONDITION
>        if gkeffect !=6 then ; REMEMBER TO SWITCH THIS TO INSTR NUMBER WHEN
> BUILDING NEW EFFECTS
>                  turnoff2 6, 0, 1  ; REMEMBER TO SWITCH THIS TO INSTR NUMBER
> WHEN BUILDING NEW EFFECTS
>         endif
> ;FADING
>          afade       madsr i (gkattack), 0, 1, i (gkrelease)
>
> ;MAPPING
> kratL = gkrootNoteCps/gkglobrootNoteCps; DIVIDE DESIRED PITCH BY BASE PITCH
> TO GET RATIO
> kratR = gkrootNoteCps2/gkglobrootNoteCps ; DIVIDE DESIRED PITCH BY BASE
> PITCH TO GET RATIO
> ;ROUTING
> ;asig   MixerReceive 11, 0
> ;asig2 MixerReceive 11, 1
> asig = gasig
> asig2 = gasig2
> ;DSP
> fsig1          pvsanal        asig,   1024,     256,       1024,      1
> fsig2           pvsanal       asig2, 1024,     256,       1024,      1
>
> a1      pvsadsyn  fsig1, 100,kratL  ,1,2
> a2      pvsadsyn  fsig2, 100,kratR ,1,2
> ;OUTPUT CALCULATIONS
> asigL = a1* afade; FADE
> asigR = a2* afade; FADE
> MixerSetLevel           6, 111, gkvolumefactor
> MixerSend        asigL, 6, 111, 0 ; change first number to be the instrument
> number
> MixerSend        asigR, 6, 111, 1 ; change first number to be the instrument
> number
>
> endin
> Then it goes to the mixer:
> ;OUTS AND POSTPROCESSING
> instr 111
> aOutL  MixerReceive 111, 0
> aOutR   MixerReceive 111, 1
> denorm aOutL, aOutR
> ;aOutL dcblock2 aOutL
> ;aOutR dcblock2  aOutR
> outq aOutL, aOutR, aOutL, aOutR
> MixerClear
> endin
>


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2009-12-30 15:38
FromJ
Subject[Csnd] Re: Re: Strange channel dropout problem
Ok - taking out all mixer inputs and outputs DID solve the problem. No dropouts or other unexpected behaviour - I'm using local variables for the audio in all instruments, input and output.

I'm still not sure why that might be the case however - using local variables will work fine for this project, though I am curious as to why using the mixer caused this behaviour.

Best, Jeremy

On Wed, Dec 30, 2009 at 2:44 PM, J <falabala66@gmail.com> wrote:
Thank you for looking it over Oeyvind - it is just as I feared ;) I think the first thing I will try is to use direct i/o, as instinctively I think that may be a part of the problem - I also haven't tried that yet, only globals vs. mixer sends. Will report back when I get to the bottom of it!

Best, Jeremy


On Wed, Dec 30, 2009 at 11:19 AM, Oeyvind Brandtsegg <obrandts@gmail.com> wrote:
I can't see anything obvious errors in the code snippets you sent,
but since this is part of a large csd the error might lurk "anywhere".
The only sane method for finding errors like this in a large orchestra
is to strip it down until the error disappears. In your eaxmple,
perhaps limiting the number of different effects (taking away one by
one until you oly have one effect type, and see if the error still
occurs). If it's still there, try to use "direct out" audio routing
(audio out from each instrument instead of using globals and a mixer).
Then if it's still there, you probably have something quite small now,
one audio generating instr and one audio effect, and you isolate each
of those to see where the error is. You should be able to debug
anything by breaking it down into smaller pieces like this.

it can take some time, sorry, but more often than not it's the way to go ;-)
Oeyvind


2009/12/29 J <falabala66@gmail.com>:
> Hello.
> I am experiencing a strange, inexplicable (to me anyway ;)  problem with a
> crossfading effects unit I'm building. The unit is designed to crossfade
> between effects which process a common input. I have tried sending the input
> both via the mixer opcodes as well as just using a global signal.
> The problem that happens is this: randomly, after running the .csd for
> awhile, one channel will go silent, and the other channel will get really
> loud. It doesn't seem to be happening on any particular DSP block - it does
> seem to be happening only to the right channel. Any suggestions would be
> much appreciated, as this is a real head scratcher for me at this point, as
> I've tried everything I can think of and scoured the board archives. I will
> include sections of my code just to show how I am doing things, the whole
> csd is too big to post and would clog the board a bit I think.
> Best, Jeremy
> I'm sending audio like this (as you can see, I first used mixer send, then
> tried a gasig solution)>
>
> ;GLOBALISED AUDIO INS
> gasig = asig  * gkvolumefactor
> gasig2 = asig2 * gkvolumefactor
> gasig3= asig3 * gkvolumefactor
> gasig4 = asig4 * gkvolumefactor
> ;MIXER SENDS
> ;MixerSetLevel           1, 11, gkvolumefactor
> ;MixerSend        asig, 1, 11, 0 ; change first number to be the instrument
> number
> ;MixerSend        asig2, 1, 11, 1 ; change first number to be the instrument
> number
> ;MixerSetLevel           1, 12, gkvolumefactor
> ;MixerSend        asig3, 1, 12, 0 ; change first number to be the instrument
> number
> ;MixerSend        asig4, 1, 12, 1 ; change first number to be the instrument
> number
> endin
> The effects are scheduled like this:
> instr 2 ;Effects Scheduler
> ktrigger init 0 ;NO INITIAL TRIGGER
>
> gkeffect chnget "gkeffect" ; TURNS ON NEW EFFECT IF CHANGED
> ktrigger changed gkeffect ; IF gkeffect CHANGES GENERATE AN TRIGGER IMPULSE
> ;START NEW EFFECT
>  kmintim = 0 ; MINIMUM TIME BETWEEN INSTANCE TRIGGERS
>  kmaxnum = 3 ; MAX NUMBER OF SIMULTANEOUS INSTANCES (PER INSTRUMENT)
>  kwhen = 0 ; TRIGGER TIME OFFSET
>  kdur = 36000 ; DURATION OF INSTRUMENT
> schedkwhen ktrigger, kmintim, kmaxnum, gkeffect, kwhen, kdur
> endin
> Here's an effect:
> instr 6; PVADSYN
> ;TURNOFF CONDITION
>        if gkeffect !=6 then ; REMEMBER TO SWITCH THIS TO INSTR NUMBER WHEN
> BUILDING NEW EFFECTS
>                  turnoff2 6, 0, 1  ; REMEMBER TO SWITCH THIS TO INSTR NUMBER
> WHEN BUILDING NEW EFFECTS
>         endif
> ;FADING
>          afade       madsr i (gkattack), 0, 1, i (gkrelease)
>
> ;MAPPING
> kratL = gkrootNoteCps/gkglobrootNoteCps; DIVIDE DESIRED PITCH BY BASE PITCH
> TO GET RATIO
> kratR = gkrootNoteCps2/gkglobrootNoteCps ; DIVIDE DESIRED PITCH BY BASE
> PITCH TO GET RATIO
> ;ROUTING
> ;asig   MixerReceive 11, 0
> ;asig2 MixerReceive 11, 1
> asig = gasig
> asig2 = gasig2
> ;DSP
> fsig1          pvsanal        asig,   1024,     256,       1024,      1
> fsig2           pvsanal       asig2, 1024,     256,       1024,      1
>
> a1      pvsadsyn  fsig1, 100,kratL  ,1,2
> a2      pvsadsyn  fsig2, 100,kratR ,1,2
> ;OUTPUT CALCULATIONS
> asigL = a1* afade; FADE
> asigR = a2* afade; FADE
> MixerSetLevel           6, 111, gkvolumefactor
> MixerSend        asigL, 6, 111, 0 ; change first number to be the instrument
> number
> MixerSend        asigR, 6, 111, 1 ; change first number to be the instrument
> number
>
> endin
> Then it goes to the mixer:
> ;OUTS AND POSTPROCESSING
> instr 111
> aOutL  MixerReceive 111, 0
> aOutR   MixerReceive 111, 1
> denorm aOutL, aOutR
> ;aOutL dcblock2 aOutL
> ;aOutR dcblock2  aOutR
> outq aOutL, aOutR, aOutL, aOutR
> MixerClear
> endin
>


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2010-01-02 08:35
FromOeyvind Brandtsegg
Subject[Csnd] Re: Re: Re: Strange channel dropout problem
... so the next step is to write a simple version of the mixer setup,
you could do this "bottom up" by implementing it from scratch,
og "top down" by stripping down the big csd and leaving only one sound
generator, one effect (maybe two), and one mixer/out instr.

Sorry for giving such obvious advice...

Oeyvind

2009/12/30 J :
> Ok - taking out all mixer inputs and outputs DID solve the problem. No
> dropouts or other unexpected behaviour - I'm using local variables for the
> audio in all instruments, input and output.
> I'm still not sure why that might be the case however - using local
> variables will work fine for this project, though I am curious as to why
> using the mixer caused this behaviour.
> Best, Jeremy
>
> On Wed, Dec 30, 2009 at 2:44 PM, J  wrote:
>>
>> Thank you for looking it over Oeyvind - it is just as I feared ;) I think
>> the first thing I will try is to use direct i/o, as instinctively I think
>> that may be a part of the problem - I also haven't tried that yet, only
>> globals vs. mixer sends. Will report back when I get to the bottom of it!
>> Best, Jeremy
>>
>> On Wed, Dec 30, 2009 at 11:19 AM, Oeyvind Brandtsegg 
>> wrote:
>>>
>>> I can't see anything obvious errors in the code snippets you sent,
>>> but since this is part of a large csd the error might lurk "anywhere".
>>> The only sane method for finding errors like this in a large orchestra
>>> is to strip it down until the error disappears. In your eaxmple,
>>> perhaps limiting the number of different effects (taking away one by
>>> one until you oly have one effect type, and see if the error still
>>> occurs). If it's still there, try to use "direct out" audio routing
>>> (audio out from each instrument instead of using globals and a mixer).
>>> Then if it's still there, you probably have something quite small now,
>>> one audio generating instr and one audio effect, and you isolate each
>>> of those to see where the error is. You should be able to debug
>>> anything by breaking it down into smaller pieces like this.
>>>
>>> it can take some time, sorry, but more often than not it's the way to go
>>> ;-)
>>> Oeyvind
>>>
>>>
>>> 2009/12/29 J :
>>> > Hello.
>>> > I am experiencing a strange, inexplicable (to me anyway ;)  problem
>>> > with a
>>> > crossfading effects unit I'm building. The unit is designed to
>>> > crossfade
>>> > between effects which process a common input. I have tried sending the
>>> > input
>>> > both via the mixer opcodes as well as just using a global signal.
>>> > The problem that happens is this: randomly, after running the .csd for
>>> > awhile, one channel will go silent, and the other channel will get
>>> > really
>>> > loud. It doesn't seem to be happening on any particular DSP block - it
>>> > does
>>> > seem to be happening only to the right channel. Any suggestions would
>>> > be
>>> > much appreciated, as this is a real head scratcher for me at this
>>> > point, as
>>> > I've tried everything I can think of and scoured the board archives. I
>>> > will
>>> > include sections of my code just to show how I am doing things, the
>>> > whole
>>> > csd is too big to post and would clog the board a bit I think.
>>> > Best, Jeremy
>>> > I'm sending audio like this (as you can see, I first used mixer send,
>>> > then
>>> > tried a gasig solution)>
>>> >
>>> > ;GLOBALISED AUDIO INS
>>> > gasig = asig  * gkvolumefactor
>>> > gasig2 = asig2 * gkvolumefactor
>>> > gasig3= asig3 * gkvolumefactor
>>> > gasig4 = asig4 * gkvolumefactor
>>> > ;MIXER SENDS
>>> > ;MixerSetLevel           1, 11, gkvolumefactor
>>> > ;MixerSend        asig, 1, 11, 0 ; change first number to be the
>>> > instrument
>>> > number
>>> > ;MixerSend        asig2, 1, 11, 1 ; change first number to be the
>>> > instrument
>>> > number
>>> > ;MixerSetLevel           1, 12, gkvolumefactor
>>> > ;MixerSend        asig3, 1, 12, 0 ; change first number to be the
>>> > instrument
>>> > number
>>> > ;MixerSend        asig4, 1, 12, 1 ; change first number to be the
>>> > instrument
>>> > number
>>> > endin
>>> > The effects are scheduled like this:
>>> > instr 2 ;Effects Scheduler
>>> > ktrigger init 0 ;NO INITIAL TRIGGER
>>> >
>>> > gkeffect chnget "gkeffect" ; TURNS ON NEW EFFECT IF CHANGED
>>> > ktrigger changed gkeffect ; IF gkeffect CHANGES GENERATE AN TRIGGER
>>> > IMPULSE
>>> > ;START NEW EFFECT
>>> >  kmintim = 0 ; MINIMUM TIME BETWEEN INSTANCE TRIGGERS
>>> >  kmaxnum = 3 ; MAX NUMBER OF SIMULTANEOUS INSTANCES (PER INSTRUMENT)
>>> >  kwhen = 0 ; TRIGGER TIME OFFSET
>>> >  kdur = 36000 ; DURATION OF INSTRUMENT
>>> > schedkwhen ktrigger, kmintim, kmaxnum, gkeffect, kwhen, kdur
>>> > endin
>>> > Here's an effect:
>>> > instr 6; PVADSYN
>>> > ;TURNOFF CONDITION
>>> >        if gkeffect !=6 then ; REMEMBER TO SWITCH THIS TO INSTR NUMBER
>>> > WHEN
>>> > BUILDING NEW EFFECTS
>>> >                  turnoff2 6, 0, 1  ; REMEMBER TO SWITCH THIS TO INSTR
>>> > NUMBER
>>> > WHEN BUILDING NEW EFFECTS
>>> >         endif
>>> > ;FADING
>>> >          afade       madsr i (gkattack), 0, 1, i (gkrelease)
>>> >
>>> > ;MAPPING
>>> > kratL = gkrootNoteCps/gkglobrootNoteCps; DIVIDE DESIRED PITCH BY BASE
>>> > PITCH
>>> > TO GET RATIO
>>> > kratR = gkrootNoteCps2/gkglobrootNoteCps ; DIVIDE DESIRED PITCH BY BASE
>>> > PITCH TO GET RATIO
>>> > ;ROUTING
>>> > ;asig   MixerReceive 11, 0
>>> > ;asig2 MixerReceive 11, 1
>>> > asig = gasig
>>> > asig2 = gasig2
>>> > ;DSP
>>> > fsig1          pvsanal        asig,   1024,     256,       1024,      1
>>> > fsig2           pvsanal       asig2, 1024,     256,       1024,      1
>>> >
>>> > a1      pvsadsyn  fsig1, 100,kratL  ,1,2
>>> > a2      pvsadsyn  fsig2, 100,kratR ,1,2
>>> > ;OUTPUT CALCULATIONS
>>> > asigL = a1* afade; FADE
>>> > asigR = a2* afade; FADE
>>> > MixerSetLevel           6, 111, gkvolumefactor
>>> > MixerSend        asigL, 6, 111, 0 ; change first number to be the
>>> > instrument
>>> > number
>>> > MixerSend        asigR, 6, 111, 1 ; change first number to be the
>>> > instrument
>>> > number
>>> >
>>> > endin
>>> > Then it goes to the mixer:
>>> > ;OUTS AND POSTPROCESSING
>>> > instr 111
>>> > aOutL  MixerReceive 111, 0
>>> > aOutR   MixerReceive 111, 1
>>> > denorm aOutL, aOutR
>>> > ;aOutL dcblock2 aOutL
>>> > ;aOutR dcblock2  aOutR
>>> > outq aOutL, aOutR, aOutL, aOutR
>>> > MixerClear
>>> > endin
>>> >
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>
>


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-01-02 16:54
FromUnUnUnium
Subject[Csnd] Re: Re: Re: Strange channel dropout problem
Thank you Oeyvind. This makes sense to me - nothing is too obvious at this
stage in my Csound learning.

I think some of the problem may have been occurring because I was not
calling "MixerClear" inside the effect, just in the final instrument - I was
sending like this "Global instrument send -> individual effect -> Global
mixer(MixerClear).

I tried clearing the mixer inside each effect, but that caused gaps in
playback. Will get to the bottom of this at some point ;)

Best, Jeremy



Oeyvind Brandtsegg-2 wrote:
> 
> ... so the next step is to write a simple version of the mixer setup,
> you could do this "bottom up" by implementing it from scratch,
> og "top down" by stripping down the big csd and leaving only one sound
> generator, one effect (maybe two), and one mixer/out instr.
> 
> Sorry for giving such obvious advice...
> 
> Oeyvind
> 
> 2009/12/30 J :
>> Ok - taking out all mixer inputs and outputs DID solve the problem. No
>> dropouts or other unexpected behaviour - I'm using local variables for
>> the
>> audio in all instruments, input and output.
>> I'm still not sure why that might be the case however - using local
>> variables will work fine for this project, though I am curious as to why
>> using the mixer caused this behaviour.
>> Best, Jeremy
>>
>> On Wed, Dec 30, 2009 at 2:44 PM, J  wrote:
>>>
>>> Thank you for looking it over Oeyvind - it is just as I feared ;) I
>>> think
>>> the first thing I will try is to use direct i/o, as instinctively I
>>> think
>>> that may be a part of the problem - I also haven't tried that yet, only
>>> globals vs. mixer sends. Will report back when I get to the bottom of
>>> it!
>>> Best, Jeremy
>>>
>>> On Wed, Dec 30, 2009 at 11:19 AM, Oeyvind Brandtsegg
>>> 
>>> wrote:
>>>>
>>>> I can't see anything obvious errors in the code snippets you sent,
>>>> but since this is part of a large csd the error might lurk "anywhere".
>>>> The only sane method for finding errors like this in a large orchestra
>>>> is to strip it down until the error disappears. In your eaxmple,
>>>> perhaps limiting the number of different effects (taking away one by
>>>> one until you oly have one effect type, and see if the error still
>>>> occurs). If it's still there, try to use "direct out" audio routing
>>>> (audio out from each instrument instead of using globals and a mixer).
>>>> Then if it's still there, you probably have something quite small now,
>>>> one audio generating instr and one audio effect, and you isolate each
>>>> of those to see where the error is. You should be able to debug
>>>> anything by breaking it down into smaller pieces like this.
>>>>
>>>> it can take some time, sorry, but more often than not it's the way to
>>>> go
>>>> ;-)
>>>> Oeyvind
>>>>
>>>>
>>>> 2009/12/29 J :
>>>> > Hello.
>>>> > I am experiencing a strange, inexplicable (to me anyway ;)  problem
>>>> > with a
>>>> > crossfading effects unit I'm building. The unit is designed to
>>>> > crossfade
>>>> > between effects which process a common input. I have tried sending
>>>> the
>>>> > input
>>>> > both via the mixer opcodes as well as just using a global signal.
>>>> > The problem that happens is this: randomly, after running the .csd
>>>> for
>>>> > awhile, one channel will go silent, and the other channel will get
>>>> > really
>>>> > loud. It doesn't seem to be happening on any particular DSP block -
>>>> it
>>>> > does
>>>> > seem to be happening only to the right channel. Any suggestions would
>>>> > be
>>>> > much appreciated, as this is a real head scratcher for me at this
>>>> > point, as
>>>> > I've tried everything I can think of and scoured the board archives.
>>>> I
>>>> > will
>>>> > include sections of my code just to show how I am doing things, the
>>>> > whole
>>>> > csd is too big to post and would clog the board a bit I think.
>>>> > Best, Jeremy
>>>> > I'm sending audio like this (as you can see, I first used mixer send,
>>>> > then
>>>> > tried a gasig solution)>
>>>> >
>>>> > ;GLOBALISED AUDIO INS
>>>> > gasig = asig  * gkvolumefactor
>>>> > gasig2 = asig2 * gkvolumefactor
>>>> > gasig3= asig3 * gkvolumefactor
>>>> > gasig4 = asig4 * gkvolumefactor
>>>> > ;MIXER SENDS
>>>> > ;MixerSetLevel           1, 11, gkvolumefactor
>>>> > ;MixerSend        asig, 1, 11, 0 ; change first number to be the
>>>> > instrument
>>>> > number
>>>> > ;MixerSend        asig2, 1, 11, 1 ; change first number to be the
>>>> > instrument
>>>> > number
>>>> > ;MixerSetLevel           1, 12, gkvolumefactor
>>>> > ;MixerSend        asig3, 1, 12, 0 ; change first number to be the
>>>> > instrument
>>>> > number
>>>> > ;MixerSend        asig4, 1, 12, 1 ; change first number to be the
>>>> > instrument
>>>> > number
>>>> > endin
>>>> > The effects are scheduled like this:
>>>> > instr 2 ;Effects Scheduler
>>>> > ktrigger init 0 ;NO INITIAL TRIGGER
>>>> >
>>>> > gkeffect chnget "gkeffect" ; TURNS ON NEW EFFECT IF CHANGED
>>>> > ktrigger changed gkeffect ; IF gkeffect CHANGES GENERATE AN TRIGGER
>>>> > IMPULSE
>>>> > ;START NEW EFFECT
>>>> >  kmintim = 0 ; MINIMUM TIME BETWEEN INSTANCE TRIGGERS
>>>> >  kmaxnum = 3 ; MAX NUMBER OF SIMULTANEOUS INSTANCES (PER INSTRUMENT)
>>>> >  kwhen = 0 ; TRIGGER TIME OFFSET
>>>> >  kdur = 36000 ; DURATION OF INSTRUMENT
>>>> > schedkwhen ktrigger, kmintim, kmaxnum, gkeffect, kwhen, kdur
>>>> > endin
>>>> > Here's an effect:
>>>> > instr 6; PVADSYN
>>>> > ;TURNOFF CONDITION
>>>> >        if gkeffect !=6 then ; REMEMBER TO SWITCH THIS TO INSTR NUMBER
>>>> > WHEN
>>>> > BUILDING NEW EFFECTS
>>>> >                  turnoff2 6, 0, 1  ; REMEMBER TO SWITCH THIS TO INSTR
>>>> > NUMBER
>>>> > WHEN BUILDING NEW EFFECTS
>>>> >         endif
>>>> > ;FADING
>>>> >          afade       madsr i (gkattack), 0, 1, i (gkrelease)
>>>> >
>>>> > ;MAPPING
>>>> > kratL = gkrootNoteCps/gkglobrootNoteCps; DIVIDE DESIRED PITCH BY BASE
>>>> > PITCH
>>>> > TO GET RATIO
>>>> > kratR = gkrootNoteCps2/gkglobrootNoteCps ; DIVIDE DESIRED PITCH BY
>>>> BASE
>>>> > PITCH TO GET RATIO
>>>> > ;ROUTING
>>>> > ;asig   MixerReceive 11, 0
>>>> > ;asig2 MixerReceive 11, 1
>>>> > asig = gasig
>>>> > asig2 = gasig2
>>>> > ;DSP
>>>> > fsig1          pvsanal        asig,   1024,     256,       1024,    
>>>>  1
>>>> > fsig2           pvsanal       asig2, 1024,     256,       1024,    
>>>>  1
>>>> >
>>>> > a1      pvsadsyn  fsig1, 100,kratL  ,1,2
>>>> > a2      pvsadsyn  fsig2, 100,kratR ,1,2
>>>> > ;OUTPUT CALCULATIONS
>>>> > asigL = a1* afade; FADE
>>>> > asigR = a2* afade; FADE
>>>> > MixerSetLevel           6, 111, gkvolumefactor
>>>> > MixerSend        asigL, 6, 111, 0 ; change first number to be the
>>>> > instrument
>>>> > number
>>>> > MixerSend        asigR, 6, 111, 1 ; change first number to be the
>>>> > instrument
>>>> > number
>>>> >
>>>> > endin
>>>> > Then it goes to the mixer:
>>>> > ;OUTS AND POSTPROCESSING
>>>> > instr 111
>>>> > aOutL  MixerReceive 111, 0
>>>> > aOutR   MixerReceive 111, 1
>>>> > denorm aOutL, aOutR
>>>> > ;aOutL dcblock2 aOutL
>>>> > ;aOutR dcblock2  aOutR
>>>> > outq aOutL, aOutR, aOutL, aOutR
>>>> > MixerClear
>>>> > endin
>>>> >
>>>>
>>>>
>>>> Send bugs reports to this list.
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>>> "unsubscribe
>>>> csound"
>>
>>
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
> 

-- 
View this message in context: http://old.nabble.com/Strange-channel-dropout-problem-tp26958032p26994552.html
Sent from the Csound - General mailing list archive at Nabble.com.



Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"