Jump to content
Sign in to follow this  
PatrickMimran

Try to add seed as an option in this function

Recommended Posts

 

I try to put a seed as an option in this function with a default value of nil or no seed , how may i add it as optional 

 

Thanks  Patrick  

 

(defun patkaos ( seed lambda long )
 (let ((res (cons seed nil)) (xn seed))
    (dotimes (n long res) (setf res (cons (setf xn (* lambda xn (- 1 xn))) res)))
    (reverse res)))

Share this post


Link to post
Share on other sites

i looked at it and i tried to put it in the function , but without success 

 

This is what i did 

 

(defun patkaos (  lambda long &key seed  )

(rnd-seed seed )
 (let ((res (cons seed nil)) (xn seed))
    (dotimes (n long res) (setf res (cons (setf xn (* lambda xn (- 1 xn))) res)))
    (reverse res)))

 

when i evaluate this is what i gat 

 

Error: floating-point-overflow detected
>        performing * on (-2.5452163E+36 2.5452163E+36)
> While executing: ccl::*-2, in process Listener-1(7).
> Type cmd-. to abort, cmd-\ for a list of available restarts.
> Type :? for other options.

 

 

Thanks Patrick

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Topics

    • By torstenanders
      What is the Lisp function for stopping playback (bound to the shortcut cmd-esc)? 
       
      ... I could never add a custom keyboard shortcut to the Opusmodus text editor Hemlock (and I tried), but I just managed adding keyboard shortcuts and a menu for playing Opusmodus snippets and my polyphonic score format to Emacs (thanks to the fact that scores now can be displayed in a separate window). Only need some key for stopping playback as well.
       
      (The main thing I will then miss when using Emacs as the Opusmodus IDE is the close integration of the document, but well, you cannot have everything 🙂  On the plus side, I have a more stable editor and in particular a very good debugger.)
       
      Thanks! 
       
      Torsten
    • By spuki
      Hallo,
      newbie here 🙂
      I'm just starting with OM and playing around with the tutorials.
      I slightly changed tutorial #4 and run into something strange.
       
      If i run the script as posted below, all works as expected. But when i change the function reverse to nreverse (and nreverse is the oficially documented name of the function)
      the omn result will leave the right hand empty. Why ist that?  And why does reverse work as i expect it to work?
       
      And, another thing: i dont understand what the term seed will do. Will it make random functions behave always the same as long as the seed is the same?
      ...and what does the number following the seed mean?
       
      Thank you !!
      Best,
      Sebasian
      (setf pitches (gen-repeat 5 '(c4 cs4 fs4 g4 c5 cs5))) (setf transposed-pitches (gen-repeat 5 (pitch-transpose -24 pitches))) (setf lengths (span pitches '(e))) (setf lengths-rests (length-weight lengths :weight '(2 1) :seed 12)) (setf left-lengths (reverse lengths-rests)) (setf piano-righthand       (make-omn        :length lengths-rests        :pitch pitches        :velocity'(mp))) (setf piano-lefthand       (make-omn        :length left-lengths        :pitch transposed-pitches        :velocity '(f))) (setf timesigs (get-time-signature left-lengths)) (def-score lesson-4            (:key-signature 'chromatic             :time-signature '( 5 8 )             :tempo 190             :layout (piano-layout 'piano-rh 'piano-lh))     (piano-rh    :omn piano-righthand    :channel 1    :sound 'gm    :program 'acoustic-grand-piano)     (piano-lh    :omn piano-lefthand)   )  
    • By JulioHerrlein
      Dear All,
       
      I have a little suggestion for workflow.
       
      1) A simple context menu button (or some way) to open the XML snippet in other software.
      Like right-clicking on the snippet and have an option (OS based option) like "open with" (musescore, finale, sibelius, etc)
       
      This could be useful for collecting material for a piece to be edited outside Opusmodus.
      I personally use Musescore with my students. It's free, open and runs windows and mac.
      I also use Finale for myself.
      This simple options could solve the problem of the audition of many different snippets.
       
      2) Another (much more complex) idea would be  when click over each snippet to have a play panel, similar to the
       live coding panel (with play/stop button, tempo, volume, maybe sound and channel assigment , according
       to the number of staves, etc...
       
      This could be handy.
       
      Best,
      Julio
      added 2 minutes later Like this (when clicking over the snipett inside Opusmodus:
       

×
×
  • Create New...