Skip to content
View in the app

A better way to browse. Learn more.

Learn more

How can I access the measure-structured OMN generated by def-score?

Featured Replies

Hello, If someone could help me...it's not easy for me to explain something that seems simple to me ;-)

I'm having a problem with measure (bar) management in Opusmodus.

I have a comping sequence built with make-omn, with a fairly complex list of lengths. I then use it to generate a pitch sequence:

(setf comping
      (make-omn
       :pitch comping-pitches
       :length '(q q q q q q q q
                 3h = = = = = = = = = = =
                 e e e e e e e e e e e e e e e e
                 5h = = = = 5h = = = = 5h = = = = 5h = = = =
                 ...
                 q q q q bl-h)
       :span :length))

(setf res
      (gen-divide 3
                  (flatten (pitch-melodize comping))))

(setf omn1
      (loop for i in '(0 2 7)
            append (pitch-transpose i res)))

The problem then arises with omn1.

I have to use def-score with a precise time signature so that the sequence is correctly distributed across the measures:

(def-score score-name
  (:title "twelve T"
   :key-signature 'atonal
   :time-signature '((2 2) 4)
   :tempo 72)
  (instrument
   :omn omn1
   :channel 1
   :sound 'gm
   :program 'acoustic-grand-piano))

The score is correctly measured by Opusmodus.

For example, with:

(pprint-last-score)

Opusmodus displays events with positional annotations:

#|1|#  (q c4 e4 g4)
#|2|#  (q cs4 f4 bb4)
#|3|#  (q d4 fs4 3h a4)
#|4|#  (3h eb4 gs4 b4)
...
#|840|# (...)

And the lengths have indeed been rewritten to take the metric into account.

But omn1 itself remains a flat OMN sequence. For example:

((q c4 e4 g4)
 (q cs4 f4 bb4)
 (q d4 fs4 3h a4)
 ...)

My goal is then to be able to do something like:

(find-bar (gi '(1..30..85..114..169..226)) ...)

to select measures 1 through 30...

The problem is that I don't want to manually reconstruct the measures from the durations: def-score already knows perfectly well how to divide the sequence according to the time signature.

I also tried:

(compile-score 'score-name :output :score)

But the result remains a def-score containing an :omn in the form of a flat sequence.

My question is therefore:

Is there a function or method that allows me to retrieve, from the compiled score (def-score / *last-score*), the OMN sequence with its metric structure per measure?

In other words, I'm looking to preserve/retrieve the segmentation that def-score has already calculated, so that I can then manipulate the measures with functions like find-bar, rather than recalculating the measure boundaries myself.

Thank you!

  • Author

No, unfortunately. with OMN-to-time-signature, the rhythms are unstructured I don't know why.

The correct display of rhythms is only possible with def-score...

Here is my complete code; perhaps you will understand it better than I do;-)

(progn

(setf minor1

'((c4 m)

(bb3 maj :rotate 1)

(e4 maj)

(fs3 m :rotate 2 )

(c4 m :rotate 1)

(bb3 maj :rotate 2)

(e4 maj :rotate 1)

(fs4 m )

(c4 m :rotate 2)

(bb4 maj)

(e4 maj :rotate 2)

(fs4 m :rotate 1)

))

(setf minor1-down

'((c5 m)

(bb4 maj)

(e4 maj :rotate 2)

(fs4 m :rotate 1)

(c4 m :rotate 2)

(bb3 maj :rotate 2)

(e4 maj :rotate 1)

(fs4 m )

(c4 m :rotate 1)

(bb3 maj :rotate 1)

(e4 maj)

(fs3 m :rotate 2)

(c4 m :rotate 2)

(bb3 maj :rotate 2)

(e4 maj :rotate 1)

(fs4 m )

(c4 m :rotate 1)

(bb3 maj :rotate 1)

(e4 maj)

(fs3 m :rotate 2)

))

(setf comping-pitches

(append

(expand-chord minor1)

(expand-chord minor1-down)))

;; 4. Création du flux OMN final

(setf comping (make-omn

:pitch comping-pitches

:length '(q q q q q q q q

3h = = = = = = = = = = =

e e e e e e e e e e e e e e e e

5h = = = = 5h = = = = 5h = = = = 5h = = = =

6h = = = = = 6h = = = = = 6h = = = = = 6h = = = = =

7h = = = = = = 7h = = = = = = 7h = = = = = = 7h = = = = = =

8h = = = = = = = 8h = = = = = = = 8h = = = = = = = 8h = = = = = = =

8h = = = = = = = 8h = = = = = = = 8h = = = = = = = 8h = = = = = = =

7h = = = = = = 7h = = = = = = 7h = = = = = = 7h = = = = = =

6h = = = = = 6h = = = = = 6h = = = = = 6h = = = = =

5h = = = = 5h = = = = 5h = = = = 5h = = = =

e e e e e e e e e e e e e e e e

3h = = = = = = = = = = =

q q q q q q q q bl-h)

:span :length))

(setf res (gen-divide 3 (flatten (pitch-melodize comping))))

;;dans ce cas quitolet avec gen-palindrome

(setf omn (loop for i in '(4 9 11)

append (pitch-transpose i res)))

(def-score score-name

(:title "twelve"

:key-signature 'atonal

:time-signature '((2 2) 4)

:tempo 72)

(instrument

:omn omn

:channel 1

:sound 'gm

:program 'acoustic-grand-piano)))

Yes, you are true, only def-score can display as you wish, probably because it use something internal for the correct display.

But with omn-to-time-signature you can cut correctly your material and edit it with find-bar or whatever and display the edited result correctly in def-score.

(setf omn (loop for i in '(4 9 11)

append (pitch-transpose i res)))

(setf omn2 (omn-to-time-signature omn '(4 4)))

;;; ACCESS SOME BARS

(setf bar12 (find-bar 12 omn2))

(setf bar16 (find-bar 16 omn2))

(setf bar18 (find-bar 18 omn2))

(setf selection (assemble-seq bar12 bar16 bar18))

(def-score score-name

(:title "twelve"

:key-signature 'atonal

:time-signature '((2 2) 4)

:tempo 72)

(instrument

:omn selection

:channel 1

:sound 'gm

:program 'acoustic-grand-piano)

  • Author

You're right dear Stéphane🙏 and I wanted to go faster and use def-score... indeed, we can do that:

(setf omn (loop for i in '(0 5 7)

append (pitch-transpose i res)))

(setf omn2 (omn-to-time-signature omn '(4 4)))

(setf bar1 (find-bar '(1..30) omn2))

(setf bar2 (find-bar '(85..114) omn2))

(setf bar3 (find-bar '(169..198) omn2))

or faster

(setf bar1 (find-bar '(1..30 85..114 169..198) omn2))

(setf selection (assemble-seq bar1 bar2 bar3))

(def-score score-name

(:title "twelve"

:key-signature 'atonal

:time-signature '((2 2) 4)

:tempo 72)

(instrument

:omn selection (or bar1 )

:channel 1

:sound 'gm

:program 'acoustic-grand-piano))

Create an account or sign in to comment

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.