Jump to content

Opusmodus commands don't work in Aquamacs


Recommended Posts

Hello!

 

The Opusmodus commands for Emacs that are listed in file "Slime in Opusmodus" don't work for me.

 

Written commands, like "(circle-pitch-plot 'bartok :point-radius 4)", work ok, a window opens from Opusmodus and shows the plot.

But not the ?alqsv-commands, that are shown in mini buffer, but don't do anything, except command "?", that shows commands listed.

 

I'm using Aquamacs 3.5 and my Clozure version is 1.12. Is this setup ok?

 

Best wishes,

Henry

 

Link to comment
Share on other sites

There is nothing to do for ?alqsv-commands with a plot. It is for snippets. The command '? explain what each symbol do.

 

Quote

I'm using Aquamacs 3.5 and my Clozure version is 1.12. Is this setup ok?

Is OK. Have you try Emacs.

Link to comment
Share on other sites

I cannot answer for the builtin Opusmodus Slime functionality, but I developed something similar some time ago on my own, which works in Aquamacs for me. Try copying the Emacs Lisp code below into your Emacs initialisation file (e.g., ~/.emacs), start Aquamacs again and open a Lisp file.

 

The code below adds to Emacs buffers in Lisp mode an Opusmodus menu with some standard commands like for previewing a snippet, stopping the playback etc. together with shortcuts shown in the menu. 

 

It is all a bit hacky, but works for me and perhaps also for others 😉  It should also be easy to add menu items and keyboard shortcuts for any other commands (like plotting) that work from Lisp. 

 


;; Custom function for previewing Openmusic snippets etc
(defun slime-eval-and-preview-opmo-snippet-before-point ()
  "Evaluate the Openmusic snippet (an expression) preceding point and preview that snippet."
  (interactive)
  (let* ((score (slime-last-expression))
	 ;; wrap call to preview-score around the score before point
	 (full-expr (concat "(preview-score (list :snippet " score "))")))
    (slime-interactive-eval full-expr)))

(defun slime-eval-and-preview-opmo-score-before-point ()
  "Evaluate the score (an expression in the tot score format) preceding point and preview that score (notation and playback)."
  (interactive)
  (let* ((score (slime-last-expression))
	 ;; wrap call to preview-score around the score before point
	 (full-expr (concat "(preview-score " score ")")))
    (slime-interactive-eval full-expr)))

(defun slime-stop-opmo-playback ()
  "Stop the currently playing Openmusic sound playback."
  (interactive)
  (slime-interactive-eval "(sequencer:sequencer-stop *audition-sequencer*)"))

(defun slime-opmo-midi-playback ()
  "(Re-)play the last Opusmodus score with a separate MIDI playback window."
  (interactive)
  (slime-interactive-eval "(display-midi *last-score* :display :window)"))

