Jump to content

saving the output (omn) in a seperat file


Recommended Posts

hi all

 

is there a possibility to SAVE my output - the OMN-lists - (rnd-generated structures) in a seperate file? that by EVALUATION the OMN-lists will be written in a sepeart/new-generated file? 

...so that i have not to re-import it via MIDI (makes a lot of strange rhythms)

 

thanks for help

andré

Link to post
Share on other sites

Randomly created data can be recreated if you fix a seed. It is very handy that Opusmodus supports setting a seed for all its randomised functions (in contrast to pretty much all other composition systems). You can initialise the seed with init-seed. See also 

 

 

This feature probably makes it unnecessary for you to save/read files. If you still want to write to and read from text files, the Common Lisp macro with-open-file is your friend.  

 

For more details see the following links

 

Textbook

http://www.gigamonkeys.com/book/files-and-file-io.html

 

Cookbook with examples 

http://cl-cookbook.sourceforge.net/files.html

 

Language reference

http://clhs.lisp.se/Body/m_w_open.htm

 

Best,

Torsten

 

Link to post
Share on other sites

You can find how to use the RND-SEED in the documentation. You need to explore bit more the system 🙂
Function example using RND-SEED function:

(defun rnd-number* (n low high &key seed)
  (do-verbose ("rnd-number*")
    (rnd-seed seed)
    (if (zerop n) nil
      (cons (round (+ low (rnd-round 0 (- high low) :seed (seed))))
            (rnd-number* (decf n) low high :seed (seed))))))

Each time we evaluate the expression we get a different result.
(rnd-number* 12 0 5)
=> (0 3 2 5 3 3 4 3 2 2 4 4)
 
Adding seed to the expression will produce always the same result.
(rnd-number* 12 0 5 :seed 45)
=> (2 2 5 4 5 0 5 3 5 3 1 1)

 

If you need more help please let me know.

Link to post
Share on other sites

yes, i know - i love to code a lot of things myself, and at the moment i'm not very virtuous in it. but I have found a solution - without rebuilding my big programs. with

(pprint-last-score)

i can read and save the OMN, after evaluating and exporting xml/midi. so you were right, janusz, the solution was in the SYSTEM FUNCTIONS 🙂

thanx for help - torsten, stéphane & janusz

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.

  • Similar Topics

    • By Dpcoffin
      Sometimes I find I cannot focus the saving process on the current workspace; it won't save on command-s, and on shift-command-s, what is offered for saving is the .opmo file, no matter what efforts I can think to make to focus elsewhere than the composer. Anyone else? Solutions?
    • By Jorvd
      Hi everyone,

      Today I've been learning about the Counterpoint function in v2, I decided to start simple:
      (setf p01 '((-e e4 stacc g4 stacc b4 stacc s e4 fs4 leg e g4 leg fs4 b3 leg))) (setf p02 '(((leg -e b5 b5 a5 a5 eb5 q eb5 leg)))) (setf voices (counterpoint (list p01 p02) '( ((1 -) :methods (- -) :polyphony (7 o)) ((2 1) :methods (t-12 -) :polyphony (7 o)) ((2 1) :methods (t-5 r) :polyphony (7 ?)) ))) (ps 'gm :fl (list (assemble-voices 1 voices)) :cl (list (assemble-voices 2 voices)) :tempo '(80) :time-signature '(4 4) :start 1) In this example I would really like to change the "as4" in bar 3 but I haven't been able to figure out how to do so.
      I know that with the Unfold function I can process specific events, like so:
      ;;Transpose second bar and 3th and 7th note in bar 4 (unfold 'om '( (t12 2 ) (t-7 4 (3 7)) ) mat) However, that doesn't seem to work within the :methods for the counterpoint function.
      This then brought my attention to the build-in polyphony function, but so far it's taking a lot of time to understand how to use this function.

      Thanks in advance for the help!
      - Jor
    • By AM
      dear all
       
      is there a quick way to import (or filter) only pitches and chords from a midi-file? if i only use these (nothing else from midi/xml)
       
      thanx for a hint
      andré
×
×
  • Create New...