Jump to content

Help on WILDCARDS ? *


Recommended Posts

Dear All,

 

Some help needed in wildcard uses in Opusmodus Functions and OMN expressions...

 

><><><><><><><><><><>

The definition....

https://en.wikipedia.org/wiki/Wildcard_character

In computer (software) technology, a wildcard is a symbol used to replace or represent one or more characters.[2] Algorithms for matching wildcards have been developed in a number of recursive and non-recursive varieties.

In Unix-like and DOS operating systems, the question mark ? matches exactly one character.

><><><><><><><><><><><><><

 

I was in need of a wildcard to represent a pitch class in ANY register, like "cs?" meaning all C# pitch classes in any register/octave (cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, etc).

 

There are other interesting uses for this wildcards inside functions, to generalize and make recursions possible elegantly.

 

Any Hints ?

 

Best,

Julio

Link to comment
Share on other sites

often helpful in PATTERN MATCH things... (like in OPMO pattern-match-functions)

 

here is a short IDEA for an octave-independent PITCH-PATTERN-MATCHP with possible WILDCARD, perhaps could help you...

 

;;;-------------------------------------------------------------- 
;;; PITCH PATTERN-MATCHP octave-independent
;;;-------------------------------------------------------------- 

;;; SUB
(defun convert-pitch (pitches)
  (loop for i in pitches
    when (pitchp i)
    collect (compress (butlast (explode i)))
    else collect i))

;;; MAIN

(defun pitch-pattern-matchp (pitchlist pattern)
  (let ((pitchlist (convert-pitch pitchlist))
        (pattern (convert-pitch pattern)))
    (pattern-matchp pitchlist pattern)))

(pitch-pattern-matchp '(c4 d4 eb4 f4 g4) '(c ? e))
=> nil

(pitch-pattern-matchp '(c4 d4 eb4 f4 g4) '(c ? eb))
=> t

 

Link to comment
Share on other sites

Thanks, André !

 

I was trying to solve this problem

 

 

(setf melody '(c5 c5 d5 e5 g5 a5 g5 c6 b5 c6))

(setf blkharm (pattern-map '(((c3) (e2g2a2c3))((d3) (f2gs2b2d3))((e3) (e3c3a2g2))((f3) (gs2b2d3f3))((g3) (g3e3c3a2))((gs3) (b2d3f3gs3))((ab3) (b2d3f3ab3))((a3) (c3e3g3a3))((b3) (d3f3ab3b3))((c4) (e3g3a3c4))((d4) (f3gs3b3d4))((e4) (e4c4a3g3))((f4) (gs3b3d4f4))((g4) (g4e4c4a3))((gs4) (b3d4f4gs4))((ab4) (b3d4f4ab4))((a4) (g4e4c4a4))((b4) (d4f4ab4b4))((c5) (e4g4a4c5))((d5) (f4gs4b4d5))((e5) (e5c5a4g4))((f5) (gs4b4d5f5))((g5) (g5e5c5a4))((gs5) (b4d5f5gs5))((ab5) (b4d5f5ab5))((a5) (g5e5c5a5))((b5) (d5f5ab5b5))((c6) (e5g5a5c6))((d6) (f5gs5b5d6))((e6) (e6c6a5g5))((f6) (gs5b5d6f6))((g6) (g6e6c6a5))((gs6) (b5d6f6gs6))((ab6) (b5d6f6ab6))((a6) (g6e6c6a6))((b6) (d6f6ab6b6)))
             melody :otherwise 'c4f4bb4eb5))

(make-omn
 :length '(q e e e e e e q q q)
 :pitch blkharm)

 

To make some block harmonizations, like this:

 

image.png.2f3bc60840d0d7fcfbabc532f9526ae8.png

 

If you are curious, see this post:

 

 

Best !! Thank you ! You are the LOOPER MAN !

 

Julio

 

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