(add-hook 'lisp-mode-hook
	  (lambda ()
	    (local-set-key (kbd "<A-f2>") #'slime-eval-and-preview-opmo-snippet-before-point)
	    (local-set-key (kbd "<A-f3>") #'slime-eval-and-preview-opmo-score-before-point)
	    (local-set-key (kbd "<A-f4>") #'slime-opmo-midi-playback)
	    (local-set-key (kbd "<A-f1>") #'slime-stop-opmo-playback)
	    ))


;; Creating a new "Opusmodus" menu in the menu bar to the right of "Lisp" menu.
;; This new menu is only shown when in lisp-mode
(define-key-after
  lisp-mode-map
  [menu-bar opusmodus]
  (cons "Opusmodus" (make-sparse-keymap "hoot hoot"))
  'lisp)


;; Creating a menu item, under the menu by the id “[menu-bar opusmodus]”
(define-key
  lisp-mode-map
  [menu-bar opusmodus preview-score]
  '("Preview score cmd-f3" . slime-eval-and-preview-opmo-score-before-point))

(define-key
  lisp-mode-map
  [menu-bar opusmodus preview-snippet]
  '("Preview snippet cmd-f2" . slime-eval-and-preview-opmo-snippet-before-point))

(define-key
  lisp-mode-map
  [menu-bar opusmodus stop-playback]
  '("Stop playback cmd-f1" . slime-stop-opmo-playback))

(define-key
  lisp-mode-map
  [menu-bar opusmodus replay-score]
  '("(Re)play last score cmd-f4" . slime-opmo-midi-playback))

 

Link to comment
Share on other sites

I can confirm that audition and notation of snippets unfortunately does not work for me either with the builtin Slime in Opusmodus. E.g., I am trying to place the cursor behind an Opusmodus function call an execute the relevant short cut (e.g., C-c o a), but nothing happens.  C-c o ? seems to work, though.

 

Anyway, my own Slime interface works, at least for me...

Link to comment
Share on other sites

  • 3 months later...

I just noted that the code I shared above depends on other definitions in my library (e.g., the function preview-score). Below is an update that instead uses only builtin Opusmodus functions. Holler in case this is not working for you, as the code on my machine is a bit different, and I did not test the code below... (specifically, the version below only works for the scores with instruments from the ps set gm, while my own code is more flexible, but then again depends on other custom definitions).

 

 

;; Emacs lisp code: put into your Emacs init file, e.g., ~/.emacs

;; Custom function for previewing Openmusic snippets etc
(defun slime-eval-and-preview-opmo-snippet-before-point ()
  "Evaluate the Openmusic snippet (an expression) preceding point and preview that snippet."
  (interactive)
  (let* ((score (slime-last-expression))
	 (full-expr (concat "(ps 'gm (list :treble " score "))"))
	 )
    ;; (print (concat "debug: " full-expr))
    (slime-interactive-eval full-expr)))

(defun slime-eval-and-preview-opmo-score-before-point ()
  "Evaluate the score (an expression in the tot score format) preceding point and preview that score (notation and playback)."
  (interactive)
  (let* ((score (slime-last-expression))
	 (full-expr (concat "(ps 'gm " score ")"))
	 )
    (slime-interactive-eval full-expr)))

(defun slime-stop-opmo-playback ()
  "Stop the currently playing Openmusic sound playback."
  (interactive)
  (slime-interactive-eval "(sequencer:sequencer-stop *audition-sequencer*)"))

(defun slime-opmo-midi-playback ()
  "(Re-)play the last Opusmodus score with a separate MIDI playback window."
  (interactive)
  (slime-interactive-eval "(display-midi *last-score* :display :window)"))

(add-hook 'lisp-mode-hook
	  (lambda ()
	    (local-set-key (kbd "<A-f2>") #'slime-eval-and-preview-opmo-snippet-before-point)
	    (local-set-key (kbd "<A-f3>") #'slime-eval-and-preview-opmo-score-before-point)
	    (local-set-key (kbd "<A-f4>") #'slime-opmo-midi-playback)
	    (local-set-key (kbd "<A-f1>") #'slime-stop-opmo-playback)
	    ))


;; Creating a new "Opusmodus" menu in the menu bar to the right of "Lisp" menu.
;; This new menu is only shown when in lisp-mode
(define-key-after
  lisp-mode-map
  [menu-bar opusmodus]
  (cons "Opusmodus" (make-sparse-keymap "hoot hoot"))
  'lisp)


;; Creating a menu item, under the menu by the id “[menu-bar opusmodus]”
(define-key
  lisp-mode-map
  [menu-bar opusmodus preview-score]
  '("Preview score cmd-f3" . slime-eval-and-preview-opmo-score-before-point))

(define-key
  lisp-mode-map
  [menu-bar opusmodus preview-snippet]
  '("Preview snippet cmd-f2" . slime-eval-and-preview-opmo-snippet-before-point))

(define-key
  lisp-mode-map
  [menu-bar opusmodus stop-playback]
  '("Stop playback cmd-f1" . slime-stop-opmo-playback))

(define-key
  lisp-mode-map
  [menu-bar opusmodus replay-score]
  '("(Re)play last score cmd-f4" . slime-opmo-midi-playback))

 

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