[Impromptu] problem using two metres

Michele Pasin michele.pasin at kcl.ac.uk
Fri Mar 13 12:38:56 GMT 2009


Hey Andrew,

i guess that's something wrong in my system cause i've just been  
copying and pasting your example into Impromptu (v. 1.34) - see this  
screenshot:

http://localhostr.com/files/040e4c/Picture+2.png

Another (easily fixable) minor thing I noticed is that (cosr 70 20 4)  
doesn't work, i get this error message:
:ERROR: eval: unbound variable: 2pi

Did you mean to include the variable in Imprompty standard set or not?
Also in the functions-index cosr's explanation is generating an error!


 >>>>>>>>>> UPDATE :

I found what the problem is: I was loading at startup the time-lib  
library [http://impromptu.moso.com.au/libs/time-lib.html] that  
contains another version of the make-metro utility. I removed this  
(supposedly older) version and now everything works!!


tx!

m



On 12 Mar 2009, at 20:11, Andrew Sorensen wrote:

> Hi Michele,
>
> You should avoid fmod, it is evil, and it will be removed in v1.4
>
> If modulo isn't available then you must be using an out of date
> version of impromptu?
>
> If you do have modulo but the previous example doesn't work then your
> beat is probably a real number and not a rational number.  Basically
> the rule of thumb is this - make sure that you always use integers or
> rationals whenever you create or touch a beat.  This goes for when you
> create the beat with metro such as (*metro* 'get-beat 4/1) (*metro*
> 'get-beat 1/2) (*metro* 'get-beat 4) or modify a beat (+ beat 1/3) (+
> beat 3/2) (+ beat 3) (* beat 1/2) etc..  To check just print beat and
> if it is a real number then you're in trouble.
>
> Rational numbers are really very helpful.  In particular for rhythmic
> work.  This ensures that things like triplets, quintuplets etc.. are
> always accurate.  fmod and modulo with real numbers basically will
> never work accurately.  Below is a similar example as before but uses
> rationals more explicitly.  You can't do this kind of thing reliably
> with real numbers (and therefore with fmod).
>
> Hope this all makes sense :)
>
> (define loop
>    (lambda (beat)
>       (case (modulo beat 4)
>             ((0)
>              (play piano 36 110 4))
>             ((1/3 2/3 1)
>              (play piano (random '(87 72 74 75 82)) (cosr 70 20 4)
> 3/2))
>             ((3/2)
>              (for-each (lambda (p)
>                           (play piano p (random 40 60) 2))
>                        (pc:make-chord 50 70 3 (random '((0 3 7 10) (2
> 5 8 10))))))
>             ((10/4 11/4 12/4 13/4)
>              (play piano (random '(60 65 63 62 58)) (cosr 70 30 3)
> 3/2))
>             ((15/4)
>              (play piano 48 80 1/2)))
>       (callback (*metro* (+ beat (* .5 1/12))) 'loop (+ beat 1/12))))
>
> (loop (*metro* 'get-beat 4))
>
> Cheers,
> Andrew.
>
> On 13/03/2009, at 9:11 AM, Michele Pasin wrote:
>
>> btw the function below doesn't work like that, you need to use 'fmod'
>> instead of 'modulo'.
>> (mind that I haven't applied Glen's patches yet - nor had a chance to
>> try to understand the various floating point related issues - so
>> again, I might have left out something important here!)
>>
>> thanks, impromptu rocks!
>>
>> m
>>
>>
>> On 12 Mar 2009, at 00:29, Andrew Sorensen wrote:
>>
>>> ;; using modulo directly
>>> (define loop
>>>  (lambda (beat)
>>>     (case (modulo beat 8)
>>>           ((0)
>>>            (play piano 60 120 1)
>>>            (play piano 36 120 1))
>>>           ((1 2 3)
>>>            (play piano 36 120 1))
>>>           ((4 5 6 7)
>>>            (play piano 40 120 1)))
>>>     (callback (*metro* (+ beat (* .5 1/2))) 'loop (+ beat 1/2))))
>>>
>>> (loop (*metro* 'get-beat 4))
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ____________________________
>> Dr. Michele Pasin
>> Centre for Computing in the Humanities
>> King's College, London
>> http://staff.cch.kcl.ac.uk/~mpasin/
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Impromptu mailing list
>> Impromptu at lists.moso.com.au
>> http://lists.moso.com.au/mailman/listinfo/impromptu
>
> _______________________________________________
> Impromptu mailing list
> Impromptu at lists.moso.com.au
> http://lists.moso.com.au/mailman/listinfo/impromptu









____________________________
Dr. Michele Pasin
Centre for Computing in the Humanities
King's College, London
http://staff.cch.kcl.ac.uk/~mpasin/








More information about the Impromptu mailing list