Csound Csound-dev Csound-tekno Search About

Re: Lorenz Orchestra

Date1997-10-09 16:09
FromHans Mikelson
SubjectRe: Lorenz Orchestra
Hello,

At 08:50 AM 10/14/97 +1000, Arne Hanna wrote:
>The instrument below is from an old post, (apologies to the author, whose
>name has been lost in time)and refers to the Lorenz Equation.  When I try
>to process with a ten second score file, everything seems to set up just
>fine and then waiting... waiting... waiting...  My PPC doesn't hang, but
>two hours later still nothing, and still no crunching.  Anyone?

>if kcontzoom==kzoom kgoto sortida
>if kcontzoom!=kzoom kgoto loop1

I suspect it is stuck in a loop for some reason.  Change == to >=.
Actually this is not mine although I think I had it up on my web site for a
while.  I think it may be by either Josep M* Comajuncosas or a friend of
his originally.  The one that was posted had a bug in but I don't recall
exactly where it was.  The following one should work:

sr=44100
kr=44100
ksmps=1
nchnls=1

instr 1

; Lorenz Equations System at a-rate with all parameters Time-Variable


ipi init 6.283184
amix init 0

;p4 p5 i p6 = initial values for control parameters
;p7 = time differential (not less than 0.02 - may be improved using
Runge-Kutta
;       integration methode but it is very time consuming )
;p8 amplitude
;p9 zoom factor (a kind of temporal window applied to trajectories, values of
;               aprox. 5 are equivalent-almost- to downing p7 at the price of
;               a bit slowing down computing time...)
;p10 p11 p12 = deviation value for p6 p7 p8
;               (It is implemented with a simple line statement, but
;                improving it is straightforward)


kcontzoom init 0
kzoom init p9

iprof init p8
idt init p7

; NEWTON integration methode

adx init 0     ;diferentials
ady init 0
adz init 0
ax init .6       ;values
ay init .6
az init .6

;aa, ab and ac holds for the values of control parameters

       aa line p4,p3,p4+p10
       ab line p5,p3,p5+p11
       ac line p6,p3,p6+p12

aa init p4
ab init p5
ac init p6

loop1: adx=aa*(ay-ax)
       ady=ax*(ab-az)-ay
       adz=ax*ay-ac*az
       ax=ax+(idt*adx)
       ay=ay+(idt*ady)
       az=az+(idt*adz)

kcontzoom=kcontzoom+1

if kcontzoom>=kzoom kgoto sortida
if kcontzoom!=kzoom kgoto loop1

sortida:amix = ax*iprof

out amix

kcontzoom=0

endin

; score******************************************************************
;  P2     P3   P4   P5    P6     P7         P8         P9     P10 P11 P12
;  istart idur A1   B1    C1     Time (dT)  Amplitude  KZoom  A2  B2  C2
i1  0     .5    22   28   2.667      .01       600     3      5   0    0
;i1  0     3    26   28   2.667      .01       600     4      0   10    0

;e

Or this simplified version:

sr=44100
kr=44100
ksmps=1
nchnls=2
;Lorenz Attractor
        instr  1
;--------------------------------------------------------------------
ax      init   p5
ay      init   p6
az      init   p7
as      init   p8
ar      init   p9
ab      init   p10
ah      init   p11
;--------------------------------------------------------------------
kampenv linseg 0, .01, p4, p3-.02, p4, .01, 0
axnew   =      ax+ah*as*(ay-ax)
aynew   =      ay+ah*(-ax*az+ar*ax-ay)
aznew   =      az+ah*(ax*ay-ab*az)
;--------------------------------------------------------------------
ax      =      axnew
ay      =      aynew
az      =      aznew
;--------------------------------------------------------------------
        outs   ax*kampenv,ay*kampenv
        endin

f1 0 8192 10 1
t 0 400
;  Start  Dur Amp  X   Y   Z    S    R   B      h
;i1  0     8   600  .6  .6  .6  10   28  2.667  .01
;i1  +     .   600  .6  .6  .6  22   28  2.667  .01
;i1  .     .   600  .6  .6  .6  32   28  2.667  .01

The loop will allow you to get higher frequencies out of the system without
going to very high sample rates.

Bye,
Hans Mikelson

Date1997-10-13 23:50
FromArne Hanna
SubjectLorenz Orchestra
The instrument below is from an old post, (apologies to the author, whose
name has been lost in time)and refers to the Lorenz Equation.  When I try
to process with a ten second score file, everything seems to set up just
fine and then waiting... waiting... waiting...  My PPC doesn't hang, but
two hours later still nothing, and still no crunching.  Anyone?

sr=44100
kr=4410
ksmps=10
nchnls=1


instr 1

; Lorenz Equations System at a-rate with all parameters Time-Variable


ipi init 6.283184
amix init 0

;p4 p5 i p6 = initial values for control parameters
;p7 = time differential (not less than 0.02 - may be improved using Runge ;Kutta
;       integration methode but it is very time consuming )
;p8 amplitude
;p9 zoom factor (a kind of temporal window applied to trajectories, values of
;               aprox. 5 are equivalent-almost- to downing p7 at the price of
;               a bit slowing down computing time...)
;p10 p11 p12 = deviation value for p6 p7 p8
;               (It is implemented with a simple line statement, but
;                improving it is straightforward)


kcontzoom init 0
kzoom init p9

iprof init p8
idt init p7

; NEWTON integration methode

aadx init 0     ;diferentials
aady init 0
aadz init 0
axx init 0      ;new values
ayy init 0
azz init 0
ax init 1       ;values
ay init 1
az init 1

;aa, ab and ac holds for the values of control parameters

       aa line p4,p3,p4+p10
       ab line p5,p3,p5+p11
       ac line p6,p3,p6+p12

loop1:  adx=aa*(ay-ax)
       ady=ax*(ab-az)-ay
       adz=ax*ay-ac*az
       ax=ax+(idt*adx)
       ay=ay+(idt*ady)
       az=az+(idt*adz)
       axx=ax
       ayy=ay
       azz=az


kcontzoom=kcontzoom+1

if kcontzoom==kzoom kgoto sortida
if kcontzoom!=kzoom kgoto loop1

sortida:amix = ax*iprof

out amix

kcontzoom=0

endin

Cheers
Arne




"...for they have an undying thirst for the infinite"
                                               Lautremont

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

        http://www.geocities.com/SiliconValley/Peaks/3346

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=