Jump to content

Rangarajan

Members
  • Posts

    222
  • Joined

  • Last visited

Everything posted by Rangarajan

  1. Oh, I think my knowledge of Lisp is just passable. Interestingly, to be able to generate good music in Opusmodus, one need not be an expert in Lisp. Regards, Rangarajan
  2. That was quick! One of the biggest challenges in mastering a powerful platform such as Opusmodus is getting the bigger picture, and learning to use the wide variety of functions in the library. I hope someone writes a great "Beginners" guide to working with the software! Regards, Rangarajan
  3. Yes, BINARY-SERIES will be a useful addition to the library. Regards, Rangarajan
  4. Hi Janusz, Thanks for your comment. The function is expected to return NIL if num-pulses argument is ODD or if the rhythmic oddity cannot be satisfied for the given set of arguments. I think the function you have given solves a different problem. Regards, Rangarajan
  5. I am reading a very good book "The Geometry of Musical Rhythms". Chapter 15 discusses an interesting idea called "Rhythmic Oddity". In today's blog of mine, I have briefly written about this idea and how it can be implemented in Opusmodus. Hope members will find it useful in their work. Do read the book for many great insights! Regards, Rangarajan
  6. I am amazed by such frequent and swift releases of Opusmodus! I have never seen this kind of product commitment and support from any other company so far. The product continues to become better day by day. Best wishes to Janusz and team for such a great product and even greater support! Regards, Rangarajan
  7. No, I did not explicitly give any package specification at the top of the file. But, on checking I find that the functions I defined are in "OPUSMODUS" package as seen from the variable *package*. In that sense, I agree with you that some symbols could shadow built-in functions, but the strange thing is that when I load them explicitly from within Quicklisp Start.opmo, they work fine. I will leave it at that for now, but it needs further investigation. Regards, Rangarajan
  8. I thought so too, but when I evaluate functions once again via "Evaluate All", they start working. What behaviour is to be expected if by accident I define a function that is part of the system? Will there be an error or warning? Also, they work when I load them from the Quicklisp Start file as mentioned in my previous post. That is strange, right? Regards, Rangarajan
  9. Hi, I have a set of utility functions in a file called "Utils.opmo". These functions have been tested and have no errors. In order to load these functions at start up, I copied this file to my Extensions folder. When I launch OM, what I notice is that some of the functions in this file are loaded correctly, but some others are not loaded at all (I get error when I call them from the console) even though all are in the same source file. I do not get any error messages at load time. I then included the call "(load "<path>/Utils.opmo"), where <path> is the location of the file, in "Quicklisp Start.lisp". Now, when I start OM, as part of Quicklisp initialisation, my "Utils.opmo" gets loaded correctly. I cannot figure out what the problem could be. Any guesses? Regards, Rangarajan
  10. OK, interesting point. It is possible to return duplicate elements if unique elements cannot be found. -Rangarajan
  11. I think this might work, although computationally expensive: ;; (combinations '(1 2) '(3 4)) => ((1 3) (2 3) (1 4) (2 4)) (defun find-all-combinations-of (&rest sublists) (if (first sublists) (mapcan (lambda (x) (mapcar (lambda (y) (cons y x)) (first sublists))) (apply #'find-all-combinations-of (rest sublists))) '(nil))) ;; (select-unique-elements '((1 3 2) (1) (2 1 3))) => (2 1 3) or (3 1 2) (defun select-unique-elements (alist) (rnd-pick (remove-if (lambda (alist) (< (length (find-unique alist)) (length alist))) (apply #'find-all-combinations-of alist)))) ;; Test cases (select-unique-elements '((1 3 2) (1) (2 1 3))) => (2 1 3) or (3 1 2) (select-unique-elements '((2) (2 1))) => (2 1) (select-unique-elements '((1) (1))) => nil I return nil if unique elements cannot be selected. Regards, Rangarajan
  12. I understand what you are saying, and this could be an acceptable specification of the function. According to my specification, this example is "unsatisfiable". There is a simple prerequisite: (>= (length (union given-sublists)) (length given-sublists)). In this example, there are 4 sublists, but only 3 unique elements across the whole sublists. So it is not satisfiable at all. As an exception, in this case, you could repeat the elements. But what I want is: if the prerequisite is satisfied, then the function should return unique elements. So in this example '((1 2) (2)), the function should ALWAYS return '(1 2) because there is no other solution. In the case of '((1 2) (1 2) (2 3)), the solutions are: (1 2 3), (2 1 3). I agree that the definition you have provided is still quite useful. Regards, Rangarajan
  13. Hi, Opusmodus has some neat functions for working with text and converting letters to pitches. I wanted to see if we can go beyond that, so wrote a program to determine the parts of speech (POS) of words in a piece of text and then use that to generate pitches. The code shows how to use the REST API to access one of the popular text analysis engines (TextRazor). I have written up the details in my blog post. Regards, Rangarajan
  14. Thanks, but this does not work (in general). Try this test code: (let (result) (dotimes (i 20) (setf result (find-unique-seq '((1 2 3) (2)))) (when (< (length result) 2) (format t "Result: ~A does not satisfy specification~%" result)))) You can see that there are times when the output does not include element from at least one of the subsets. The simplest test case is what I have used in the code fragment: '((1 2 3) (2)) It seems to me that to solve this problem requires some backtracking or heavy pre-processing. Maybe I am wrong. Regards, Rangarajan
  15. Yeah. There are so many nice functions in OM, so wanted to know if there was one directly usable. Thanks, anyway. Regards, Rangarajan
  16. No, this won't work because the order is not preserved. I guess I should have been more precise in my specification. We need one element from each sublist, in the same order of sublists, such that the final selection is unique. This is reflected in my example output. The solution you have given can yield, for example, (2 4 1). The last sublist in input does not have 1, so this is incorrect. Regards, Rangarajan
  17. Hi, I see that there is a family of functions for computing "unique" elements, sequences, etc. Just wondering if there is a function to pick a random element from a list of lists, such that the result has no duplicates. For example, assuming the function is called "select-unique-elements", I am expecting this behaviour: (select-unique-elements '((1 2 3) (2 4) (3 5))) => (1 2 3) or (1 4 5) or (2 4 3) etc. That is, each time I call this function it will return a possibly different list with one element chosen from each sub-list, but preserving uniqueness in the result. Regards, Rangarajan
  18. Thanks very much. Obviously I had not read the quick lisp-related posts fully. I did the following and it works now: 1) Created a directory "ccl" under my user name directory 2) cd to that directory 3) svn co http://svn.clozure.com/publicsvn/openmcl//release/1.11/darwin-x86-headers64 4) In the file "Quicklisp Start.lisp" located under "~/Opusmodus/Extensions" folder, I uncommented and modified the following line: (setf (logical-pathname-translations "ccl") '((#P"ccl:**;*.*" #P"/Users/Rangarajan/ccl/**/*.*"))) That is it. Regards, Rangarajan
  19. Hi, I know support for quicklisp is not expected of this forum, but in case someone has found a fix, I would appreciate the insight. I installed quicklisp without any problem. But when I try to install "drakma" library (via console), I am getting this error: -------------- ? (ql:quickload "drakma") To load "drakma": Load 1 ASDF system: drakma ; Loading "drakma" Read error between positions 66 and 163 in /Users/Rangarajan/quicklisp/dists/quicklisp/software/usocket-0.6.3.2/backend/openmcl.lisp. > Error: Foreign function not found: x86-darwin64::|gethostname| > While executing: ccl::load-external-function, in process Listener-1(7). > Type cmd-. to abort, cmd-\ for a list of available restarts. > Type :? for other options. --------------- Regards, Rangarajan
  20. Thanks SB. That was a very useful suggestion (to prefer OMN). I will try to spend more time to learn these. Regards, Rangarajan
  21. Thanks very much S.B! That seems neat, but tricky. I looked up the documentation of make-omn, but could not find any explanation of the :swallow option, but there was one example. Maybe for everyone's benefit, this could be elaborated in the documentation. By the way, isn't each nested list mapped to one bar? When generating through a function, it was easy (and natural) to do it this way. Looks like I have to do more serious study! Regards, Rangarajan
  22. Hi, I am encountering a funny problem with the following score. As shown in the comments, notes played in some bars are not as per the supplied pitches list. Strangely, the musicxml notation and what is played agree! Request your comment on what might be wrong. ;;; --------------- ;;; Notes played in the last 2 bars are not as per this list (setf m1 '((c4) (e4) (b4) (d5) (g4) (g4) (c5 d4 c5 c5 c5) (a4 d4 a4 e5 a4))) (setf rhy1 '((-w) (-w) (-w) (-w) (-w) (-w) (1/4 1/4 1/8 1/8 1/4) (1/4 1/4 1/8 1/8 1/4))) ;;; Notes played in the 6th and 8th bars are not as per this list (setf m2 '((c4 g4 c4 f4 f4) (e4 d4 c4 d4 f4) (b4 a4 a4 d5 a4) (d5 d5 g4 g4 g4) (g4 d4 d4 g4 c4) (g4 d4 f4 g4 e4) (c5 e5 a4 c5 d4) (a4 a4 e5 e5 a4))) (setf rhy2 '((1/4 1/4 1/8 1/8 1/4) (1/4 1/4 1/8 1/8 1/4) (1/4 1/8 -1/8 1/4 1/4) (1/4 1/4 1/8 1/8 1/4) (1/4 1/8 1/8 1/4 1/4) (1/4 1/8 -1/8 1/4 1/4) (1/4 1/4 1/4 1/8 1/8) (1/8 1/8 1/4 -1/8 3/8))) (def-score progression-example ( :key-signature 'chromatic :time-signature '(4 4) :tempo 120 ) (instr1 :pitch m1 :length rhy1 :velocity '(f) :channel 1 :sound 'gm :program 'Glockenspiel) (instr2 :pitch m2 :length rhy2 :velocity '(f) :channel 2 :sound 'gm :program 'Flute) ) ;;; ------------------ Regards, Rangarajan
  23. Hi, I am sharing my first (longest - 32 bars!) composition in AABA form! Thanks to Opusmodus for making this possible. Hope to become better in the near future! Rangarajan
×
×
  • Create New...

Important Information

Terms of Use Privacy Policy