Jump to content

play polytempo -> code/examples


Recommended Posts

dear all

here is a setup for playing midi-files/scores in polytempi / follow the instructions and have fun!

just ask if you have some questions...

 

greetings

andré

 

- personally i will use it for exact sample/e-player perfomance with my pieces which are working with "Technology-Assisted Conducting"

http://polytempo.zhdk.ch ... in future i will do it all directly from OPMO or lisp - "live score generating" + polytempo-conducting + e-player)

- i have already done this with my piece MODULAR FORM  but not all controlled by LISP/OPMO, so next step is doing it all in OPMO/LISP

 

...some explanations about the piece....

 

 

 

greetings

andré

 

EN.WIKIPEDIA.ORG

 

;;; POLYTEMPO-PLAY
;;; with a MAX-patch (from my friend thomas peter) and some OSC-send i can play the same/different midis (up to 30) 
;;; in different tempos in parallel - any combination, with precise coordination
;;; also possible: change global velocity (means: change velocity inside midi)
;;;                time-delay (start) in ms

;;; 1) OSC-send functions:

(defparameter *out-socket* (make-socket :type :datagram))
(defparameter *remote-host* "127.0.0.1")
(defparameter *remote-port* 7500)

(defun udpsend (&rest args)
  (let ((message (apply' osc::encode-message args)))
    (send-to *out-socket* message (length message)
             :remote-host *remote-host*
             :remote-port *remote-port*)))


;;; 2) a) put the MAX-player-folder on desktop
;;;    b) start midiplayer.maxpat
;;;    c) midiplayer: define your output source in [midiout@name "from MAX 1"]
;;;    d) the MIDIS must be placed in the midi-folder (inside MAX-player-folder)



