all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs music everywhere/REPL Elisp/Nyquist/XLISP
@ 2021-11-25  3:44 Emanuel Berg via Users list for the GNU Emacs text editor
  2021-11-25 17:40 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 2+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-11-25  3:44 UTC (permalink / raw)
  To: help-gnu-emacs

Hello music lovers,

I thought one would do music with Emacs, and have the
interactiveness of Emacs Lisp (I was about to say Lisp, but
I've only seen it 100% in Elisp, even in SLIME and SBCL
I couldn't get further than what amounted to a very fancy
REPL, with the tedious loading and redoing on error ...).

So terminology - the REPL prompt is interactive - Elisp is
- what is it - everywhere?

Anyway this is another case of the same phenomenon (as my
SLIME experience), it is the music composing language/software
Nyquist which is based on XLISP (which I've never heard of,
but there are a lot of Lisp dialects, thanks to the simplicity
of said REPL ironically) - anyway here, if you take a look at
the code below, if I can feed code into the interactive
interpreter (Lisp cruncher or prompt), why can't I/how can
I just `eval-last-sexp' as I do in Emacs?

If one changes mode to `inferior-lisp-mode' can't it introduce
(optimally replace/rewire for the mode being) eval-last-sexp
and corresponding functions with the likes of
"inferior-lisp-eval-last-sexp" and what will happen is the
code read will be fed into the REPL prompt or rather it would
be evaluated and executed under the hood just the same!

Question 2 - can't we clone Nyquist and move the C to us and
have it available from Elisp so one do not have to bother with
XLISP and inferior-etc at all?

Fork?

Question 3 - here is the source: [first - Elisp, second - XLISP]

;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;;   https://dataswamp.org/~incal/emacs-init/ny.el
;;;
;;; original commands/docstrings:
;;;   https://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/examples/emacs/how-to/init-nyquist.html
;;;
;;; all Nyquist files:
;;;   https://dataswamp.org/~incal/ny/

(require 'inf-lisp)

(let*((ny-buff "*Nyquist*")
      (ny-proc "inferior-lisp")
      (inferior-lisp-buffer ny-buff) )
  (defun ny-running-p ()
    "Return non-nil iff a Nyquist process is running."
    (get-process ny-proc) )
  (declare-function ny-running-p nil)

  (defun ny-start ()
    "Start a new Nyquist process."
    (run-lisp "/bin/ny")
    (switch-to-buffer (format "*%s*" ny-proc))
    (rename-buffer ny-buff)
    (setq inferior-lisp-buffer ny-buff) )
  (declare-function ny-start nil)

  (defun ny-kill ()
    "Kill the Nyquist process and buffer."
    (when (get-buffer ny-buff)
      (kill-buffer ny-buff) )
    (when (processp ny-proc)
      (delete-process ny-proc) ))
  (declare-function ny-kill nil)

  (defun ny ()
    "Switch to the Nyquist buffer, if not running start one."
    (interactive)
    (if (and (ny-running-p)
             (get-buffer ny-buff) )
        (switch-to-buffer ny-buff)
      (ny-kill)
      (ny-start) ))
  (declare-function ny nil) )

;; this file:
;;   https://dataswamp.org/~incal/ny/init-incal.lsp

(defun load-init ()
  (load "/home/incal/ny/init-incal.lsp") )

(setq *snd-list-devices* nil)
(setq *snd-device*       7)

(defun midi-note-p (note)
  (when (and (<= 0 note)
             (<= note 127) )
    t) )

(defun orgel-note-p (note)
  (when (and (<= 1 note)
             (<= note 88) )
    t) )

(defun piano-note-p (note)
  (when (and (<= 1 note)
             (<= note 61) )
    t) )

(defun play-midi (note)
  (when (midi-note-p note)
    (play (osc note)) ))

(defun play-midi-orgel (note)
  (when (orgel-note-p note)
    (play (osc (+ 20 note))) ))

(defun play-midi-piano (note)
  (when (piano-note-p note)
    (play (osc (+ 35 note))) ))

(defun play-midi-interval (beg end)
  (when (and (midi-note-p beg)
             (midi-note-p end)
             (< beg end) )
    (do ((n beg (setq n (+ 1 n))))
        ((< end n))
      (play (osc n)) )))

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-25 17:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-25  3:44 Emacs music everywhere/REPL Elisp/Nyquist/XLISP Emanuel Berg via Users list for the GNU Emacs text editor
2021-11-25 17:40 ` Emanuel Berg via Users list for the GNU Emacs text editor

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.