|
Yes, encapsulation and recursion...I have to study that very well, thank
you...Is like in other languages like maxmsp, one can create a very complex
patch and then recall it like a simple object, and create multiple instances
of it...it's a very inportant and powerful feature, but here, without have
to manage "realtime" problems and a bunch of patching cables, it's
exponentially better, if one is not intrested in so called "live
electronics".
I think I'll begin to study python too...for enhancing programming
possibilities.
One can use python language for any "algoritmic" problem? I mean above all
for working with functions, arrays of numbers and math problems...csound has
gen routines and powerful math features but if I want work in a very deep
way with function tables, curves and equations? I downloaded Athena cl, what
do you think about it? An intresting think I would like to do is create
correlations between parameters with equations...an example ka + kb = 8 /
oscili iamp * ka, ifrequ * kb. I find difficult to imagine how to implement
this in csound language (maybe because I'm a newbie...). What's the best
choice for all this sort of problems? Python scripting?
Steven Yi wrote:
>
> Ah, I realize I actually wrote a UDO that did what I was about to do,
> and it's in the article TIm mentioned here:
>
> http://www.csounds.com/journal/2006summer/controlFlow_part2.html
>
> I've pasted below another example though renaming the opcode to
> multioscil3.
>
> steven
>
>
>
>
>
> sr=44100
> ksmps=1
> nchnls=2
>
>
>
> ga_bluemix_1_0 init 0
> ga_bluemix_1_1 init 0
> ga_bluesub_Master_0 init 0
> ga_bluesub_Master_1 init 0
>
>
>
> gitab2 ftgen 3, 0, 16, -2, 1, 1, 2.174, .5, 3.2, .4, 4.7, .225, \
> 5.234, .1625, 6.05, .03125, 0,0,0,0
> gi_sine ftgen 0, 0, 65537, 10, 1
>
>
> opcode multioscil3,a,ikko
>
> itable, kenv, kpch, i_index xin
>
> itablesize = ftlen(itable)
>
> ifreq tablei i_index, itable
> iamp tablei i_index + 1, itable
>
> kfreq = kpch * ifreq
>
> if (iamp > 0) then
> asig oscil3 iamp, kfreq, gi_sine
> else
> asig = 0
> endif
>
> kcount = 0
> kenv_local = kenv
>
> loopStart:
>
> kenv_local = kenv_local * kenv
>
> loop_lt kcount, 2, i_index + 2, loopStart
>
> asig = asig * kenv_local
>
> aout = asig
>
> if (i_index < itablesize - 2) then
> anextsig multioscil3 itable, kenv, kpch, i_index + 2
> aout = aout + anextsig
> endif
>
> if (i_index == 0) then
> aout balance aout, asig
> endif
>
> xout aout
>
> endop
> opcode blueEffect0,aa,aa
>
> ain1,ain2 xin
> aout1, aout2 reverbsc ain1, ain2, 0.85, 8000.0
>
> aout1 = (ain1 * 0.3) + (aout1 * (1 - 0.3))
> aout2 = (ain2 * 0.3) + (aout2 * (1 - 0.3))
>
>
> xout aout1,aout2
>
>
> endop
>
>
> instr 1 ;multioscil3
> ipch = cpspch(p4)
> iamp = ampdb(p5)
> kenv linseg 0, p3 * .5, 1, p3 * .5, 0
> aout multioscil3 gitab2, kenv, ipch
> aout = aout * iamp
> ga_bluemix_1_0 = ga_bluemix_1_0 + aout
> ga_bluemix_1_1 = ga_bluemix_1_1 + aout
>
> endin
>
> instr 2 ;Blue Mixer Instrument
> ga_bluemix_1_0, ga_bluemix_1_1 blueEffect0 ga_bluemix_1_0, ga_bluemix_1_1
> ga_bluesub_Master_0 sum ga_bluesub_Master_0, ga_bluemix_1_0
> ga_bluesub_Master_1 sum ga_bluesub_Master_1, ga_bluemix_1_1
> outc ga_bluesub_Master_0, ga_bluesub_Master_1
> ga_bluemix_1_0 = 0
> ga_bluemix_1_1 = 0
> ga_bluesub_Master_0 = 0
> ga_bluesub_Master_1 = 0
>
> endin
>
>
>
>
>
>
>
>
> i1 0.0 8.328125 8.00 80
> i1 1.90625 7.03125 7.02 80
> i1 3.84375 5.78125 9.05 80
> i2 0 13.625
> e
>
>
>
>
>
>
> On 8/30/07, Steven Yi wrote:
>> For UDO's, besides the manual there is the repository available at:
>>
>> http://www.csounds.com/udo/
>>
>> I'm surprised there isn't an example of an oscillator bank opcode
>> there. I was going to write one the other day anyways so one can use
>> gen 10 style table but using gen 2 so one can write fractional
>> frequency multipliers (gen 10 would truncate the freq as it was non
>> whole multiplier when generating table). Perhaps that doesn't make
>> sense, but I'll submit something later today and that should be
>> clearer as to its use.
>>
>> As for python, I highly recommend it as a programming language for
>> score work or any programming work. Very versatile and generally easy
>> to pick up and go.
>>
>> steven
>>
>>
>>
>> On 8/30/07, ad80a wrote:
>> >
>> > Many thanks...and many thanks to Tim.
>> >
>> > So...I'll start to study UDO...I'think all the information I need are
>> on the
>> > canonical manual, they are'nt?
>> > What I need is really this sort of orientation...to know were I've to
>> look
>> > for my tasks...
>> > Another thing I think will became a need very soon...once I've created
>> this
>> > sort of recursive opcode that generate a "cluster" of signal generators
>> > (even of synth structures or other UDOs I think), there is a way to
>> global
>> > CONTROL that, I think with arrays of number in ftables, assigning, by
>> > indexing, different values to different parameters...I think this will
>> be an
>> > efficent way to globally change parameters of dozens of unit
>> > generators...Where I've to look for this kind of problems?
>> > It's very intresting this sort of algoritmic creation of signal
>> STRUCTURES
>> > and control parameters...It can simplify the crations of very complex
>> > instruments...
>> > Can learning python scripting enhance my possibilities in that
>> direction or
>> > the "basic" csound language can achieve all these task alone?
>> > Thanks for your patience...
>> >
>> > Steven Yi wrote:
>> > >
>> > > This approach will not work for a couple of reasons. One is the that
>> > > the "if" is at i-time, so will loop four times during initialization.
>> > > Second is that you did use an arate loop, you still can not run an
>> > > oscillator like this. What you will end up doing is effectively
>> > > running a single oscillator at x times the normal rate. I assume you
>> > > want x number of different distinct oscilators. The only way to do
>> > > that in Csound is to use a recursive User-Defined Opcode.
>> > >
>> > > steven
>> > >
>> > >
>> > > On 8/30/07, ad80a wrote:
>> > >>
>> > >> I'm trying to do what I call an "accumulator" (I don't know if this
>> the
>> > >> right
>> > >> definition...in english).
>> > >> In few words I would like to create an oscillator
>> > >>
>> > >> ares oscili iamp, ifrequ, ifn
>> > >>
>> > >> and the create a sort of loop that changes parameters of this
>> oscillator
>> > >> and
>> > >> mix it with prevoius instances...
>> > >> index = 0
>> > >> amix init 0
>> > >> loop:
>> > >>
>> > >> asig oscili iamp, ifrequ, ifn
>> > >>
>> > >> amix = asig + amix
>> > >>
>> > >> index = index +1
>> > >> ifrequ = ifrequ + 100
>> > >> if index < 4 goto loop
>> > >>
>> > >> outs amix, amix
>> > >>
>> > >> It does NOT work right. I'm sure there is an error of
>> procedure...first
>> > >> thing, I don't know if it's possible to do this sort of loop...it's
>> > >> implemented in adsynt opcode help, but non with signals...it creates
>> an
>> > >> array of numbers...
>> > >> I well know that with adsynt I can do this sort of additive
>> synthesis,
>> > >> but
>> > >> what I want to do can improve the creation of arrays of signal
>> > >> generators,
>> > >> filters for algoritmic crations of complex patterns...
>> > >> Can csound help me in this way or my approach to the language is
>> wrong?
>> > >> Thank you very very much
>> > >>
>> > >>
>> > >> --
>> > >> View this message in context:
>> > >> http://www.nabble.com/Accumulator-tf4356703.html#a12415417
>> > >> Sent from the Csound - General mailing list archive at Nabble.com.
>> > >>
>> > >> --
>> > >> Send bugs reports to this list.
>> > >> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>> > >>
>> > > --
>> > > Send bugs reports to this list.
>> > > To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>> > >
>> > >
>> >
>> > --
>> > View this message in context:
>> http://www.nabble.com/Accumulator-tf4356703.html#a12417459
>> > Sent from the Csound - General mailing list archive at Nabble.com.
>> >
>> > --
>> > Send bugs reports to this list.
>> > To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>> >
>>
> --
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>
>
--
View this message in context: http://www.nabble.com/Accumulator-tf4356703.html#a12424280
Sent from the Csound - General mailing list archive at Nabble.com. |