;;; 3) generate SCORE (here a nonsense example)
(setf omn (make-omn :pitch (setf pitches 
                                 (filter-repeat 1 
                                                (flatten (gen-sort 
                                                          (rnd-air :type :pitch :seed 45) 
                                                          :step 5 :sort '> :seed 123))))
                    :length (gen-length '(1) 1/32)
                    :velocity (pitch-to-velocity 'p 'mf pitches :type :float)
                    :span :pitch))


(def-score sorted-whitenoise
           (:title "sorted-whitenoise"
                   :key-signature 'atonal   
                   :time-signature '(4 4) 
                   :tempo 60
                   :layout (grand-layout 'inst))
  (inst
   :omn omn
   :port 0
   :channel 1
   :sound 'gm
   :program 'acoustic-grand-piano))


;;; 4) COMPILE that score into your Max-Player/midi-folder => PATH+NAME!!!

(compile-score
 'sorted-whitenoise
 :file "your-path/sorted-whitenoise")




;;; 5) play it by evaluate UPSEND -> some examples
;;; /eplayer / midi-name / tempo-factor / velocity factor / time-delay in ms


(udpsend "/eplayer" "sorted-whitenoise" 1.0   0.5 0) ;; originaltempo, velocity 0.5
(udpsend "/eplayer" "sorted-whitenoise" 2.3   1.0 0) ;; (* tempo 2.3) etc...
(udpsend "/eplayer" "sorted-whitenoise" 0.375 1.0 2000) ;; (* tempo 0.375 with startdelay 2000ms)

(udpsend "/eplayer" "stop") ; you can stop with that


;;; a tempo-relations => 23:17:13:9:3:2 -> a complex example with time-delays
;;; also possible with every and different midis you like

(progn
  (udpsend "/eplayer" "sorted-whitenoise" 2.3 1.0 0)
  (udpsend "/eplayer" "sorted-whitenoise" 0.3 0.8 0)
  (udpsend "/eplayer" "sorted-whitenoise" 0.2 0.4 0)
  (udpsend "/eplayer" "sorted-whitenoise" 1.3 1.0 10000)
  (udpsend "/eplayer" "sorted-whitenoise" 1.7 0.9 16000)
  (udpsend "/eplayer" "sorted-whitenoise" 0.9 0.7 20000))
  


(udpsend "/eplayer" "stop") ; you can stop with that

 

 

Max_Player_19-08-23.zip example.aiff

goldberg_13_11.aiff example_11_7_5_3_2.aiff

Link to comment
Share on other sites

for me usage it has to be "by OSC".  i have to be able to control two programs (conducting/display + e-player/samples) simultaneously and in a coordinated way. so i can send DATA for both software-applications well coordinated...

Link to comment
Share on other sites

  • 4 weeks later...

polytemporal fall - algorithmic study

[with tempo relations 3:5:7:11:17:23:29]

 

https://soundcloud.com/andr-meier-1/algorithmic-study-polytemporal-fall

 

this is a small example: i coordinate and play MIDIs (in this case this are simple scales) in OPMO via OSC -> maxmsp_player. you can here how precise you can coordinate simple [but polytemporal] scales => all the MIDIs coincide (?) - 30000ms after the evaluation of the code - in an unsiono pitch!!! 

 

in that way you can coordinate different scores/midi's (which have individual tempos (!)) very precise. with OSC/maxmsp_player you can change/manipulate the tempi of the midi's (directly from OPMO) so you can be variable with pre-produced midis (perhaps produced in OPMO)...

 

greetings

a.

 

 

 

 

 

Link to comment
Share on other sites

Quote

No '13' or '19'? 

 

because in such a fast "basic tempo" they were too close to "17" and "23"  😉

i think in slower tempo it makes sense to work with numbers they are close/closer to each other. then the perception compares the tempi, when the GAPS are to large it's only "SLOW/FAST".... depends on your ideas...

 

THANKS FOR THE HINT, i will look at it!!

 

andré

 

 

Link to comment
Share on other sites

  • 2 years later...

POLYTEMPO:

 

here is an easy solution to play POLYTEMPO-textures in OPMO

 

in every "play-tempo-stream" you can write for 4 instruments... then put it in (progn...  // then choose different tempos and PLAY it 😉

greetings

andré

 

p.s. if you want to do it like CONLON then write a list with tempos/beats in :tempo-curve

... example: "tempoverlauf per BEAT"

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; damit kannst du einfach dann OMN's eingeben, pro tempo-stream 4 instrumente und dann abspielen,
;; streams überlagernd abspielen

(defun play-tempo-stream (&key (inst1 nil) 
                               (inst2 nil)  
                               (inst3 nil) 
                               (inst4 nil)
                               (port 0)
                               (tempo-curve 60))

  (def-score stream
             (:key-signature 'chromatic
                             :time-signature (get-time-signature (omn-to-time-signature inst1 '(1 4)))
                             :tempo tempo-curve
                             :layout (list
                                      (bracket-group
                                       (treble-layout 'inst1)
                                       (treble-layout 'inst2)
                                       (treble-layout 'inst3)
                                       (treble-layout 'inst4))))
    
    (inst1 :omn inst1 
           :port port
           :channel 1 
           :pan 20)
    
    (inst2 :omn inst2 
           :port port
           :channel 2 
           :pan 20)
    
    (inst3 :omn inst3 
           :port port
           :channel 3 
           :pan 20)
    
    (inst4 :omn inst4 
           :port port
           :channel 4 
           :pan 20))

  (score-player 'stream))



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; some "random omn" to play

(setf p1 '(q d4 pp s eb4 < leg g4 < leg bb4 < leg a4 q. cs5 mf -e
             3q gs5 > leg fs5 > leg c5 > b4 > leg f4 leg e4))
  
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;; 3 streams mit je 3 instrumenten
;; konstantes tempo

(progn 
  (play-tempo-stream :inst1 p1
                     :inst2 p1
                     :inst3 (gen-retrograde p1)
                     :tempo-curve 30
                     :port 0)

  (play-tempo-stream :inst1 (pitch-transpose 11 p1)
                     :inst2 (pitch-transpose 12 p1)
                     :inst3 (pitch-transpose 13 (gen-retrograde p1))
                     :tempo-curve 50
                     :port 0)

  (play-tempo-stream :inst1 (pitch-transpose -11 p1)
                     :inst2 (pitch-transpose -12 p1)
                     :inst3 (pitch-transpose -13 (gen-retrograde p1))
                     :tempo-curve 70
                     :port 0))

;;; tempoverlauf per BEAT

(progn 
  (play-tempo-stream :inst1 p1
                     :inst2 p1
                     :inst3 (gen-retrograde p1)
                     :tempo-curve '((100 1) (160 1) (172 1)) ;; tempo per beat
                     :port 0)

  (play-tempo-stream :inst1 (pitch-transpose 11 p1)
                     :inst2 (pitch-transpose 12 p1)
                     :inst3 (pitch-transpose 13 (gen-retrograde p1))
                     :tempo-curve '((122 1) (177 1) (201 1)) ;; tempo per beat
                     :port 0)

  (play-tempo-stream :inst1 (pitch-transpose -11 p1)
                     :inst2 (pitch-transpose -12 p1)
                     :inst3 (pitch-transpose -13 (gen-retrograde p1))
                     :tempo-curve '((63 1) (62 1) (67 1))  ;; tempo per beat
                     :port 0))



 

 

Link to comment
Share on other sites

Hi,

I was fiddeling around with your code below, but I don't get it, can you please explain a little more how it works, when I test it the tempo of instrument1 to 4 are still in the same tempo (inside one play-tempo-stream (), when I try the play-tempo-streams at the same time, it throws me an error. Can you please provide a simple Conlon-Nancarro-ish 2 voice example or something to work along?

Thanks in advance!

best ole

 

Edit: I get it to work with a fresh morning head, thanks for sharing the code!

 

15 hours ago, AM said:

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; damit kannst du einfach dann OMN's eingeben, pro tempo-stream 4 instrumente und dann abspielen,
;; streams überlagernd abspielen

(defun play-tempo-stream (&key (inst1 nil) 
                               (inst2 nil)  
                               (inst3 nil) 
                               (inst4 nil)
                               (port 0)
                               (tempo-curve 60))

  (def-score stream
             (:key-signature 'chromatic
                             :time-signature (get-time-signature (omn-to-time-signature inst1 '(1 4)))
                             :tempo tempo-curve
                             :layout (list
                                      (bracket-group
                                       (treble-layout 'inst1)
                                       (treble-layout 'inst2)
                                       (treble-layout 'inst3)
                                       (treble-layout 'inst4))))
    
    (inst1 :omn inst1 
           :port port
           :channel 1 
           :pan 20)
    
    (inst2 :omn inst2 
           :port port
           :channel 2 
           :pan 20)
    
    (inst3 :omn inst3 
           :port port
           :channel 3 
           :pan 20)
    
    (inst4 :omn inst4 
           :port port
           :channel 4 
           :pan 20))

  (score-player 'stream))



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; some "random omn" to play

(setf p1 '(q d4 pp s eb4 < leg g4 < leg bb4 < leg a4 q. cs5 mf -e
             3q gs5 > leg fs5 > leg c5 > b4 > leg f4 leg e4))
  
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;; 3 streams mit je 3 instrumenten
;; konstantes tempo

(progn 
  (play-tempo-stream :inst1 p1
                     :inst2 p1
                     :inst3 (gen-retrograde p1)
                     :tempo-curve 30
                     :port 0)

  (play-tempo-stream :inst1 (pitch-transpose 11 p1)
                     :inst2 (pitch-transpose 12 p1)
                     :inst3 (pitch-transpose 13 (gen-retrograde p1))
                     :tempo-curve 50
                     :port 0)

  (play-tempo-stream :inst1 (pitch-transpose -11 p1)
                     :inst2 (pitch-transpose -12 p1)
                     :inst3 (pitch-transpose -13 (gen-retrograde p1))
                     :tempo-curve 70
                     :port 0))

;;; tempoverlauf per BEAT

(progn 
  (play-tempo-stream :inst1 p1
                     :inst2 p1
                     :inst3 (gen-retrograde p1)
                     :tempo-curve '((100 1) (160 1) (172 1)) ;; tempo per beat
                     :port 0)

  (play-tempo-stream :inst1 (pitch-transpose 11 p1)
                     :inst2 (pitch-transpose 12 p1)
                     :inst3 (pitch-transpose 13 (gen-retrograde p1))
                     :tempo-curve '((122 1) (177 1) (201 1)) ;; tempo per beat
                     :port 0)

  (play-tempo-stream :inst1 (pitch-transpose -11 p1)
                     :inst2 (pitch-transpose -12 p1)
                     :inst3 (pitch-transpose -13 (gen-retrograde p1))
                     :tempo-curve '((63 1) (62 1) (67 1))  ;; tempo per beat
                     :port 0))



 

 

 

Link to comment
Share on other sites

I made a simple example to show how it works.

You have to set the port and the midi channels to your needs.

What I don't get is why the two voices of different length, any explanation is welcome..

The OM MIDI-Export function does not work here, so you have to record the MIDI-Stream in your DAW.

Enjoy!

 


(setf pattern (gen-repeat 50 '(s e4 fs4 b4 cs5 d5 fs4 e4 cs5 b4 fs4 d5 cs5)))


(defun play-tempo-stream (&key (inst1 nil) 
                               (inst2 nil)  
                               (port "OM-VE1")
                               (tempo-curve 60))

  (def-score stream
             (:key-signature 'chromatic
                             :time-signature  '(3 4)                             
                             :tempo tempo-curve
                             :layout (list
                                      (bracket-group
                                       (treble-layout 'inst1)
                                       (treble-layout 'inst2))))
    
    (inst1 :omn inst1 
           :port port
           :channel 1 
           :pan 20)
    
    (inst2 :omn inst2 
           :port port
           :channel 7 
           :pan 20))
    
    
  (score-player 'stream))



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(progn 
  (play-tempo-stream :inst1 pattern
                     :tempo-curve (mapcar 'list (gen-integer 110 60)(gen-repeat 50 '1))
                     :port 0)

  (play-tempo-stream :inst2 pattern
                     :tempo-curve (mapcar 'list (gen-integer 61 111)(gen-repeat 50 '1))                             
                     :port 0))

 

flextempo.mid

Link to comment
Share on other sites

you will have the same DURATION when the pitch-loop and tempo-loop (tempo-progression = TIME) have the same length. so you have to stop the pitch-seq at the end of your BAR/tempo-seq!!!

 

process should equal !?

(gen-integer 110 60) 
(gen-integer 61 111)
Link to comment
Share on other sites

Example with def-score and score-player only:

(setf pattern (gen-repeat 50 (list '(s e4 fs4 b4 cs5 d5 fs4 e4 cs5 b4 fs4 d5 cs5))))
(setf tempo (mclist (gen-integer 110 60) (gen-repeat 50 1)))

(def-score score1
           (
            :key-signature 'chromatic
            :time-signature '(3 4)                             
            :tempo tempo
            )
  
  (inst1 :omn pattern
         :sound 'gm
         :channel 1
         :program 0
         :pan 27))

(def-score score2
           (
            :key-signature 'chromatic
            :time-signature '(3 4)                             
            :tempo (reverse tempo)
            )
  
  (inst1 :omn pattern
         :sound 'gm
         :channel 2
         :program 0
         :pan 100))

(progn
  (score-player 'score1)
  (score-player 'score2)
  )

 

The score-player plays midi-files and scores.

(score-player "~/Opusmodus/Media/MIDI/Bach/Chorals/036500b_.mid")

 

Link to comment
Share on other sites

Thank you!

As the time-signature is 1/4 now, there is a change in the tempo definition necessary:

(setf tempo (mclist (gen-integer 160 10) (gen-repeat 150 1)))

then the two instrument's start and end together as it should be..

Can't wait for the score-player doc, any chance the midi export function can work correctly? It is cumbersome to record the midi-stream..

Anyway thanks a lot for this!!

 

best

 

ole

 

PS I do not understand why this:

(mapcar 'list (gen-integer 110 60)(gen-repeat 50 '1))
==>((110 1) (109 1) (108 1) (107 1) (106 1) (105 1) (104 1) (103 1) (102 1) (101 1) (100 1) (99 1) (98 1) (97 1) (96 1) (95 1) (94 1) (93 1) (92 1) (91 1) (90 1) (89 1) (88 1) (87 1) (86 1) (85 1) (84 1) (83 1) (82 1) (81 1) (80 1) (79 1) (78 1) (77 1) (76 1) (75 1) (74 1) (73 1) (72 1) (71 1) (70 1) (69 1) (68 1) (67 1) (66 1) (65 1) (64 1) (63 1) (62 1) (61 1))

(mapcar 'list (gen-integer 60 110)(gen-repeat 50 '1)) 
==>((60 1) (61 1) (62 1) (63 1) (64 1) (65 1) (66 1) (67 1) (68 1) (69 1) (70 1) (71 1) (72 1) (73 1) (74 1) (75 1) (76 1) (77 1) (78 1) (79 1) (80 1) (81 1) (82 1) (83 1) (84 1) (85 1) (86 1) (87 1) (88 1) (89 1) (90 1) (91 1) (92 1) (93 1) (94 1) (95 1) (96 1) (97 1) (98 1) (99 1) (100 1) (101 1) (102 1) (103 1) (104 1) (105 1) (106 1) (107 1) (108 1) (109 1))

gives a different result than this:

(gen-integer 110 60)
==>(110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60)

(gen-integer 60 110)
==>(60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110)

 

Link to comment
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.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy