Jump to content
View in the app

A better way to browse. Learn more.

Opusmodus

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hi,

 

When I write functions and make use of setf's, I get the brown colored warning: Undeclared free variable

This becomes a problem, when I'd like to put the function into the extensions folder.

How can I remedy this?

 

Thanks!

  • Author

Here is what I've hacked together, thanks for looking into it:

(defun plot-pcs-distr (x)

(progn
(setf c (list (count '0 (flatten (get-pcs x)))))
(setf cs (list (count '1 (flatten (get-pcs x)))))
(setf d (list (count '2 (flatten (get-pcs x)))))
(setf ds (list (count '3 (flatten (get-pcs x)))))
(setf e (list (count '4 (flatten (get-pcs x)))))
(setf f (list (count '5 (flatten (get-pcs x)))))
(setf fs (list (count '6 (flatten (get-pcs x)))))
(setf g (list (count '7 (flatten (get-pcs x)))))
(setf gs (list (count '8 (flatten (get-pcs x)))))
(setf a (list (count '9 (flatten (get-pcs x)))))
(setf bb (list (count '10 (flatten (get-pcs x)))))
(setf b (list (count '11 (flatten (get-pcs x)))))

(setf all (append c cs d ds e f fs g gs a bb b))

(setf liste (loop for x in all
      for y in '(c cis d dis e f fis g gis a bes b)
  collect (list x y)))

(sort liste #'< :key #'first)


 
(setf liste-plot (loop for i in all
      for j in '(0 1 2 3 4 5 6 7 8 9 10 11)
  collect (list j i)))

(xy-plot liste-plot
         :join-points t
         :point-radius 2
         :style :fill
         :point-style :square)
))

 

Not very clear what you like to do.

What (would be) is the result of the LIST-PLOT expression.

What is the input of the function.

 

What should this do:

(list (count 4 (flatten (get-pcs x))))

 

  • Author

I've tried to get an overview of which pitches are used how many times in a stem:


 

(plot-pcs-distr  '((q c3 c3 d4 f5)(e fs2 fs2 fs2 fs2 fs2 gs4)))

==>((0 2) (1 0) (2 1) (3 0) (4 0) (5 1) (6 5) (7 0) (8 1) (9 0) (10 0) (11 0))

so I can see at a glance there are 2 c's, zero cis's, one d and so forth..

 

and the plot:

Bildschirmfoto 2021-09-12 um 17.21.11.jpg

Here it is:

 

(defun pcs-count-plot (sequence)
  (do-verbose ("pcs-count-plot")
    (let* ((i (sort-asc
               (flatten
                (modus
                 (pitch-to-integer
                  (melodize (omn :pitch sequence)))))))
           (r (count-repeat i))
           (l (mapcar 'list (remove-duplicates i) r)))
      (xy-plot l
               :point-radius 4
               :style :axis
               :point-style :hollow)
      )))

 

(pcs-count-plot omn)
=> ((0 2) (2 1) (5 1) (6 5) (8 1))

 

  • Author

Thanks for you efforts of completely rewriting the function! This will serve me well as a model of how to use let*..!

Create an account or sign in to comment


Copyright © 2014-2025 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy

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.