From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: Integrating Midi into Emacs Date: Wed, 14 Jan 2015 11:49:34 +0100 Message-ID: <878uh5hc1t.fsf@fencepost.gnu.org> References: <87fvbttoa9.fsf@fencepost.gnu.org> <87lhlbmx7l.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1421232592 12900 80.91.229.3 (14 Jan 2015 10:49:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 Jan 2015 10:49:52 +0000 (UTC) Cc: emacs-devel@gnu.org To: Niels Giesen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 14 11:49:47 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YBLWD-00055J-17 for ged-emacs-devel@m.gmane.org; Wed, 14 Jan 2015 11:49:45 +0100 Original-Received: from localhost ([::1]:45539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBLWC-00054J-Cx for ged-emacs-devel@m.gmane.org; Wed, 14 Jan 2015 05:49:44 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58683) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBLW5-00053w-S5 for emacs-devel@gnu.org; Wed, 14 Jan 2015 05:49:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBLW3-0000Bt-K4 for emacs-devel@gnu.org; Wed, 14 Jan 2015 05:49:37 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34534) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBLW3-0000Bp-Hu for emacs-devel@gnu.org; Wed, 14 Jan 2015 05:49:35 -0500 Original-Received: from localhost ([127.0.0.1]:41708 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBLW3-00024U-3o; Wed, 14 Jan 2015 05:49:35 -0500 Original-Received: by lola (Postfix, from userid 1000) id 591DDE048C; Wed, 14 Jan 2015 11:49:34 +0100 (CET) In-Reply-To: (Niels Giesen's message of "Wed, 14 Jan 2015 10:42:48 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:181248 Archived-At: Niels Giesen writes: > Hi David, > > This looks really cool to me. I tried to use your code, but cannot for the > life of me find out how to bind functions to those events. Could you give a > simple example? Well, this is work in progress. I've been tripped up by quirks of the raw Midi spec: to make things more challenging, it allows inserting foreign command bytes ("realtime events") in the middle of other commands. And it allows leaving off command bytes altogether ("running status byte"). When accessing Midi devices through libraries or the Midi API, those peculiarities are taken care off, but not so with the raw Midi stream. I'm appending the current files I am working with. They are _not_ a finished application yet. The midikbd module produces events. The decoding framework should now be working reliably, but currently only the events I am interested in working with get produced. And the lily-midi module integrates this into LilyPond-mode, assuming that it has already been loaded (again: work in progress, so load order, autoloads etc are all not in place). The notenames are hardwired to dutch, channel changes are not currently used, timing is not recorded and so on. The last thing I did was implementing a recording key signature so that pitches are produced with accidentals chosen in a useful relation to the key signature. The long pitch would be to use libmidiport in Emacs proper, and produce both key up and down events (with at least the up events ignored by default) and full timing info, similar to mouse events. Most of this (apart from the default binding behavior) can probably be presimulated by extending midi-kbd.el, but the precision of the timing would likely suffer. -- David Kastrup