Jump to content

Featured Replies

Posted

Inspired by the example from this thread but I could not find the related function been shipped with the OM application.

 

The code requires OM3.0 because of LispWorks specific API but the concept should be simple enough to be implemented in Clozure CL.

 

After some midi objects has been compiled and inserted to the playlist one can use run-playlist to start play. While it is still playing one

can feed more midi objects queued to the playlist. When the playlist is empty and after the specified seconds of timeout, the player process would exit.

 

(setq midi1 (compile-score 'score1))
(setq midi2 (compile-score 'score2))
(setq midi3 (compile-score 'score3))

(defparameter *playlist* (mp:make-mailbox))

(defun push-to-list (item)
  (let ((midi (cond ((eq (type-of item) 'midi:midi)
                     item)
                    ((symbolp item)
                     (compile-score item))
                    ((or (stringp item) (pathnamep item))
                     (midi:read-midi-file item)))))
    (mp:mailbox-send *playlist* midi)))

(defun run-playlist (&key (timeout 5) (ignore-ports nil))
  (mp:process-run-function
   "Playing..." ()
   (lambda ()
     (loop
        (let ((current (mp:mailbox-read *playlist* "Wait for feed tracks" timeout)))
          (if current
              (mp:process-join (start-midi current :ignore-ports ignore-ports))
            (return)))))))

(push-to-list midi1)
(push-to-list midi2)

(run-playlist 5)

(push-to-list midi3)

 

great, i will test it today!!
 

this works fine, very useful for me!

 

do you know how to read/play thus from an existing midi-library - with a path, like, perhaps

(push-to-list "/Users/..../Opusmodus/Media/MIDI/Meier/50.mid")

 

 

 

  • Author

Ok I have change push-to-list a bit so it would either compile the core, use the midi object, or read from a file.

 

(defun push-to-list (item)
  (let ((midi (cond ((eq (type-of item) 'midi:midi)
                     item)
                    ((symbolp item)
                     (compile-score item))
                    ((or (stringp item) (pathnamep item))
                     (midi:read-midi-file item)))))
    (mp:mailbox-send *playlist* midi)))

 

 

thanx, that's great!!!.... there is only one problem (but you don't have to solve it for me): the port/channel-settings are deleted 🙂  so only the internal midiplayer is playing, and no other midi-destinations via preseted port/channels (in the midi-file) are possible...?

 

(i'm working on a generative-live-scoring project (open forms) and with OPMO i can generate/simulate different generative-grammars of my "musical material" (organzied/read as/from an array). so your solution would be very practical to develop and test the "form-grammar" of the work - THANX!!)

  • Author
17 minutes ago, AM said:

the port/channel-settings are deleted

 

(setf *audition-ignore-ports* nil) should do the trick

 

However, let me make a further modification so you can set it as an argument to the call to play lists.

 

(defun run-playlist (&key (timeout 5) (ignore-ports nil))
  (mp:process-run-function
   "Playing..." ()
   (lambda ()
     (loop
        (let ((current (mp:mailbox-read *playlist* "Wait for feed tracks" timeout)))
          (if current
              (mp:process-join (start-midi current :ignore-ports ignore-ports))
            (return)))))))

;; example call
(run-playlist :timeout 2 :ignore-ports t)

(run-playlist) ; won't ignore port settings now

 

 

If you have more ideas one how this should be improved please let me know.

thx for your work - but the ports are always changed to "internal" - but you don't have to try any further, the (score player)-function (OPMO) has the same problem, will certainly be "repaired" sometime...

 

greetings

andré

 

 

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