all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Emacs music everywhere/REPL Elisp/Nyquist/XLISP
Date: Thu, 25 Nov 2021 04:44:26 +0100	[thread overview]
Message-ID: <87wnkwhpb9.fsf@zoho.eu> (raw)

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




             reply	other threads:[~2021-11-25  3:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25  3:44 Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2021-11-25 17:40 ` Emacs music everywhere/REPL Elisp/Nyquist/XLISP Emanuel Berg via Users list for the GNU Emacs text editor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnkwhpb9.fsf@zoho.eu \
    --to=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.