Posts posted by AM
-
-
i know, of course, that LISP is not an environment for REALTIME actions (pure data / max would be much more suitable) - so I had to outsmart the system a little to import data (from a modularsynth and other applications) almost "on the fly" to generate a LIVE-SCORE (with the influence of this datas) at the concert/on the stage....
maybe i should learn MAX... for more smart-coded REALTIME things 😄
-
MIDI KEYBOARD
to
OSCulator (translates MIDI to OSC)
to
OPMO (reading pitch (midi number) and set to variable X)
1) evaluate (setq *osc-receive*.......)
2) start/evaluate LOOP-section
3) start LIVE-CODE
4) play your midi-keyboard
=> in every cycle of LIVE-CODING the "keyboard-pitch" will be read --- to variable X -> tempo and pitch are changing (by new cycle start)
5) stop all, incl. evaluate (process-kill *osc-receive*)
-
here is a short sketch of how you can integrate a midi keyboard into live coding. evaluate the BASIC SETUP as before but in a LOOP (here 10 times) the LIVE-CODING setup, so a new value X (the PITCH (midi number) from the external keyboard) is always read in (which comes from the keyboard)...
these values can now be used on various parameters. for this sketch only pitch + tempo (see: tempo (list (* x 3))
VIDEO: at the beginnig you see data coming in from midi keyboard
some code/sketch
(defparameter *remote-host* "127.0.0.1") (defparameter *in-port* 1234) (defparameter *in-socket* (make-socket :type :datagram :local-port *in-port* :format :binary)) (setq *osc-receive* (process-run-function "osc-receive-process" #'(lambda () (loop do (print (setf x (second (osc::decode-message (receive-from *in-socket* 2048)))) #.*terminal-io*))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (loop repeat 10 do (progn (def-score test1 (:key-signature '(c maj) :time-signature '(4 4) :tempo (list (* x 3)) :start 1 :end 4) (part1 :omn (make-omn :pitch (list (midi-to-pitch x)) :length (gen-length-cartesian 1 1 'n 'n 'q '(2 3) '(13 4) '(1 2 3 4 5 6)) :span :length) :port 4 :channel 1 :sound 'gm :program 0 :volume 127)) (live-coding-midi (compile-score 'test1))) do (print x) do (sleep 3)) (process-kill *osc-receive*) ;; Prozess wieder anhalten
-
I have now found a SOLUTION that might be also interesting for LIVE CODING:
With the APP OSCulator you can convert midi-input (by an external keyboard) into OSC and then read it in real time (via osc-library + code) in OPMO (see video).
Of course, it could also be done directly from OSC (then via an APP such as TouchOSC from the mobile or tablet). you just have to reread the values (by a loop-function) as you can see in the video; in this way, certain parameters of the LIVE-CODING could be controlled / influenced from the outside.
LINKS:
OSC to LISP:
GitHub - zzkt/osc: a common lisp implementation of the Open Sound Control protocol aka OSC
GITHUB.COMa common lisp implementation of the Open Sound Control protocol aka OSC - GitHub - zzkt/osc: a common lisp implementation of the Open Sound Control protocol aka OSCOSCulator:
Home | OSCulator
OSCULATOR.NETLinks your controllers to your favorite music and video software. Works with Nintendo Wiimote, iPhone and more.TouchOSC:
TouchOSC | hexler.net
HEXLER.NETVIDEO:
left- PROTOKOL to see what's MIDI-in
right - midi to osc (OSCulator)
bottom - OPMO with midi-data PRINT in the listener
BASIC CODE:
(defparameter *remote-host* "127.0.0.1") (defparameter *in-port* 1234) (defparameter *in-socket* (make-socket :type :datagram :local-port *in-port* :format :binary)) (setq *osc-receive* (process-run-function "osc-receive-process" #'(lambda () (loop do (print (osc::decode-message (receive-from *in-socket* 2048)) #.*terminal-io*))))) ;; instead of PRINT you could use SETF (process-kill *osc-receive*) ;; STOP "listening process" ;;; CODE by philippe kocher
-
with OSC - (with the external osc-library i've sended you) - it should work similiar?
loop-function which PRINT the revcevied osc-values over and over (it works). i would like to do that with MIDI
but i'm not a lisp pro....
(code not by me)
(defparameter *in-port* 9999) (defparameter *in-socket* (make-socket :type :datagram :local-port *in-port* :format :binary)) (setq *osc-receive* (process-run-function "osc-receive-process" #'(lambda () (loop do (print (osc::decode-message (receive-from *in-socket* 2048)) #.*terminal-io*))))) (process-kill *osc-receive*) ;; Prozess wieder anhalten
-
-
dear all
as so often i try out strange things 🙂 i switch on midi-entry, read the pitches which i enter from a keyboard. everything clear so far. I am now trying to do this in a 2-second-loop (with sleep-function), so that variable X would always be assigned new values. at the end of the loop sequence, however, X is NIL. only when I evaluate X again are the values assigned. (see video)
(the idea is... to IMPORT live-midi into a "realtime-process")
some ideas?
thanx
andré -
-
-
the LOOP-cycles produces data-sequences with lengths about 5 to 20 sec
for this... stop and wait via SLEEP is oaky....
inside the loop: i send the datas (the sequences) to screens (generative score + conducting for the musicians / polytempo) and MAXMSP (sound/modsynth) ... this is via OSC for accuracy/coordination
so it works fine like that... but: LISP is not exactly suitable for REALTIME processing 😄
-
-
is there a possibilty to ONLY show INSIDE the LISTENER what i like to: some (print ....)-stuff
...and not all the "function-calls" like
.....
ratio-to-msec
rnd-pick :seed 990096
rnd1 :seed 858709
compress
rnd1 :seed 223329
compress
list-to-string
ratio-to-msec
ratio-to-msec
ratio-to-msec
prob :seed 115209
prob :seed 40751
stop-score-player
score-player
....thanx for a hint
andré
-
-
-
(defun interval-distance (alist n) (let ((alist (if (pitchp (car alist)) (pitch-to-midi alist) alist)) (n (if (pitchp n) (pitch-to-midi n) n))) (loop for i in alist collect (- i n)))) (interval-distance '(c4 d4 b2 e7) 'c4) => (0 2 -13 40) (interval-distance '(c4 d4) 'c4) => (0 2) (interval-distance '(43 44) '41) => (2 3) (interval-distance '(56 48 11) 'c4) => (-4 -12 -49)
-
-
is this a solution? ...or some ideas to it...
greetings
andré
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun gen-resultant (r1 r2 &key (rhy 1/4)) (gen-length (difference (remove-duplicates (sort-asc (flatten (append (cons 0 (gen-accumulate r1)) (cons 0 (gen-accumulate r2))))))) rhy)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; example.... correct? (gen-resultant (primes-to 7) (reverse (primes-to 7))) ;;; another example (gen-resultant '(9) '(3 1 4)) (gen-resultant '(9) '(3 1 4) :rhy 1/16) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
n-version...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; for several layers (defun gen-resultant* (r &key (rhy 1/4)) (gen-length (difference (remove-duplicates (sort-asc (flatten (loop for i in r append (cons 0 (gen-accumulate i))))))) rhy)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; correct? (gen-resultant* '((16) (9) (3 1 4) (7))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a version with length-input - but test it, correct...?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; for several layers / with direct rhythm-input (defun gen-resultant** (r) (difference (remove-duplicates (sort-asc (flatten (loop for i in r append (cons 0 (gen-accumulate i)))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; correct? (gen-resultant** '((2/4 1/4 3/4) (1/16 3/16 2/12 1/12) (3/4 3/20 2/20))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
listen to the processes...
(make-omn :pitch (integer-to-pitch (pascal-triangle 50 :johnson-modulo (1+ (random 23)))) :length '(t) :span :pitch)
an example with parallel processes (chordized)..
(setf chordlist (loop for i in (flatten (integer-to-pitch (pascal-triangle 20 :johnson-modulo (1+ (random 23))))) for j in (flatten (integer-to-pitch (pascal-triangle 20 :johnson-modulo (1+ (random 23))))) for k in (flatten (integer-to-pitch (pascal-triangle 20 :johnson-modulo (1+ (random 23))))) append (chordize (list i j k)))) (make-omn :pitch chordlist :length '(t) :span :pitch)
-
here is a short program (based on JOHNSON's writing... pascal-code found in www and modified) to generate TOM JOHNSON's series of numbers for "pascal's triangle ...".
maybe interesting to play with the MODULO like JOHNSON did (mod 7)... try it!
greetings
andré
;;; SUB (defun pascal-next-row (a &key (johnson-modulo nil)) (loop :for q :in a :and p = 0 :then q :as s = (if (null johnson-modulo) (list (+ p q)) (list (mod (+ p q) johnson-modulo))) :nconc s :into a :finally (rplacd s (list 1)) (return a))) ;;; MAIN (defun pascal-triangle (n &key (johnson-modulo nil)) (loop :for a = (list 1) :then (pascal-next-row a :johnson-modulo johnson-modulo) :repeat n :collect a)) ;;; => pascal-triangle (pascal-triangle 7) => ((1) (1 1) (1 2 1) (1 3 3 1) (1 4 6 4 1) (1 5 10 10 5 1) (1 6 15 20 15 6 1)) ;;; => pascal-triangle with MODULO like tom johnson in PASCAL'S TRIANGLE MODULO SEVEN (pascal-triangle 21 :johnson-modulo 7) => ((1) (1 1) (1 2 1) (1 3 3 1) (1 4 6 4 1) (1 5 3 3 5 1) (1 6 1 6 1 6 1) (1 0 0 0 0 0 0 1) (1 1 0 0 0 0 0 1 1) (1 2 1 0 0 0 0 1 2 1) (1 3 3 1 0 0 0 1 3 3 1) (1 4 6 4 1 0 0 1 4 6 4 1) (1 5 3 3 5 1 0 1 5 3 3 5 1) (1 6 1 6 1 6 1 1 6 1 6 1 6 1) (1 0 0 0 0 0 0 2 0 0 0 0 0 0 1) (1 1 0 0 0 0 0 2 2 0 0 0 0 0 1 1) (1 2 1 0 0 0 0 2 4 2 0 0 0 0 1 2 1) (1 3 3 1 0 0 0 2 6 6 2 0 0 0 1 3 3 1) (1 4 6 4 1 0 0 2 1 5 1 2 0 0 1 4 6 4 1) (1 5 3 3 5 1 0 2 3 6 6 3 2 0 1 5 3 3 5 1) (1 6 1 6 1 6 1 2 5 2 5 2 5 2 1 6 1 6 1 6 1)) ;;; look!! (list-plot (flatten (pascal-triangle 50 :johnson-modulo 7)) :point-radius 0 :style :fill) (list-plot (flatten (pascal-triangle 50 :johnson-modulo 11)) :point-radius 0 :style :fill) (list-plot (flatten (pascal-triangle 80 :johnson-modulo 17)) :point-radius 0 :style :fill) (list-plot (flatten (pascal-triangle 50 :johnson-modulo 3)) :point-radius 0 :style :fill) ;;; rnd-testing (list-plot (flatten (pascal-triangle 80 :johnson-modulo (1+ (random 23)))) :point-radius 0 :style :fill)
-
-
yes, but i do not compose with OPMO - it's too strange with rhythm/instrumentation/notation. most of the time i'm sketching with OPMO and compose "by hand".
guitar-scordatura: i thought i'd rather "pull the pitches out of MIDI/XML" and then convert them.. i will see... but, THANX!
greetings
andré
could look like that (excerpt of a piece for solo trp - also with some SORT-ALGORITHMS inside (sketched/calculated with OPMO) 🙂
works fine with SIBELIUS for layouting etc...
-
-
i am currently working on a piece for piano, guitar and drums. the guitar will have a "scordatura" so that i can do different harmonics and resonances than with the usual tunings. so that I can now make a more readable score, I would like to write the guitar part on two systems: one system as it sounds and one readable for the guitarist (because of the scordatura/fingerings)...
it would be nice if we could do a FUNCTION which transforms the "sounding pitch part" (readable in score) into the "guitar-specific-part" (how to play for guitarist)...
-
midi-entry / data saving
in Support & Troubleshooting
thanks, julio!!