Jump to content
Sign in to follow this  
AM

pattern-match with overwrite -> question

Recommended Posts

hi all

 

i'm trying to code a PM-function with an OVERWRITE, so that the global-lengths stays correct... i'm working this evening with some ideas for that and this is only a first sketch of a basic idea, don't know if it will work later...

 

i have one little ordinary problem: to find/insert/overwrite i have to split the original sequence into small parts... that's the RESOLUTION, so i have a list with OMN-events in the span of the resolution. and a lot of TIEs -> at the end i would like to remove the tied-lengths by ordinary lengths? how? filter-tie works not with all insert-examples.... what can i do...?

 

thanx

andré

 

;;; --------------------------------------------------------------------------------------------
;;; OVERWRITE -> überschreibt eine sequenz bei PM -> resolution einstellbar
;;; --------------------------------------------------------------------------------------------

;;; ausgangs-sequenz
(setf seq '(q c4 d4 e. e4 s f4 h g4))

;;; inserts => test different INSERTS
(setf insert '(t gs5 g5 fs5 f5 e5))
;(setf insert '(q gs5 -e e gs5))
;(setf insert '(1/24 gs5 1/24 1/24))

;;; pattern => if such a pattern matched => now INSERT starting at PITCH f4
(setf pattern '(? f4))

;;; resolution of SCANNING/INSERTING
(setf resolution 1/16)

;;; --------------------------------------------------------------------------------------------
(setf omn-old seq)
(setf omn-new (loop repeat (length (omn-to-time-signature seq (list (numerator resolution) (denominator resolution))))
                for cnt = 0 then (incf cnt)
                with new-seq = (omn-to-time-signature seq (list (numerator resolution) (denominator resolution)))
                with insert-rounded = (append insert 
                                              (rest (length-rational-quantize
                                                     (list (apply '+ (omn :length insert)))
                                                     :round resolution)))
                
                when (pattern-matchp (nth cnt new-seq) pattern) collect insert-rounded
                and do (incf cnt (/ (apply '+ (abs! (omn :length insert-rounded))) resolution))
                collect (nth cnt new-seq)))

(setf omn-new (flatten omn-new))

;;; --------------------------------------------------------------------------------------------
(def-score test
           (:title "test"
                   :key-signature 'atonal
                   :time-signature '(4 4)
                   :tempo 90
                   :layout (bracket-group 
                            (treble-layout 'new)
                            (treble-layout 'old)))
  (new 
   :omn omn-new
   :channel 1
   :port 1
   :sound 'gm
   :program 'acoustic-grand-piano)

  (old 
   :omn omn-old
   :channel 1
   :port 1
   :sound 'gm
   :program 'acoustic-grand-piano))

 

added 4 minutes later

some other ideas to the main problems or some great solutions are very welcome :-)

Share this post


Link to post
Share on other sites

Hi,

 

i don't know if this could help you but just in case, here's how i use pattern-map inside some of my functions:

 

;;; =============================================
;;; ARTICULATION-MAP
;;; AJOUTE DES ARTICULATIONS SUR DES LISTES OMN
;;; BASÉES SUR DU PATTERN MATCHING.
;;; =============================================

(defun articulation-map (map omn &key (otherwise '-))
  (do-verbose
      ("articulation-map")
  (let* ((plist (disassemble-omn omn)))
         (setf (getf plist :articulation)
               (pattern-map map (getf plist :length) :otherwise otherwise :swallow t))
    (apply 'make-omn plist))))

#| USAGE
(setf mat '((q c4 p d4 e e4 f4 s g4 f a4 g4 f4 q e4)(e d4 mp c4 s d4 e4 f4 e4 q d4 e c4 b3)(h a3 f -h)))

(setf prules '(
               ((s s s) (leg leg leg))
               ((s s)(leg leg))
               ((s e)(- -))
               ((s q)(- stacc))
               ((q) (stacc))
               ((e) (-))
               ))

(setf out (articulation-map prules mat))
|#

Cheers.

 

Stéphane.

Share this post


Link to post
Share on other sites

thanx...!!! the concrete question was... i could eliminate the TIEs in such a sequence... (and add the tied 1/16-lengths) -> simplify the notation

 

'(s c4 tie s c4 tie s c4 tie s c4 s d4 tie s d4 tie s d4 tie s d4 s e4 tie s e4 tie s e4 t gs5 g5 fs5 f5 e5 -1/32 s g4 tie s g4 tie s g4 tie s g4 tie s g4 tie s g4)

 

Share this post


Link to post
Share on other sites
(setf seq '(s c4 tie s c4 tie s c4 tie s c4 s d4 tie s d4 tie s d4 tie s d4 s e4 tie s e4 tie s e4 t gs5 g5 fs5 f5 e5 -1/32 s g4 tie s g4 tie s g4 tie s g4 tie s g4 tie s g4))

(filter-tie seq)

S.

Share this post


Link to post
Share on other sites

yes, but wrong with this...

 

'(s c4 tie s c4 tie s c4 tie s c4 s d4 tie s d4 tie s d4 tie s d4 s e4 tie s e4 tie s e4 1/24 gs5 1/24 1/24 s g4 tie s g4 tie s g4 tie s g4 tie s g4 tie s g4 tie s g4)

because of the 1/24... why?

Share this post


Link to post
Share on other sites
(omn-merge-ties
'(s c4 tie s c4 tie s c4 tie s c4 s d4 tie s d4 tie s d4 tie
   s d4 s e4 tie s e4 tie s e4 t gs5 g5 fs5 f5 e5 -1/32
   s g4 tie s g4 tie s g4 tie s g4 tie s g4 tie s g4))
=> (q c4 d4 e. e4 t gs5 g5 fs5 f5 e5 - q. g4)

(omn-merge-ties
'(s c4 tie s c4 tie s c4 tie s c4 s d4 tie s d4 tie s d4 tie
    s d4 s e4 tie s e4 tie s e4 1/24 gs5 1/24 1/24 s g4 tie
    s g4 tie s g4 tie s g4 tie s g4 tie s g4 tie s g4))
=> (q c4 d4 e. e4 3e gs5 gs5 gs5 q.. g4)

I will make a doc for the function soon.

Share this post


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.

Sign in to follow this  

  • Similar Topics

    • By hujairi
      Hello,
       
      I am trying to find different ways of importing partials/frames data into Opusmodus. I am currently trying to use spectral analysis to analyzes certain music/audio phenomena I haven't really seen analyzed before to adapt into my own composition process. The sounds are generally archival or things I have synthesized on the computer through software myself (in .wav format), and are usually between 1 - 5 seconds in length. Is this a good length of time to analyze the spectral data of sounds? 
       
      I just wanted to understand the following information about spectral tools within Opusmodus. I really would appreciate it if anyone could help me out.
       
      1. Is it only Spear that we can use for spectral analysis? Is something like Audiosculpt also useable?
       
      2. Looking at Spear, when we explore the data, which of the following export formats do we use: 1. Text - Resampled Frames, 2. Text - Partials, 3. SDIF 1 TRC - Resampled Frames, 4. SDIF 1 TRC - Exact Interpolated, or 5. SDIF RBEP?
       
      3. Once I have the data in the correct format, I think I want to create a library of the datasets I important so that I can reinterpret them in the future. If I want to use the "get-tuning" function, for example, and then mapping it across certain instruments within my planned orchestration. What would be an effective way of doing this?
       
      One of my main challenges is finding a way to keep all my data organized every time I want to use Opusmodus for a new project. I still find myself using Opusmodus in little blocks as I compose, and I hope to eventually get to the point in which I can compose entire pieces using only Opusmodus. 
       
      I really appreciate your help.
    • By JulioHerrlein
      Dear All,
       
      I´m doing some melodic permutations and I have a question about replace-map:
      Here are four elements permutations, generated by:
      (permute '(1 2 3 4)) (setf permut4 '((1 2 3 4) (1 2 4 3) (1 3 2 4) (1 3 4 2) (1 4 2 3) (1 4 3 2) (2 1 3 4) (2 1 4 3) (2 3 1 4) (2 3 4 1) (2 4 1 3) (2 4 3 1) (3 1 2 4) (3 1 4 2) (3 2 1 4) (3 2 4 1) (3 4 1 2) (3 4 2 1) (4 1 2 3) (4 1 3 2) (4 2 1 3) (4 2 3 1) (4 3 1 2) (4 3 2 1))) Here are the pitch material to be permutated:
      (setf permutcontent '((1 cs4) (2 d4) (3 e4) (4 g4))) I used the REPLACE MAP FUNCTION, like this:
      (replace-map permutcontent permut4)  
      THE RESULT:
      ((c4 d4 e4 g4) (c4 d4 g4 e4) (c4 e4 d4 g4) (c4 e4 g4 d4) (c4 g4 d4 e4) (c4 g4 e4 d4) (d4 c4 e4 g4) (d4 c4 g4 e4) (d4 e4 c4 g4) (d4 e4 g4 c4) (d4 g4 c4 e4) (d4 g4 e4 c4) (e4 c4 d4 g4) (e4 c4 g4 d4) (e4 d4 c4 g4) (e4 d4 g4 c4) (e4 g4 c4 d4) (e4 g4 d4 c4) (g4 c4 d4 e4) (g4 c4 e4 d4) (g4 d4 c4 e4) (g4 d4 e4 c4) (g4 e4 c4 d4) (g4 e4 d4 c4))  
      THE QUESTION:
      What if I want to replace one item (like a pitch) for a list of melodic pitches ?
      How to proceed ?
       
      For example:
      Instead of substitute a C4 for the number 1, I want to substitute a list of notes, like (cs4 ds4)
      (setf permutcontent '((1 cs4 ds4) (2 d4) (3 e4) (4 g4)))  
      When I set this, a get only the cs4 permeated...
       
      Best,
      Julio
       
      I got it !
       
      All the material must have the same number of elements, like
      (setf permutcontent '((1 (c4 cs4)) (2 (b4 ds4)) (3 (c5 f4)) (4 (cs5 ds4))))  
      Resulting in:
      ((c4 cs4) (b4 ds4) (c5 f4) (cs5 ds4)) ((c4 cs4) (b4 ds4) (cs5 ds4) (c5 f4)) ((c4 cs4) (c5 f4) (b4 ds4) (cs5 ds4)) ((c4 cs4) (c5 f4) (cs5 ds4) (b4 ds4)) ((c4 cs4) (cs5 ds4) (b4 ds4) (c5 f4)) ((c4 cs4) (cs5 ds4) (c5 f4) (b4 ds4)) ((b4 ds4) (c4 cs4) (c5 f4) (cs5 ds4)) ((b4 ds4) (c4 cs4) (cs5 ds4) (c5 f4)) ((b4 ds4) (c5 f4) (c4 cs4) (cs5 ds4)) ((b4 ds4) (c5 f4) (cs5 ds4) (c4 cs4)) ((b4 ds4) (cs5 ds4) (c4 cs4) (c5 f4)) ((b4 ds4) (cs5 ds4) (c5 f4) (c4 cs4)) ((c5 f4) (c4 cs4) (b4 ds4) (cs5 ds4)) ((c5 f4) (c4 cs4) (cs5 ds4) (b4 ds4)) ((c5 f4) (b4 ds4) (c4 cs4) (cs5 ds4)) ((c5 f4) (b4 ds4) (cs5 ds4) (c4 cs4)) ((c5 f4) (cs5 ds4) (c4 cs4) (b4 ds4)) ((c5 f4) (cs5 ds4) (b4 ds4) (c4 cs4)) ((cs5 ds4) (c4 cs4) (b4 ds4) (c5 f4)) ((cs5 ds4) (c4 cs4) (c5 f4) (b4 ds4)) ((cs5 ds4) (b4 ds4) (c4 cs4) (c5 f4)) ((cs5 ds4) (b4 ds4) (c5 f4) (c4 cs4)) ((cs5 ds4) (c5 f4) (c4 cs4) (b4 ds4)) ((cs5 ds4) (c5 f4) (b4 ds4) (c4 cs4)))  
      But would be nice to MIX different number of elements...
    • By JulioHerrlein
      Dear All,
       
      Stephane did this amazing and clear example (code below) of how to spread an harmonic progression over a predefined texture.
      This can be altered to any harmonic idiom. I did some test, using a chorale texture originated from a 12-tone row and also
       a more jazz-oriented chorale.
       
      THE QUESTION IS (For Stephane Boussuge)
       
      1) How the harmonic rhythm is controlled here? In the example, the chord changes every half note.
      2) How can I make the harmony changes at every quarter note ?
      3) Can I use different rates of harmonic rhythms ?
       
      Best,
      Julio
       
       
      ;;; Classical Accompaniment Exemple ;;;--------------------------------------------------------- ;;; Parameters ;;;--------------------------------------------------------- ;;; Motif definition (setf mtf1 '((s c5 leg g5 leg e6 leg g5 c5 leg g5 leg e6 leg g5))) (setf mtf2 (pitch-transpose 4 mtf1)) (setf mtf3 '((-q e5))) (setf mtf4 '((-q g4c5))) (setf mtf5 '((q c2 -))) ;;; Chords definition (setf chords (library 'harmoprog1 'minor-4vx 'prog1)) ;;; Ostinati (setf ost1 (gen-repeat (length chords) mtf1)) (setf ost2 (gen-repeat (length chords) mtf2)) (setf ost3 (gen-repeat (length chords) mtf3)) (setf ost4 (gen-repeat (length chords) mtf4)) (setf ost5 (gen-repeat (length chords) mtf5)) ;;; Tonality-map series (setf tm-path (tonality-series chords)) ;;; Here we apply the map 'tm-path' into arpegio sequence. (setf ost1.map (tonality-map tm-path ost1)) (setf ost2.map (tonality-map tm-path ost2)) ;;; Here we apply our library chords into chord sequence. ;;; The harmonic-path preserves the voice leading. (setf ost3.map (harmonic-path chords ost3)) (setf ost4.map (harmonic-path chords ost4)) (setf ost5.map (harmonic-path chords ost5)) (setf violin1 (ambitus '(g3 c7) ost2.map)) (setf violin2 (ambitus '(g3 c6) ost1.map)) (setf viola (ambitus '(c3 e4) ost3.map)) (setf violoncello (ambitus-chord 12 (pitch-transpose -12 ost4.map))) (setf bass ost5.map) ;;;--------------------------------------------------------- ;;; Score and Layout ;;;--------------------------------------------------------- (def-score Classical-accomp (:title "Classical accompaniment example" :composer "S.Boussuge" :copyright "Copyright © 2018 s.boussuge" :key-signature 'chromatic :time-signature '((1 1 1 1) 4) :tempo 80 :layout (bracket-group (violin-layout 'violin1 :name "Violin-1") (violin-layout 'violin2 :name "Violin-2") (viola-layout 'viola) (violoncello-layout 'violoncello) (contrabass-layout 'bass) ) ) (violin1 :omn violin1 :channel 1 :sound 'gm :program 'String-Ensemble-1 :volume 100 :pan 48 :controllers (91 '(68)) ) (violin2 :omn violin2 :channel 2 :sound 'gm :program 'String-Ensemble-1 :volume 100 :pan 48 :controllers (91 '(68)) ) (viola :omn viola :channel 3 :sound 'gm :program 'String-Ensemble-1 :volume 90 :pan 64 :controllers (91 '(68)) ) (violoncello :omn violoncello :channel 4 :sound 'gm :program 'String-Ensemble-1 :volume 90 :pan 80 :controllers (91 '(68)) ) (bass :omn bass :channel 5 :sound 'gm :program 'String-Ensemble-1 :volume 90 :pan 80 :controllers (91 '(68)) ) )  
×
×
  • Create New...