Index: plugins/audacity/Makefile.am
===================================================================
--- plugins/audacity/Makefile.am	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
+++ plugins/audacity/Makefile.am	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
@@ -0,0 +1,2 @@
+SUBDIRS = plug-ins
+EXTRA_DIST = README  audacity-libnyquist.diff  audacity-nyquist.diff
Index: plugins/audacity/Makefile.in
===================================================================
--- plugins/audacity/Makefile.in	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
+++ plugins/audacity/Makefile.in	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
@@ -0,0 +1,453 @@
+# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FFTWLIB_CFLAGS = @FFTWLIB_CFLAGS@
+FFTWLIB_LIBS = @FFTWLIB_LIBS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+LADCCA_CFLAGS = @LADCCA_CFLAGS@
+LADCCA_LIBS = @LADCCA_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDLIB_CFLAGS = @SNDLIB_CFLAGS@
+SNDLIB_LIBS = @SNDLIB_LIBS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS = plug-ins
+EXTRA_DIST = README  audacity-libnyquist.diff  audacity-nyquist.diff
+subdir = plugins/audacity
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+
+RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
+	ps-recursive install-info-recursive uninstall-info-recursive \
+	all-recursive install-data-recursive install-exec-recursive \
+	installdirs-recursive install-recursive uninstall-recursive \
+	check-recursive installcheck-recursive
+DIST_COMMON = README $(srcdir)/Makefile.in Makefile.am
+DIST_SUBDIRS = $(SUBDIRS)
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  plugins/audacity/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if (etags --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	else \
+	  include_option=--include; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -f $$subdir/TAGS && \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
+
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d $(distdir)/$$subdir \
+	    || mkdir $(distdir)/$$subdir \
+	    || exit 1; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$(top_distdir)" \
+	        distdir=../$(distdir)/$$subdir \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
+	clean-generic clean-libtool clean-recursive ctags \
+	ctags-recursive distclean distclean-generic distclean-libtool \
+	distclean-recursive distclean-tags distdir dvi dvi-am \
+	dvi-recursive info info-am info-recursive install install-am \
+	install-data install-data-am install-data-recursive \
+	install-exec install-exec-am install-exec-recursive \
+	install-info install-info-am install-info-recursive install-man \
+	install-recursive install-strip installcheck installcheck-am \
+	installdirs installdirs-am installdirs-recursive \
+	maintainer-clean maintainer-clean-generic \
+	maintainer-clean-recursive mostlyclean mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-recursive pdf pdf-am \
+	pdf-recursive ps ps-am ps-recursive tags tags-recursive \
+	uninstall uninstall-am uninstall-info-am \
+	uninstall-info-recursive uninstall-recursive
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Index: plugins/audacity/README
===================================================================
--- plugins/audacity/README	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
+++ plugins/audacity/README	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
@@ -0,0 +1,15 @@
+This directory contains 2 patches for audacity and a nyquist plugin.
+
+The patch audacity-nyquist.diff is made from the current nyquist release
+source. It's here to activate s-save function which seem to have been left out
+of the audacity source tree.
+
+The other patch is a modification i made to nyx so that the 'system' command
+works and an addition to xlisp to have the 'ftoa' and 'atof' functions.
+
+The nyquist plugin aubioonset simply saves the current selection to a file and
+calls the aubioonset program on this file. The text file obtained is then read,
+converted to a list of labels and unlinked.
+
+Starting a patched audacity from the directory above plug-ins should add an
+entry 'Onset detection...' to the Process menu.
Index: plugins/audacity/audacity-libnyquist.diff
===================================================================
--- plugins/audacity/audacity-libnyquist.diff	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
+++ plugins/audacity/audacity-libnyquist.diff	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
@@ -0,0 +1,96 @@
+--- audacity-1.2.1.orig/lib-src/libnyquist/nyx/nyx.c
++++ audacity-1.2.1/lib-src/libnyquist/nyx/nyx.c
+@@ -620,8 +620,14 @@
+ {
+    if (moreargs()) {
+       unsigned char *cmd;
++      int retval;
+       cmd = (unsigned char *)getstring(xlgastring());
+-      fprintf(stderr, "Will not execute system command: %s\n", cmd);
++      //fprintf(stderr, "Will not execute system command: %s\n", cmd);
++      system(cmd);
++      if (retval != 0) 
++      	fprintf(stderr, 
++		"the command \n %s \n exited with the error %d\n", 
++		cmd, retval);
+    }
+    return s_true;
+ }
+--- audacity-1.2.1.orig/lib-src/libnyquist/xlisp/xlftab.c
++++ audacity-1.2.1/lib-src/libnyquist/xlisp/xlftab.c
+@@ -83,6 +83,7 @@
+     xgetlambda(void),xmacroexpand(void),x1macroexpand(void),
+     xinfo(void),					//Added by Ning Hu	Apr.2001
+     xsetdir(void),					//Added by Ning Hu	May.2001
++    xatof(void), xftoa(void),				//Added by PiemBrossier Jul.2004
+     xtrace(void),xuntrace(void),xprofile(void),xstrsearch(void), xsetupconsole(void);
+ #endif
+ 
+@@ -452,8 +453,9 @@
+ {	"WRITE-INT",			S, xwrint		}, /* 292 */
+ {	"WRITE-FLOAT",			S, xwrfloat		}, /* 293 */
+ {	"INFO",				S, xinfo		}, /* 294 */ /* Ning Hu, Apr 2001 */
+-{	NULL,				S, xnotimp		}, /* 295 */
+-{	NULL,				S, xnotimp		}, /* 296 */
++
++{	"ATOF",				S, xatof		}, /* 295 */ /* Paul Brossier <piem@altern.org> */
++{	"FTOA",				S, xftoa		}, /* 296 */ /* Jul. 2004 */ 
+ {	NULL,				S, xnotimp		}, /* 297 */
+ {	NULL,				S, xnotimp		}, /* 298 */
+ {	NULL,				S, xnotimp		}, /* 299 */
+--- audacity-1.2.1.orig/lib-src/libnyquist/xlisp/xlstr.c
++++ audacity-1.2.1/lib-src/libnyquist/xlisp/xlstr.c
+@@ -16,6 +16,11 @@
+ #define TLEFT	1
+ #define TRIGHT	2
+ 
++/* on the NeXT, atof is a macro in stdlib.h */
++#ifndef atof
++extern double atof();
++#endif
++
+ /* external variables */
+ extern LVAL k_start,k_end,k_1start,k_1end,k_2start,k_2end;
+ extern LVAL s_true;
+@@ -555,3 +560,41 @@
+     return (icmp ? s_true : NIL);
+ }
+ 
++/* functions added by Paul Brossier <piem@altern.org> */
++LVAL xatof() /* converts a string to a float */
++{
++	if (moreargs()) {
++		unsigned char *astring = NULL;
++		float afloat;
++		astring = (unsigned char *)getstring(xlgastring());
++		xllastarg();
++		afloat = atof(astring);
++		return cvflonum(afloat);
++	} else 
++		return NIL;
++}
++
++LVAL xftoa() /* converts a float to a string */
++{
++	LVAL arg;
++	FIXTYPE ival=0;
++	FLOTYPE fval=0;
++	if (moreargs()) {
++		/* get the first argument */
++		arg = xlgetarg();
++		xllastarg();
++
++		/* set the type of the first argument */
++		if (fixp(arg)) {
++			ival = getfixnum(arg);
++			snprintf(buf,STRMAX,"%d",ival);
++		}
++		else if (floatp(arg)) {
++			fval = getflonum(arg);
++			snprintf(buf,STRMAX,"%f",fval);
++		}
++
++		return cvstring(buf);
++	} else 
++		return NIL;
++}
Index: plugins/audacity/audacity-nyquist.diff
===================================================================
--- plugins/audacity/audacity-nyquist.diff	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
+++ plugins/audacity/audacity-nyquist.diff	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
@@ -0,0 +1,631 @@
+--- audacity-1.2.1.orig/nyquist/misc.lsp
++++ audacity-1.2.1/nyquist/misc.lsp
+@@ -74,19 +74,3 @@
+                   (setf fullpath ":")))
+            fullpath)
+           (t nil))))
+-          
+-;; real-random -- pick a random real from a range
+-;;
+-(defun real-random (from to)
+-  (cond ((= from to) from)
+-          (t
+-         (+ from
+-           (* (random 10000)
+-              0.0001
+-              (- to from))))))
+-
+-;; power -- raise a number to some power x^y
+-;;
+-(defun power (x y)
+-  (exp (* (log (float x)) y)))
+-  
+--- audacity-1.2.1.orig/nyquist/nyinit.lsp
++++ audacity-1.2.1/nyquist/nyinit.lsp
+@@ -26,7 +26,7 @@
+ (setf *WATCH* NIL)
+ 
+ (format t "~%Nyquist -- A Language for Sound Synthesis and Composition~%")
+-(format t "    Copyright (c) 1991-2003 by Roger B. Dannenberg~%")
++(format t "    Copyright (c) 1991,1992,1995 by Roger B. Dannenberg~%")
+ (format t "    Version 2.29~%~%")
+ 
+ (setf *gc-flag* t)
+--- audacity-1.2.1.orig/nyquist/nyquist.lsp
++++ audacity-1.2.1/nyquist/nyquist.lsp
+@@ -6,10 +6,7 @@
+ ;;;   ###########################################################
+ ;;;
+ 
+-;;;   
+-;;;   Modifications for using Nyquist within Audacity
+-;;;   by Dominic Mazzoni
+-;;;
++(load "fileio.lsp")
+ 
+ (prog ()
+    (setq lppp -12.0) (setq lpp -9.0)  (setq lp -6.0)    (setq lmp -3.0)
+@@ -217,7 +214,7 @@
+     (cond ((> hz (/ *SOUND-SRATE* 2))
+            (format t "Warning: buzz nominal frequency (~A hz) will alias at current sample rate (~A hz).\n"
+                    hz *SOUND-SRATE*)))
+-    (setf n (min n 1)) ; avoid divide by zero problem
++    (setf n (max n 1)) ; avoid divide by zero problem
+     (scale-db (get-loud)
+               (snd-buzz n                   ; number of harmonics
+                         *SOUND-SRATE*       ; output sample rate
+@@ -344,6 +341,7 @@
+     d			; duration
+     phase)))		; phase
+ 
++
+ ;; FMLFO -- like LFO but uses frequency modulation
+ ;;
+ (defun fmlfo (freq &optional (sound *SINE-TABLE*) (phase 0.0))
+@@ -358,6 +356,7 @@
+           (t
+            (error "frequency must be a number or sound")))))
+ 
++
+ ;; OSC - table lookup oscillator
+ ;;
+ (defun osc (pitch &optional (duration 1.0) 
+@@ -761,6 +760,51 @@
+       ,s))
+ 
+ 
++;; COMPUTE-DEFAULT-SOUND-FILE -- construct and set *default-sound-file*
++;;
++;; (this is harder than it might seem because the default place for
++;;  sound files is in /tmp, which is shared by users, so we'd like to
++;;  use a user-specific name to avoid collisions)
++;;
++(defun compute-default-sound-file () 
++  (let (inf user extension)
++      ; the reason for the user name is that if UserA creates a temp file,
++      ; then UserB will not be able to overwrite it. The user name is a
++      ; way to give each user a unique temp file name. Note that we don't
++      ; want each session to generate a unique name because Nyquist doesn't
++      ; delete the sound file at the end of the session.
++    (system "echo $USER > ny_username.tmp")
++    (setf inf (open "ny_username.tmp"))
++    (cond (inf
++           (setf user (read inf))
++       (close inf)
++       (system "rm ny_username.tmp"))
++      (t	; must not be unix, make up a generic name
++       (setf user 'nyquist)))
++    (cond ((null user)           
++       (format t 
++"Please type your user-id so that I can construct a default 
++sound-file name.  To avoid this message in the future, add
++this to your .login file:
++    setenv USER <your id here>
++or add this to your init.lsp file:
++    (setf *default-sound-file* \"<your filename here>\")
++    (setf *default-sf-dir* \"<full pathname of desired directory here>\")
++
++Your id please: ")
++       (setf user (read))))
++    ; now compute the extension based on *default-sf-format*
++    (cond ((= *default-sf-format* snd-head-AIFF)
++           (setf extension ".aif"))
++          ((= *default-sf-format* snd-head-Wave)
++           (setf extension ".wav"))
++          (t
++           (setf extension ".snd")))
++    (setf *default-sound-file* 
++      (strcat (string-downcase (symbol-name user)) "-temp" extension))
++    (format t "Default sound file is ~A.~%" *default-sound-file*)))
++
++
+ ;; CONTROL-WARP -- apply a warp function to a control function
+ ;; 
+ (defun control-warp (warp-fn control &optional wrate)
+@@ -792,6 +836,9 @@
+          (snd-srate sound)
+          (local-to-global 0) *START* *STOP* (db-to-linear (get-loud))))
+ 
++; (s-plot (progv '(*TIME* *START*)'(0.0 0.5)(cue (snd-sine 20 1 100 1)))1000)
++;(s-plot(progv'(*TIME* *START*)'(0.0 0.5)(cue(cue (snd-sine 20 1 100 1))))1000)
++
+ ;; (sound sound)
+ ;;    Same as (cue sound), except also warps the sound.
+ ;; Note that the *WARP* can change the pitch of the
+@@ -861,6 +908,13 @@
+ (setfn control sound)
+ 
+ 
++;; (cue-file string)
++;;    Loads a sound file with the given name, returning a sound which is
++;; transformed to the current environment.
++;(defun cue-file (name)
++;   (cue (snd-load  name *SOUND-SRATE*)))
++
++
+ ;; (env t1 t2 t4 l1 l2 l3 &optional duration)
+ ;; Creates a 4-phase envelope.
+ ;;	tN is the duration of phase N, and lN is the final level of
+@@ -1327,6 +1381,54 @@
+ ; 
+ (load "seq" :verbose NIL)
+ 
++;(defmacro with%environment (env &rest expr)
++;  `(progv ',*environment-variables* ',env ,@expr))
++; 
++;(defmacro seq (&rest list)
++;  (display "seq" list)
++;  (cond ((null list)
++;         (snd-zero *time* *sound-srate*))
++;        ((null (cdr list))
++;         (car list))
++;	((null (cddr list))
++;	 `(let* ((first%sound ,(car list))
++;		 (s%rate (snd-srate first%sound)))
++;	    (snd-seq first%sound
++;	 	     #'(lambda (t0) 
++;	                 (with%environment
++;			   ,(the%environment) (setf *time* t0)     
++;			   (force-srate s%rate ,(cadr list)))))))
++;	(t
++;	 `(let* ((first%sound ,(car list))
++;		 (s%rate (snd-srate first%sound)))
++;	    (snd-seq first%sound
++;		     #'(lambda (t0)
++;			 (format t "snd-seq applying lambda")
++;			 (with%environment
++;			   ,(the%environment) (setf *time* t0)     
++;			   (seq (force-srate s%rate ,(cadr list))
++;				,@(cddr list))))) ))))
++; 
++; 
++;(defmacro seqrep (pair sound)
++;  `(let ((,(car pair) 0)
++;         ($loop-count (1- ,(cadr pair))))
++;     (cond ((< 0 $loop-count)
++;            (seqrep2 ,(car pair) ,sound))
++;           ((= 0 $loop-count)
++;            ,sound)
++;           (t
++;            (snd-zero *time* *sound-srate*)))))
++; 
++; 
++;(defmacro seqrep2 (var sound)
++;  `(cond ((< ,var $loop-count)
++;          (seq (prog1 ,sound (setf ,var (1+ ,var)))
++;               (seqrep2 ,var ,sound)))
++;         ((= ,var $loop-count)
++;          ,sound)))
++
++
+ ; set-logical-stop - modify the sound and return it, time is shifted and
+ ;			 stretched
+ (defun set-logical-stop (snd tim)
+@@ -1532,4 +1634,4 @@
+ (defun osc-pulse (hz bias &optional (compare-shape *step-shape*))
+   (compare bias (osc-tri hz) compare-shape))
+ 
+-(setf NY:ALL 1000000000)
++
+--- audacity-1.2.1.orig/nyquist/seq.lsp
++++ audacity-1.2.1/nyquist/seq.lsp
+@@ -176,21 +176,18 @@
+              (error (format nil "Negative stretch factor in TIMED-SEQ: ~A" event)))
+             (t
+              (setf start-time (car event)))))
+-    (cond ((null score) (s-rest 0))
+-          (t
+-           (at (caar score)
+-               (seqrep (i (length score))
+-                 (cond ((cdr score)
+-                        (let (event)
+-                          (prog1
+-                            (set-logical-stop
+-                              (stretch (cadar score)
+-                              (setf event (eval (caddar score))))
+-                            (- (caadr score) (caar score)))
+-;                           (display "timed-seq" (caddar score) (local-to-global 0))
+-                            (setf score (cdr score)))))
+-                         (t
+-                          (stretch (cadar score) (eval (caddar score)))))))))))
++    (at (caar score)
++        (seqrep (i (length score))
++           (cond ((cdr score)
++                  (let (event)
++                   (prog1 
++                    (set-logical-stop (stretch (cadar score) 
++                                               (setf event (eval (caddar score))))
++                                      (- (caadr score) (caar score)))
++;                   (display "timed-seq" (caddar score) (local-to-global 0))
++                    (setf score (cdr score)))))
++                 (t
++                  (stretch (cadar score) (eval (caddar score)))))))))
+ 
+ 
+ 
+--- audacity-1.2.1.orig/nyquist/system.lsp
++++ audacity-1.2.1/nyquist/system.lsp
+@@ -1,23 +1,18 @@
+-; system.lsp -- machine/system-dependent definitions
++;; system.lsp -- system-dependent lisp code
+ 
+-;; default behavior is to call SETUP-CONSOLE to get large white typescript
+-;;
+-;; set *setup-console* to nil in your personal init.lsp to override this behavior 
+-;; (this may be necessary to work with emacs)
+-;;
+-(if (not (boundp '*setup-console*)) (setf *setup-console* t))
+-(if *setup-console* (setup-console))
++; local definition for play
++;  this one is for Linux:
+ 
+ (setf ny:bigendianp nil)
+ 
+ (if (not (boundp '*default-sf-format*))
+-    (setf *default-sf-format* snd-head-Wave))
++    (setf *default-sf-format* snd-head-wave))
+ 
+-;(if (not (boundp '*default-sound-file*))
+-;    (setf *default-sound-file* "temp.wav"))
++(if (not (boundp '*default-sound-file*))
++    (compute-default-sound-file))
+ 
+-;(if (not (boundp '*default-sf-dir*))
+-;    (setf *default-sf-dir* ""))
++(if (not (boundp '*default-sf-dir*))
++    (setf *default-sf-dir* "./"))
+ 
+ (if (not (boundp '*default-sf-mode*))
+     (setf *default-sf-mode* snd-head-mode-pcm))
+@@ -25,25 +20,8 @@
+ (if (not (boundp '*default-sf-bits*))
+     (setf *default-sf-bits* 16))
+ 
+-;(if (not (boundp '*default-plot-file*))
+-;    (setf *default-plot-file* "points.dat"))
+-
+-;(if (not (boundp '*plotscript-file*))
+-;    (setf *plotscript-file* "sys/unix/rs6k/plotscript"))
+-
+-; local definition for play
+-;(defmacro play (expr)
+-;  `(s-save-autonorm ,expr NY:ALL *default-sound-file* :play *soundenable*))
+-
+-
+-;(defun r ()
+-;  (s-save (s-read *default-sound-file*) NY:ALL "" :play t)
+-;)
+-
+-
+-; PLAY-FILE -- play a file
+-;(defun play-file (name)
+-;  (s-save (s-read name) NY:ALL "" :play t))
++(if (not (boundp '*default-plot-file*))
++    (setf *default-plot-file* "points.dat"))
+ 
+ 
+ ; FULL-NAME-P -- test if file name is a full path or relative path
+@@ -51,67 +29,52 @@
+ ; (otherwise the *default-sf-dir* will be prepended
+ ;
+ (defun full-name-p (filename)
+-  (or (eq (char filename 0) #\\)
+-      (eq (char filename 0) #\.)
+-      (and (> (length filename) 2)
+-         (both-case-p (char filename 0))
+-       (equal (char filename 1) #\:))))
++  (or (eq (char filename 0) #\/)
++      (eq (char filename 0) #\.)))
+ 
+-(setf *file-separator* #\\)
+ 
+-;(defun ny:load-file () (load "*.*"))
+-;(defun ny:reload-file () (load "*"))
++(setf *file-separator* #\/)
+ 
+ 
+-; save the standard function to write points to a file
+-;
+-;(setfn s-plot-points s-plot)
++;; PLAY-FILE - play a sound file
++;;
++(defun play-file (name)
++;;  (system (strcat "sndplay " (soundfilename name))))
++  (system (strcat "play " (soundfilename name) )))
++
++;; R - replay last file written with PLAY
++(defun r () (play-file *default-sound-file*))
++
++;;;; use this old version if you want to use sndplay to play
++;;;; the result file rather than play the samples as they
++;;;; are computed. This version does not autonormalize.
++;; PLAY - write value of an expression to file and play it
++;;
++;(defmacro play (expr)
++;  `(prog (specs)
++;	 (setf specs (s-save (force-srate *sound-srate* ,expr) 
++;			   1000000000 *default-sound-file*))
++;	 (r)))
++;;;;
+ 
+-;(defun array-max-abs (points)
+-;  (let ((m 0.0))
+-;        (dotimes (i (length points))
+-;          (setf m (max m (abs (aref points i)))))
+-;        m))
+-
+-;(setf graph-width 600)
+-;(setf graph-height 220)
+-
+-;(defun s-plot (snd &optional (n 600))
+-;  (show-graphics)
+-;  (clear-graphics)
+-;  (cond ((soundp snd)
+-;               (s-plot-2 snd n (/ graph-height 2) graph-height))
+-;              (t
+-;               (let ((gh (/ graph-height (length snd)))
+-;                     hs)
+-;                 (dotimes (i (length snd))
+-;                   (setf hs (s-plot-2 (aref snd i) n (+ (/ gh 2) (* i gh)) gh hs)))))))
+-;
+-;
+-;(defun s-plot-2 (snd n y-offset graph-height horizontal-scale)
+-;  (prog ((points (snd-samples snd n))
+-;                   maxpoint horizontal-scale vertical-scale)
+-;    (setf maxpoint (array-max-abs points))
+-;    (moveto 0 y-offset)
+-;    (lineto graph-width y-offset)
+-;    (moveto 0 y-offset)
+-;    (cond ((null horizontal-scale)
+-;               (setf horizontal-scale (/ (float graph-width) (length points)))))
+-;    (setf vertical-scale (- (/ (float graph-height) 2 maxpoint)))
+-;    (dotimes (i (length points))
+-;      (lineto (truncate (* horizontal-scale i))
+-;              (+ y-offset (truncate (* vertical-scale (aref points i))))))
+-;    (format t "X Axis: ~A to ~A (seconds)\n" (snd-t0 snd) (/ (length points) (snd-srate snd)))
+-;    (format t "Y Axis: ~A to ~A\n" (- maxpoint) maxpoint)
+-;    (format t "~A samples plotted.\n" (length points))
+-;    (return horizontal-scale)
+-;    ))
+-;
+-; S-EDIT - run the audio editor on a sound
+-;
+-;(defmacro s-edit (&optional expr)
+-;  `(prog ()
+-;         (if ,expr (s-save ,expr 1000000000 *default-sound-file*))
+-;         (system (format nil "audio_editor ~A &" 
+-;                         (soundfilename *default-sound-file*)))))
++; local definition for play
++(defmacro play (expr)
++  `(s-save-autonorm ,expr NY:ALL *default-sound-file* :play *soundenable*))
++
++;; for Linux, modify s-plot (defined in nyquist.lsp) by saving s-plot
++;; in standard-s-plot, then call gnuplot to display the points.
++;;
++;; we also need to save the location of this file so we can find
++;; nyquist-plot.txt, the command file for gnuplot
++;;
++(setf *runtime-path* (current-path))
++(display "system.lsp" *runtime-path*)
++
++(setfn standard-s-plot s-plot)
++
++(defun s-plot (s)
++  (let (plot-file)
++    (standard-s-plot s) ;; this calculates the data points
++    (setf plot-file (strcat *runtime-path* "nyquist-plot.txt"))
++    (system (strcat "gnuplot -persist " plot-file))))
+ 
+--- audacity-1.2.1.orig/nyquist/fileio.lsp
++++ audacity-1.2.1/nyquist/fileio.lsp
+@@ -0,0 +1,204 @@
++;; s-save -- saves a file
++(setf NY:ALL 1000000000)	; 1GIG constant for maxlen
++(defmacro s-save (expression &optional (maxlen NY:ALL) filename 
++                  &key (format '*default-sf-format*)
++                  (mode '*default-sf-mode*) (bits '*default-sf-bits*)
++                  (endian NIL) ; nil, :big, or :little -- specifies file format
++                  (play nil))
++  `(let ((ny:fname ,filename)
++         (ny:maxlen ,maxlen)
++         (ny:endian ,endian)
++         (ny:swap 0))
++     ; allow caller to omit maxlen, in which case the filename will
++     ; be a string in the maxlen parameter position and filename will be null
++     (cond ((null ny:fname)
++                 (cond ((stringp ny:maxlen)
++                            (setf ny:fname ny:maxlen)
++                            (setf ny:maxlen NY:ALL))
++                           (t
++                            (setf ny:fname *default-sound-file*)))))
++     
++     (cond ((equal ny:fname "")
++                 (cond ((not ,play)
++                       (format t "s-save: no file to write! play option is off!\n"))))
++           (t
++            (setf ny:fname (soundfilename ny:fname))
++            (format t "Saving sound file to ~A~%" ny:fname)))
++     (cond ((eq ny:endian :big)
++            (setf ny:swap (if ny:bigendianp 0 1)))
++           ((eq ny:endian :little)
++            (setf ny:swap (if ny:bigendianp 1 0))))
++     (snd-save ',expression ny:maxlen ny:fname ,format ,mode ,bits ny:swap ,play)))
++
++(defmacro s-save-autonorm (expression &rest arglist)
++  `(let ((peak (s-save (scale *autonorm* ,expression) ,@arglist)))
++     (autonorm-update peak)))
++
++;; The "AutoNorm" facility: when you play something, the Nyquist play
++;; command will automatically compute what normalization factor you
++;; should have used. If you play the same thing again, the normalization
++;; factor is automatically applied.
++;;
++;; Call AUTONORM-OFF to turn off this feature, and AUTONORM-ON to turn
++;; it back on.
++;;
++;; *autonorm-target* is the peak value we're aiming for (it's set below 1
++;; so allow the next signal to get slightly louder without clipping)
++;;
++(setf *autonorm-target* 0.9)
++
++(defun autonorm-on ()
++  (setf *autonorm* 1.0)
++  (setf *autonorm-previous-peak* 1.0)
++  (setf *autonormflag* t)
++  (format t "AutoNorm feature is on.~%"))
++
++(if (not (boundp '*autonormflag*)) (autonorm-on))
++
++(defun autonorm-off ()
++  (setf *autonormflag* nil)
++  (setf *autonorm* 1.0)
++  (format t "AutoNorm feature is off.~%"))
++
++(defun autonorm-update (peak)
++  (cond ((and *autonormflag* (> peak 0.0))
++           (setf *autonorm-previous-peak* (/ peak *autonorm*))
++         (setf *autonorm* (/ *autonorm-target* *autonorm-previous-peak*))
++         (format t "AutoNorm: peak was ~A,~%" *autonorm-previous-peak*)
++         (format t "     peak after normalization was ~A,~%" peak)
++         (format t "     new normalization factor is ~A~%" *autonorm*)
++         *autonorm-previous-peak*
++        )
++        (t peak)
++  ))
++
++;; s-read -- reads a file
++(defun s-read (filename &key (time-offset 0) (srate *sound-srate*)
++        (dur 10000.0) (nchans 1) (format *default-sf-format*)
++        (mode *default-sf-mode*) (bits *default-sf-bits*) (endian NIL))
++  (let ((swap 0))
++    (cond ((eq endian :big)
++           (setf swap (if ny:bigendianp 0 1)))
++          ((eq endian :little)
++           (setf swap (if ny:bigendianp 1 0))))
++    (snd-read (soundfilename filename) time-offset
++            (local-to-global 0) format nchans mode bits swap srate
++            dur)))
++
++;; SF-INFO -- print sound file info
++;;
++(defun sf-info (filename)
++  (let (s format channels mode bits srate dur flags)
++    (format t "~A:~%" (soundfilename filename))
++    (setf s (s-read filename))
++    (setf format (car *rslt*))
++    (setf channels (cadr *rslt*))
++    (setf mode (caddr *rslt*))
++    (setf bits (cadddr *rslt*))
++    (setf *rslt* (cddddr *rslt*))
++    (setf srate (car *rslt*))
++    (setf dur (cadr *rslt*))
++    (setf flags (caddr *rslt*))
++    (format t "Format: ~A~%" 
++            (nth format '("none" "AIFF" "IRCAM" "NeXT" "Wave")))
++    (cond ((setp (logand flags snd-head-channels))
++           (format t "Channels: ~A~%" channels)))
++    (cond ((setp (logand flags snd-head-mode))
++           (format t "Mode: ~A~%"
++                   (nth mode '("ADPCM" "PCM" "uLaw" "aLaw" "Float" "UPCM")))))
++    (cond ((setp (logand flags snd-head-bits))
++           (format t "Bits/Sample: ~A~%" bits)))
++    (cond ((setp (logand flags snd-head-srate))
++           (format t "SampleRate: ~A~%" srate)))
++    (cond ((setp (logand flags snd-head-dur))
++           (format t "Duration: ~A~%" dur)))
++    ))
++
++;; SETP -- tests whether a bit is set (non-zero)
++;
++(defun setp (bits) (not (zerop bits)))
++
++;; SOUNDFILENAME -- add default directory to name to get filename
++;;
++(defun soundfilename (filename)
++  (cond ((= 0 (length filename))
++         (break "filename must be at least one character long" filename))
++        ((full-name-p filename))
++        (t
++         ; if sf-dir nonempty and does not end with filename separator,
++         ; append one
++         (cond ((and (< 0 (length *default-sf-dir*))
++                     (not (eq (char *default-sf-dir* 
++                                    (1- (length *default-sf-dir*)))
++                              *file-separator*)))
++                (setf *default-sf-dir* (strcat *default-sf-dir* (string *file-separator*)))
++                (format t "Warning: appending \"~A\" to *default-sf-dir*~%"
++                        *file-separator*)))
++         (setf filename (strcat *default-sf-dir* (string filename)))))
++  filename)
++
++
++(setfn s-read-format car)
++(setfn s-read-channels cadr)
++(setfn s-read-mode caddr)
++(setfn s-read-bits cadddr)
++(defun s-read-swap (rslt) (car (cddddr rslt)))
++(defun s-read-srate (rslt) (cadr (cddddr rslt)))
++(defun s-read-dur (rslt) (caddr (cddddr rslt)))
++(defun s-read-byte-offset (rslt) (car (cddddr (cddddr rslt))))
++(defun round (x) (truncate (+ 0.5 x)))
++
++;; change defaults for PLAY macro:
++(setf *soundenable* t)
++(defun sound-on () (setf *soundenable* t))
++(defun sound-off () (setf *soundenable* nil))
++
++(defmacro s-add-to (expr maxlen filename &optional time-offset)
++  `(let ((ny:fname (soundfilename ,filename))
++         ny:input ny:rslt ny:offset
++         )
++     (cond ((setf ny:input (s-read ny:fname :time-offset ,time-offset))
++            (setf ny:rslt *rslt*)
++            (format t "Adding sound to ~A at offset ~A~%" 
++                    ny:fname ,time-offset)
++            (setf ny:offset (s-read-byte-offset ny:rslt))
++
++            (snd-overwrite '(let ((ny:addend ,expr))
++                              (sum (snd-coterm
++                                    (s-read ny:fname :time-offset ,time-offset)
++                                    ny:addend)
++                                 ny:addend))
++                           ,maxlen ny:fname ny:offset 
++                           (s-read-mode ny:rslt) (s-read-bits ny:rslt)
++                           (s-read-srate ny:rslt) (s-read-channels ny:rslt))
++            (format t "Duration written: ~A~%" (car *rslt*)))
++           ((setf ny:input (s-read ny:fname :time-offset 0))
++            (format t "Could not open ~A at time offset ~A~%" 
++                    ny:fname ,time-offset))
++           (t
++            (format t "Could not open ~A~%" ny:fname)))))
++
++
++(defmacro s-overwrite (expr maxlen filename &optional time-offset)
++  `(let ((ny:fname (soundfilename ,filename))
++         ny:input ny:rslt ny:offset)
++         (setf ny:offset ,time-offset)
++         (cond ((null ny:offset) (setf ny:offset 0)))
++     (cond ((setf ny:input (s-read ny:fname :time-offset ny:offset))
++            (setf ny:rslt *rslt*)
++            (format t "Overwriting ~A at offset ~A~%" ny:fname ny:offset)
++            (setf ny:offset (s-read-byte-offset ny:rslt))
++                (display "s-overwrite" ny:offset)
++            (snd-overwrite `,expr ,maxlen ny:fname ny:offset
++                           (s-read-format ny:rslt)
++                           (s-read-mode ny:rslt) (s-read-bits ny:rslt)
++                           (s-read-swap ny:rslt)
++                           (s-read-srate ny:rslt) (s-read-channels ny:rslt))
++            (format t "Duration written: ~A~%" (car *rslt*)))
++           ((s-read ny:fname :time-offset 0)
++            (format t "Could not open ~A at time offset ~A~%" 
++                    ny:fname ,time-offset))
++           (t
++            (format t "Could not open ~A~%" ny:fname)))))
++
++
+--- audacity-1.2.1.orig/nyquist/nyquist-plot.txt
++++ audacity-1.2.1/nyquist/nyquist-plot.txt
+@@ -0,0 +1,3 @@
++set nokey
++plot "points.dat" with lines
++
Index: plugins/audacity/plug-ins/Makefile.am
===================================================================
--- plugins/audacity/plug-ins/Makefile.am	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
+++ plugins/audacity/plug-ins/Makefile.am	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
@@ -0,0 +1,1 @@
+EXTRA_DIST = aubioonset.ny 
Index: plugins/audacity/plug-ins/Makefile.in
===================================================================
--- plugins/audacity/plug-ins/Makefile.in	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
+++ plugins/audacity/plug-ins/Makefile.in	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
@@ -0,0 +1,303 @@
+# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FFTWLIB_CFLAGS = @FFTWLIB_CFLAGS@
+FFTWLIB_LIBS = @FFTWLIB_LIBS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JACK_CFLAGS = @JACK_CFLAGS@
+JACK_LIBS = @JACK_LIBS@
+LADCCA_CFLAGS = @LADCCA_CFLAGS@
+LADCCA_LIBS = @LADCCA_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@
+SAMPLERATE_LIBS = @SAMPLERATE_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNDLIB_CFLAGS = @SNDLIB_CFLAGS@
+SNDLIB_LIBS = @SNDLIB_LIBS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_DIST = aubioonset.ny 
+subdir = plugins/audacity/plug-ins
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  plugins/audacity/plug-ins/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Index: plugins/audacity/plug-ins/aubioonset.ny
===================================================================
--- plugins/audacity/plug-ins/aubioonset.ny	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
+++ plugins/audacity/plug-ins/aubioonset.ny	(revision 96fb8ad625b1b62c2551bd98a7af1aa3f00307f6)
@@ -0,0 +1,45 @@
+;nyquist plug-in
+;version 1
+;type analyze
+;name "Onset Detection..."
+;action "Generate onset label track using aubioonset..."
+;info "Aubio onset detector:\n Generates a label track with markers at the beginning of audio events"
+;control threshold "Detection threshold" real "[0.001-0.900...]" 0.1 0.001 1.0
+
+; largest number of samples 
+(setf largenumber 1000000000) 
+; some temporary files
+(setf infile "/tmp/test.wav")
+(setf tmfile "/tmp/test.txt")
+; our command lines
+(setf aubiocmd (strcat "aubioonset -t " (ftoa threshold) " -i " infile " > " tmfile))
+(setf deletcmd "rm -f /tmp/test.wav /tmp/test.txt")
+
+; save current selection in /tmp
+; bug: should check the sound is mono
+(s-save s (snd-length s largenumber) "/tmp/test.wav")
+; run aubio
+(system aubiocmd)
+
+; read the file and build the list of label in result
+(let* (
+	(fp (open "/tmp/test.txt"  :direction :input))
+ 	(result '())
+	(n 1)
+ 	(c (read-line fp))
+      )
+ (read-line fp)
+ (while (not (not c))
+   (setq result 
+	(append
+	result
+	(list (list (atof c) ""))
+ 	))
+   (setf c (read-line fp))
+   (setq n (+ n 1))
+  )
+(close fp)
+(system deletcmd)
+;uncomment to debug
+;(print result) 
+result)
