[Fluxus] getting there osc-recursion-

geoffroy tremblay gef at ponnuki.net
Thu Dec 30 23:44:34 PST 2010


I was able to get value from an osc device (nds with dsmi) - and I was
trying to emulate the movement of the mouse with the camera - I
attached a camera to an object then trying to use the osc values to
move around. can I accomplish the same effect with the camera move
than the normal mouse camera ?

would I use rotate for the left click
the translate for the middle click
and the set-ortho zoom for the right click
(in my code right now I only loaded some movement but nothing really nice)

also the osc is quite laggy - is there some better to get the osc
data? it's not really usable at this point - maybe it's sending too
much data to the function (like too often - can I reduce that ?)

I am also moving around a recursion - and taking input from the audio
in -  and it seems out of sync - is there someway to create a faster
connection with jack ? or is it just computer power that will help
that ?

I am sure my code is probably not being quite optimized for speed :S

(thanks)

(clear)

; (define obj (build-cube)) ; create a cube to lock camera too
; (osc-source "9000")

; defining all the osc source 3 slider and a kaos xy
(define oscR 1)
(define oscG 1)
(define oscB 1)
(define oscY 1)
(define oscX 1)
(define evolve 0)

;(lock-camera obj)  ; locking the camera that will be used by osc
;(camera-lag 0.1)

(texture (load-texture "egg3.png"))
(gain 0.1)



(define (animate)
    (with-primitive obj
        (identity)

 ; loading the osc data into the variables

        (display (mouse-wheel))
        (when (osc-msg "/ds/kaos/y")
            (set! oscY (* 1000 (osc 0))))

        (when (osc-msg "/ds/kaos/x")
            (set! oscX (* 1000 (osc 0))))

        (when (osc-msg "/ds/slider1")
            (set! oscR (* 1000 (osc 0))))

        (when (osc-msg "/ds/slider2")
            (set! oscG (* 10 (osc 0))))

        (when (osc-msg "/ds/slider3")
            (set! oscB (* 100 (osc 0))))

;applying the osc data

        (rotate (vector oscX oscY oscR))
        ;(scale (vector oscB oscB oscB))

        )
    )


; My main recursion

(define (play count)

    (cond
        ((not (zero? count))
            (rotate (vector (time) 0 0)) ; keeping it moving

; getting the sphere to react to audio input

           ;(colour (vector (+ 10 (* 100 (gh 1))) (* 100 (gh 1)) (*
100 (gh 1))))
            (scale (vector (+ 1 (gh 1)) (+ 1 (gh 1)) (+ 1 (gh 1))))
            (draw-sphere)


            (with-state
                (rotate (vector 0 0 (* 10 (time))))
                (translate (vector 3 3 3))
                (scale (vector .6 .6 .6))
                (draw-sphere)

                (rotate (vector 0 0 (* 100 (time))))
                (translate (vector 2 2 2))
                (scale (vector .6 .6 .6))
                (draw-sphere)

                (rotate (vector 0 0 (* 100 (time))))
                (translate (vector 2 2 2))
                (scale (vector .6 .6 .6))
                (draw-sphere))

            (translate (vector 1 2 3))
            (play (- count 1)))))

(every-frame(begin
        ;        (animate)
        ;mouse wheel to increase the number of recursion
        (set! evolve (+ evolve (mouse-wheel)))
        (play evolve)))



More information about the Fluxus mailing list