[Fluxus] getting there osc-recursion-
evan.raskob [lists]
lists at lowfrequency.org
Fri Dec 31 06:07:20 PST 2010
I also meant to add, if you include the (osc-last-msg) in a loop you will get all the sent messages for a certain osc path, but this may not be a good thing if you are receiving them a lot faster than your framerate.
On 31 Dec 2010, at 09:05, evan.raskob [lists] wrote:
> Hey - a bit late, but here's a simple example that gets the last (top of the osc message stack) osc values for an audio device and uses them to draw a cube on the screen:
>
>
> ;------- BEGIN DRAW CUBE OSC -----------------------------------------
>
> (clear)
>
> (osc-source "7005")
>
> (define x 0)
> (define y 0)
>
> ; "path" is a string
> ; value, in this case, is any default value you get back if the message wasn't found
>
> (define (osc-last-msg path arg value)
> (if (osc-msg path)
> (osc-last-msg path arg (osc arg))
> value))
>
> (show-fps 1)
>
> (define a (with-state
> (texture tex0)
> (scale 2)
> (build-sphere 30 30)))
>
> (define (animate)
> (set! y (osc-last-msg "/audioin/1/val" 0 y))
> (set! x (osc-last-msg "/audioin/2/val" 0 x))
>
> ;top
> (with-state
> (translate (vector 0 (+ 2 (* x 2.5)) 0))
> (draw-cube))
> )
>
>
> (every-frame (animate))
>
> ;------- END DRAW CUBE OSC -----------------------------------------
>
>
>
> On 31 Dec 2010, at 04:18, geoffroy tremblay wrote:
>
>> On Fri, Dec 31, 2010 at 12:08 AM, gabor papp <gabor.lists at mndl.hu> wrote:
>>>> move around. can I accomplish the same effect with the camera move
>>>> than the normal mouse camera ?
>>>
>>> you can check how fluxus does it. the code is in
>>> fluxus/modules/scheme/camera.ss. see (input-camera), which sets the camera
>>> rotation and position depending on mouse movement and (update-camera), which
>>> uses the camera parameters to set up a camera matrix that you can load with
>>> the (set-camera-transform) function. let us know if you need further help.
>>
>> nice - good to read directly from there...
>>
>>>
>>>> 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 ?)
>>>
>>> it is possible that you send too much data, you have to drain the data
>>> reading all available osc messages to decrease the lag.
>>>
>>>> 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 ?
>>>
>>> it should be quite fast by default. maybe you are using a too deep recursion
>>> level that slows down processing. especially because you set the level from
>>> the mouse wheel, and you have no upper limit. you can check the frame per
>>> second using. if that looks fine, you can try changing the
>>> buffer size of jack.
>>
>> the fps start at about 16 and drop to 9ish when too many recursions
>> are loaded - will play around with the buffer size to see how that
>> will help.
>>
>> thanks - I am doing a short live event for new year - mainly mixing
>> music and playing around with fluxus with this code (not really live
>> coding yet ) - not sure if I'll integrate the osc part this time -
>> anyhow I will video some part of the event and post it online ;)
>>
>> thanks again
>>
>>>
>>> gabor
>>>
>>>
>
More information about the Fluxus
mailing list