Csound Csound-dev Csound-tekno Search About

[Csnd] Re: Re: Re: Re: Strange channel dropout problem

Date2010-01-02 17:14
Frommichael.gogins@gmail.com
Subject[Csnd] Re: Re: Re: Re: Strange channel dropout problem
Clearing the mixer should be done only once and in the highest numbered 
instrument. The examples/CsoundAC.csd orchestra shows how it should be done, 
typically as the last opcode in a master output stage.

The new Signal Flow Graph opcodes can be used for mixing in a more flexible 
way, and do not require clearing (it is handled automatically). But they do 
not mimic the traditional mixer with busses.

Hope this helps,
Mike

----- Original Message ----- 
From: "UnUnUnium" 
To: 
Sent: Saturday, January 02, 2010 11:54 AM
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"
>

Date2010-01-02 17:25
FromJ
Subject[Csnd] Re: Re: Re: Re: Re: Strange channel dropout problem
Thank you Mike. OK, so I was doing it right then - I was clearing only in the final, higher numbered instrument - makes sense to clear so as not to accumulate samples. Must be some other problem then.

Where do I find out more about these Signal Flow Graph opcodes? Intrigued....

Best, Jeremy


On Sat, Jan 2, 2010 at 5:14 PM, <michael.gogins@gmail.com> wrote:
Clearing the mixer should be done only once and in the highest numbered instrument. The examples/CsoundAC.csd orchestra shows how it should be done, typically as the last opcode in a master output stage.

The new Signal Flow Graph opcodes can be used for mixing in a more flexible way, and do not require clearing (it is handled automatically). But they do not mimic the traditional mixer with busses.

Hope this helps,
Mike

----- Original Message ----- From: "UnUnUnium" <falabala66@gmail.com>
To: <csound@lists.bath.ac.uk>
Sent: Saturday, January 02, 2010 11:54 AM
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 <falabala66@gmail.com>:
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"




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"


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