Jump to content

erka

Members
  • Posts

    104
  • Joined

  • Last visited

Posts posted by erka

  1. Exactly.

    But , why not. There is no harm in comments. If it helps for any reason.

     

    The original problem seems to me, was:

    :omn '(line1)

    That does not work, because line1 is not evaluated, but given to :omn as a symbol.

    :omn line1  should work.

     

    If for any reason I can't see  there needs to be an extra () , (list line1) will do.

    I didn't look into counterpoint yet. Maybe things have to be done differently.

     

    Tom, could you try :omn line1 instead of :omn '(line1) and see if that solves the original posted problem?

    Try with #|1|# or without. There is no difference. 

    You probably know about comments:  ;   ignores everything to end of line.

                                                                     #|......|# ignores everything between #| and |#  . So you can comment several lines of code.

                                                                     #!......!# works in opusmodus. It is not mentioned in the Common-lisp-Hyperspec but handy on my German Apple keyboard.                                              

     

     

     

  2. Besides the option of compile-score you can save from the midi-player

     

    Tools-> last-score->midi player (or anything to  the midi player).

    Then in the menu (left upper-corner ) of the midi player -> save as -> give the file a name and destination. Import in DAW.

     

    Regarding ((0 . "Bus 1")) :

    In the score you write :port 0 when you want to send to your IAC-driver Bus 1.
      (inst1 
       :omn omn1
       :port 0
       :channel 1
       )

    In logic etc set the track midi-input to all or BUS 1.

    Make sure that in the MIDI-settings of the DAW the IAC-driver bus is active.

     

    In the Audio-midi-setup.app menu -> window (in German Fenster) -> MIDI-studio -> IAC-drivers you  see the names of the  IAC-driver and can create new ones. 

    (midi-destinations) is listing them counting the opusmodus port starting from 0. That is why ((0 . "Bus 1"))

  3. I think for this kind of tasks it could help to have functions like this:

     

    (send-midi-note :note 60 :velocity 20 :chan 0 :dest 0 :dur 'q)

    (send-controller :num 1 :val 60 :chan 0 :dest 0 :dur 'q :endval 10)

     

    Bypassing score, notation, midi-player, live-coding. 

    Just instant MIDI-output on cmd-e or inside of code.

    Then you could write functions ,loops or just for testing or setting up your devices. 

     

    What do you think?

     

    I assume live-coding-midi is not made to run inside of a functions.

     

     

     

  4. Wasn't the initial question why this throws an error:

     

    (setf chords '((h a2a3c4 c4a3a3) (h d4f3g2 f4g3d4) (h e4c4a3 c3a3e4) (h d3a3f4 w f4d4a3) (h e2e3g3 g3e4e4) (h a3f4e4 f2e3a3) (h e4g3b3 b3e3g2) (h a2d3fs2 w fs2a2e2) (h a2e3c4 c4a3e4) (h e4g3b3 b3e3g2) (h f2e3a3 a3f4e4) (h e4e4g3 w g3e3e2) (h d3a3f4 f4d4a3) (h e4c4a3 c3a3e4) (h b2a3d4 d4b3a3) (h a3a3c4 w c4a3a2)))

     

    (pitch-variation 0 1 7 chords    :type '? :seed 23)

     

    So why does it throw an error?

    When there are no duplicate notes in a chord there is no error.

    Are duplicate notes in a chord not allowed? They make no sense, but could have been randomly generated. 

     

  5. (setf chords '((h a2a3c4 c4a3a3)))

    (pitch-variation 0 1 7 chords
                     :type '? :seed 23)

     

    The first bar already returns an error.

    If you change the duplicate a3 in the second chord it will work. Why two a3 in a chord?

     

    On the other hand why not. Shouldn't  throw an error.

  6. I rewrote the function, so I can enter any length-symbol or ratio and don't have to make complicated calculations. Looks good to me and does what I wanted.

    I don't use length-modify anymore. But still wonder way 'all is not a feature.

    If you have any suggestions regarding style or other optimization please let me know.

    I had entered this forum in 2015 but was into other things until release of v3. In case you are wondering. Just starting again with lisp and opusmodus.

    I made a short score and my wife smiled while listening. 🙂 

     

    text2morse-length.opmo

  7. (encode-seq 't)  => t

    (encode-seq (list 't)) => (1/32)

     

    When the user inputs in my example :dit_length 't ,I would write 

    (car (encode-seq (list :dit_length))) => 1/32

    to get a value for calculation.

  8. Thank you o-e. That is much better. You didn't write this including doc this afternoon, did you?

    length-diminution and text-to-letters I didn't know.

    I  learned a lot by going the complicated way.

     

    Do you know how to convert an input of length-symbol to ratio? 

    In your function I think length-diminution is handling this. You can set :pulse 's .

     

  9. another question for this function:

    How could I convert a symbol input ('e) to  :dit_length input into a ratio for later calculation?

    A conversion from length symbol to ratio.

  10. The function takes a string as input and returns the omn . Auditioning it will sound like a morse message. Setting :morse_output to t will output the real morse-message (for testing ..).

    You can input any :pitch and  the morsecode loops over the :pitch or just change the pitch of the output

    What I was looking for is way to change the basic unit. This is set in the map to s (1/16).

    It is Between ;; make changes for non-default units and ;; prepare for morse output.

     

    (defun text-to-morse-omn (text  &key ( pitch 'c4 ) ( dit_length 1/16 ) (morse_output nil)) 
        "converting text -> morse -> omn-length 
        reference: wikipedia
        default time unit is 1/16.
        International Morse code is composed of five elements:
        short mark, dot or dit (  ▄   is one time unit long
        long mark, dash or dah (  ▄▄▄  three time units long
        inter-element gap between the dits and dahs within a character: 
        one dot duration or one unit long
        short gap (between letters): three time units long
        medium gap (between words): seven time units long "

     

            (if (or (stringp text) (stringp (car text))) () 
              (return-from text-to-morse-omn  "text must be string or string in list"))


        (let* 
                (
            ( char_lengths_map
            ;; includes the dit between the dits and dahs 
            ;;  and the 3 dits for end of letter
            '(
                    ( a ((s -s s== -s==)) ) 
            ( b ((s== -s s -s s -s s -s==))  )
            ( c ((s== -s s -s s== -s s -s==))  )
            ( d ((s== -s s -s s -s==))  )
            ( e ((s -s==))  )
            ( f ((s -s s -s s== -s s -s==))  )
            ( g ((s== -s s== -s s -s==))  )
            ( h ((s -s s -s s -s s -s==))  )
            ( i ((s -s s -s==))  )
            ( j ((s -s s== -s s== -s s== -s==)) )
            ( k ((s== -s s -s s== -s==)) )
            ( l ((s -s s== -s s -s s -s==))  )
            ( m ((s== -s s== -s==)) )
            ( n ((s== -s s -s==))  )
            ( o ((s== -s s== -s s== -s==)) )
            ( p ((s -s s= -s= s== -s s -s==))  )
            ( q ((s== -s s== -s s -s s== -s==)) )
            ( r ((s -s s== -s s -s==))  )
            ( s ((s -s s -s s -s==))  )
            ( t ((s== -s==)) )
            ( u ((s -s s -s s== -s==)) )
            ( v ((s -s s -s s -s s== -s==)) )
            ( w ((s -s s== -s s== -s==)) )
            ( x ((s== -s s -s s -s s== -s==)) )
            ( y ((s== -s s -s s== -s s== -s==)) )
            ( z ((s== -s s== -s s -s s -s==))  )
            ( 1 ((s -s s== -s s== -s s== -s s== -s==)) )
            ( 2 ((s -s s -s s== -s s== -s s== -s==)) )
            ( 3 ((s -s s -s s -s s= -s= s== -s==)) )
            ( 4 ((s -s s -s s -s s -s s== -s==)) )
            ( 5 ((s -s s -s s -s s -s s -s==))  )
            ( 6 ((s== -s s -s s -s s -s s -s==))  )
            ( 7 ((s== -s s== -s s -s s -s s -s==))  )
            ( 8 ((s== -s s== -s s== -s s -s s -s==))  )
            ( 9 ((s== -s s== -s s== -s s== -s s -s==))  )
            ( 0 ((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 -s s -s s -s s -s s -s==)))
    ; french letters can be easier added with a french keyboard 
            ; punctuation is ignored by text-map and this function

            )) 
            ( mapstr (text-map char_lengths_map text))
            
            ;; remove last rest from letter
            ;; to add 7 dits later
            ( removelastrests (if (not (listp  (car mapstr)) ) ; if only one word
                     (list ( butlast mapstr 1))
                     (loop for i in mapstr collect  (butlast i 1)))) 
                
            ;; add 7 dits for end of word. Needed for decoding into real morse maybe later
            ( add7  (loop for x in removelastrests
                 collect (append x '(-s======))))

            ;; make omnstr
            ( default_omnstr (make-omn :length add7  :pitch (list pitch) :span :length))

     

                    ;; make changes for non-default units
                    ( s_unit 1/16) ; default for 's
                    ( u_unit dit_length) ;user set unit
                    ( oper (if (>=  s_unit u_unit)  'times 'divide))
                    ( mult (if (equalp oper 'divide) (/ s_unit u_unit) (/ u_unit s_unit)))
                    ( mod_notes (length-modify mult default_omnstr :type 'n :operator oper :count 'all)).      ;first run of length-modify for notes
                    ( dit_modified_omn (length-modify mult mod_notes :type 'r :operator oper :count 'all))   ; another run for rests

     

                    ;; prepare for morse output
            ( omn_morse_map
            '(( s "." )
              ( s== "-" )
              ( -s== " " )
              ( -s====== " / ")))
            ( mapstr (text-map omn_morse_map default_omnstr))
            ( morsestr (loop for i in mapstr 
                  collect (eval (cons 'concatenate (cons ''string i)))))

                ) ; end of variablelist

                ;; decide output due to :morse_output t or nil
                (if  morse_output (format T "~a" morsestr)  dit_modified_omn) 
        ) ; end let*


    (setf ttmo_ret (text-to-morse-omn "bla" :pitch 'c3 :morse_output nil) )

    => ((e. c3 -s c3 - c3 - c3 -e. s c3 - e. c3 -s c3 - c3 -e. s c3 - e. c3 -q..))

     

    --------------
    My first function I am writing in opusmodus and lisp. I learned a lot doing it. That was the main purpose. And maybe make strange music with it.

    Maybe some morse-trained person will get the message. 🙂 

    I had something similar written for max-for-live mainly in javascript to learn all the functions needed to put notes into a clip.

    And had some musical fun with it.

     

     

  11.  

    With length-modify it seems that I can either modify notes or rests or random.

    length-modify.pdf: 
    type 'r (rest) or 'n (note) or '? (at random), if not specified random type is used.

     

    Wouldn't :type 'all also be useful? 

    I could use it for what I am doing now.

    Now I realized it by calling :type 'n and :type 'r one after the other.

     

    Is there another function that would modify all (rest and notes)?

     

  12. 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.

     

  13. 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))

  14. 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?

     

  15. Hi,

    it says in "Introduction to Opusmodus" :

    Then there is Stages: a 30-part collection of score-scripts and text commentaries designed to be opened simultaneously. Both these are available as a download: a PDF file formatted as a printable A4 book.

     

    I see the 30 Stages but where can I find the pdf to download?

     

    Rolf

  16. I got it:

    '(10 a2c4g4d5)

    easy.

     

    Is it in the language description somewhere and I didn't find it? 

    I found this:  To assist with multiple rests  (-12) will produce 12 bars of whole-note rests.  So I tried without minus. 

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy