Jump to content

All Activity

This stream auto-updates

  1. Yesterday
  2. Better doc: CLHS: Function FLOOR, FFLOOR, CEILING, FCEILING... WWW.LISPWORKS.COM
  3. Here's the doc: Simplified Common Lisp reference - round JTRA.CZ
  4. One question @Stephane Boussuge - what is 'round ? Context - (setf new-ints (mapcar 'round (linear-interpolation bassint n-steps))) I'm unable to find that in the documentation.
  5. Here it is: (defun length-to-rnd-rest (n sequence &key seed) (let (state) (setf state *init-seed*) (setf seed (rnd-seed seed)) (do-verbose ("length-to-rnd-rest :seed ~s" seed) (let* ((len (length sequence)) (sel (rnd-order (append (gen-repeat n t) (gen-repeat (- len n) nil)) :seed (seed))) (result (loop for i in sel for j in sequence collect (if (null i) j (* j -1))))) (init-state state) result)))) (setf lengths '(15/16 15/32 1/32 1/32 1/32 61/32 1/32 1/2 1/32 5/32 1/32 13/16 17/32 3/2 9/16 7/16)) (length-to-rnd-rest 5 lengths) => (15/16 15/32 1/32 -1/32 1/32 61/32 1/32 -1/2 -1/32 -5/32 1/32 -13/16 17/32 3/2 9/16 7/16) (length-to-rnd-rest 5 lengths :seed 5) => (15/16 -15/32 1/32 1/32 1/32 61/32 1/32 -1/2 1/32 -5/32 1/32 13/16 -17/32 -3/2 9/16 7/16) I could make something more useful with steps, omitting existing rests and of course working with length symbols and events (omn).
  6. The seed is not part of the function therefore it will return different output each time. Check the rnd-seed doc for how to apply seed function into your functions.
  7. Sometimes its correct, sometimes not ... Did you tried it with my seed? What was your result?
  8. This is beautiful, @Stephane Boussuge! First use of a for loop and a defined function for me with OM. This opens up a whole new world. Thank you so much! THT
  9. Yes, looks complicated. I used the loop advice now. Easier to understand. I was looking for a function without a loop, but then you have to use a lambda expression. To get into the loop-macro with all its possibilities is still on my list. But the collect does all I need. I get the idea that learning the loop-macro features is worth the effort. Thanks again.
  10. May be this can help a bit, I've tried this: (setf bass '(g2 c3 a2 e3 fs3)) (setf bassint (pitch-to-integer bass)) ;=> (-17 -12 -15 -8 -6) ;;; create a set of integers from interpolation ;;; between bass integers (bassint), ;;; then convert those to pitches (defun linear-interpolation (numbers steps) (let ((interpolated-numbers nil)) (loop for i from 0 below (- (length numbers) 1) for number = (nth i numbers) for next-number = (nth (1+ i) numbers) do (loop for j from 0 to steps do (push (+ (* (- next-number number) (/ (float j) steps)) number) interpolated-numbers) ) (push next-number interpolated-numbers)) (filter-repeat 1 (nreverse interpolated-numbers)))) (setf n-steps 4) (setf new-ints (mapcar 'round (linear-interpolation bassint n-steps))) (setf melody (integer-to-pitch new-ints)) (setf sop (filter-tie (make-omn :pitch (pitch-transpose 24 melody) :length '(e) :span :pitch ))) (setf bas (make-omn :pitch bass :length '(h) :span :pitch )) (ps 'gm :fl (list sop) :bn (list bas) :time-signature '(4 4)) SB.
  11. Last week
  12. Hello, I'm hitting a brick wall with m thinking from object-oriented approaches. Basically, I want to create a melody line that "flutters" pitches in a key corresponding to a bass pitch, and only when that bass pitch occurs. It's easy enough for an "If, then" statement but my attempt to solve this are leading me to take a first step of interpolating between bass pitches (as integers) and manually calculating the remains of the bar manually. However this is not ideal as I would prefer to use euclidean-rhythm with a rotation, so finding a parametric approach this would be ideal. Here's the general approach I've begun. Any advice from people more experienced with LISP is appreciated. (setf bass '((g2)(c3)(a2)(e3)(fs3))) (setf bassint (pitch-to-integer bass)) => ((-17) (-12) (-15) (-8) (-6)) ;;; create a set of integers from interpolation ;;; between bass integers (bassint), ;;; then convert those to pitches (setf melody (gen-transition 1 10 10 1)) Thanks, Tom
  13. test/evaluate it again... my output is => (-15/16 15/32 1/32 1/32 1/32 61/32 1/32 1/2 1/32 -5/32 -1/32 13/16 -17/32 3/2 9/16 -7/16) so it's correct
  14. Thank you! I appreciate you pointing me in the right direction. The issue was with the triplet: enclosing it into a parenthesis helped. (setf elvis (gen-repeat 2 '((h f4 c5) (h f4 -q e g4 a4) (h bb4 a4) (h g4 -q -e c4) (h d4 e4) (h f4 (3h g4 a4 bb4)) (h a4 g4 w f4) )))
  15. Something like this: (defparameter durations '(15/16 15/32 1/32 1/32 1/32 61/32 1/32 1/2 1/32 5/32 1/32 13/16 17/32 3/2 9/16 7/16)) (defun length-to-rnd-rest (numb dur-lst) (let* ((llst (- (length dur-lst) 1)) (minnumb (min numb llst)) (posns (sort-asc (rnd-unique minnumb (gen-integer 0 llst))))) (loop for i in dur-lst for j from 0 collect (if (member j posns) (* -1 i) i )))) (length-to-rnd-rest 5 durations) I get only 4 rests in this example: (defparameter durations '(15/16 15/32 1/32 1/32 1/32 61/32 1/32 1/2 1/32 5/32 1/32 13/16 17/32 3/2 9/16 7/16)) (length-invert durations :section (rnd-sample 5 (gen-integer 0 (1- (length durations))) :norep t :seed 4)) ;; => (15/16 15/32 1/32 1/32 1/32 61/32 1/32 1/2 -5/32 -13/16 1/32 -9/16 17/32 3/2 -1/32 7/16)
  16. (setf alist '(1/4 1/4 1/8 1/8 1/4 1/4)) (setf n 3) (length-invert '(1/4 1/4 1/8 1/8 1/4 1/4) :section (rnd-sample n (gen-integer 0 (1- (length alist))) :norep t))
  17. Is there a function with which I can change randomly a defined number of lengths in a list to rests? Thanks, Achim
  18. it's very lispian yes, it works also by (mapcar...)
  19. i checked it quickly: when you replace the 3h - for example - by h => then i get NO ERRORS
  20. Thank you AM. That would work. I found this in the opusmodus functions. (setf alist '((s -s s== -s -s== s== -s s -s s -s s -s==) (s== -s s -s s== -s s -s== s== -s s -s s -s==) (s -s== s -s s -s s== -s s -s==))) (mapcar #'(lambda (x) (append x '(q) )) alist). => ((s -s s== -s -s== s== -s s -s s -s s -s== q) (s== -s s -s s== -s s -s== s== -s s -s s -s== q) (s -s== s -s s -s s== -s s -s== q))
  21. like that? ;; as lisp-code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setf alist '((s -s s== -s -s== s== -s s -s s -s s -s==) (s== -s s -s s== -s s -s== s== -s s -s s -s==) (s -s== s -s s -s s== -s s -s==))) (loop for i in alist collect (append i (list 'q))) => ((s -s s== -s -s== s== -s s -s s -s s -s== q) (s== -s s -s s== -s s -s== s== -s s -s s -s== q) (s -s== s -s s -s s== -s s -s== q)) ;; as lisp-function ;;;;;;;;;;;;;;;;;;;;;;;;;; (defun append-value (lists value) (loop for i in lists collect (append i (list value)))) (append-value alist 'q) => ((s -s s== -s -s== s== -s s -s s -s s -s== q) (s== -s s -s s== -s s -s== s== -s s -s s -s== q) (s -s== s -s s -s s== -s s -s== q))
  22. I'm studying the Orchestral Example code from Opusmodus documentation. After changing the original melodic source (setf solo => setf elvis), compiling solovar1 and solovar2 functions produce error messages more than half the time. Does anyone know how to fix that? Thank you! ;;; MELODY ;; Basic melodic material (setf elvis (gen-repeat 2 '((h f4 c5) (h f4 -q e g4 a4) (h bb4 a4) (h g4 -q -e c4) (h d4 e4) (h f4 3h g4 a4 bb4) (h a4 g4 w f4) ))) (setf frag1 (gen-loop 14 (list (rnd-pick '(2 3 1 4)) (rnd-pick '(2 3))))) (setf frag2 (gen-loop 14 (list (rnd-pick '(2 3 1 4)) (rnd-pick '(2 3))))) ;; Melodic variations (setf solovar1 (gen-fragment frag1 elvis)) (setf solovar2 (gen-fragment frag2 elvis)) Here's one of the error messages: Error: Function nthcdr expected a non-negative integer, got -1. 1 (abort) Return to top loop level 0. Type :b for backtrace or :c <option number> to proceed. Type :bug-form "<subject>" for a bug report template or :? for other options.
  23. Hi, I have this list of lists (will have much more sublists) : '((s -s s== -s -s== s== -s s -s s -s s -s==) (s== -s s -s s== -s s -s== s== -s s -s s -s==) (s -s== s -s s -s s== -s s -s==)) I want to append e.g. a 'q to the end of each list. Is there a function I could use? How would you do this?
  24. Ha yes, But I mean the colour of the note in the notation viewer. Like I change the note head style for a particular note to a cross, : attribute '(- nh-x nh-norm - -) I would like to be able to do something like: :attribute '(- ncolorff0000 ) and have the second note drawn in red in the notation view Or something like that? Maybe it's a feature request
  1. Load more activity
×
×
  • Create New...

Important Information

Terms of Use Privacy Policy