aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-10-08 01:06:18 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-10-08 01:06:18 +0000
commit680fe2637842731e3d28cbbc47349a32faee374b (patch)
treee26fc560e6541b3c4c0e7d3b8eea468c84b833ce /externals
parent5aeafcb5b77b06ef6e14d140db81bd79b2f173c4 (diff)
deleting botched copies/tags
svn path=/trunk/; revision=16360
Diffstat (limited to 'externals')
-rw-r--r--externals/extra/0.43.2/LICENSE.txt378
-rw-r--r--externals/extra/0.43.2/Makefile263
-rw-r--r--externals/extra/0.43.2/README.txt30
-rw-r--r--externals/extra/0.43.2/bonk~/bonk~-help.pd209
-rw-r--r--externals/extra/0.43.2/bonk~/bonk~.c1638
-rw-r--r--externals/extra/0.43.2/bonk~/templates.txt4
-rw-r--r--externals/extra/0.43.2/choice/choice-help.pd58
-rw-r--r--externals/extra/0.43.2/choice/choice.c128
-rw-r--r--externals/extra/0.43.2/complex-mod~-help.pd26
-rw-r--r--externals/extra/0.43.2/complex-mod~.pd30
-rw-r--r--externals/extra/0.43.2/debian/changelog5
-rw-r--r--externals/extra/0.43.2/debian/compat1
-rw-r--r--externals/extra/0.43.2/debian/control35
-rw-r--r--externals/extra/0.43.2/debian/copyright63
-rw-r--r--externals/extra/0.43.2/debian/gbp.conf7
-rw-r--r--externals/extra/0.43.2/debian/links1
-rwxr-xr-xexternals/extra/0.43.2/debian/rules15
-rw-r--r--externals/extra/0.43.2/debian/source/format1
-rw-r--r--externals/extra/0.43.2/debian/watch2
-rw-r--r--externals/extra/0.43.2/expr-help.pd497
-rw-r--r--externals/extra/0.43.2/expr~/LICENSE.txt165
-rw-r--r--externals/extra/0.43.2/expr~/README.txt97
-rw-r--r--externals/extra/0.43.2/expr~/fts_to_pd.h41
-rw-r--r--externals/extra/0.43.2/expr~/vexp.c2142
-rw-r--r--externals/extra/0.43.2/expr~/vexp.h248
-rw-r--r--externals/extra/0.43.2/expr~/vexp_fun.c1315
-rw-r--r--externals/extra/0.43.2/expr~/vexp_if.c1225
-rw-r--r--externals/extra/0.43.2/extra-meta.pd7
-rw-r--r--externals/extra/0.43.2/fiddle~/fiddle~-help.pd142
-rw-r--r--externals/extra/0.43.2/fiddle~/fiddle~.c1851
-rw-r--r--externals/extra/0.43.2/hilbert~-help.pd18
-rw-r--r--externals/extra/0.43.2/hilbert~.pd27
-rw-r--r--externals/extra/0.43.2/loop~/loop~-help.pd74
-rw-r--r--externals/extra/0.43.2/loop~/loop~.c169
-rw-r--r--externals/extra/0.43.2/loop~/test-loop~.pd58
-rw-r--r--externals/extra/0.43.2/lrshift~/lrshift~-help.pd33
-rw-r--r--externals/extra/0.43.2/lrshift~/lrshift~.c76
-rw-r--r--externals/extra/0.43.2/pd~/notes.txt8
-rw-r--r--externals/extra/0.43.2/pd~/pdsched.c106
-rw-r--r--externals/extra/0.43.2/pd~/pd~-help.pd75
-rw-r--r--externals/extra/0.43.2/pd~/pd~-subprocess.pd60
-rw-r--r--externals/extra/0.43.2/pd~/pd~.c771
-rw-r--r--externals/extra/0.43.2/pd~/z.pd15
-rw-r--r--externals/extra/0.43.2/pique/pique-help.pd33
-rw-r--r--externals/extra/0.43.2/pique/pique.c243
-rw-r--r--externals/extra/0.43.2/rev1-final.pd106
-rw-r--r--externals/extra/0.43.2/rev1-stage.pd99
-rw-r--r--externals/extra/0.43.2/rev1~-help.pd119
-rw-r--r--externals/extra/0.43.2/rev1~.pd64
-rw-r--r--externals/extra/0.43.2/rev2~-help.pd134
-rw-r--r--externals/extra/0.43.2/rev2~.pd237
-rw-r--r--externals/extra/0.43.2/rev3~-help.pd136
-rw-r--r--externals/extra/0.43.2/rev3~.pd439
-rw-r--r--externals/extra/0.43.2/sigmund~/sigmund~-help.pd194
-rw-r--r--externals/extra/0.43.2/sigmund~/sigmund~.c1655
-rw-r--r--externals/extra/0.43.2/stdout/stdout-help.pd19
-rw-r--r--externals/extra/0.43.2/stdout/stdout.c50
-rw-r--r--externals/extra/0.43.3/0.43.2/LICENSE.txt378
-rw-r--r--externals/extra/0.43.3/0.43.2/Makefile263
-rw-r--r--externals/extra/0.43.3/0.43.2/README.txt30
-rw-r--r--externals/extra/0.43.3/0.43.2/bonk~/bonk~-help.pd209
-rw-r--r--externals/extra/0.43.3/0.43.2/bonk~/bonk~.c1638
-rw-r--r--externals/extra/0.43.3/0.43.2/bonk~/templates.txt4
-rw-r--r--externals/extra/0.43.3/0.43.2/choice/choice-help.pd58
-rw-r--r--externals/extra/0.43.3/0.43.2/choice/choice.c128
-rw-r--r--externals/extra/0.43.3/0.43.2/complex-mod~-help.pd26
-rw-r--r--externals/extra/0.43.3/0.43.2/complex-mod~.pd30
-rw-r--r--externals/extra/0.43.3/0.43.2/debian/changelog5
-rw-r--r--externals/extra/0.43.3/0.43.2/debian/compat1
-rw-r--r--externals/extra/0.43.3/0.43.2/debian/control35
-rw-r--r--externals/extra/0.43.3/0.43.2/debian/copyright63
-rw-r--r--externals/extra/0.43.3/0.43.2/debian/gbp.conf7
-rw-r--r--externals/extra/0.43.3/0.43.2/debian/links1
-rwxr-xr-xexternals/extra/0.43.3/0.43.2/debian/rules15
-rw-r--r--externals/extra/0.43.3/0.43.2/debian/source/format1
-rw-r--r--externals/extra/0.43.3/0.43.2/debian/watch2
-rw-r--r--externals/extra/0.43.3/0.43.2/expr-help.pd497
-rw-r--r--externals/extra/0.43.3/0.43.2/expr~/LICENSE.txt165
-rw-r--r--externals/extra/0.43.3/0.43.2/expr~/README.txt97
-rw-r--r--externals/extra/0.43.3/0.43.2/expr~/fts_to_pd.h41
-rw-r--r--externals/extra/0.43.3/0.43.2/expr~/vexp.c2142
-rw-r--r--externals/extra/0.43.3/0.43.2/expr~/vexp.h248
-rw-r--r--externals/extra/0.43.3/0.43.2/expr~/vexp_fun.c1315
-rw-r--r--externals/extra/0.43.3/0.43.2/expr~/vexp_if.c1225
-rw-r--r--externals/extra/0.43.3/0.43.2/extra-meta.pd7
-rw-r--r--externals/extra/0.43.3/0.43.2/fiddle~/fiddle~-help.pd142
-rw-r--r--externals/extra/0.43.3/0.43.2/fiddle~/fiddle~.c1851
-rw-r--r--externals/extra/0.43.3/0.43.2/hilbert~-help.pd18
-rw-r--r--externals/extra/0.43.3/0.43.2/hilbert~.pd27
-rw-r--r--externals/extra/0.43.3/0.43.2/loop~/loop~-help.pd74
-rw-r--r--externals/extra/0.43.3/0.43.2/loop~/loop~.c169
-rw-r--r--externals/extra/0.43.3/0.43.2/loop~/test-loop~.pd58
-rw-r--r--externals/extra/0.43.3/0.43.2/lrshift~/lrshift~-help.pd33
-rw-r--r--externals/extra/0.43.3/0.43.2/lrshift~/lrshift~.c76
-rw-r--r--externals/extra/0.43.3/0.43.2/pd~/notes.txt8
-rw-r--r--externals/extra/0.43.3/0.43.2/pd~/pdsched.c106
-rw-r--r--externals/extra/0.43.3/0.43.2/pd~/pd~-help.pd75
-rw-r--r--externals/extra/0.43.3/0.43.2/pd~/pd~-subprocess.pd60
-rw-r--r--externals/extra/0.43.3/0.43.2/pd~/pd~.c771
-rw-r--r--externals/extra/0.43.3/0.43.2/pd~/z.pd15
-rw-r--r--externals/extra/0.43.3/0.43.2/pique/pique-help.pd33
-rw-r--r--externals/extra/0.43.3/0.43.2/pique/pique.c243
-rw-r--r--externals/extra/0.43.3/0.43.2/rev1-final.pd106
-rw-r--r--externals/extra/0.43.3/0.43.2/rev1-stage.pd99
-rw-r--r--externals/extra/0.43.3/0.43.2/rev1~-help.pd119
-rw-r--r--externals/extra/0.43.3/0.43.2/rev1~.pd64
-rw-r--r--externals/extra/0.43.3/0.43.2/rev2~-help.pd134
-rw-r--r--externals/extra/0.43.3/0.43.2/rev2~.pd237
-rw-r--r--externals/extra/0.43.3/0.43.2/rev3~-help.pd136
-rw-r--r--externals/extra/0.43.3/0.43.2/rev3~.pd439
-rw-r--r--externals/extra/0.43.3/0.43.2/sigmund~/sigmund~-help.pd194
-rw-r--r--externals/extra/0.43.3/0.43.2/sigmund~/sigmund~.c1655
-rw-r--r--externals/extra/0.43.3/0.43.2/stdout/stdout-help.pd19
-rw-r--r--externals/extra/0.43.3/0.43.2/stdout/stdout.c50
-rw-r--r--externals/extra/0.43.3/LICENSE.txt378
-rw-r--r--externals/extra/0.43.3/Makefile263
-rw-r--r--externals/extra/0.43.3/README.txt30
-rw-r--r--externals/extra/0.43.3/bonk~/bonk~-help.pd209
-rw-r--r--externals/extra/0.43.3/bonk~/bonk~.c1638
-rw-r--r--externals/extra/0.43.3/bonk~/templates.txt4
-rw-r--r--externals/extra/0.43.3/choice/choice-help.pd58
-rw-r--r--externals/extra/0.43.3/choice/choice.c128
-rw-r--r--externals/extra/0.43.3/complex-mod~-help.pd26
-rw-r--r--externals/extra/0.43.3/complex-mod~.pd30
-rw-r--r--externals/extra/0.43.3/debian/changelog5
-rw-r--r--externals/extra/0.43.3/debian/compat1
-rw-r--r--externals/extra/0.43.3/debian/control35
-rw-r--r--externals/extra/0.43.3/debian/copyright63
-rw-r--r--externals/extra/0.43.3/debian/gbp.conf7
-rw-r--r--externals/extra/0.43.3/debian/links1
-rwxr-xr-xexternals/extra/0.43.3/debian/rules15
-rw-r--r--externals/extra/0.43.3/debian/source/format1
-rw-r--r--externals/extra/0.43.3/debian/watch2
-rw-r--r--externals/extra/0.43.3/expr-help.pd497
-rw-r--r--externals/extra/0.43.3/expr~/LICENSE.txt165
-rw-r--r--externals/extra/0.43.3/expr~/README.txt97
-rw-r--r--externals/extra/0.43.3/expr~/fts_to_pd.h41
-rw-r--r--externals/extra/0.43.3/expr~/vexp.c2142
-rw-r--r--externals/extra/0.43.3/expr~/vexp.h248
-rw-r--r--externals/extra/0.43.3/expr~/vexp_fun.c1315
-rw-r--r--externals/extra/0.43.3/expr~/vexp_if.c1225
-rw-r--r--externals/extra/0.43.3/extra-meta.pd7
-rw-r--r--externals/extra/0.43.3/fiddle~/fiddle~-help.pd142
-rw-r--r--externals/extra/0.43.3/fiddle~/fiddle~.c1851
-rw-r--r--externals/extra/0.43.3/hilbert~-help.pd18
-rw-r--r--externals/extra/0.43.3/hilbert~.pd27
-rw-r--r--externals/extra/0.43.3/loop~/loop~-help.pd74
-rw-r--r--externals/extra/0.43.3/loop~/loop~.c169
-rw-r--r--externals/extra/0.43.3/loop~/test-loop~.pd58
-rw-r--r--externals/extra/0.43.3/lrshift~/lrshift~-help.pd33
-rw-r--r--externals/extra/0.43.3/lrshift~/lrshift~.c76
-rw-r--r--externals/extra/0.43.3/pd~/notes.txt8
-rw-r--r--externals/extra/0.43.3/pd~/pdsched.c106
-rw-r--r--externals/extra/0.43.3/pd~/pd~-help.pd75
-rw-r--r--externals/extra/0.43.3/pd~/pd~-subprocess.pd60
-rw-r--r--externals/extra/0.43.3/pd~/pd~.c771
-rw-r--r--externals/extra/0.43.3/pd~/z.pd15
-rw-r--r--externals/extra/0.43.3/pique/pique-help.pd33
-rw-r--r--externals/extra/0.43.3/pique/pique.c243
-rw-r--r--externals/extra/0.43.3/rev1-final.pd106
-rw-r--r--externals/extra/0.43.3/rev1-stage.pd99
-rw-r--r--externals/extra/0.43.3/rev1~-help.pd119
-rw-r--r--externals/extra/0.43.3/rev1~.pd64
-rw-r--r--externals/extra/0.43.3/rev2~-help.pd134
-rw-r--r--externals/extra/0.43.3/rev2~.pd237
-rw-r--r--externals/extra/0.43.3/rev3~-help.pd136
-rw-r--r--externals/extra/0.43.3/rev3~.pd439
-rw-r--r--externals/extra/0.43.3/sigmund~/sigmund~-help.pd194
-rw-r--r--externals/extra/0.43.3/sigmund~/sigmund~.c1655
-rw-r--r--externals/extra/0.43.3/stdout/stdout-help.pd19
-rw-r--r--externals/extra/0.43.3/stdout/stdout.c50
171 files changed, 0 insertions, 46926 deletions
diff --git a/externals/extra/0.43.2/LICENSE.txt b/externals/extra/0.43.2/LICENSE.txt
deleted file mode 100644
index bb6c6e6e..00000000
--- a/externals/extra/0.43.2/LICENSE.txt
+++ /dev/null
@@ -1,378 +0,0 @@
-
-Most of the code is covered by a BSD license, but the 'expr' code is covered by a GPL license:
-
-------------------------------------------------------------------------------
-
-This software is copyrighted by Miller Puckette and others. The following
-terms (the "Standard Improved BSD License") apply to all files associated with
-the software unless explicitly disclaimed in individual files:
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-3. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior
- written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
-
-------------------------------------------------------------------------------
-
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/externals/extra/0.43.2/Makefile b/externals/extra/0.43.2/Makefile
deleted file mode 100644
index e3b0e63e..00000000
--- a/externals/extra/0.43.2/Makefile
+++ /dev/null
@@ -1,263 +0,0 @@
-# To use this Makefile for your project, first put the name of your library in
-# LIBRARY_NAME variable. The folder for your project should have the same name
-# as your library.
-LIBRARY_NAME = extra
-
-# Next, add your source files to the SOURCES variable.
-SOURCES = bonk~/bonk~.c choice/choice.c fiddle~/fiddle~.c loop~/loop~.c lrshift~/lrshift~.c pique/pique.c sigmund~/sigmund~.c stdout/stdout.c
-
-# For objects that only build on certain platforms, add those to the SOURCES
-# line for the right platforms.
-SOURCES_Darwin = pd~/pd~.c
-SOURCES_Linux = pd~/pd~.c
-
-# include these abstractions with their help patches
-PD_OBJECTS = complex-mod~.pd hilbert~.pd rev1~.pd rev2~.pd rev3~.pd
-
-# these are meant to be customizable
-CFLAGS = -Wall -W -g
-LDFLAGS =
-
-#------------------------------------------------------------------------------#
-#
-# you shouldn't need to edit anything below here, if we did it right :)
-#
-#------------------------------------------------------------------------------#
-
-# where Pd lives
-PD_PATH = ../../pd
-# where to install the library
-prefix = /usr/local
-libdir = $(prefix)/lib
-pkglibdir = $(libdir)/pd-externals
-objectsdir = $(pkglibdir)
-
-ALL_CFLAGS = -DPD -I$(PD_PATH)/src
-ALL_LDFLAGS =
-LIBS =
-
-LN_S = ln -s
-
-INSTALL = install
-INSTALL_PROGRAM = $(INSTALL) -p -m 644
-INSTALL_DATA = $(INSTALL) -p -m 644
-INSTALL_DIR = $(INSTALL) -p -m 755 -d
-
-UNAME := $(shell uname -s)
-ifeq ($(UNAME),Darwin)
- SOURCES += $(SOURCES_Darwin)
- EXTENSION = pd_darwin
- OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast
- FAT_FLAGS = -arch i386 -arch ppc -mmacosx-version-min=10.4
- ALL_CFLAGS += -fPIC $(FAT_FLAGS)
- ALL_LDFLAGS += -bundle -undefined dynamic_lookup $(FAT_FLAGS)
- LIBS += -lc -lm
- STRIP = strip -x
- endif
-ifeq ($(UNAME),Linux)
- SOURCES += $(SOURCES_Linux)
- EXTENSION = pd_linux
- OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
- ALL_CFLAGS += -fPIC
- ALL_LDFLAGS += -Wl,--export-dynamic -shared -fPIC
- LIBS += -lc
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-ifeq ($(UNAME),GNU)
- # GNU/Hurd, should work like GNU/Linux for basically all externals
- SOURCES += $(SOURCES_linux)
- EXTENSION = pd_linux
- OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
- ALL_CFLAGS += -fPIC
- ALL_LDFLAGS += -Wl,--export-dynamic -shared -fPIC
- LIBS += -lc
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-ifeq ($(UNAME),GNU/kFreeBSD)
- # Debian GNU/kFreeBSD, should work like GNU/Linux for basically all externals
- SOURCES += $(SOURCES_linux)
- EXTENSION = pd_linux
- OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
- ALL_CFLAGS += -fPIC
- ALL_LDFLAGS += -Wl,--export-dynamic -shared -fPIC
- LIBS += -lc
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME)))
-# SOURCES += $(SOURCES_Linux)
- EXTENSION = dll
- OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
- ALL_CFLAGS += -fPIC
- ALL_LDFLAGS += -L$(PD_PATH)/src -Wl,--export-dynamic -shared -fPIC
- LIBS += -lc -lpd
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-ifeq (MINGW,$(findstring MINGW,$(UNAME)))
- SOURCES += $(SOURCES_Windows)
- EXTENSION = dll
- CC=gcc
- OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer -march=i686 -mtune=pentium4
- WINDOWS_HACKS = -D'O_NONBLOCK=1'
- ALL_CFLAGS += -mms-bitfields $(WINDOWS_HACKS)
- ALL_LDFLAGS += -s -shared -Wl,--enable-auto-import
- LIBS += -L$(PD_PATH)/src -lpd -lwsock32 -lkernel32 -luser32 -lgdi32
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-
-ALL_CFLAGS += $(OPT_CFLAGS)
-
-
-.PHONY = install libdir_install single_install install-doc install-exec clean dist etags
-
-# kludges for objects with strange build requirements
-EXPR_OBJECTS = expr~/expr~.$(EXTENSION) fexpr~.$(EXTENSION) expr.$(EXTENSION)
-# special cases, where there are multiple .c files for a single class
-EXPR_SOURCES = expr~/vexp.c expr~/vexp_fun.c expr~/vexp_if.c
-
-
-# get library version from meta file
-LIBRARY_VERSION = $(shell sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' $(LIBRARY_NAME)-meta.pd)
-DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION)
-ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION)
-
-
-all: $(SOURCES:.c=.$(EXTENSION)) $(EXPR_OBJECTS) pd~/pdsched.$(EXTENSION)
-
-%.o: %.c
- $(CC) $(ALL_CFLAGS) $(CFLAGS) -o "$*.o" -c "$*.c"
-
-%.$(EXTENSION): %.o
- $(CC) $(ALL_LDFLAGS) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS)
- chmod a-x "$*.$(EXTENSION)"
-
-
-expr~/expr~.$(EXTENSION): $(EXPR_SOURCES:.c=.o)
- $(CC) $(ALL_LDFLAGS) $(LDFLAGS) -o expr~/expr~.$(EXTENSION) $(EXPR_SOURCES:.c=.o) $(LIBS)
- chmod a-x expr~/expr~.$(EXTENSION)
-
-expr.$(EXTENSION): expr~/expr~.$(EXTENSION)
- test -e expr.$(EXTENSION) || \
- $(LN_S) expr~/expr~.$(EXTENSION) expr.$(EXTENSION)
-
-fexpr~.$(EXTENSION): expr~/expr~.$(EXTENSION)
- test -e fexpr~.$(EXTENSION) || \
- $(LN_S) expr~/expr~.$(EXTENSION) fexpr~.$(EXTENSION)
-
-install: all install-doc install-exec install-special
-
-# install all the weird old kludgey build stuff here
-install-special:
- $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) extra-meta.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(EXPR_OBJECTS) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(SOURCES:.c=-help.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) rev1-final.pd rev1-stage.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) expr-help.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/*.$(EXTENSION)
-
-install-doc:
- $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(SOURCES:.c=-help.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(PD_OBJECTS:.pd=-help.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) pd~/pd~-subprocess.pd pd~/z.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) README.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt
-
-install-exec:
- $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(PD_OBJECTS) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) pd~/pdsched.$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
-
-dist:
- $(INSTALL_DIR) $(DISTDIR)
- $(INSTALL_DATA) Makefile $(DISTDIR)
- $(INSTALL_DATA) README.txt $(DISTDIR)
- $(INSTALL_DATA) LICENSE.txt $(DISTDIR)
- $(INSTALL_DATA) extra-meta.pd $(DISTDIR)
- $(INSTALL_DATA) complex-mod~-help.pd $(DISTDIR)
- $(INSTALL_DATA) complex-mod~.pd $(DISTDIR)
- $(INSTALL_DATA) hilbert~-help.pd $(DISTDIR)
- $(INSTALL_DATA) hilbert~.pd $(DISTDIR)
- $(INSTALL_DATA) rev1-final.pd $(DISTDIR)
- $(INSTALL_DATA) rev1~-help.pd $(DISTDIR)
- $(INSTALL_DATA) rev1~.pd $(DISTDIR)
- $(INSTALL_DATA) rev1-stage.pd $(DISTDIR)
- $(INSTALL_DATA) rev2~-help.pd $(DISTDIR)
- $(INSTALL_DATA) rev2~.pd $(DISTDIR)
- $(INSTALL_DATA) rev3~-help.pd $(DISTDIR)
- $(INSTALL_DATA) rev3~.pd $(DISTDIR)
- $(INSTALL_DATA) expr-help.pd $(DISTDIR)
- $(INSTALL_DIR) $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/fts_to_pd.h $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/LICENSE.txt $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/README.txt $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/vexp.c $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/vexp_fun.c $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/vexp.h $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/vexp_if.c $(DISTDIR)/expr~
- $(INSTALL_DIR) $(DISTDIR)/bonk~
- $(INSTALL_DATA) bonk~/bonk~.c $(DISTDIR)/bonk~
- $(INSTALL_DATA) bonk~/bonk~-help.pd $(DISTDIR)/bonk~
- $(INSTALL_DATA) bonk~/templates.txt $(DISTDIR)/bonk~
- $(INSTALL_DIR) $(DISTDIR)/choice
- $(INSTALL_DATA) choice/choice.c $(DISTDIR)/choice
- $(INSTALL_DATA) choice/choice-help.pd $(DISTDIR)/choice
- $(INSTALL_DIR) $(DISTDIR)/fiddle~
- $(INSTALL_DATA) fiddle~/fiddle~.c $(DISTDIR)/fiddle~
- $(INSTALL_DATA) fiddle~/fiddle~-help.pd $(DISTDIR)/fiddle~
- $(INSTALL_DIR) $(DISTDIR)/loop~
- $(INSTALL_DATA) loop~/loop~.c $(DISTDIR)/loop~
- $(INSTALL_DATA) loop~/loop~-help.pd $(DISTDIR)/loop~
- $(INSTALL_DATA) loop~/test-loop~.pd $(DISTDIR)/loop~
- $(INSTALL_DIR) $(DISTDIR)/lrshift~
- $(INSTALL_DATA) lrshift~/lrshift~.c $(DISTDIR)/lrshift~
- $(INSTALL_DATA) lrshift~/lrshift~-help.pd $(DISTDIR)/lrshift~
- $(INSTALL_DIR) $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/notes.txt $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/pd~.c $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/pd~-help.pd $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/pdsched.c $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/pd~-subprocess.pd $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/z.pd $(DISTDIR)/pd~
- $(INSTALL_DIR) $(DISTDIR)/pique
- $(INSTALL_DATA) pique/pique.c $(DISTDIR)/pique
- $(INSTALL_DATA) pique/pique-help.pd $(DISTDIR)/pique
- $(INSTALL_DIR) $(DISTDIR)/sigmund~
- $(INSTALL_DATA) sigmund~/sigmund~.c $(DISTDIR)/sigmund~
- $(INSTALL_DATA) sigmund~/sigmund~-help.pd $(DISTDIR)/sigmund~
- $(INSTALL_DIR) $(DISTDIR)/stdout
- $(INSTALL_DATA) stdout/stdout.c $(DISTDIR)/stdout
- $(INSTALL_DATA) stdout/stdout-help.pd $(DISTDIR)/stdout
- tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR)
-
-distclean: clean
- -rm -f -- $(DISTBINDIR).tar.gz
- -rm -rf -- $(DISTBINDIR)
- -rm -f -- $(DISTDIR).tar.gz
- -rm -rf -- $(DISTDIR)
- -rm -f -- $(ORIGDIR).tar.gz
- -rm -rf -- $(ORIGDIR)
-
-# make a Debian source package
-dpkg-source:
- debclean
- make distclean dist
- mv $(DISTDIR) $(ORIGDIR)
- tar --exclude-vcs -czpf ../$(ORIGDIR).orig.tar.gz $(ORIGDIR)
- rm -f -- $(DISTDIR).tar.gz
- rm -rf -- $(DISTDIR) $(ORIGDIR)
- cd .. && dpkg-source -b $(LIBRARY_NAME)
-
-clean:
- -rm -f -- $(SOURCES:.c=.o)
- -rm -f -- $(SOURCES:.c=.$(EXTENSION))
- -rm -f -- $(LIBRARY_NAME).$(EXTENSION)
- -rm -f -- $(EXPR_SOURCES:.c=.o)
- -rm -f -- $(EXPR_OBJECTS) pd~/pdsched.$(EXTENSION)
-
-showpaths:
- @echo "PD_PATH: $(PD_PATH)"
- @echo "objectsdir: $(objectsdir)"
- @echo "LIBRARY_NAME: $(LIBRARY_NAME)"
- @echo "SOURCES: $(SOURCES)"
diff --git a/externals/extra/0.43.2/README.txt b/externals/extra/0.43.2/README.txt
deleted file mode 100644
index 850e3032..00000000
--- a/externals/extra/0.43.2/README.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-This is the README file for the "extras" library, consisting of Pd
-objects which are too specialized or otherwise non-canonical for
-inclusion into Pd proper. These files are open source; see
-LICENSE.txt in this distribution for details.
-Note however that "expr" is GPL (the rest is all BSD).
-
-This package should run in Pd under linux, MSW, or Mac OSX.
-You can additionally compile fiddle~. bonk~, and paf~ for Max/MSP.
-
-contents:
-
-externs:
-fiddle~ -- pitch tracker
-bonk~ - percussion detector
-choose - find the "best fit" of incoming vector with stored profiles
-paf~ -- phase aligned formant generator
-loop~ -- sample looper
-expr -- arithmetic expression evaluation (Shahrokh Yadegari)
-pique - fft-based peak finder
-lrshift~ - left or right shift an audio vector
-
-abstractions:
-hilbert~ - Hilbert transform for SSB modulation
-complex-mod~ - ring modulation for complex (real+imaginary) audio signals
-rev1~, etc. - reverberators
-
-These objects are part of the regular Pd distribution as of Pd version
-0.30. Macintosh versions of fiddle~, bonk~, and paf~ are available
-from http://www.crca.ucsd.edu/~tapel
-- msp@ucsd.edu
diff --git a/externals/extra/0.43.2/bonk~/bonk~-help.pd b/externals/extra/0.43.2/bonk~/bonk~-help.pd
deleted file mode 100644
index 4666d6f5..00000000
--- a/externals/extra/0.43.2/bonk~/bonk~-help.pd
+++ /dev/null
@@ -1,209 +0,0 @@
-#N canvas 0 0 1052 581 12;
-#X obj 382 492 spigot;
-#X msg 484 293 bang;
-#X obj 483 454 bonk~;
-#X msg 483 357 print;
-#X obj 435 428 adc~;
-#X msg 637 506 \; pd dsp 1;
-#X obj 300 492 spigot;
-#N canvas 366 126 604 404 synth 0;
-#X obj 112 24 r bonk-cooked;
-#X obj 112 49 unpack;
-#X obj 112 99 * 12;
-#X obj 112 124 div 7;
-#X obj 112 74 + 1;
-#X obj 112 174 mtof;
-#X obj 112 224 osc~;
-#X obj 112 249 cos~;
-#X obj 112 149 + 47;
-#X obj 209 247 line~;
-#X obj 209 272 *~;
-#X obj 209 297 lop~ 500;
-#X obj 112 274 *~;
-#X obj 103 361 dac~;
-#X obj 253 165 dbtorms;
-#X obj 253 115 * 0.5;
-#X obj 253 140 + 50;
-#X obj 211 189 f;
-#X msg 173 159 bang;
-#X obj 258 83 inlet;
-#X obj 111 307 hip~ 5;
-#X msg 34 24 0 60;
-#X obj 112 199 sig~;
-#X msg 209 222 \$1 \, 0 200;
-#X connect 0 0 1 0;
-#X connect 1 0 4 0;
-#X connect 2 0 3 0;
-#X connect 3 0 8 0;
-#X connect 4 0 2 0;
-#X connect 5 0 18 0;
-#X connect 5 0 22 0;
-#X connect 6 0 7 0;
-#X connect 7 0 12 0;
-#X connect 8 0 5 0;
-#X connect 9 0 10 0;
-#X connect 9 0 10 1;
-#X connect 10 0 11 0;
-#X connect 11 0 12 1;
-#X connect 12 0 20 0;
-#X connect 14 0 17 1;
-#X connect 15 0 16 0;
-#X connect 16 0 14 0;
-#X connect 17 0 23 0;
-#X connect 18 0 17 0;
-#X connect 19 0 15 0;
-#X connect 20 0 13 1;
-#X connect 20 0 13 0;
-#X connect 21 0 1 0;
-#X connect 22 0 6 0;
-#X connect 23 0 9 0;
-#X restore 869 523 pd synth;
-#X floatatom 869 500 0 0 0 0 - - -;
-#X msg 869 470 0;
-#X msg 900 470 90;
-#X text 625 472 click here;
-#X text 626 485 to start DSP;
-#X text 5 285 In this patch \, after starting DSP \, you can print
-out the raw or cooked output using the two "spigots" or listen to a
-synthesizer output by raising its volume.;
-#X text 770 469 output volume;
-#X text 784 487 (0-100);
-#X msg 483 138 mask 4 0.7;
-#X text 578 120 Describes how energy in each frequency band masks later
-energy in the band. Here the masking is total for 4 analysis periods
-and then drops by 0.7 each period.;
-#X text 528 286 Poll the current spectrum via "raw" outlet \, You can
-set a very high threshold if you don't want attacks mixed in.;
-#X msg 483 331 debug 0;
-#X text 561 331 turn debugging on or off.;
-#X obj 349 493 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 431 493 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 382 522 print cooked;
-#X obj 300 522 print raw;
-#X text 162 491 enable printout:;
-#X text 560 202 Minimum "velocity" to output (quieter notes are ignored.)
-;
-#X obj 485 481 s bonk-cooked;
-#X text 8 145 Bonk's two outputs are the raw spectrum of the attack
-(provided as a list of 11 numbers giving the signal "loudness" in the
-11 frequency bands used) \, and the "cooked" output which gives only
-an instrument number (counting up from zero) and a "velocity". This
-"velocity" is the sum of the square roots of the amplitudes of the
-bands \, normalized so that 100 is an attack of amplitude of about
-1 The instrument number is significant only if Bonk has a "template
-set" in memory.;
-#X text 580 35 Set low and high thresholds. Signal growth must exceed
-the high one and then fall to the low one to make an attack. The unit
-is the sum of the proportional growth in the 11 filter bands. Proportional
-growth is essentially the logarithmic time derivative.;
-#X msg 483 384 print 1;
-#X text 551 386 print out filterbank settings;
-#X text 9 33 The Bonk object takes an audio signal input and looks
-for "attacks" defined as sharp changes in the spectral envelope of
-the incoming sound. Optionally \, and less reliably \, you can have
-Bonk check the attack against a collection of stored templates to try
-to guess which of two or more instruments was hit. Bonk is described
-theoretically in the 1998 ICMC proceedings \, reprinted on crca.ucsd.edu/~msp
-.;
-#N canvas 0 0 699 717 creation-arguments 1;
-#X text 228 14 creation arguments for bonk~;
-#X text 70 272 -npts 256;
-#X text 44 244 default value:;
-#X text 70 308 -hop 128;
-#X text 70 342 -nfilters 11;
-#X text 68 380 -halftones 6;
-#X text 76 514 -overlap 1;
-#X text 79 567 -firstbin 1;
-#X text 71 454 -minbandwidth 1.5;
-#X text 122 147 All frequency parameters are specified in 'bins'. One
-bin is the sample rate divided by the window size. The minimum possible
-bandwidth is 1.5 bins. Higher bandwidths give numerically more robust
-outputs.;
-#X text 43 229 Arguments and;
-#X text 212 270 window size in points;
-#X text 210 306 analysis period ("hop size") in points;
-#X text 212 340 number of filters to use;
-#X text 212 379 desired bandwidth of filters in halftones \, effective
-in the exponentially spaced region. (At lower center frequencies the
-bandwidth is supported by the "minbandwidth" parameter below).;
-#X text 212 511 overlap factor between filters. If 1 \, the filters
-are spaced to line up at their half-power points. Other values specify
-more or fewer filters proportionally.;
-#X text 121 49 bonk~ uses a filterbank whose center frequencies are
-spaced equally at low frequencies and proportionally at high ones -
-i.e. \, they increase linearly \, then exponentially. They are determined
-by the filters' bandwidths and overlap. The bandwidths are specified
-proportionally to frequency but bounded below by a specified minimum.
-;
-#X text 210 455 minimum bandwidth in bins. If the bandwidth specified
-by "halftones" is smaller than this \, this value is used. This must
-be at least 1.5.;
-#X text 212 567 center frequency \, in bins \, of the lowest filter.
-The others are computed from this.;
-#X restore 147 414 pd creation-arguments;
-#N canvas 660 173 579 589 templates 0;
-#X msg 76 197 learn 0;
-#X msg 76 227 forget;
-#X msg 76 257 write templates.txt;
-#X msg 76 287 read templates.txt;
-#X msg 76 107 debounce 0;
-#X msg 76 137 learn 10;
-#X obj 62 431 outlet;
-#X text 155 133 Forget all templates and start learning new ones. The
-argument gives the number of times you will hit each instrument (10
-recommended.) Turn on the output volume above for audible feedback
-as you train Bonk. "Learn 0" exits learn mode.;
-#X text 155 217 Forget the last template. In Learn mode \, use "forget"
-to erase and record over a template.;
-#X text 220 253 Write templates to a file in text-editable format.
-;
-#X text 221 283 Read templates from a file.;
-#X text 157 104 Minimum time (msec) between attacks in learn mode;
-#X connect 0 0 6 0;
-#X connect 1 0 6 0;
-#X connect 2 0 6 0;
-#X connect 3 0 6 0;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X restore 500 421 pd templates;
-#X msg 483 68 thresh 2.5 5;
-#X msg 483 173 attack-frames 1;
-#X text 608 174 number of frames over which to measure growth;
-#X text 605 422 more messages for managing templates;
-#X msg 483 201 minvel 7;
-#X msg 483 228 spew 0;
-#X text 550 230 Turn spew mode on/off;
-#X msg 483 255 useloudness 0;
-#X text 597 254 experimental: use alternative loudness units;
-#X text 212 9 BONK~ - attack detection and spectral envelope measurement
-;
-#X text 734 552 Updated for Pd version 0.42;
-#X text 5 344 By default bonk's analysis is carried out on a 256-point
-window (6 msec at 44.1 kHz) and the analysis period is 128 samples.
-These and other parameters may be overridden using creation arguments
-as shown in the subpatch below:;
-#X text 552 356 Print out settings and templates.;
-#X connect 0 0 23 0;
-#X connect 1 0 2 0;
-#X connect 2 0 6 0;
-#X connect 2 1 0 0;
-#X connect 2 1 27 0;
-#X connect 3 0 2 0;
-#X connect 4 0 2 0;
-#X connect 6 0 24 0;
-#X connect 8 0 7 0;
-#X connect 9 0 8 0;
-#X connect 10 0 8 0;
-#X connect 16 0 2 0;
-#X connect 19 0 2 0;
-#X connect 21 0 6 1;
-#X connect 22 0 0 1;
-#X connect 30 0 2 0;
-#X connect 34 0 2 0;
-#X connect 35 0 2 0;
-#X connect 36 0 2 0;
-#X connect 39 0 2 0;
-#X connect 40 0 2 0;
-#X connect 42 0 2 0;
diff --git a/externals/extra/0.43.2/bonk~/bonk~.c b/externals/extra/0.43.2/bonk~/bonk~.c
deleted file mode 100644
index c3516775..00000000
--- a/externals/extra/0.43.2/bonk~/bonk~.c
+++ /dev/null
@@ -1,1638 +0,0 @@
-/*
- ###########################################################################
- # bonk~ - a Max/MSP external
- # by miller puckette and ted apel
- # http://crca.ucsd.edu/~msp/
- # Max/MSP port by barry threw
- # http://www.barrythrew.com
- # me@barrythrew.com
- # San Francisco, CA
- # (c) 2008
- # for Kesumo - http://www.kesumo.com
- ###########################################################################
- // bonk~ detects attacks in an audio signal
- ###########################################################################
- This software is copyrighted by Miller Puckette and others. The following
- terms (the "Standard Improved BSD License") apply to all files associated with
- the software unless explicitly disclaimed in individual files:
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- 3. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior
- written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
-dolist:
-decay and other times in msec
-*/
-
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
-/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
-#ifdef _MSC_VER
-#pragma warning (disable: 4305 4244)
-#endif
-
-#ifdef MSP
-#include "ext.h"
-#include "z_dsp.h"
-#include "math.h"
-#include "ext_support.h"
-#include "ext_proto.h"
-#include "ext_obex.h"
-
-typedef double t_floatarg; /* from m_pd.h */
-#define flog log
-#define fexp exp
-#define fsqrt sqrt
-#define t_resizebytes(a, b, c) t_resizebytes((char *)(a), (b), (c))
-
-void *bonk_class;
-#define getbytes t_getbytes
-#define freebytes t_freebytes
-#endif /* MSP */
-
-#ifdef PD
-#include "m_pd.h"
-static t_class *bonk_class;
-#endif
-
-#ifdef _WIN32
-#include <malloc.h>
-#elif ! defined(_MSC_VER)
-#include <alloca.h>
-#endif
-
-/* ------------------------ bonk~ ----------------------------- */
-
-#define DEFNPOINTS 256
-#define MAXCHANNELS 8
-#define MINPOINTS 64
-#define DEFPERIOD 128
-#define DEFNFILTERS 11
-#define DEFHALFTONES 6
-#define DEFOVERLAP 1
-#define DEFFIRSTBIN 1
-#define DEFMINBANDWIDTH 1.5
-#define DEFHITHRESH 5
-#define DEFLOTHRESH 2.5
-#define DEFMASKTIME 4
-#define DEFMASKDECAY 0.7
-#define DEFDEBOUNCEDECAY 0
-#define DEFMINVEL 7
-#define DEFATTACKBINS 1
-#define MAXATTACKWAIT 4
-
-typedef struct _filterkernel
-{
- int k_filterpoints;
- int k_hoppoints;
- int k_skippoints;
- int k_nhops;
- t_float k_centerfreq; /* center frequency, bins */
- t_float k_bandwidth; /* bandwidth, bins */
- t_float *k_stuff;
-} t_filterkernel;
-
-typedef struct _filterbank
-{
- int b_nfilters; /* number of filters in bank */
- int b_npoints; /* input vector size */
- t_float b_halftones; /* filter bandwidth in halftones */
- t_float b_overlap; /* overlap; default 1 for 1/2-power pts */
- t_float b_firstbin; /* freq of first filter in bins, default 1 */
- t_float b_minbandwidth; /* minimum bandwidth, default 1.5 */
- t_filterkernel *b_vec; /* filter kernels */
- int b_refcount; /* number of bonk~ objects using this */
- struct _filterbank *b_next; /* next in linked list */
-} t_filterbank;
-
-#if 0 /* this is the design for 1.0: */
-static t_filterkernel bonk_filterkernels[] =
- {{256, 2, .01562}, {256, 4, .01562}, {256, 6, .01562}, {180, 6, .02222},
- {128, 6, .01803}, {90, 6, .02222}, {64, 6, .02362}, {46, 6, .02773},
- {32, 6, .03227}, {22, 6, .03932}, {16, 6, .04489}};
-#endif
-
-#if 0
- /* here's the 1.1 rev: */
-static t_filterkernel bonk_filterkernels[] =
- {{256, 1, .01562, 0}, {256, 3, .01562, 0}, {256, 5, .01562, 0},
- {212, 6, .01886, 0}, {150, 6, .01885, 0}, {106, 6, .02179, 0},
- {76, 6, .0236, 0}, {54, 6, .02634, 0}, {38, 6, .03047, 0},
- {26, 6, .03667, 0}, {18, 6, .04458, 0}};
-
-#define NFILTERS \
- ((int)(sizeof(bonk_filterkernels) / sizeof(bonk_filterkernels[0])))
-
-#endif
-
-#if 0
- /* and 1.2 */
-#define NFILTERS 11
-static t_filterkernel bonk_filterkernels[NFILTERS];
-#endif
-
- /* and 1.3 */
-#define MAXNFILTERS 50
-#define MASKHIST 8
-
-static t_filterbank *bonk_filterbanklist;
-
-typedef struct _hist
-{
- t_float h_power;
- t_float h_before;
- t_float h_outpower;
- int h_countup;
- t_float h_mask[MASKHIST];
-} t_hist;
-
-typedef struct template
-{
- t_float t_amp[MAXNFILTERS];
-} t_template;
-
-typedef struct _insig
-{
- t_hist g_hist[MAXNFILTERS]; /* history for each filter */
-#ifdef PD
- t_outlet *g_outlet; /* outlet for raw data */
-#endif
-#ifdef MSP
- void *g_outlet; /* outlet for raw data */
-#endif
- t_float *g_inbuf; /* buffered input samples */
- t_float *g_invec; /* new input samples */
-} t_insig;
-
-typedef struct _bonk
-{
-#ifdef PD
- t_object x_obj;
- t_outlet *x_cookedout;
- t_clock *x_clock;
- t_canvas *x_canvas; /* ptr to current canvas --fbar */
-#endif /* PD */
-#ifdef MSP
- t_pxobject x_obj;
- void *obex;
- void *x_cookedout;
- void *x_clock;
-#endif /* MSP */
- /* parameters */
- int x_npoints; /* number of points in input buffer */
- int x_period; /* number of input samples between analyses */
- int x_nfilters; /* number of filters requested */
- t_float x_halftones; /* nominal halftones between filters */
- t_float x_overlap;
- t_float x_firstbin;
- t_float x_minbandwidth;
- t_float x_hithresh; /* threshold for total growth to trigger */
- t_float x_lothresh; /* threshold for total growth to re-arm */
- t_float x_minvel; /* minimum velocity we output */
- t_float x_maskdecay;
- int x_masktime;
- int x_useloudness; /* use loudness spectra instead of power */
- t_float x_debouncedecay;
- t_float x_debouncevel;
- double x_learndebounce; /* debounce time (in "learn" mode only) */
- int x_attackbins; /* number of bins to wait for attack */
-
- t_filterbank *x_filterbank;
- t_hist x_hist[MAXNFILTERS];
- t_template *x_template;
- t_insig *x_insig;
- int x_ninsig;
- int x_ntemplate;
- int x_infill;
- int x_countdown;
- int x_willattack;
- int x_attacked;
- int x_debug;
- int x_learn;
- int x_learncount; /* countup for "learn" mode */
- int x_spew; /* if true, always generate output! */
- int x_maskphase; /* phase, 0 to MASKHIST-1, for mask history */
- t_float x_sr; /* current sample rate in Hz. */
- int x_hit; /* next "tick" called because of a hit, not a poll */
-} t_bonk;
-
-#ifdef MSP
-static void *bonk_new(t_symbol *s, long ac, t_atom *av);
-static void bonk_tick(t_bonk *x);
-static void bonk_doit(t_bonk *x);
-static t_int *bonk_perform(t_int *w);
-static void bonk_dsp(t_bonk *x, t_signal **sp);
-void bonk_assist(t_bonk *x, void *b, long m, long a, char *s);
-static void bonk_free(t_bonk *x);
-void bonk_setup(void);
-int main();
-
-static void bonk_thresh(t_bonk *x, t_floatarg f1, t_floatarg f2);
-static void bonk_print(t_bonk *x, t_floatarg f);
-static void bonk_bang(t_bonk *x);
-
-static void bonk_write(t_bonk *x, t_symbol *s);
-static void bonk_dowrite(t_bonk *x, t_symbol *s);
-static void bonk_writefile(t_bonk *x, char *filename, short path);
-
-static void bonk_read(t_bonk *x, t_symbol *s);
-static void bonk_doread(t_bonk *x, t_symbol *s);
-static void bonk_openfile(t_bonk *x, char *filename, short path);
-
-void bonk_minvel_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_lothresh_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_hithresh_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_masktime_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_maskdecay_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_debouncedecay_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_debug_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_spew_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_useloudness_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_attackbins_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_learn_set(t_bonk *x, void *attr, long ac, t_atom *av);
-
-t_float qrsqrt(t_float f);
-double clock_getsystime();
-double clock_gettimesince(double prevsystime);
-char *strcpy(char *s1, const char *s2);
-#endif
-
-static void bonk_tick(t_bonk *x);
-
-#define HALFWIDTH 0.75 /* half peak bandwidth at half power point in bins */
-#define SLIDE 0.25 /* relative slide between filter subwindows */
-
-static t_filterbank *bonk_newfilterbank(int npoints, int nfilters,
- t_float halftones, t_float overlap, t_float firstbin, t_float minbandwidth)
-{
- int i, j;
- t_float cf, bw, h, relspace;
- t_filterbank *b = (t_filterbank *)getbytes(sizeof(*b));
- b->b_npoints = npoints;
- b->b_nfilters = nfilters;
- b->b_halftones = halftones;
- b->b_overlap = overlap;
- b->b_firstbin = firstbin;
- b->b_minbandwidth = minbandwidth;
- b->b_refcount = 0;
- b->b_next = bonk_filterbanklist;
- bonk_filterbanklist = b;
- b->b_vec = (t_filterkernel *)getbytes(nfilters * sizeof(*b->b_vec));
-
- h = exp((log(2.)/12.)*halftones); /* specced interval between filters */
- relspace = (h - 1)/(h + 1); /* nominal spacing-per-f for fbank */
-
- if (minbandwidth < 2*HALFWIDTH)
- minbandwidth = 2*HALFWIDTH;
- if (firstbin < minbandwidth/(2*HALFWIDTH))
- firstbin = minbandwidth/(2*HALFWIDTH);
- cf = firstbin;
- bw = cf * relspace * overlap;
- if (bw < (0.5*minbandwidth))
- bw = (0.5*minbandwidth);
- for (i = 0; i < nfilters; i++)
- {
- t_float *fp, newcf, newbw;
- t_float normalizer = 0;
- int filterpoints, skippoints, hoppoints, nhops;
-
- filterpoints = npoints * HALFWIDTH/bw;
- if (cf > npoints/2)
- {
- post("bonk~: only using %d filters (ran past Nyquist)", i+1);
- break;
- }
- if (filterpoints < 4)
- {
- post("bonk~: only using %d filters (kernels got too short)", i+1);
- break;
- }
- else if (filterpoints > npoints)
- filterpoints = npoints;
-
- hoppoints = SLIDE * npoints * HALFWIDTH/bw;
-
- nhops = 1. + (npoints-filterpoints)/(t_float)hoppoints;
- skippoints = 0.5 * (npoints-filterpoints - (nhops-1) * hoppoints);
-
- b->b_vec[i].k_stuff =
- (t_float *)getbytes(2 * sizeof(t_float) * filterpoints);
- b->b_vec[i].k_filterpoints = filterpoints;
- b->b_vec[i].k_nhops = nhops;
- b->b_vec[i].k_hoppoints = hoppoints;
- b->b_vec[i].k_skippoints = skippoints;
- b->b_vec[i].k_centerfreq = cf;
- b->b_vec[i].k_bandwidth = bw;
-
- for (fp = b->b_vec[i].k_stuff, j = 0; j < filterpoints; j++, fp+= 2)
- {
- t_float phase = j * cf * (2*3.141592653589793 / npoints);
- t_float wphase = j * (2*3.141592653589793 / filterpoints);
- t_float window = sin(0.5*wphase);
- fp[0] = window * cos(phase);
- fp[1] = window * sin(phase);
- normalizer += window;
- }
- normalizer = 1/(normalizer * sqrt(nhops));
- for (fp = b->b_vec[i].k_stuff, j = 0;
- j < filterpoints; j++, fp+= 2)
- fp[0] *= normalizer, fp[1] *= normalizer;
-#if 0
- post("i %d cf %.2f bw %.2f nhops %d, hop %d, skip %d, npoints %d",
- i, cf, bw, nhops, hoppoints, skippoints, filterpoints);
-#endif
- newcf = (cf + bw/overlap)/(1 - relspace);
- newbw = newcf * overlap * relspace;
- if (newbw < 0.5*minbandwidth)
- {
- newbw = 0.5*minbandwidth;
- newcf = cf + minbandwidth / overlap;
- }
- cf = newcf;
- bw = newbw;
- }
- for (; i < nfilters; i++)
- b->b_vec[i].k_stuff = 0, b->b_vec[i].k_filterpoints = 0;
- return (b);
-}
-
-static void bonk_freefilterbank(t_filterbank *b)
-{
- t_filterbank *b2, *b3;
- int i;
- if (bonk_filterbanklist == b)
- bonk_filterbanklist = b->b_next;
- else for (b2 = bonk_filterbanklist; b3 = b2->b_next; b2 = b3)
- if (b3 == b)
- {
- b2->b_next = b3->b_next;
- break;
- }
- for (i = 0; i < b->b_nfilters; i++)
- if (b->b_vec[i].k_stuff)
- freebytes(b->b_vec[i].k_stuff,
- b->b_vec[i].k_filterpoints * sizeof(t_float));
- freebytes(b, sizeof(*b));
-}
-
-static void bonk_donew(t_bonk *x, int npoints, int period, int nsig,
- int nfilters, t_float halftones, t_float overlap, t_float firstbin,
- t_float minbandwidth, t_float samplerate)
-{
- int i, j;
- t_hist *h;
- t_float *fp;
- t_insig *g;
- t_filterbank *fb;
- for (j = 0, g = x->x_insig; j < nsig; j++, g++)
- {
- for (i = 0, h = g->g_hist; i--; h++)
- {
- h->h_power = h->h_before = 0, h->h_countup = 0;
- for (j = 0; j < MASKHIST; j++)
- h->h_mask[j] = 0;
- }
- /* we ought to check for failure to allocate memory here */
- g->g_inbuf = (t_float *)getbytes(npoints * sizeof(t_float));
- for (i = npoints, fp = g->g_inbuf; i--; fp++) *fp = 0;
- }
- if (!period) period = npoints/2;
- x->x_npoints = npoints;
- x->x_period = period;
- x->x_ninsig = nsig;
- x->x_nfilters = nfilters;
- x->x_halftones = halftones;
- x->x_template = (t_template *)getbytes(0);
- x->x_ntemplate = 0;
- x->x_infill = 0;
- x->x_countdown = 0;
- x->x_willattack = 0;
- x->x_attacked = 0;
- x->x_maskphase = 0;
- x->x_debug = 0;
- x->x_hithresh = DEFHITHRESH;
- x->x_lothresh = DEFLOTHRESH;
- x->x_masktime = DEFMASKTIME;
- x->x_maskdecay = DEFMASKDECAY;
- x->x_learn = 0;
- x->x_learndebounce = clock_getsystime();
- x->x_learncount = 0;
- x->x_debouncedecay = DEFDEBOUNCEDECAY;
- x->x_minvel = DEFMINVEL;
- x->x_useloudness = 0;
- x->x_debouncevel = 0;
- x->x_attackbins = DEFATTACKBINS;
- x->x_sr = samplerate;
- x->x_filterbank = 0;
- x->x_hit = 0;
- for (fb = bonk_filterbanklist; fb; fb = fb->b_next)
- if (fb->b_nfilters == x->x_nfilters &&
- fb->b_halftones == x->x_halftones &&
- fb->b_firstbin == firstbin &&
- fb->b_overlap == overlap &&
- fb->b_npoints == x->x_npoints &&
- fb->b_minbandwidth == minbandwidth)
- {
- fb->b_refcount++;
- x->x_filterbank = fb;
- break;
- }
- if (!x->x_filterbank)
- x->x_filterbank = bonk_newfilterbank(npoints, nfilters,
- halftones, overlap, firstbin, minbandwidth),
- x->x_filterbank->b_refcount++;
-}
-
-static void bonk_tick(t_bonk *x)
-{
- t_atom at[MAXNFILTERS], *ap, at2[3];
- int i, j, k, n;
- t_hist *h;
- t_float *pp, vel = 0., temperature = 0.;
- t_float *fp;
- t_template *tp;
- int nfit, ninsig = x->x_ninsig, ntemplate = x->x_ntemplate, nfilters = x->x_nfilters;
- t_insig *gp;
-#ifdef _MSC_VER
- t_float powerout[MAXNFILTERS*MAXCHANNELS];
-#else
- t_float *powerout = alloca(x->x_nfilters * x->x_ninsig * sizeof(*powerout));
-#endif
-
- for (i = ninsig, pp = powerout, gp = x->x_insig; i--; gp++)
- {
- for (j = 0, h = gp->g_hist; j < nfilters; j++, h++, pp++)
- {
- t_float power = h->h_outpower;
- t_float intensity = *pp = (power > 0. ? 100. * qrsqrt(qrsqrt(power)) : 0.);
- vel += intensity;
- temperature += intensity * (t_float)j;
- }
- }
- if (vel > 0) temperature /= vel;
- else temperature = 0;
- vel *= 0.5 / ninsig; /* fudge factor */
- if (x->x_hit)
- {
- /* if hit nonzero it's a clock callback. if in "learn" mode update the
- template list; in any event match the hit to known templates. */
-
- if (vel < x->x_debouncevel)
- {
- if (x->x_debug)
- post("bounce cancelled: vel %f debounce %f",
- vel, x->x_debouncevel);
- return;
- }
- if (vel < x->x_minvel)
- {
- if (x->x_debug)
- post("low velocity cancelled: vel %f, minvel %f",
- vel, x->x_minvel);
- return;
- }
- x->x_debouncevel = vel;
- if (x->x_learn)
- {
- double lasttime = x->x_learndebounce;
- double msec = clock_gettimesince(lasttime);
- if ((!ntemplate) || (msec > 200))
- {
- int countup = x->x_learncount;
- /* normalize to 100 */
- t_float norm;
- for (i = nfilters * ninsig, norm = 0, pp = powerout; i--; pp++)
- norm += *pp * *pp;
- if (norm < 1.0e-15) norm = 1.0e-15;
- norm = 100. * qrsqrt(norm);
- /* check if this is the first strike for a new template */
- if (!countup)
- {
- int oldn = ntemplate;
- x->x_ntemplate = ntemplate = oldn + ninsig;
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- oldn * sizeof(x->x_template[0]),
- ntemplate * sizeof(x->x_template[0]));
- for (i = ninsig, pp = powerout; i--; oldn++)
- for (j = nfilters, fp = x->x_template[oldn].t_amp; j--;
- pp++, fp++)
- *fp = *pp * norm;
- }
- else
- {
- int oldn = ntemplate - ninsig;
- if (oldn < 0) post("bonk_tick bug");
- for (i = ninsig, pp = powerout; i--; oldn++)
- {
- for (j = nfilters, fp = x->x_template[oldn].t_amp; j--;
- pp++, fp++)
- *fp = (countup * *fp + *pp * norm)
- /(countup + 1.0);
- }
- }
- countup++;
- if (countup == x->x_learn) countup = 0;
- x->x_learncount = countup;
- }
- else return;
- }
- x->x_learndebounce = clock_getsystime();
- if (ntemplate)
- {
- t_float bestfit = -1e30;
- int templatecount;
- nfit = -1;
- for (i = 0, templatecount = 0, tp = x->x_template;
- templatecount < ntemplate; i++)
- {
- t_float dotprod = 0;
- for (k = 0, pp = powerout;
- k < ninsig && templatecount < ntemplate;
- k++, tp++, templatecount++)
- {
- for (j = nfilters, fp = tp->t_amp;
- j--; fp++, pp++)
- {
- if (*fp < 0 || *pp < 0) post("bonk_tick bug 2");
- dotprod += *fp * *pp;
- }
- }
- if (dotprod > bestfit)
- {
- bestfit = dotprod;
- nfit = i;
- }
- }
- if (nfit < 0) post("bonk_tick bug");
- }
- else nfit = 0;
- }
- else nfit = -1; /* hit is zero; this is the "bang" method. */
-
- x->x_attacked = 1;
- if (x->x_debug)
- post("bonk out: number %d, vel %f, temperature %f",
- nfit, vel, temperature);
-
- SETFLOAT(at2, nfit);
- SETFLOAT(at2+1, vel);
- SETFLOAT(at2+2, temperature);
- outlet_list(x->x_cookedout, 0, 3, at2);
-
- for (n = 0, gp = x->x_insig + (ninsig-1),
- pp = powerout + nfilters * (ninsig-1); n < ninsig;
- n++, gp--, pp -= nfilters)
- {
- t_float *pp2;
- for (i = 0, ap = at, pp2 = pp; i < nfilters;
- i++, ap++, pp2++)
- {
- ap->a_type = A_FLOAT;
- ap->a_w.w_float = *pp2;
- }
- outlet_list(gp->g_outlet, 0, nfilters, at);
- }
-}
-
-static void bonk_doit(t_bonk *x)
-{
- int i, j, ch, n;
- t_filterkernel *k;
- t_hist *h;
- t_float growth = 0, *fp1, *fp3, *fp4, hithresh, lothresh;
- int ninsig = x->x_ninsig, nfilters = x->x_nfilters,
- maskphase = x->x_maskphase, nextphase, oldmaskphase;
- t_insig *gp;
- nextphase = maskphase + 1;
- if (nextphase >= MASKHIST)
- nextphase = 0;
- x->x_maskphase = nextphase;
- oldmaskphase = nextphase - x->x_attackbins;
- if (oldmaskphase < 0)
- oldmaskphase += MASKHIST;
- if (x->x_useloudness)
- hithresh = qrsqrt(qrsqrt(x->x_hithresh)),
- lothresh = qrsqrt(qrsqrt(x->x_lothresh));
- else hithresh = x->x_hithresh, lothresh = x->x_lothresh;
- for (ch = 0, gp = x->x_insig; ch < ninsig; ch++, gp++)
- {
- for (i = 0, k = x->x_filterbank->b_vec, h = gp->g_hist;
- i < nfilters; i++, k++, h++)
- {
- t_float power = 0, maskpow = h->h_mask[maskphase];
- t_float *inbuf= gp->g_inbuf + k->k_skippoints;
- int countup = h->h_countup;
- int filterpoints = k->k_filterpoints;
- /* if the user asked for more filters that fit under the
- Nyquist frequency, some filters won't actually be filled in
- so we skip running them. */
- if (!filterpoints)
- {
- h->h_countup = 0;
- h->h_mask[nextphase] = 0;
- h->h_power = 0;
- continue;
- }
- /* run the filter repeatedly, sliding it forward by hoppoints,
- for nhop times */
- for (fp1 = inbuf, n = 0;
- n < k->k_nhops; fp1 += k->k_hoppoints, n++)
- {
- t_float rsum = 0, isum = 0;
- for (fp3 = fp1, fp4 = k->k_stuff, j = filterpoints; j--;)
- {
- t_float g = *fp3++;
- rsum += g * *fp4++;
- isum += g * *fp4++;
- }
- power += rsum * rsum + isum * isum;
- }
- if (!x->x_willattack)
- h->h_before = maskpow;
-
- if (power > h->h_mask[oldmaskphase])
- {
- if (x->x_useloudness)
- growth += qrsqrt(qrsqrt(
- power/(h->h_mask[oldmaskphase] + 1.0e-15))) - 1.;
- else growth += power/(h->h_mask[oldmaskphase] + 1.0e-15) - 1.;
- }
- if (!x->x_willattack && countup >= x->x_masktime)
- maskpow *= x->x_maskdecay;
-
- if (power > maskpow)
- {
- maskpow = power;
- countup = 0;
- }
- countup++;
- h->h_countup = countup;
- h->h_mask[nextphase] = maskpow;
- h->h_power = power;
- }
- }
- if (x->x_willattack)
- {
- if (x->x_willattack > MAXATTACKWAIT || growth < x->x_lothresh)
- {
- /* if haven't yet, and if not in spew mode, report a hit */
- if (!x->x_spew && !x->x_attacked)
- {
- for (ch = 0, gp = x->x_insig; ch < ninsig; ch++, gp++)
- for (i = nfilters, h = gp->g_hist; i--; h++)
- h->h_outpower = h->h_mask[nextphase];
- x->x_hit = 1;
- clock_delay(x->x_clock, 0);
- }
- }
- if (growth < x->x_lothresh)
- x->x_willattack = 0;
- else x->x_willattack++;
- }
- else if (growth > x->x_hithresh)
- {
- if (x->x_debug) post("attack: growth = %f", growth);
- x->x_willattack = 1;
- x->x_attacked = 0;
- for (ch = 0, gp = x->x_insig; ch < ninsig; ch++, gp++)
- for (i = nfilters, h = gp->g_hist; i--; h++)
- h->h_mask[nextphase] = h->h_power, h->h_countup = 0;
- }
-
- /* if in "spew" mode just always output */
- if (x->x_spew)
- {
- for (ch = 0, gp = x->x_insig; ch < ninsig; ch++, gp++)
- for (i = nfilters, h = gp->g_hist; i--; h++)
- h->h_outpower = h->h_power;
- x->x_hit = 0;
- clock_delay(x->x_clock, 0);
- }
- x->x_debouncevel *= x->x_debouncedecay;
-}
-
-static t_int *bonk_perform(t_int *w)
-{
- t_bonk *x = (t_bonk *)(w[1]);
- int n = (int)(w[2]);
- int onset = 0;
- if (x->x_countdown >= n)
- x->x_countdown -= n;
- else
- {
- int i, j, ninsig = x->x_ninsig;
- t_insig *gp;
- if (x->x_countdown > 0)
- {
- n -= x->x_countdown;
- onset += x->x_countdown;
- x->x_countdown = 0;
- }
- while (n > 0)
- {
- int infill = x->x_infill;
- int m = (n < (x->x_npoints - infill) ?
- n : (x->x_npoints - infill));
- for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
- {
- t_float *fp = gp->g_inbuf + infill;
- t_float *in1 = gp->g_invec + onset;
- for (j = 0; j < m; j++)
- *fp++ = *in1++;
- }
- infill += m;
- x->x_infill = infill;
- if (infill == x->x_npoints)
- {
- bonk_doit(x);
-
- /* shift or clear the input buffer and update counters */
- if (x->x_period > x->x_npoints)
- x->x_countdown = x->x_period - x->x_npoints;
- else x->x_countdown = 0;
- if (x->x_period < x->x_npoints)
- {
- int overlap = x->x_npoints - x->x_period;
- t_float *fp1, *fp2;
- for (n = 0, gp = x->x_insig; n < ninsig; n++, gp++)
- for (i = overlap, fp1 = gp->g_inbuf,
- fp2 = fp1 + x->x_period; i--;)
- *fp1++ = *fp2++;
- x->x_infill = overlap;
- }
- else x->x_infill = 0;
- }
- n -= m;
- onset += m;
- }
- }
- return (w+3);
-}
-
-static void bonk_dsp(t_bonk *x, t_signal **sp)
-{
- int i, n = sp[0]->s_n, ninsig = x->x_ninsig;
- t_insig *gp;
-
- x->x_sr = sp[0]->s_sr;
-
- for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
- gp->g_invec = (*(sp++))->s_vec;
-
- dsp_add(bonk_perform, 2, x, n);
-}
-
-static void bonk_thresh(t_bonk *x, t_floatarg f1, t_floatarg f2)
-{
- if (f1 > f2)
- post("bonk: warning: low threshold greater than hi threshold");
- x->x_lothresh = (f1 <= 0 ? 0.0001 : f1);
- x->x_hithresh = (f2 <= 0 ? 0.0001 : f2);
-}
-
-#ifdef PD
-static void bonk_mask(t_bonk *x, t_floatarg f1, t_floatarg f2)
-{
- int ticks = f1;
- if (ticks < 0) ticks = 0;
- if (f2 < 0) f2 = 0;
- else if (f2 > 1) f2 = 1;
- x->x_masktime = ticks;
- x->x_maskdecay = f2;
-}
-
-static void bonk_debounce(t_bonk *x, t_floatarg f1)
-{
- if (f1 < 0) f1 = 0;
- else if (f1 > 1) f1 = 1;
- x->x_debouncedecay = f1;
-}
-
-static void bonk_minvel(t_bonk *x, t_floatarg f)
-{
- if (f < 0) f = 0;
- x->x_minvel = f;
-}
-
-static void bonk_debug(t_bonk *x, t_floatarg f)
-{
- x->x_debug = (f != 0);
-}
-
-static void bonk_spew(t_bonk *x, t_floatarg f)
-{
- x->x_spew = (f != 0);
-}
-
-static void bonk_useloudness(t_bonk *x, t_floatarg f)
-{
- x->x_useloudness = (f != 0);
-}
-
-static void bonk_attackbins(t_bonk *x, t_floatarg f)
-{
- if (f < 1)
- f = 1;
- else if (f > MASKHIST)
- f = MASKHIST;
- x->x_attackbins = f;
-}
-
-static void bonk_learn(t_bonk *x, t_floatarg f)
-{
- int n = f;
- if (n < 0) n = 0;
- if (n)
- {
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(x->x_template[0]), 0);
- x->x_ntemplate = 0;
- }
- x->x_learn = n;
- x->x_learncount = 0;
-}
-#endif
-
-static void bonk_print(t_bonk *x, t_floatarg f)
-{
- int i;
- post("thresh %f %f", x->x_lothresh, x->x_hithresh);
- post("mask %d %f", x->x_masktime, x->x_maskdecay);
- post("attack-frames %d", x->x_attackbins);
- post("debounce %f", x->x_debouncedecay);
- post("minvel %f", x->x_minvel);
- post("spew %d", x->x_spew);
- post("useloudness %d", x->x_useloudness);
-
-#if 0 /* LATER rewrite without hard-coded 11 filters */
- if (x->x_ntemplate)
- {
- post("templates:");
- for (i = 0; i < x->x_ntemplate; i++)
- post(
-"%2d %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f",
- i,
- x->x_template[i].t_amp[0],
- x->x_template[i].t_amp[1],
- x->x_template[i].t_amp[2],
- x->x_template[i].t_amp[3],
- x->x_template[i].t_amp[4],
- x->x_template[i].t_amp[5],
- x->x_template[i].t_amp[6],
- x->x_template[i].t_amp[7],
- x->x_template[i].t_amp[8],
- x->x_template[i].t_amp[9],
- x->x_template[i].t_amp[10]);
- }
- else post("no templates");
-#endif
- post("number of templates %d", x->x_ntemplate);
- if (x->x_learn) post("learn mode");
- if (f != 0)
- {
- int j, ninsig = x->x_ninsig;
- t_insig *gp;
- for (j = 0, gp = x->x_insig; j < ninsig; j++, gp++)
- {
- t_hist *h;
- if (ninsig > 1) post("input %d:", j+1);
- for (i = x->x_nfilters, h = gp->g_hist; i--; h++)
- post("pow %f mask %f before %f count %d",
- h->h_power, h->h_mask[x->x_maskphase],
- h->h_before, h->h_countup);
- }
- post("filter details (frequencies are in units of %.2f-Hz. bins):",
- x->x_sr/x->x_npoints);
- for (j = 0; j < x->x_nfilters; j++)
- post("%2d cf %.2f bw %.2f nhops %d hop %d skip %d npoints %d",
- j,
- x->x_filterbank->b_vec[j].k_centerfreq,
- x->x_filterbank->b_vec[j].k_bandwidth,
- x->x_filterbank->b_vec[j].k_nhops,
- x->x_filterbank->b_vec[j].k_hoppoints,
- x->x_filterbank->b_vec[j].k_skippoints,
- x->x_filterbank->b_vec[j].k_filterpoints);
- }
- if (x->x_debug) post("debug mode");
-}
-
-static void bonk_forget(t_bonk *x)
-{
- int ntemplate = x->x_ntemplate, newn = ntemplate - x->x_ninsig;
- if (newn < 0) newn = 0;
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(x->x_template[0]),
- newn * sizeof(x->x_template[0]));
- x->x_ntemplate = newn;
- x->x_learncount = 0;
-}
-
-static void bonk_bang(t_bonk *x)
-{
- int i, ch;
- t_insig *gp;
- x->x_hit = 0;
- for (ch = 0, gp = x->x_insig; ch < x->x_ninsig; ch++, gp++)
- {
- t_hist *h;
- for (i = 0, h = gp->g_hist; i < x->x_nfilters; i++, h++)
- h->h_outpower = h->h_power;
- }
- bonk_tick(x);
-}
-
-#ifdef PD
-static void bonk_read(t_bonk *x, t_symbol *s)
-{
- t_float vec[MAXNFILTERS];
- int i, ntemplate = 0, remaining;
- t_float *fp, *fp2;
-
- /* fbar: canvas_open code taken from g_array.c */
- FILE *fd;
- char buf[MAXPDSTRING], *bufptr;
- int filedesc;
-
- if ((filedesc = canvas_open(x->x_canvas,
- s->s_name, "", buf, &bufptr, MAXPDSTRING, 0)) < 0
- || !(fd = fdopen(filedesc, "r")))
- {
- post("%s: open failed", s->s_name);
- return;
- }
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(t_template), 0);
- while (1)
- {
- for (i = x->x_nfilters, fp = vec; i--; fp++)
- if (fscanf(fd, "%f", fp) < 1) goto nomore;
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate + 1) * sizeof(t_template));
- for (i = x->x_nfilters, fp = vec,
- fp2 = x->x_template[ntemplate].t_amp; i--;)
- *fp2++ = *fp++;
- ntemplate++;
- }
-nomore:
- if (remaining = (ntemplate % x->x_ninsig))
- {
- post("bonk_read: %d templates not a multiple of %d; dropping extras");
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate - remaining) * sizeof(t_template));
- ntemplate = ntemplate - remaining;
- }
- post("bonk: read %d templates\n", ntemplate);
- x->x_ntemplate = ntemplate;
- fclose(fd);
-}
-#endif
-
-#ifdef MSP
-static void bonk_read(t_bonk *x, t_symbol *s)
-{
- defer(x, (method)bonk_doread, s, 0, NULL);
-}
-
-static void bonk_doread(t_bonk *x, t_symbol *s)
-{
- long filetype = 'TEXT', outtype;
- char filename[512];
- short path;
-
- if (s == gensym("")) {
- if (open_dialog(filename, &path, &outtype, &filetype, 1))
- return;
- } else {
- strcpy(filename, s->s_name);
- if (locatefile_extended(filename, &path, &outtype, &filetype, 1)) {
- object_error((t_object *) x, "%s: not found", s->s_name);
- return;
- }
- }
- // we have a file
- bonk_openfile(x, filename, path);
-}
-
-static void bonk_openfile(t_bonk *x, char *filename, short path) {
- t_float vec[MAXNFILTERS];
- int i, ntemplate = 0, remaining;
- t_float *fp, *fp2;
-
- t_filehandle fh;
- char **texthandle;
- char *tokptr;
-
- if (path_opensysfile(filename, path, &fh, READ_PERM)) {
- object_error((t_object *) x, "error opening %s", filename);
- return;
- }
-
- texthandle = sysmem_newhandle(0);
- sysfile_readtextfile(fh, texthandle, 0, TEXT_LB_NATIVE);
- sysfile_close(fh);
-
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(t_template), 0);
-
- tokptr = strtok(*texthandle, " \n");
-
- while(tokptr != NULL)
- {
- for (i = x->x_nfilters, fp = vec; i--; fp++) {
- if (sscanf(tokptr, "%f", fp) < 1)
- goto nomore;
- tokptr = strtok(NULL, " \n");
- }
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate + 1) * sizeof(t_template));
- for (i = x->x_nfilters, fp = vec,
- fp2 = x->x_template[ntemplate].t_amp; i--;)
- *fp2++ = *fp++;
- ntemplate++;
- }
-nomore:
- if (remaining = (ntemplate % x->x_ninsig))
- {
- post("bonk_read: %d templates not a multiple of %d; dropping extras");
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate - remaining) * sizeof(t_template));
- ntemplate = ntemplate - remaining;
- }
-
- sysmem_freehandle(texthandle);
- post("bonk: read %d templates\n", ntemplate);
- x->x_ntemplate = ntemplate;
-}
-#endif
-
-#ifdef PD
-static void bonk_write(t_bonk *x, t_symbol *s)
-{
- FILE *fd;
- char buf[MAXPDSTRING]; /* fbar */
- int i, ntemplate = x->x_ntemplate;
- t_template *tp = x->x_template;
- t_float *fp;
-
- /* fbar: canvas-code as in g_array.c */
- canvas_makefilename(x->x_canvas, s->s_name,
- buf, MAXPDSTRING);
- sys_bashfilename(buf, buf);
-
- if (!(fd = fopen(buf, "w")))
- {
- post("%s: couldn't create", s->s_name);
- return;
- }
- for (; ntemplate--; tp++)
- {
- for (i = x->x_nfilters, fp = tp->t_amp; i--; fp++)
- fprintf(fd, "%6.2f ", *fp);
- fprintf(fd, "\n");
- }
- post("bonk: wrote %d templates\n", x->x_ntemplate);
- fclose(fd);
-}
-#endif
-
-#ifdef MSP
-static void bonk_write(t_bonk *x, t_symbol *s)
-{
- defer(x, (method)bonk_dowrite, s, 0, NULL);
-}
-
-static void bonk_dowrite(t_bonk *x, t_symbol *s)
-{
- long filetype = 'TEXT', outtype;
- char filename[MAX_FILENAME_CHARS];
- short path;
-
- if (s == gensym("")) {
- sprintf(filename, "bonk_template.txt");
- saveas_promptset("Save template as...");
- if (saveasdialog_extended(filename, &path, &outtype, &filetype, 0))
- return;
- } else {
- strcpy(filename, s->s_name);
- path = path_getdefault();
- }
- bonk_writefile(x, filename, path);
-}
-
-void bonk_writefile(t_bonk *x, char *filename, short path)
-{
- int i, ntemplate = x->x_ntemplate;
- t_template *tp = x->x_template;
- t_float *fp;
- long err;
- long buflen;
-
- t_filehandle fh;
-
- char buf[20];
-
- err = path_createsysfile(filename, path, 'TEXT', &fh);
-
- if (err)
- return;
-
- for (; ntemplate--; tp++)
- {
- for (i = x->x_nfilters, fp = tp->t_amp; i--; fp++) {
- snprintf(buf, 20, "%6.2f ", *fp);
- buflen = strlen(buf);
- sysfile_write(fh, &buflen, buf);
- }
- buflen = 1;
- sysfile_write(fh, &buflen, "\n");
- }
-
- sysfile_close(fh);
-}
-#endif
-
-static void bonk_free(t_bonk *x)
-{
-
- int i, ninsig = x->x_ninsig;
- t_insig *gp = x->x_insig;
-#ifdef MSP
- dsp_free((t_pxobject *)x);
-#endif
- for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
- freebytes(gp->g_inbuf, x->x_npoints * sizeof(t_float));
- clock_free(x->x_clock);
- if (!--(x->x_filterbank->b_refcount))
- bonk_freefilterbank(x->x_filterbank);
-
-}
-
-/* -------------------------- Pd glue ------------------------- */
-#ifdef PD
-
-static void *bonk_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_bonk *x = (t_bonk *)pd_new(bonk_class);
- int nsig = 1, period = DEFPERIOD, npts = DEFNPOINTS,
- nfilters = DEFNFILTERS, j;
- t_float halftones = DEFHALFTONES, overlap = DEFOVERLAP,
- firstbin = DEFFIRSTBIN, minbandwidth = DEFMINBANDWIDTH;
- t_insig *g;
-
- x->x_canvas = canvas_getcurrent(); /* fbar: bind current canvas to x */
- if (argc > 0 && argv[0].a_type == A_FLOAT)
- {
- /* old style args for compatibility */
- period = atom_getfloatarg(0, argc, argv);
- nsig = atom_getfloatarg(1, argc, argv);
- }
- else while (argc > 0)
- {
- t_symbol *firstarg = atom_getsymbolarg(0, argc, argv);
- if (!strcmp(firstarg->s_name, "-npts") && argc > 1)
- {
- npts = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-hop") && argc > 1)
- {
- period = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-nsigs") && argc > 1)
- {
- nsig = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-nfilters") && argc > 1)
- {
- nfilters = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-halftones") && argc > 1)
- {
- halftones = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-overlap") && argc > 1)
- {
- overlap = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-firstbin") && argc > 1)
- {
- firstbin = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-minbandwidth") && argc > 1)
- {
- minbandwidth = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-spew") && argc > 1)
- {
- x->x_spew = (atom_getfloatarg(1, argc, argv) != 0);
- argc -= 2; argv += 2;
- }
- else
- {
- pd_error(x,
-"usage is: bonk [-npts #] [-hop #] [-nsigs #] [-nfilters #] [-halftones #]");
- post(
-"... [-overlap #] [-firstbin #] [-spew #]");
- argc = 0;
- }
- }
-
- x->x_npoints = (npts >= MINPOINTS ? npts : DEFNPOINTS);
- x->x_period = (period >= 1 ? period : npts/2);
- x->x_nfilters = (nfilters >= 1 ? nfilters : DEFNFILTERS);
- if (halftones < 0.01)
- halftones = DEFHALFTONES;
- else if (halftones > 12)
- halftones = 12;
- if (nsig < 1)
- nsig = 1;
- else if (nsig > MAXCHANNELS)
- nsig = MAXCHANNELS;
- if (firstbin < 0.5)
- firstbin = 0.5;
- if (overlap < 1)
- overlap = 1;
-
- x->x_clock = clock_new(x, (t_method)bonk_tick);
- x->x_insig = (t_insig *)getbytes(nsig * sizeof(*x->x_insig));
- for (j = 0, g = x->x_insig; j < nsig; j++, g++)
- {
- g->g_outlet = outlet_new(&x->x_obj, gensym("list"));
- if (j)
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- }
- x->x_cookedout = outlet_new(&x->x_obj, gensym("list"));
- bonk_donew(x, npts, period, nsig, nfilters, halftones, overlap,
- firstbin, minbandwidth, sys_getsr());
- return (x);
-}
-
-void bonk_tilde_setup(void)
-{
- bonk_class = class_new(gensym("bonk~"), (t_newmethod)bonk_new,
- (t_method)bonk_free, sizeof(t_bonk), 0, A_GIMME, 0);
- class_addmethod(bonk_class, nullfn, gensym("signal"), 0);
- class_addmethod(bonk_class, (t_method)bonk_dsp, gensym("dsp"), 0);
- class_addbang(bonk_class, bonk_bang);
- class_addmethod(bonk_class, (t_method)bonk_learn,
- gensym("learn"), A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_forget, gensym("forget"), 0);
- class_addmethod(bonk_class, (t_method)bonk_thresh,
- gensym("thresh"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_mask,
- gensym("mask"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_debounce,
- gensym("debounce"), A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_minvel,
- gensym("minvel"), A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_print,
- gensym("print"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_debug,
- gensym("debug"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_spew,
- gensym("spew"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_useloudness,
- gensym("useloudness"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_attackbins,
- gensym("attack-bins"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_attackbins,
- gensym("attack-frames"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_read,
- gensym("read"), A_SYMBOL, 0);
- class_addmethod(bonk_class, (t_method)bonk_write,
- gensym("write"), A_SYMBOL, 0);
- post("bonk version 1.5");
-}
-#endif
-
-/* -------------------------- MSP glue ------------------------- */
-#ifdef MSP
-
-int main()
-{
- t_class *c;
- t_object *attr;
- long attrflags = 0;
- t_symbol *sym_long = gensym("long"), *sym_float32 = gensym("float32");
-
- c = class_new("bonk~", (method)bonk_new, (method)bonk_free, sizeof(t_bonk), (method)0L, A_GIMME, 0);
-
- class_obexoffset_set(c, calcoffset(t_bonk, obex));
-
- attr = attr_offset_new("npoints", sym_long, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_npoints));
- class_addattr(c, attr);
-
- attr = attr_offset_new("hop", sym_long, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_period));
- class_addattr(c, attr);
-
- attr = attr_offset_new("nfilters", sym_long, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_nfilters));
- class_addattr(c, attr);
-
- attr = attr_offset_new("halftones", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_halftones));
- class_addattr(c, attr);
-
- attr = attr_offset_new("overlap", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_overlap));
- class_addattr(c, attr);
-
- attr = attr_offset_new("firstbin", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_firstbin));
- class_addattr(c, attr);
-
- attr = attr_offset_new("minbandwidth", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_minbandwidth));
- class_addattr(c, attr);
-
- attr = attr_offset_new("minvel", sym_float32, attrflags, (method)0L, (method)bonk_minvel_set, calcoffset(t_bonk, x_minvel));
- class_addattr(c, attr);
-
- attr = attr_offset_new("lothresh", sym_float32, attrflags, (method)0L, (method)bonk_lothresh_set, calcoffset(t_bonk, x_lothresh));
- class_addattr(c, attr);
-
- attr = attr_offset_new("hithresh", sym_float32, attrflags, (method)0L, (method)bonk_hithresh_set, calcoffset(t_bonk, x_hithresh));
- class_addattr(c, attr);
-
- attr = attr_offset_new("masktime", sym_long, attrflags, (method)0L, (method)bonk_masktime_set, calcoffset(t_bonk, x_masktime));
- class_addattr(c, attr);
-
- attr = attr_offset_new("maskdecay", sym_float32, attrflags, (method)0L, (method)bonk_maskdecay_set, calcoffset(t_bonk, x_maskdecay));
- class_addattr(c, attr);
-
- attr = attr_offset_new("debouncedecay", sym_float32, attrflags, (method)0L, (method)bonk_debouncedecay_set, calcoffset(t_bonk, x_debouncedecay));
- class_addattr(c, attr);
-
- attr = attr_offset_new("debug", sym_long, attrflags, (method)0L, (method)bonk_debug_set, calcoffset(t_bonk, x_debug));
- class_addattr(c, attr);
-
- attr = attr_offset_new("spew", sym_long, attrflags, (method)0L, (method)bonk_spew_set, calcoffset(t_bonk, x_spew));
- class_addattr(c, attr);
-
- attr = attr_offset_new("useloudness", sym_long, attrflags, (method)0L, (method)bonk_useloudness_set, calcoffset(t_bonk, x_useloudness));
- class_addattr(c, attr);
-
- attr = attr_offset_new("attackframes", sym_long, attrflags, (method)0L, (method)bonk_attackbins_set, calcoffset(t_bonk, x_attackbins));
- class_addattr(c, attr);
-
- attr = attr_offset_new("learn", sym_long, attrflags, (method)0L, (method)bonk_learn_set, calcoffset(t_bonk, x_learn));
- class_addattr(c, attr);
-
- class_addmethod(c, (method)bonk_dsp, "dsp", A_CANT, 0);
- class_addmethod(c, (method)bonk_bang, "bang", A_CANT, 0);
- class_addmethod(c, (method)bonk_forget, "forget", 0);
- class_addmethod(c, (method)bonk_thresh, "thresh", A_FLOAT, A_FLOAT, 0);
- class_addmethod(c, (method)bonk_print, "print", A_DEFFLOAT, 0);
- class_addmethod(c, (method)bonk_read, "read", A_DEFSYM, 0);
- class_addmethod(c, (method)bonk_write, "write", A_DEFSYM, 0);
- class_addmethod(c, (method)bonk_assist, "assist", A_CANT, 0);
-
- class_addmethod(c, (method)object_obex_dumpout, "dumpout", A_CANT, 0);
- class_addmethod(c, (method)object_obex_quickref, "quickref", A_CANT, 0);
-
- class_dspinit(c);
-
- class_register(CLASS_BOX, c);
- bonk_class = c;
-
- post("bonk~ v1.5");
- return (0);
-}
-
-static void *bonk_new(t_symbol *s, long ac, t_atom *av)
-{
- short j;
- t_bonk *x;
-
- if (x = (t_bonk *)object_alloc(bonk_class)) {
-
- t_insig *g;
-
- x->x_npoints = DEFNPOINTS;
- x->x_period = DEFPERIOD;
- x->x_nfilters = DEFNFILTERS;
- x->x_halftones = DEFHALFTONES;
- x->x_firstbin = DEFFIRSTBIN;
- x->x_minbandwidth = DEFMINBANDWIDTH;
- x->x_overlap = DEFOVERLAP;
- x->x_ninsig = 1;
-
- x->x_hithresh = DEFHITHRESH;
- x->x_lothresh = DEFLOTHRESH;
- x->x_masktime = DEFMASKTIME;
- x->x_maskdecay = DEFMASKDECAY;
- x->x_debouncedecay = DEFDEBOUNCEDECAY;
- x->x_minvel = DEFMINVEL;
- x->x_attackbins = DEFATTACKBINS;
-
- if (!x->x_period) x->x_period = x->x_npoints/2;
- x->x_template = (t_template *)getbytes(0);
- x->x_ntemplate = 0;
- x->x_infill = 0;
- x->x_countdown = 0;
- x->x_willattack = 0;
- x->x_attacked = 0;
- x->x_maskphase = 0;
- x->x_debug = 0;
- x->x_learn = 0;
- x->x_learndebounce = clock_getsystime();
- x->x_learncount = 0;
- x->x_useloudness = 0;
- x->x_debouncevel = 0;
- x->x_sr = sys_getsr();
-
- if (ac) {
- switch (av[0].a_type) {
- case A_LONG:
- x->x_ninsig = av[0].a_w.w_long;
- break;
- }
- }
-
- if (x->x_ninsig < 1) x->x_ninsig = 1;
- if (x->x_ninsig > MAXCHANNELS) x->x_ninsig = MAXCHANNELS;
-
- attr_args_process(x, ac, av);
-
- x->x_insig = (t_insig *)getbytes(x->x_ninsig * sizeof(*x->x_insig));
-
- dsp_setup((t_pxobject *)x, x->x_ninsig);
-
- object_obex_store(x, gensym("dumpout"), outlet_new(x, NULL));
-
- x->x_cookedout = listout((t_object *)x);
-
- for (j = 0, g = x->x_insig + x->x_ninsig-1; j < x->x_ninsig; j++, g--) {
- g->g_outlet = listout((t_object *)x);
- }
-
- x->x_clock = clock_new(x, (method)bonk_tick);
-
- bonk_donew(x, x->x_npoints, x->x_period, x->x_ninsig, x->x_nfilters,
- x->x_halftones, x->x_overlap, x->x_firstbin, x->x_minbandwidth,
- sys_getsr());
- }
- return (x);
-}
-
-/* Attribute setters. */
-void bonk_minvel_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- if (f < 0) f = 0;
- x->x_minvel = f;
- }
-}
-
-void bonk_lothresh_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- if (f > x->x_hithresh)
- post("bonk: warning: low threshold greater than hi threshold");
- x->x_lothresh = (f <= 0 ? 0.0001 : f);
- }
-}
-
-void bonk_hithresh_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- if (f < x->x_lothresh)
- post("bonk: warning: low threshold greater than hi threshold");
- x->x_hithresh = (f <= 0 ? 0.0001 : f);
- }
-}
-
-void bonk_masktime_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- x->x_masktime = (n < 0) ? 0 : n;
- }
-}
-
-void bonk_maskdecay_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- f = (f < 0) ? 0 : f;
- f = (f > 1) ? 1 : f;
- x->x_maskdecay = f;
- }
-}
-
-void bonk_debouncedecay_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- f = (f < 0) ? 0 : f;
- f = (f > 1) ? 1 : f;
- x->x_debouncedecay = f;
- }
-}
-
-void bonk_debug_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- x->x_debug = (n != 0);
- }
-}
-
-void bonk_spew_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- x->x_spew = (n != 0);
- }
-}
-
-void bonk_useloudness_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- x->x_useloudness = (n != 0);
- }
-}
-
-void bonk_attackbins_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- n = (n < 1) ? 1 : n;
- n = (n > MASKHIST) ? MASKHIST : n;
- x->x_attackbins = n;
- }
-}
-
-void bonk_learn_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- if (n != 0) {
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(x->x_template[0]), 0);
- x->x_ntemplate = 0;
- }
- x->x_learn = n;
- x->x_learncount = 0;
- }
-}
-/* end attr setters */
-
-void bonk_assist(t_bonk *x, void *b, long m, long a, char *s)
-{
-}
-
- /* get current system time */
-double clock_getsystime()
-{
- return gettime();
-}
-
- /* elapsed time in milliseconds since the given system time */
-double clock_gettimesince(double prevsystime)
-{
- return ((gettime() - prevsystime));
-}
-
-t_float qrsqrt(t_float f)
-{
- return 1/sqrt(f);
-}
-#endif /* MSP */
diff --git a/externals/extra/0.43.2/bonk~/templates.txt b/externals/extra/0.43.2/bonk~/templates.txt
deleted file mode 100644
index f3528d78..00000000
--- a/externals/extra/0.43.2/bonk~/templates.txt
+++ /dev/null
@@ -1,4 +0,0 @@
- 10.47 9.65 14.95 23.77 28.32 38.84 53.21 41.20 31.25 21.70 16.48
- 6.52 13.93 27.82 58.05 24.11 35.26 35.98 37.78 22.54 13.56 10.75
- 30.45 28.86 29.42 21.94 29.92 35.70 38.49 32.01 28.19 27.38 22.10
- 66.77 46.27 28.82 25.95 22.84 20.61 20.33 14.18 6.86 8.92 7.37
diff --git a/externals/extra/0.43.2/choice/choice-help.pd b/externals/extra/0.43.2/choice/choice-help.pd
deleted file mode 100644
index 0677db87..00000000
--- a/externals/extra/0.43.2/choice/choice-help.pd
+++ /dev/null
@@ -1,58 +0,0 @@
-#N canvas 16 5 609 600 12;
-#X obj 8 195 choice;
-#X msg 41 86 print;
-#X msg 29 63 clear;
-#X msg 8 34 add 1 0 0 \, add 0 1 0 \, add 0 0 1 \, add 1 1 1 \, add
-1 1 0;
-#X obj 77 171 pack 0 0 0;
-#X floatatom 182 125 0 0 0 0 - - -;
-#X floatatom 148 125 0 0 0 0 - - -;
-#X floatatom 115 125 0 0 0 0 - - -;
-#X obj 77 147 f;
-#X msg 77 125 bang;
-#X floatatom 8 216 0 0 0 0 - - -;
-#X obj 71 196 choice 1;
-#X floatatom 71 217 0 0 0 0 - - -;
-#X obj 76 4 choice;
-#X text 135 3 - search for a best match to an incoming list;
-#X text 19 243 The choice object holds a list of vectors \, each having
-up to ten elements. When sent a list of numbers \, it outputs the index
-of the known vector that matches most closely. The quality of the match
-is the dot product of the two vectors after normalizing them \, i.e.
-\, the vector whose direction is closest to that of the input wins.
-;
-#X text 19 340 If given a nonzero creation argument \, choice tries
-to avoid repetitious outputs by weighting less recently output vectors
-preferentially.;
-#X text 20 389 You can use this to choose interactively between a number
-of behaviors depending on their attributes. For example \, you might
-have stored a number of melodies \, of which some are syncopated \,
-some chromatic \, some are more than 100 years old \, some are bugle
-calls \, and some are Christmas carols. You could then ask to find
-a syncopated bugle call (1 \, 0 \, 0 \, 1 \, 0) and you'll get the
-thing most closely matching the request.;
-#X text 19 514 You can use numbers other than 0 and 1 to indicate relative
-strengths of the attributes \, or even use negative numbers to indicate
-opposites \, either in the incoming lists or in the stored ones.;
-#X text 320 572 updated for Pd version-0.30;
-#X text 79 62 delete all stored vectors;
-#X text 498 34 add vectors;
-#X text 94 84 debugging printout;
-#X text 69 104 tweak the numbers and hit "bang" to input a list;
-#X text 151 197 creation argument to avoid repeated outout;
-#X text 108 219 output is the index of best match \, counting from
-zero;
-#X connect 0 0 10 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 0;
-#X connect 2 0 11 0;
-#X connect 3 0 0 0;
-#X connect 3 0 11 0;
-#X connect 4 0 0 0;
-#X connect 4 0 11 0;
-#X connect 5 0 4 2;
-#X connect 6 0 4 1;
-#X connect 7 0 8 1;
-#X connect 8 0 4 0;
-#X connect 9 0 8 0;
-#X connect 11 0 12 0;
diff --git a/externals/extra/0.43.2/choice/choice.c b/externals/extra/0.43.2/choice/choice.c
deleted file mode 100644
index 9b8bfb1c..00000000
--- a/externals/extra/0.43.2/choice/choice.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* choice -- match incoming list against a collection of stored templates. */
-
-/* Copyright 1999 Miller Puckette.
-Permission is granted to use this software for any purpose provided you
-keep this copyright notice intact.
-
-THE AUTHOR AND HIS EMPLOYERS MAKE NO WARRANTY, EXPRESS OR IMPLIED,
-IN CONNECTION WITH THIS SOFTWARE.
-
-This file is downloadable from http://www.crca.ucsd.edu/~msp .
-*/
-
-#include "m_pd.h"
-#include <math.h>
-static t_class *choice_class;
-#define DIMENSION 10
-
-typedef struct _elem
-{
- t_float e_age;
- t_float e_weight[DIMENSION];
-} t_elem;
-
-typedef struct _choice
-{
- t_object x_obj;
- t_elem *x_vec;
- int x_n;
- int x_nonrepeat;
-} t_choice;
-
-static void *choice_new(t_float fnonrepeat)
-{
- t_choice *x = (t_choice *)pd_new(choice_class);
- outlet_new(&x->x_obj, gensym("float"));
- x->x_vec = (t_elem *)getbytes(0);
- x->x_n = 0;
- x->x_nonrepeat = (fnonrepeat != 0);
- return (x);
-}
-
-static void choice_clear(t_choice *x)
-{
- x->x_vec = (t_elem *)resizebytes(x->x_vec, x->x_n * sizeof(t_elem), 0);
- x->x_n = 0;
-}
-
-static void choice_print(t_choice *x)
-{
- int j;
- for (j = 0; j < x->x_n; j++)
- {
- t_elem *e = x->x_vec + j;
- t_float *w = e->e_weight;
- post("%2d age %2d \
-w %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f",
- j, (int)(e->e_age), w[0], w[1], w[2], w[3], w[4], w[5],
- w[6], w[7], w[8], w[9]);
- }
-}
-
-static void choice_add(t_choice *x, t_symbol *s, int argc, t_atom *argv)
-{
- int oldn = x->x_n, newn = oldn + 1, i;
- t_elem *e;
- t_float sum, normal;
- x->x_vec = (t_elem *)resizebytes(x->x_vec, oldn * sizeof(t_elem),
- newn * sizeof(t_elem));
- x->x_n = newn;
- e = x->x_vec + oldn;
- e->e_age = 2;
-
- for (i = 0, sum = 0; i < DIMENSION; i++)
- {
- t_float f = atom_getfloatarg(i, argc, argv);
- e->e_weight[i] = f;
- sum += f*f;
- }
- normal = (t_float)(sum > 0 ? 1./sqrt(sum) : 1);
- for (i = 0; i < DIMENSION; i++)
- e->e_weight[i] *= normal;
-}
-
-static void choice_list(t_choice *x, t_symbol *s, int argc, t_atom *argv)
-{
- int i, j;
- t_float bestsum = 0;
- int bestindex = -1;
- t_float invec[DIMENSION];
- for (i = 0; i < DIMENSION; i++)
- invec[i] = atom_getfloatarg(i, argc, argv);
- for (j = 0; j < x->x_n; j++)
- {
- t_elem *e = x->x_vec + j;
- t_float sum;
- for (i = 0, sum = 0; i < DIMENSION; i++)
- sum += e->e_weight[i] * invec[i];
- if (x->x_nonrepeat) sum *= (t_float)(log(e->e_age));
- if (sum > bestsum)
- {
- bestsum = sum;
- sum = 1;
- bestindex = j;
- }
- }
- if (bestindex >= 0)
- {
- for (j = 0; j < x->x_n; j++)
- x->x_vec[j].e_age += 1.;
- x->x_vec[bestindex].e_age = 1;
- }
- outlet_float(x->x_obj.ob_outlet, (t_float)bestindex);
-}
-
-static void choice_free(t_choice *x)
-{
- freebytes(x->x_vec, x->x_n * sizeof(t_elem));
-}
-
-void choice_setup(void)
-{
- choice_class = class_new(gensym("choice"), (t_newmethod)choice_new,
- (t_method)choice_free, sizeof(t_choice), 0, A_DEFFLOAT, 0);
- class_addmethod(choice_class, (t_method)choice_add, gensym("add"), A_GIMME, 0);
- class_addmethod(choice_class, (t_method)choice_clear, gensym("clear"), 0);
- class_addmethod(choice_class, (t_method)choice_print, gensym("print"), 0);
- class_addlist(choice_class, choice_list);
-}
diff --git a/externals/extra/0.43.2/complex-mod~-help.pd b/externals/extra/0.43.2/complex-mod~-help.pd
deleted file mode 100644
index 9e14904d..00000000
--- a/externals/extra/0.43.2/complex-mod~-help.pd
+++ /dev/null
@@ -1,26 +0,0 @@
-#N canvas 136 85 600 480 12;
-#X graph graph1 0 -1 882 1 279 209 579 39;
-#X array mod-output 882 float;
-#X pop;
-#X msg 84 256 bang \; pd dsp 1;
-#X floatatom 67 56;
-#X obj 67 186 complex-mod~;
-#X obj 67 84 phasor~ 440;
-#X obj 67 115 cos~;
-#X obj 106 138 cos~;
-#X obj 106 114 -~ 0.25;
-#X floatatom 145 152;
-#X text 93 351 The complex modulator takes two signals in which it considers to be the real and imaginary part of a complex-valued signal. It then does a complex multiplication by a sinusoud to shift all frequencies up or down by any frequency shift in Hz. See also hilbert~.;
-#X obj 69 298 tabwrite~ mod-output;
-#X text 149 204 right outlet;
-#X text 151 220 gives the other;
-#X text 149 236 sideband;
-#X connect 1 0 10 0;
-#X connect 2 0 4 0;
-#X connect 3 0 10 0;
-#X connect 4 0 5 0;
-#X connect 4 0 7 0;
-#X connect 5 0 3 0;
-#X connect 6 0 3 1;
-#X connect 7 0 6 0;
-#X connect 8 0 3 2;
diff --git a/externals/extra/0.43.2/complex-mod~.pd b/externals/extra/0.43.2/complex-mod~.pd
deleted file mode 100644
index df78a3bf..00000000
--- a/externals/extra/0.43.2/complex-mod~.pd
+++ /dev/null
@@ -1,30 +0,0 @@
-#N canvas 206 108 428 341 12;
-#X obj 142 87 inlet~;
-#X obj 315 166 cos~;
-#X obj 351 144 +~ -0.25;
-#X obj 351 166 cos~;
-#X obj 225 87 inlet~;
-#X obj 142 215 *~;
-#X obj 225 216 *~;
-#X obj 142 251 -~;
-#X obj 142 284 outlet~;
-#X obj 212 285 outlet~;
-#X obj 212 252 +~;
-#X text 140 310 positive;
-#X text 213 311 negative;
-#X obj 315 114 phasor~;
-#X obj 315 88 inlet~;
-#X connect 0 0 5 0;
-#X connect 1 0 5 1;
-#X connect 2 0 3 0;
-#X connect 3 0 6 1;
-#X connect 4 0 6 0;
-#X connect 5 0 7 0;
-#X connect 5 0 10 0;
-#X connect 6 0 7 1;
-#X connect 6 0 10 1;
-#X connect 7 0 8 0;
-#X connect 10 0 9 0;
-#X connect 13 0 2 0;
-#X connect 13 0 1 0;
-#X connect 14 0 13 0;
diff --git a/externals/extra/0.43.2/debian/changelog b/externals/extra/0.43.2/debian/changelog
deleted file mode 100644
index 1aaa941b..00000000
--- a/externals/extra/0.43.2/debian/changelog
+++ /dev/null
@@ -1,5 +0,0 @@
-pd-extra (0.42.6-1) unstable; urgency=low
-
- * Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
-
- -- Hans-Christoph Steiner <hans@eds.org> Thu, 21 Jan 2010 23:27:04 -0500
diff --git a/externals/extra/0.43.2/debian/compat b/externals/extra/0.43.2/debian/compat
deleted file mode 100644
index 7f8f011e..00000000
--- a/externals/extra/0.43.2/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-7
diff --git a/externals/extra/0.43.2/debian/control b/externals/extra/0.43.2/debian/control
deleted file mode 100644
index f6000b5c..00000000
--- a/externals/extra/0.43.2/debian/control
+++ /dev/null
@@ -1,35 +0,0 @@
-Source: pd-extra
-Section: sound
-Priority: optional
-Maintainer: Debian Multimedia Maintainers <pkg-multimedia-maintainers@lists.alioth.debian.org>
-Uploaders: Hans-Christoph Steiner <hans@eds.org>
-Build-Depends: debhelper (>= 7.0.50~),
- puredata
-Standards-Version: 3.9.1
-Homepage: http://puredata.info
-
-Package: pd-extra
-Architecture: any
-Depends: ${shlibs:Depends},
- pd,
- pd-libdir,
- ${misc:Depends}
-Recommends: pd-import
-Description: Pd library of core extras distributed as part of Pure Data
- Pure Data ships with a separate collection of objects known as
- 'extra'. Included in this collection is a set of audio functions like audio
- analysis and reverb.
- .
- bonk~: attack detection and spectral envelope measurement
- choice: search for a best match to an incoming list
- complex-mod~: complex multiplication
- expr, expr~, fexpr~: objects for evalutaing mathematical expressions
- fiddle~: pitch estimator and sinusoidal peak finder
- hilbert~: a phase quadrature for signal sideband modulation
- loop~: phase generator for looping samplers
- lrshift~: shift signal vector elements left or right
- pd~: run pd as a subprocess of pd itself
- pique: find peaks in an FFT spectrum
- rev1~, rev2~, rev3~: different reverberation algorithms
- sigmund~: sinusoidal analysis and pitch tracking
- stdout: write messages to stdout
diff --git a/externals/extra/0.43.2/debian/copyright b/externals/extra/0.43.2/debian/copyright
deleted file mode 100644
index 231abfd2..00000000
--- a/externals/extra/0.43.2/debian/copyright
+++ /dev/null
@@ -1,63 +0,0 @@
-Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?rev=135
-Name: extra
-Maintainer: Miller Puckette and others
-Source: http://sourceforge.net/projects/pure-data/files/libraries/extra/
-
-Files: *
-Copyright: 1997-2010, Miller Puckette
- 1997-1999, Ted Apel
-License: BSD Pd License
-
-Files: expr~/*
-Copyright: 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
-License: GPL-2+
-
-License: BSD Pd License
-This software is copyrighted by Miller Puckette and others. The following
-terms (the "Standard Improved BSD License") apply to all files associated with
-the software unless explicitly disclaimed in individual files:
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-3. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior
- written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
-
-
-License: GPL-2+
- This package is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- .
- This package is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- .
- You should have received a copy of the GNU General Public License
- along with this package; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-X-Comment: On Debian systems, the complete text of the GNU General
- Public License can be found in `/usr/share/common-licenses/GPL-2'.
diff --git a/externals/extra/0.43.2/debian/gbp.conf b/externals/extra/0.43.2/debian/gbp.conf
deleted file mode 100644
index ae1dc367..00000000
--- a/externals/extra/0.43.2/debian/gbp.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-[DEFAULT]
-upstream-branch = upstream
-debian-branch = master
-upstream-tag = upstream/%(version)s
-debian-tag = debian/%(version)s
-pristine-tar = True
-sign-tags = True
diff --git a/externals/extra/0.43.2/debian/links b/externals/extra/0.43.2/debian/links
deleted file mode 100644
index d97ab7c9..00000000
--- a/externals/extra/0.43.2/debian/links
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib/pd/extra/extra/README.txt usr/share/doc/pd-extra/README
diff --git a/externals/extra/0.43.2/debian/rules b/externals/extra/0.43.2/debian/rules
deleted file mode 100755
index 67fca227..00000000
--- a/externals/extra/0.43.2/debian/rules
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/make -f
-
-LIBRARY_NAME = extra
-PACKAGE = pd-$(LIBRARY_NAME)
-pkglibdir = /usr/lib/pd/extra
-
-%:
- dh $@ --buildsystem=makefile
-
-override_dh_auto_install:
- dh_auto_install -- prefix=/usr pkglibdir=$(pkglibdir)
-
-override_dh_shlibdeps:
- dpkg-shlibdeps $(CURDIR)/debian/$(PACKAGE)$(pkglibdir)/$(LIBRARY_NAME)/*.pd_linux \
- -T$(CURDIR)/debian/$(PACKAGE).substvars
diff --git a/externals/extra/0.43.2/debian/source/format b/externals/extra/0.43.2/debian/source/format
deleted file mode 100644
index 163aaf8d..00000000
--- a/externals/extra/0.43.2/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/externals/extra/0.43.2/debian/watch b/externals/extra/0.43.2/debian/watch
deleted file mode 100644
index 06eccab4..00000000
--- a/externals/extra/0.43.2/debian/watch
+++ /dev/null
@@ -1,2 +0,0 @@
-version=3
-http://sf.net/pure-data/extra-(.*)\.tar\.gz
diff --git a/externals/extra/0.43.2/expr-help.pd b/externals/extra/0.43.2/expr-help.pd
deleted file mode 100644
index 8fafb35d..00000000
--- a/externals/extra/0.43.2/expr-help.pd
+++ /dev/null
@@ -1,497 +0,0 @@
-#N canvas 165 94 1012 579 12;
-#X text 66 10 expression evaluation family - expr \, expr~ \, fexpr~
-;
-#X text 63 239 Syntyax:;
-#X text 64 311 $f#: float input variable;
-#X text 65 326 $s#: symbol input variable;
-#X text 553 90 Used for expr~ only:;
-#X text 553 105 $v#: signal (vector) input (vector by vector evaluation)
-;
-#X text 550 164 Used for fexpr~ only:;
-#X text 550 220 $y[n]: the output value indexed by n where n has to
-satisfy 0 > n >= -vector size.;
-#X text 550 248 (the vector size can be changed by the "block~" object.)
-;
-#X text 550 179 $x#[n]: the sample from inlet # indexed by n where
-n has to satisfy 0 => n >= -vector size \, ($x# is a shorthand for
-$x#[0] \, specifying the current sample);
-#X text 63 151 expr~ is used for expression evaluaion of signal data
-on the vector by vector basis;
-#X text 63 136 expr is used for expression evaluaion of control data
-;
-#X text 67 39 For a more detailed documentaion refer to http://www.crca.ucsd.edu/~yadegari/expr.html
-;
-#X text 64 254 The syntax is very close to how expressions are written
-in C. Variables are specified as follows where the '#' stands for the
-inlet number:;
-#X text 65 297 $i#: integer input variable;
-#X text 63 179 fexpr~ is used for expression evaluaion on sample level
-data \; i.e. \, filter design. Warning: fexpr~ is very cpu intensive.
-;
-#X text 633 12 updated for Pd 0.35 test 26 and expr* 0.4;
-#X text 67 85 you can define multiple expressoins in the same object.
-semicolon is used to separates the expressions.;
-#X text 635 294 $y -> $y1[-1];
-#X text 550 263 Shorthands: $x -> $x1[0];
-#X text 635 279 $x1 -> $x1[0] $x2 -> $x2[0] .....;
-#X text 635 309 $y1 -> $y1[-1] $y2 -> $y2[-1] .....;
-#N canvas 0 0 828 385 Examples 0;
-#X obj 33 151 expr 1;
-#X floatatom 197 119 0 0 0 0 - - -;
-#X floatatom 33 181 0 0 0 0 - - -;
-#X msg 33 123 bang;
-#X obj 101 149 expr 2 + 3;
-#X msg 101 122 bang;
-#X floatatom 101 177 0 0 0 0 - - -;
-#X floatatom 196 177 0 0 0 0 - - -;
-#X obj 196 149 expr 2+$f1;
-#X floatatom 34 220 0 0 0 0 - - -;
-#X floatatom 34 277 0 0 0 0 - - -;
-#X obj 34 249 expr $f1 * $f2;
-#X floatatom 113 220 0 0 0 0 - - -;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array array1 10 float 0;
-#X coords 0 10 10 0 200 150 1;
-#X restore 584 180 graph;
-#X floatatom 35 315 0 0 0 0 - - -;
-#X floatatom 35 371 0 0 0 0 - - -;
-#X floatatom 194 219 0 0 0 0 - - -;
-#X floatatom 194 276 0 0 0 0 - - -;
-#X obj 194 248 expr $s2[$f1];
-#X msg 267 220 symbol array1;
-#X obj 35 343 expr sin(2 * 3.14159 * $f1 / 360);
-#X msg 330 281 \; array1 1 4 2 8 5 6 1 4 2 8 5 6;
-#X floatatom 310 184 5 0 0 0 - - -;
-#X floatatom 395 186 5 0 0 0 - - -;
-#X floatatom 480 184 5 0 0 0 - - -;
-#X floatatom 310 105 5 0 0 0 - - -;
-#X obj 310 132 expr $f1 \; if ($f1 > 0 \, $f1 * 2 \, 0) \; if ($f1
-<= 0 \, $f1 / 2 \, 0);
-#X text 34 56 Examples of expr object;
-#X text 304 88 an example of multiple expressions and the use of 'if'
-;
-#X connect 0 0 2 0;
-#X connect 1 0 8 0;
-#X connect 3 0 0 0;
-#X connect 4 0 6 0;
-#X connect 5 0 4 0;
-#X connect 8 0 7 0;
-#X connect 9 0 11 0;
-#X connect 11 0 10 0;
-#X connect 12 0 11 1;
-#X connect 14 0 20 0;
-#X connect 16 0 18 0;
-#X connect 18 0 17 0;
-#X connect 19 0 18 1;
-#X connect 20 0 15 0;
-#X connect 25 0 26 0;
-#X connect 26 0 22 0;
-#X connect 26 1 23 0;
-#X connect 26 2 24 0;
-#X restore 307 398 pd Examples of expr;
-#N canvas 23 24 882 676 Examples 0;
-#X text -88 101 expr~ examples:;
-#X obj -24 355 print~;
-#X msg 13 334 bang;
-#X obj -24 276 sig~ 440;
-#X floatatom 49 293 0 0 0 0 - - -;
-#X floatatom -24 253 0 0 0 0 - - -;
-#X obj -24 316 expr~ $v1*$f2;
-#X obj 85 356 print~;
-#X msg 101 335 bang;
-#X floatatom 85 268 0 0 0 0 - - -;
-#X floatatom 158 270 0 0 0 0 - - -;
-#X floatatom 357 291 0 0 0 0 - - -;
-#X floatatom 244 267 0 0 0 0 - - -;
-#X obj 244 294 osc~;
-#X msg 369 47 \; pd dsp 0;
-#X msg 291 49 \; pd dsp 1;
-#X text 294 26 audio on;
-#X text 377 25 audio off;
-#X text -45 236 vector times scalar;
-#X text 87 236 vector;
-#X obj 243 354 dac~;
-#X text 241 245 frequency;
-#X text 373 273 amplitude;
-#X obj 85 315 expr~ $v1*$v2;
-#X floatatom 207 471 5 0 0 0 - - -;
-#X obj -40 520 tabsend~ a1;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array a1 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore -39 542 graph;
-#X obj -40 497 expr~ max(min($v1 \, $f2/10) \, -$f2/10);
-#X text -38 123 NOTES: the first inlet of expr~ cannot be a $f1 or
-$i1 \, this may change in later releases;
-#X text -87 420 A simple limiter example;
-#X obj 356 158 vsl 15 128 0 127 0 0 empty empty empty 20 8 0 8 -262144
--1 -1 0 1;
-#X obj 243 315 expr~ $v1*$f2/128;
-#X text -82 28 make sure you turn on audio for the expr~ examples;
-#X obj -40 473 osc~ 2756.25;
-#X text 122 436 Move the value below between 0 and 10;
-#X text 126 451 to change the limiter threshold;
-#X obj 417 522 tabsend~ a2;
-#X obj 580 518 tabsend~ a3;
-#X obj 417 439 osc~ 2756.25;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array a2 64 float 1;
-#A 0 -0.797042 -0.728354 -0.551199 -0.29486 -5.74798e-08 0.28779 0.525076
-0.677165 0.723186 0.658973 0.49724 0.265198 -5.86755e-06 -0.257244
--0.467812 -0.601285 -0.639938 -0.581051 -0.436842 -0.232108 -4.49318e-08
-0.223344 0.404462 0.517604 0.548393 0.495593 0.370771 0.195993 -4.2964e-06
--0.186556 -0.335875 -0.427214 -0.449737 -0.4037 -0.299884 -0.157342
--3.00576e-08 0.14734 0.262927 0.331275 0.34523 0.306564 0.225106 0.116645
--2.503e-06 -0.106219 -0.186565 -0.231035 -0.236249 -0.205455 -0.147412
--0.0744387 -1.36289e-08 0.0637127 0.10778 0.127799 0.124205 0.101679
-0.0677997 0.0312617 -5.8003e-07 -0.0203835 -0.0275998 -0.0229047;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 347 554 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array a3 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 569 554 graph;
-#X obj 417 473 expr~ $v1 *$v2 \; if ($v2 > 0 \, 0 \, $v1*$v2);
-#X obj 580 439 osc~ 100;
-#X connect 2 0 1 0;
-#X connect 3 0 6 0;
-#X connect 4 0 6 1;
-#X connect 5 0 3 0;
-#X connect 6 0 1 0;
-#X connect 8 0 7 0;
-#X connect 9 0 23 0;
-#X connect 10 0 23 1;
-#X connect 11 0 31 1;
-#X connect 12 0 13 0;
-#X connect 13 0 31 0;
-#X connect 23 0 7 0;
-#X connect 24 0 27 1;
-#X connect 27 0 25 0;
-#X connect 30 0 11 0;
-#X connect 31 0 20 0;
-#X connect 31 0 20 1;
-#X connect 33 0 27 0;
-#X connect 38 0 41 0;
-#X connect 41 0 36 0;
-#X connect 41 1 37 0;
-#X connect 42 0 41 1;
-#X restore 307 433 pd Examples of expr~;
-#X text 40 399 For expr examples click here ->;
-#X text 41 433 For expr~ examples click here ->;
-#X text 40 471 For fexpr~ examples click here ->;
-#N canvas 0 0 1059 688 examples 0;
-#X msg 519 84 \; pd dsp 0;
-#X msg 428 84 \; pd dsp 1;
-#X text 426 64 audio on;
-#X text 518 65 audio off;
-#X floatatom 126 304 0 0 0 0 - - -;
-#X floatatom 259 323 0 0 0 0 - - -;
-#X msg 226 283 -10;
-#X text 53 103 fexpr~ examples:;
-#X obj 125 571 print~;
-#X msg 247 552 bang;
-#X floatatom 125 475 0 0 0 0 - - -;
-#X obj 126 347 fexpr~ ($x1[$f2]+$x1)/2;
-#X obj 125 532 fexpr~ $x1+$y[-1];
-#X floatatom 635 366 0 0 0 0 - - -;
-#X floatatom 795 387 0 0 0 0 - - -;
-#X obj 630 456 dac~;
-#X obj 632 407 fexpr~ ($x1[$f2/1000]+$x1)/2;
-#X msg 864 317 0 10000;
-#X obj 795 368 line 0;
-#X msg 798 318 -10000;
-#X obj 120 389 dac~;
-#X text 96 227 Simple FIR filter;
-#X text 557 134 Simple FIR filter using fractional offset;
-#X msg 704 318 -10000 10000;
-#X obj 635 387 osc~ 2205;
-#X msg 644 343 1102.5;
-#X msg 862 342 0 10000;
-#X msg 796 343 -20000;
-#X msg 702 343 -20000 10000;
-#X msg 635 318 2205;
-#X msg 548 312 start;
-#X msg 550 334 stop;
-#X msg 57 284 start;
-#X msg 56 309 stop;
-#X msg 75 469 start;
-#X msg 74 494 stop;
-#X obj 491 335 loadbang;
-#X obj 18 495 loadbang;
-#X obj 1 309 loadbang;
-#X text 617 291 frequency;
-#X text 707 300 of the simple filter;
-#X msg 293 282 -20;
-#X obj 126 325 osc~ 2205;
-#X msg 156 281 1102.5;
-#X msg 110 281 2205;
-#X msg 260 282 0;
-#X text 123 445 simple accumulator defined as and an IIR filter;
-#X text 52 148 NOTE: fexpr~ could use lots of CPU power \, by default
-fexpr~ is on when it is loaded. In this page we are turning them off
-with loadbang \, so to hear them you have to turn them on explicitly.
-You can use the "start" and "stop" messages to start and stop fexpr~
-and expr~;
-#X text 706 288 index defining the frequency;
-#X text 95 240 -10 offset will fully filter audio frequency of 2205
-\, and -20 offset will filter audio at frequency of 1102.5;
-#X text 559 215 Thus \, the offset -10000 will filter audio at frequency
-of 2205 and the offset value -20000 will filter the audio at frequency
-of 1102.5.;
-#X text 558 161 When fractional offset is used \, fexpr~ determines
-indexed by linear interpolation. In the following example the offset
-value is divided by 1000 \, thus we can continuously change the offset
-without an audible click in the output.;
-#X text 288 318 If you change this value you;
-#X text 290 330 hear a click;
-#X text 51 87 make sure you turn on audio for the fexpr~ examples;
-#X text 55 -323 Used for fexpr~ only:;
-#X text 55 -267 $y[n]: the output value indexed by n where n has to
-satisfy 0 > n >= -vector size.;
-#X text 55 -239 (the vector size can be changed by the "block~" object.)
-;
-#X text 55 -308 $x#[n]: the sample from inlet # indexed by n where
-n has to satisfy 0 => n >= -vector size \, ($x# is a shorthand for
-$x#[0] \, specifying the current sample);
-#X text 140 -193 $y -> $y1[-1];
-#X text 55 -224 Shorthands: $x -> $x1[0];
-#X text 140 -208 $x1 -> $x1[0] $x2 -> $x2[0] .....;
-#X text 140 -178 $y1 -> $y1[-1] $y2 -> $y2[-1] .....;
-#X text 64 -125 fexpr~ responds to the following methods;
-#X text 66 -106 clear - clears all the previous input and output buffers
-;
-#X text 65 -92 clear x# - clears the previous values of the #th input
-;
-#X text 66 -79 clear y# - clears the previous values of the #th output
-;
-#X text 66 -33 set x# val-1 val-2 ... - sets the as many supplied values
-of the #th input;
-#X text 513 -22 e.g. \, set x2 3.4 0.4 sets x2[-1]=3.4 and x2[-2]=0.4
-;
-#X text 66 -2 set y# val-1 val-2 ... - sets the as many supplied values
-of the #th input;
-#X text 514 4 e.g. \, set y3 1.1 3.3 4.5 sets y3[-1]=1.1 y3[-2]=3.3
-and y3[-3]=4.5;
-#X text 64 -54 set val val ... - sets the first past values of each
-output;
-#X text 513 -59 e.g. \, set 0.1 2.2 0.4 sets y1[-1]=0.1 y2[-1]=2.2
-\, and y3[-1]=0.4;
-#X msg 244 475 set 4000;
-#X obj 125 504 sig~ 0.001;
-#X msg 245 498 clear;
-#X text 22 442 comment;
-#X text 14 431 1 first click the start button;
-#X text 307 494 2 click the set or the clear button;
-#X text 304 547 3 then click bang to see how set and clear work;
-#X connect 4 0 42 0;
-#X connect 5 0 11 1;
-#X connect 6 0 5 0;
-#X connect 9 0 8 0;
-#X connect 10 0 74 0;
-#X connect 11 0 20 0;
-#X connect 11 0 20 1;
-#X connect 12 0 8 0;
-#X connect 13 0 24 0;
-#X connect 14 0 16 1;
-#X connect 16 0 15 0;
-#X connect 16 0 15 1;
-#X connect 17 0 18 0;
-#X connect 18 0 14 0;
-#X connect 19 0 18 0;
-#X connect 23 0 18 0;
-#X connect 24 0 16 0;
-#X connect 25 0 13 0;
-#X connect 26 0 18 0;
-#X connect 27 0 18 0;
-#X connect 28 0 18 0;
-#X connect 29 0 13 0;
-#X connect 30 0 16 0;
-#X connect 31 0 16 0;
-#X connect 32 0 11 0;
-#X connect 33 0 11 0;
-#X connect 34 0 12 0;
-#X connect 35 0 12 0;
-#X connect 36 0 31 0;
-#X connect 37 0 35 0;
-#X connect 38 0 33 0;
-#X connect 41 0 5 0;
-#X connect 42 0 11 0;
-#X connect 43 0 4 0;
-#X connect 44 0 4 0;
-#X connect 45 0 5 0;
-#X connect 73 0 12 0;
-#X connect 74 0 12 0;
-#X connect 75 0 12 0;
-#X restore 306 472 pd examples of fexpr~;
-#X text 42 504 For using fexpr~ for solving;
-#X text 43 520 differential equations click here ->;
-#N canvas 112 22 944 449 lorenz 0;
-#X obj 176 67 v pr;
-#X obj 307 68 v r;
-#X obj 233 69 v b;
-#X floatatom 176 38 5 0 0 0 - - -;
-#X floatatom 307 40 5 0 0 0 - - -;
-#X msg 177 13 10;
-#X obj 231 10 expr 8./3;
-#X msg 128 136 set 1.2 2.3 4.4;
-#X floatatom 233 39 7 0 0 0 - - -;
-#X msg 75 46 stop;
-#X msg 75 67 start;
-#X floatatom 399 40 5 0 0 0 - - -;
-#X obj 399 69 v dt;
-#X msg 310 12 18;
-#X msg 395 13 0.01;
-#X obj 68 296 dac~;
-#X obj 128 -41 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X text 201 -41 <- turn audio on and bang here;
-#X text 463 42 <- experiment with these numbers;
-#X text 472 72 if you hear a buzz \, you have probably gone unstable
-bang on the top again;
-#X obj 489 15 line;
-#X obj 128 241 /~ 20;
-#X obj 234 238 /~ 20;
-#X obj 340 237 /~ 20;
-#X msg 484 -11 0.01 \, 0.04 5000;
-#X obj 128 185 fexpr~ $y1+(pr*$y2-pr*$y1)*dt \; $y2 +(-$y1*$y3 + r*$y1-$y2)*dt
-\; $y3+($y1*$y2 - b*$y3)*dt;
-#X obj 14 65 loadbang;
-#X text 113 -100 This is an example of how fexpr~ could be used for
-solving differential equations \, in this case the lorenz equations
-which generate chotic signals;
-#X text 361 182 Note the following shorthands:;
-#X text 360 198 $y1 -> $y1[-1] \, $y2 -> $y2[-1] \, .....;
-#X text 248 136 the 'set' commands sets the initial previous values
-;
-#X obj 128 298 tabsend~ lorenz1a;
-#X obj 234 278 tabsend~ lorenz2a;
-#X obj 339 259 tabsend~ lorenz3a;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz1a 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 73 437 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz2a 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 331 435 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz3a 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 592 436 graph;
-#X text 301 315 You can see the graphs if you scroll down;
-#X text 301 328 but the redrawings may cause clicks in the audio;
-#X connect 3 0 0 0;
-#X connect 4 0 1 0;
-#X connect 5 0 3 0;
-#X connect 6 0 8 0;
-#X connect 7 0 25 0;
-#X connect 8 0 2 0;
-#X connect 9 0 25 0;
-#X connect 10 0 25 0;
-#X connect 11 0 12 0;
-#X connect 13 0 4 0;
-#X connect 14 0 11 0;
-#X connect 16 0 5 0;
-#X connect 16 0 6 0;
-#X connect 16 0 13 0;
-#X connect 16 0 14 0;
-#X connect 16 0 7 0;
-#X connect 16 0 10 0;
-#X connect 20 0 11 0;
-#X connect 21 0 31 0;
-#X connect 21 0 15 0;
-#X connect 21 0 15 1;
-#X connect 22 0 32 0;
-#X connect 23 0 33 0;
-#X connect 24 0 20 0;
-#X connect 25 0 21 0;
-#X connect 25 1 22 0;
-#X connect 25 2 23 0;
-#X connect 26 0 9 0;
-#X restore 308 518 pd lorenz equations for audition;
-#N canvas 97 36 978 656 lorenz 0;
-#X obj 176 67 v pr;
-#X obj 307 68 v r;
-#X obj 233 69 v b;
-#X floatatom 176 38 5 0 0 0 - - -;
-#X floatatom 307 40 5 0 0 0 - - -;
-#X msg 177 13 10;
-#X obj 231 10 expr 8./3;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz1 2048 float 0;
-#X coords 0 -1 2047 1 200 140 1;
-#X restore 82 357 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz2 2048 float 0;
-#X coords 0 -1 2047 1 200 140 1;
-#X restore 327 353 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz3 2048 float 0;
-#X coords 0 -1 2047 1 200 140 1;
-#X restore 570 347 graph;
-#X msg 128 136 set 1.2 2.3 4.4;
-#X floatatom 233 39 7 0 0 0 - - -;
-#X msg 75 46 stop;
-#X msg 75 67 start;
-#X floatatom 399 40 5 0 0 0 - - -;
-#X obj 399 69 v dt;
-#X msg 310 12 18;
-#X msg 395 13 0.01;
-#X obj 128 -41 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X text 201 -41 <- turn audio on and bang here;
-#X text 463 42 <- experiment with these numbers;
-#X text 472 72 if you hear a buzz \, you have probably gone unstable
-bang on the top again;
-#X obj 489 15 line;
-#X obj 128 241 /~ 20;
-#X obj 234 238 /~ 20;
-#X obj 340 237 /~ 20;
-#X msg 484 -11 0.01 \, 0.04 5000;
-#X obj 14 65 loadbang;
-#X text 113 -100 This is an example of how fexpr~ could be used for
-solving differential equations \, in this case the lorenz equations
-which generate chotic signals;
-#X text 361 182 Note the following shorthands:;
-#X text 360 198 $y1 -> $y1[-1] \, $y2 -> $y2[-1] \, .....;
-#X text 248 136 the 'set' commands sets the initial previous values
-;
-#X obj 128 298 tabsend~ lorenz1;
-#X obj 234 278 tabsend~ lorenz2;
-#X obj 339 259 tabsend~ lorenz3;
-#X obj 627 280 block~ 2048;
-#X text 669 133 Lorenz Equations;
-#X obj 128 185 fexpr~ $y1+pr * ($y2-$y1)*dt \; $y2 +(-$y1*$y3 + r*$y1-$y2)*dt
-\; $y3+($y1*$y2 - b*$y3)*dt;
-#X text 672 197 dZ/dt = -bZ;
-#X text 669 167 dX/dt = pr * (X - Y);
-#X text 668 147 written with 3 state variable X \, Y \, and Z;
-#X text 670 182 dY/dt = -XZ + rX - y;
-#X connect 3 0 0 0;
-#X connect 4 0 1 0;
-#X connect 5 0 3 0;
-#X connect 6 0 11 0;
-#X connect 10 0 37 0;
-#X connect 11 0 2 0;
-#X connect 12 0 37 0;
-#X connect 13 0 37 0;
-#X connect 14 0 15 0;
-#X connect 16 0 4 0;
-#X connect 17 0 14 0;
-#X connect 18 0 5 0;
-#X connect 18 0 6 0;
-#X connect 18 0 16 0;
-#X connect 18 0 17 0;
-#X connect 18 0 10 0;
-#X connect 18 0 13 0;
-#X connect 22 0 14 0;
-#X connect 23 0 32 0;
-#X connect 24 0 33 0;
-#X connect 25 0 34 0;
-#X connect 26 0 22 0;
-#X connect 27 0 12 0;
-#X connect 37 0 23 0;
-#X connect 37 1 24 0;
-#X connect 37 2 25 0;
-#X restore 308 541 pd lorenz equations for visualization;
-#X text 68 24 by Shahrokh Yadegari;
diff --git a/externals/extra/0.43.2/expr~/LICENSE.txt b/externals/extra/0.43.2/expr~/LICENSE.txt
deleted file mode 100644
index 01469ec7..00000000
--- a/externals/extra/0.43.2/expr~/LICENSE.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/externals/extra/0.43.2/expr~/README.txt b/externals/extra/0.43.2/expr~/README.txt
deleted file mode 100644
index bf84f2ae..00000000
--- a/externals/extra/0.43.2/expr~/README.txt
+++ /dev/null
@@ -1,97 +0,0 @@
-
-You can get more information on the expr object at
-http://www.crca.ucsd.edu/~yadegari/expr.html
-
------------
-
-New if Version 0.4
-
--access to variables (made by value object)
--multiple expression separated by ;
--added the following shorthands:
- $y or $y1 = $y1[-1] and $y2 = $y2[-1]
--new functions:
- if - conditional evaluation
- cbrt - cube root
- erf - error function
- erfc - complementary error function
- expm1 - exponential minus 1,
- log1p - logarithm of 1 plus
- isinf - is the value infinite,
- finite - is the value finite
- isnan -- is the resut a nan (Not a number)
- copysign - copy sign of a number
- ldexp - multiply floating-point number by integral power of 2
- imodf - get signed integral value from floating-point number
- modf - get signed fractional value from floating-point number
- drem - floating-point remainder function
-
- Thanks to Orm Finnendahl for adding the following functions:
- fmod - floating-point remainder function
- ceil - ceiling function: smallest integral value not less than argument
- floor - largest integral value not greater than argument
-
-------------
-
-New in Version 0.3
--Full function functionality
-
-------------
-
-The object "expr" is used for expression evaluaion of control data.
-
-Expr~ and fexpr~ are extentions to the expr object to work with vectors.
-The expr~ object is designed to efficiently combine signal and control
-stream processing by vector operations on the basis of the block size of
-the environment.
-
-fexpr~ object provides a flexible mechanism for building FIR and
-IIR filters by evaluating expressions on a sample by sample basis
-and providing access to prior samples of the input and output audio
-streams. When fractional offset is used, fexpr~ uses linear interpolation
-to determine the value of the indexed sample. fexpr~ evaluates the
-expression for every single sample and at every evaluation previous
-samples (limited by the audio vector size) can be accessed. $x is used to
-denote a singnal input whose samples we would like to access. The syntax
-is $x followed by the inlet number and indexed by brackets, for example
-$x1[-1] specifies the previous sample of the first inlet. Therefore,
-if we are to build a simple filter which replaces every sample by
-the average of that sample and its previous one, we would use "fexpr~
-($x1[0]+$x1[-1])/2 ". For ease of when the brackets are omitted, the
-current sample is implied, so we can right the previous filter expression
-as follows: " fexpr~ ($x1+$x1[-1])/2". To build IIR filters $y is used
-to access the previous samples of the output stream.
-
-The three objects expr, expr~, and fexpr~ are implemented in the same object
-so the files expr~.pd_linux and fexpr~.pd_linux are links to expr.pd_linux
-This release has been compiled and tested on Linux 6.0.
-
---------
-
-Here are some syntax information: (refer to help-expr.pd for examples)
-
-Syntyax:
-The syntax is very close to how expression are written in
-C. Variables are specified as follows where the '#' stands
-for the inlet number:
-$i#: integer input variable
-$f#: float input variable
-$s#: symbol input variable
-
-Used for expr~ only:
-$v#: signal (vector) input (vector by vector evaluation)
-
-Used for fexpr~ only:
-$x#[n]: the sample from inlet # indexed by n, where n has to
- satisfy 0 => n >= -vector size,
- ($x# is a shorthand for $x#[0], specifying the current sample)
-
-$y#[n]: the output value indexed by n, where n has to
- satisfy 0 > n >= -vector size,
- $y[n] is a shorthand for $y1[n]
-
-
-I'll appreciate hearing about bugs, comments, suggestions, ...
-
-Shahrokh Yadegari (sdy@ucsd.edu)
-7/10/02
diff --git a/externals/extra/0.43.2/expr~/fts_to_pd.h b/externals/extra/0.43.2/expr~/fts_to_pd.h
deleted file mode 100644
index 9ca2fc42..00000000
--- a/externals/extra/0.43.2/expr~/fts_to_pd.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* fts_to_pd.h -- alias some fts names to compile in Pd.
-
-copyright 1999 Miller Puckette;
-permission is granted to use this file for any purpose.
-*/
-
-
-#define fts_malloc malloc
-#define fts_calloc calloc
-#define fts_free free
-#define fts_realloc realloc
-#define fts_atom_t t_atom
-#define fts_object_t t_object
-typedef t_symbol *fts_symbol_t;
-
-#ifdef MSP
-#define t_atom Atom
-#define t_symbol Symbol
-#define pd_new(x) newobject(x);
-#define pd_free(x) freeobject(x);
-#define t_outlet void
-#define t_binbuf void
-typedef t_class *t_pd;
-typedef float t_floatarg;
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <errno.h>
-
-void pd_error(void *object, char *fmt, ...);
-
-#endif /* MSP */
-
-#define post_error pd_error
-#define fts_is_floatg(x) ((x)->a_type == A_FLOAT)
-
-#define fts_new_symbol_copy gensym
-
-#define fts_symbol_name(x) ((x)->s_name)
diff --git a/externals/extra/0.43.2/expr~/vexp.c b/externals/extra/0.43.2/expr~/vexp.c
deleted file mode 100644
index 8f8ff46c..00000000
--- a/externals/extra/0.43.2/expr~/vexp.c
+++ /dev/null
@@ -1,2142 +0,0 @@
-/*
- * jMax
- * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * See file LICENSE for further informations on licensing terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Based on Max/ISPW by Miller Puckette.
- *
- * Authors: Maurizio De Cecco, Francois Dechelle, Enzo Maggi, Norbert Schnell.
- *
- */
-
-/* "expr" was written by Shahrokh Yadegari c. 1989. -msp */
-/* "expr~" and "fexpr~" conversion by Shahrokh Yadegari c. 1999,2000 */
-
-/*
- * Feb 2002 - added access to variables
- * multiple expression support
- * new short hand forms for fexpr~
- * now $y or $y1 = $y1[-1] and $y2 = $y2[-1]
- * --sdy
- *
- * July 2002
- * fixed bugs introduced in last changes in store and ET_EQ
- * --sdy
- *
- */
-
-/*
- * vexp.c -- a variable expression evaluator
- *
- * This modules implements an expression evaluator using the
- * operator-precedence parsing. It transforms an infix expression
- * to a prefix stack ready to be evaluated. The expression sysntax
- * is close to that of C. There are a few operators that are not
- * supported and functions are also recognized. Strings can be
- * passed to functions when they are quoted in '"'s. "[]" are implememted
- * as an easy way of accessing the content of tables, and the syntax
- * table_name[index].
- * Variables (inlets) are specified with the following syntax: $x#,
- * where x is either i(integers), f(floats), and s(strings); and #
- * is a digit that coresponds to the inlet number. The string variables
- * can be used as strings when they are quoted and can also be used as
- * table names when they are followed by "[]".
- *
- * signal vectors have been added to this implementation:
- * $v# denotes a signal vector
- * $x#[index] is the value of a sample at the index of a the signal vector
- * $x# is the shorthand for $x#[0]
- * $y[index] is the value of the sample output at the index of a the
- * signal output
- * "index" for $x#[index] has to have this range (0 <= index < vectorsize)
- * "index" for $y[index] has to have this range (0 < index < vectorsize)
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "vexp.h"
-#ifdef MSP
-#undef isdigit
-#define isdigit(x) (x >= '0' && x <= '9')
-#endif
-
-char *atoif(char *s, long int *value, long int *type);
-
-static struct ex_ex *ex_lex(struct expr *expr, long int *n);
-struct ex_ex *ex_match(struct ex_ex *eptr, long int op);
-struct ex_ex *ex_parse(struct expr *expr, struct ex_ex *iptr,
- struct ex_ex *optr, long int *argc);
-struct ex_ex *ex_eval(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-
-int expr_donew(struct expr *exprr, int ac, t_atom *av);
-struct ex_ex *eval_func(struct expr *expr,struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-struct ex_ex *eval_tab(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-struct ex_ex *eval_var(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-struct ex_ex *eval_store(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-struct ex_ex *eval_sigidx(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-static int cal_sigidx(struct ex_ex *optr, /* The output value */
- int i, t_float rem_i, /* integer and fractinal part of index */
- int idx, /* index of current fexpr~ processing */
- int vsize, /* vector size */
- t_float *curvec, t_float *prevec); /* current and previous table */
-t_ex_func *find_func(char *s);
-void ex_dzdetect(struct expr *expr);
-
-#define MAX_ARGS 10
-extern t_ex_func ex_funcs[];
-
-struct ex_ex nullex;
-
-void set_tokens (char *s);
-int getoken (struct expr *expr, struct ex_ex *eptr);
-void ex_print (struct ex_ex *eptr);
-#ifdef MSP
-void atom_string(t_atom *a, char *buf, unsigned int bufsize);
-
-void atom_string(t_atom *a, char *buf, unsigned int bufsize)
-{
- char tbuf[30];
- switch(a->a_type)
- {
- case A_SEMI: strcpy(buf, ";"); break;
- case A_COMMA: strcpy(buf, ","); break;
-#ifdef PD
- case A_POINTER:
- strcpy(buf, "(pointer)");
- break;
-#endif
- case A_FLOAT:
- sprintf(tbuf, "%g", a->a_w.w_float);
- if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf);
- else if (a->a_w.w_float < 0) strcpy(buf, "-");
- else strcat(buf, "+");
- break;
- case A_LONG:
- sprintf(tbuf, "%d", a->a_w.w_long);
- if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf);
- else if (a->a_w.w_float < 0) strcpy(buf, "-");
- else strcat(buf, "+");
- break;
- case A_SYMBOL:
- {
- char *sp;
- unsigned int len;
- int quote;
- for (sp = a->a_w.w_symbol->s_name, len = 0, quote = 0; *sp; sp++, len++)
- if (*sp == ';' || *sp == ',' || *sp == '\\' ||
- (*sp == '$' && sp == a->a_w.w_symbol->s_name && sp[1] >= '0'
- && sp[1] <= '9'))
- quote = 1;
- if (quote)
- {
- char *bp = buf, *ep = buf + (bufsize-2);
- sp = a->a_w.w_symbol->s_name;
- while (bp < ep && *sp)
- {
- if (*sp == ';' || *sp == ',' || *sp == '\\' ||
- (*sp == '$' && bp == buf && sp[1] >= '0' && sp[1] <= '9'))
- *bp++ = '\\';
- *bp++ = *sp++;
- }
- if (*sp) *bp++ = '*';
- *bp = 0;
- /* post("quote %s -> %s", a->a_w.w_symbol->s_name, buf); */
- }
- else
- {
- if (len < bufsize-1) strcpy(buf, a->a_w.w_symbol->s_name);
- else
- {
- strncpy(buf, a->a_w.w_symbol->s_name, bufsize - 2);
- strcpy(buf + (bufsize - 2), "*");
- }
- }
- }
- break;
-#ifdef PD
- case A_DOLLAR:
- sprintf(buf, "$%d", a->a_w.w_index);
- break;
- case A_DOLLSYM:
- sprintf(buf, "$%s", a->a_w.w_symbol->s_name);
- break;
-#else /* MAX */
- case A_DOLLAR:
- sprintf(buf, "$%s", a->a_w.w_symbol->s_name);
- break;
-#endif
- default:
- post("atom_string bug");
- }
-}
-#endif /* MSP */
-/*
- * expr_donew -- create a new "expr" object.
- * returns 1 on failure, 0 on success.
- */
-int
-expr_donew(struct expr *expr, int ac, t_atom *av)
-{
- struct ex_ex *list;
- struct ex_ex *ret;
- long max_node = 0; /* maximum number of nodes needed */
- char *exp_string;
- int exp_strlen;
- t_binbuf *b;
- int i;
-
- memset(expr->exp_var, 0, MAX_VARS * sizeof (*expr->exp_var));
-#ifdef PD
- b = binbuf_new();
- binbuf_add(b, ac, av);
- binbuf_gettext(b, &exp_string, &exp_strlen);
-
-#else /* MSP */
- {
- char *buf = getbytes(0), *newbuf;
- int length = 0;
- char string[250];
- t_atom *ap;
- int indx;
-
- for (ap = av, indx = 0; indx < ac; indx++, ap = ++av) {
- int newlength;
- if ((ap->a_type == A_SEMI || ap->a_type == A_COMMA) &&
- length && buf[length-1] == ' ') length--;
- atom_string(ap, string, 250);
- newlength = length + strlen(string) + 1;
- if (!(newbuf = t_resizebytes(buf, length, newlength))) break;
- buf = newbuf;
- strcpy(buf + length, string);
- length = newlength;
- if (ap->a_type == A_SEMI) buf[length-1] = '\n';
- else buf[length-1] = ' ';
- }
-
- if (length && buf[length-1] == ' ') {
- if (newbuf = t_resizebytes(buf, length, length-1))
- {
- buf = newbuf;
- length--;
- }
- }
- exp_string = buf;
- exp_strlen = length;
- }
-#endif
- exp_string = (char *)t_resizebytes(exp_string, exp_strlen,exp_strlen+1);
- exp_string[exp_strlen] = 0;
- expr->exp_string = exp_string;
- expr->exp_str = exp_string;
- expr->exp_nexpr = 0;
- ret = (struct ex_ex *) 0;
- /*
- * if ret == 0 it means that we have no expression
- * so we let the pass go through to build a single null stack
- */
- while (*expr->exp_str || !ret) {
- list = ex_lex(expr, &max_node);
- if (!list) { /* syntax error */
- goto error;
- }
- expr->exp_stack[expr->exp_nexpr] =
- (struct ex_ex *)fts_malloc(max_node * sizeof (struct ex_ex));
- expr->exp_nexpr++;
- ret = ex_match(list, (long)0);
- if (!ret) /* syntax error */
- goto error;
- ret = ex_parse(expr,
- list, expr->exp_stack[expr->exp_nexpr - 1], (long *)0);
- if (!ret)
- goto error;
- }
- *ret = nullex;
- t_freebytes(exp_string, exp_strlen+1);
- return (0);
-error:
- for (i = 0; i < expr->exp_nexpr; i++) {
- fts_free(expr->exp_stack[i]);
- expr->exp_stack[i] = 0;
- }
- expr->exp_nexpr = 0;
- if (list)
- fts_free(list);
- t_freebytes(exp_string, exp_strlen+1);
- return (1);
-}
-
-/*
- * ex_lex -- This routine is a bit more than a lexical parser since it will
- * also do some syntax checking. It reads the string s and will
- * return a linked list of struct ex_ex.
- * It will also put the number of the nodes in *n.
- */
-struct ex_ex *
-ex_lex(struct expr *expr, long int *n)
-{
- struct ex_ex *list_arr;
- struct ex_ex *exptr;
- long non = 0; /* number of nodes */
- long maxnode = 0;
-
- list_arr = (struct ex_ex *)fts_malloc(sizeof (struct ex_ex) * MINODES);
- if (! list_arr) {
- post("ex_lex: no mem\n");
- return ((struct ex_ex *)0);
- }
- exptr = list_arr;
- maxnode = MINODES;
-
- while (8)
- {
- if (non >= maxnode) {
- maxnode += MINODES;
-
- list_arr = fts_realloc((void *)list_arr,
- sizeof (struct ex_ex) * maxnode);
- if (!list_arr) {
- post("ex_lex: no mem\n");
- return ((struct ex_ex *)0);
- }
- exptr = &(list_arr)[non];
- }
-
- if (getoken(expr, exptr)) {
- fts_free(list_arr);
- return ((struct ex_ex *)0);
- }
- non++;
-
- if (!exptr->ex_type)
- break;
-
- exptr++;
- }
- *n = non;
-
- return list_arr;
-}
-
-/*
- * ex_match -- this routine walks through the eptr and matches the
- * perentheses and brackets, it also converts the function
- * names to a pointer to the describing structure of the
- * specified function
- */
-/* operator to match */
-struct ex_ex *
-ex_match(struct ex_ex *eptr, long int op)
-{
- int firstone = 1;
- struct ex_ex *ret;
- t_ex_func *fun;
-
- for (; 8; eptr++, firstone = 0) {
- switch (eptr->ex_type) {
- case 0:
- if (!op)
- return (eptr);
- post("expr syntax error: an open %s not matched\n",
- op == OP_RP ? "parenthesis" : "bracket");
- return (exNULL);
- case ET_INT:
- case ET_FLT:
- case ET_II:
- case ET_FI:
- case ET_SI:
- case ET_VI:
- case ET_SYM:
- case ET_VSYM:
- continue;
- case ET_YO:
- if (eptr[1].ex_type != ET_OP || eptr[1].ex_op != OP_LB)
- eptr->ex_type = ET_YOM1;
- continue;
- case ET_XI:
- if (eptr[1].ex_type != ET_OP || eptr[1].ex_op != OP_LB)
- eptr->ex_type = ET_XI0;
- continue;
- case ET_TBL:
- case ET_FUNC:
- case ET_LP:
- /* CHANGE
- case ET_RP:
- */
- case ET_LB:
- /* CHANGE
- case ET_RB:
- */
- post("ex_match: unexpected type, %ld\n", eptr->ex_type);
- return (exNULL);
- case ET_OP:
- if (op == eptr->ex_op)
- return (eptr);
- /*
- * if we are looking for a right peranthesis
- * or a right bracket and find the other kind,
- * it has to be a syntax error
- */
- if ((eptr->ex_op == OP_RP && op == OP_RB) ||
- (eptr->ex_op == OP_RB && op == OP_RP)) {
- post("expr syntax error: prenthesis or brackets not matched\n");
- return (exNULL);
- }
- /*
- * Up to now we have marked the unary minuses as
- * subrtacts. Any minus that is the first one in
- * chain or is preceeded by anything except ')' and
- * ']' is a unary minus.
- */
- if (eptr->ex_op == OP_SUB) {
- ret = eptr - 1;
- if (firstone || (ret->ex_type == ET_OP &&
- ret->ex_op != OP_RB && ret->ex_op != OP_RP))
- eptr->ex_op = OP_UMINUS;
- } else if (eptr->ex_op == OP_LP) {
- ret = ex_match(eptr + 1, OP_RP);
- if (!ret)
- return (ret);
- eptr->ex_type = ET_LP;
- eptr->ex_ptr = (char *) ret;
- eptr = ret;
- } else if (eptr->ex_op == OP_LB) {
- ret = ex_match(eptr + 1, OP_RB);
- if (!ret)
- return (ret);
- eptr->ex_type = ET_LB;
- eptr->ex_ptr = (char *) ret;
- eptr = ret;
- }
- continue;
- case ET_STR:
- if (eptr[1].ex_op == OP_LB) {
- char *tmp;
-
- eptr->ex_type = ET_TBL;
- tmp = eptr->ex_ptr;
- if (ex_getsym(tmp, (t_symbol **)&(eptr->ex_ptr))) {
- post("expr: syntax error: problms with ex_getsym\n");
- return (exNULL);
- }
- fts_free((void *)tmp);
- } else if (eptr[1].ex_op == OP_LP) {
- fun = find_func(eptr->ex_ptr);
- if (!fun) {
- post(
- "expr: error: function %s not found\n",
- eptr->ex_ptr);
- return (exNULL);
- }
- eptr->ex_type = ET_FUNC;
- eptr->ex_ptr = (char *) fun;
- } else {
- char *tmp;
-
- if (eptr[1].ex_type && eptr[1].ex_type!=ET_OP){
- post("expr: syntax error: bad string '%s'\n", eptr->ex_ptr);
- return (exNULL);
- }
- /* it is a variable */
- eptr->ex_type = ET_VAR;
- tmp = eptr->ex_ptr;
- if (ex_getsym(tmp,
- (t_symbol **)&(eptr->ex_ptr))) {
- post("expr: variable '%s' not found",tmp);
- return (exNULL);
- }
- }
- continue;
- default:
- post("ex_match: bad type\n");
- return (exNULL);
- }
- }
- /* NOTREACHED */
-}
-
-/*
- * ex_parse -- This function if called when we have already done some
- * parsing on the expression, and we have already matched
- * our brackets and parenthesis. The main job of this
- * function is to convert the infix expression to the
- * prefix form.
- * First we find the operator with the lowest precedence and
- * put it on the stack ('optr', it is really just an array), then
- * we call ourself (ex_parse()), on its arguments (unary operators
- * only have one operator.)
- * When "argc" is set it means that we are parsing the arguments
- * of a function and we will increment *argc anytime we find
- * a a segment that can qualify as an argument (counting commas).
- *
- * returns 0 on syntax error
- */
-/* number of argument separated by comma */
-struct ex_ex *
-ex_parse(struct expr *x, struct ex_ex *iptr, struct ex_ex *optr, long int *argc)
-{
- struct ex_ex *eptr;
- struct ex_ex *lowpre = 0; /* pointer to the lowest precedence */
- struct ex_ex savex;
- long pre = HI_PRE;
- long count;
-
- if (!iptr) {
- post("ex_parse: input is null, iptr = 0x%lx\n", iptr);
- return (exNULL);
- }
- if (!iptr->ex_type)
- return (exNULL);
-
- /*
- * the following loop finds the lowest precedence operator in the
- * the input token list, comma is explicitly checked here since
- * that is a special operator and is only legal in functions
- */
- for (eptr = iptr, count = 0; eptr->ex_type; eptr++, count++)
- switch (eptr->ex_type) {
- case ET_SYM:
- case ET_VSYM:
- if (!argc) {
- post("expr: syntax error: symbols allowed for functions only\n");
- ex_print(eptr);
- return (exNULL);
- }
- case ET_INT:
- case ET_FLT:
- case ET_II:
- case ET_FI:
- case ET_XI0:
- case ET_YOM1:
- case ET_VI:
- case ET_VAR:
- if (!count && !eptr[1].ex_type) {
- *optr++ = *eptr;
- return (optr);
- }
- break;
- case ET_XI:
- case ET_YO:
- case ET_SI:
- case ET_TBL:
- if (eptr[1].ex_type != ET_LB) {
- post("expr: syntax error: brackets missing\n");
- ex_print(eptr);
- return (exNULL);
- }
- /* if this table is the only token, parse the table */
- if (!count &&
- !((struct ex_ex *) eptr[1].ex_ptr)[1].ex_type) {
- savex = *((struct ex_ex *) eptr[1].ex_ptr);
- *((struct ex_ex *) eptr[1].ex_ptr) = nullex;
- *optr++ = *eptr;
- lowpre = ex_parse(x, &eptr[2], optr, (long *)0);
- *((struct ex_ex *) eptr[1].ex_ptr) = savex;
- return(lowpre);
- }
- eptr = (struct ex_ex *) eptr[1].ex_ptr;
- break;
- case ET_OP:
- if (eptr->ex_op == OP_COMMA) {
- if (!argc || !count || !eptr[1].ex_type) {
- post("expr: syntax error: illegal comma\n");
- ex_print(eptr[1].ex_type ? eptr : iptr);
- return (exNULL);
- }
- }
- if (!eptr[1].ex_type) {
- post("expr: syntax error: missing operand\n");
- ex_print(iptr);
- return (exNULL);
- }
- if ((eptr->ex_op & PRE_MASK) <= pre) {
- pre = eptr->ex_op & PRE_MASK;
- lowpre = eptr;
- }
- break;
- case ET_FUNC:
- if (eptr[1].ex_type != ET_LP) {
- post("expr: ex_parse: no parenthesis\n");
- return (exNULL);
- }
- /* if this function is the only token, parse it */
- if (!count &&
- !((struct ex_ex *) eptr[1].ex_ptr)[1].ex_type) {
- long ac;
-
- if (eptr[1].ex_ptr == (char *) &eptr[2]) {
- post("expr: syntax error: missing argument\n");
- ex_print(eptr);
- return (exNULL);
- }
- ac = 0;
- savex = *((struct ex_ex *) eptr[1].ex_ptr);
- *((struct ex_ex *) eptr[1].ex_ptr) = nullex;
- *optr++ = *eptr;
- lowpre = ex_parse(x, &eptr[2], optr, &ac);
- if (!lowpre)
- return (exNULL);
- ac++;
- if (ac !=
- ((t_ex_func *)eptr->ex_ptr)->f_argc){
- post("expr: syntax error: function '%s' needs %ld arguments\n",
- ((t_ex_func *)eptr->ex_ptr)->f_name,
- ((t_ex_func *)eptr->ex_ptr)->f_argc);
- return (exNULL);
- }
- *((struct ex_ex *) eptr[1].ex_ptr) = savex;
- return (lowpre);
- }
- eptr = (struct ex_ex *) eptr[1].ex_ptr;
- break;
- case ET_LP:
- case ET_LB:
- if (!count &&
- !((struct ex_ex *) eptr->ex_ptr)[1].ex_type) {
- if (eptr->ex_ptr == (char *)(&eptr[1])) {
- post("expr: syntax error: empty '%s'\n",
- eptr->ex_type==ET_LP?"()":"[]");
- ex_print(eptr);
- return (exNULL);
- }
- savex = *((struct ex_ex *) eptr->ex_ptr);
- *((struct ex_ex *) eptr->ex_ptr) = nullex;
- lowpre = ex_parse(x, &eptr[1], optr, (long *)0);
- *((struct ex_ex *) eptr->ex_ptr) = savex;
- return (lowpre);
- }
- eptr = (struct ex_ex *)eptr->ex_ptr;
- break;
- case ET_STR:
- default:
- ex_print(eptr);
- post("expr: ex_parse: type = 0x%lx\n", eptr->ex_type);
- return (exNULL);
- }
-
- if (pre == HI_PRE) {
- post("expr: syntax error: missing operation\n");
- ex_print(iptr);
- return (exNULL);
- }
- if (count < 2) {
- post("expr: syntax error: mission operand\n");
- ex_print(iptr);
- return (exNULL);
- }
- if (count == 2) {
- if (lowpre != iptr) {
- post("expr: ex_parse: unary operator should be first\n");
- return (exNULL);
- }
- if (!unary_op(lowpre->ex_op)) {
- post("expr: syntax error: not a uniary operator\n");
- ex_print(iptr);
- return (exNULL);
- }
- *optr++ = *lowpre;
- eptr = ex_parse(x, &lowpre[1], optr, argc);
- return (eptr);
- }
- if (lowpre == iptr) {
- post("expr: syntax error: mission operand\n");
- ex_print(iptr);
- return (exNULL);
- }
- savex = *lowpre;
- *lowpre = nullex;
- if (savex.ex_op != OP_COMMA)
- *optr++ = savex;
- else
- (*argc)++;
- eptr = ex_parse(x, iptr, optr, argc);
- if (eptr) {
- eptr = ex_parse(x, &lowpre[1], eptr, argc);
- *lowpre = savex;
- }
- return (eptr);
-}
-
-/*
- * this is the devide zero check for a a non devide operator
- */
-#define DZC(ARG1,OPR,ARG2) (ARG1 OPR ARG2)
-
-#define EVAL(OPR); \
-eptr = ex_eval(expr, ex_eval(expr, eptr, &left, idx), &right, idx); \
-switch (left.ex_type) { \
-case ET_INT: \
- switch(right.ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)DZC(left.ex_int, OPR, right.ex_int); \
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_INT; \
- optr->ex_int = DZC(left.ex_int, OPR, right.ex_int); \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = DZC(((t_float)left.ex_int), OPR, right.ex_flt);\
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = DZC(((t_float)left.ex_int), OPR, \
- right.ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- scalar = left.ex_int; \
- rp = right.ex_vec; \
- op = optr->ex_vec; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC (scalar, OPR, *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad right type %ld\n", \
- __LINE__, right.ex_type); \
- nullret = 1; \
- } \
- break; \
-case ET_FLT: \
- switch(right.ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = DZC((t_float) left.ex_flt, OPR, right.ex_int); \
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = DZC(left.ex_flt, OPR, right.ex_int); \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = DZC(left.ex_flt, OPR, right.ex_flt); \
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt= DZC(left.ex_flt, OPR, right.ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- scalar = left.ex_flt; \
- rp = right.ex_vec; \
- op = optr->ex_vec; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC(scalar, OPR, *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad right type %ld\n", \
- __LINE__, right.ex_type); \
- nullret = 1; \
- } \
- break; \
-case ET_VEC: \
-case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left.ex_vec; \
- switch(right.ex_type) { \
- case ET_INT: \
- scalar = right.ex_int; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC(*lp, OPR, scalar); \
- lp++; \
- } \
- break; \
- case ET_FLT: \
- scalar = right.ex_flt; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC(*lp, OPR, scalar); \
- lp++; \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- rp = right.ex_vec; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- /* \
- * on a RISC processor one could copy \
- * 8 times in each round to get a considerable \
- * improvement \
- */ \
- *op++ = DZC(*lp, OPR, *rp); \
- rp++; lp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad right type %ld\n", \
- __LINE__, right.ex_type); \
- nullret = 1; \
- } \
- break; \
-case ET_SYM: \
-default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad left type %ld\n", \
- __LINE__, left.ex_type); \
-} \
-break;
-
-/*
- * evaluate a unary operator, TYPE is applied to float operands
- */
-#define EVAL_UNARY(OPR, TYPE) \
- eptr = ex_eval(expr, eptr, &left, idx); \
- switch(left.ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec,(t_float)(OPR left.ex_int),\
- expr->exp_vsize);\
- break; \
- } \
- optr->ex_type = ET_INT; \
- optr->ex_int = OPR left.ex_int; \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec, OPR (TYPE left.ex_flt),\
- expr->exp_vsize);\
- break; \
- } \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = OPR (TYPE left.ex_flt); \
- break; \
- case ET_VI: \
- case ET_VEC: \
- j = expr->exp_vsize; \
- if (optr->ex_type != ET_VEC) { \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left.ex_vec; \
- j = expr->exp_vsize; \
- for (i = 0; i < j; i++) \
- *op++ = OPR (TYPE *lp++); \
- break; \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad left type %ld\n", \
- __LINE__, left.ex_type); \
- nullret++; \
- } \
- break;
-
-void
-ex_mkvector(t_float *fp, t_float x, int size)
-{
- while (size--)
- *fp++ = x;
-}
-
-/*
- * ex_dzdetect -- divide by zero detected
- */
-void
-ex_dzdetect(struct expr *expr)
-{
- char *etype;
-
- if (!expr->exp_error & EE_DZ) {
- if (IS_EXPR(expr))
- etype = "expr";
- else if (IS_EXPR_TILDE(expr))
- etype = "expr~";
- else if (IS_FEXPR_TILDE(expr))
- etype = "fexpr~";
- else {
- post ("expr -- ex_dzdetect internal error");
- etype = "";
- }
- post ("%s divide by zero detected", etype);
- expr->exp_error |= EE_DZ;
- }
-}
-
-
-/*
- * ex_eval -- evaluate the array of prefix expression
- * ex_eval returns the pointer to the first unevaluated node
- * in the array. This is a recursive routine.
- */
-
-/* SDY
-all the returns in this function need to be changed so that the code
-ends up at the end to check for newly allocated right and left vectors which
-need to be freed
-
-look into the variable nullret
-*/
-struct ex_ex *
-ex_eval(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-/* the sample numnber processed for fexpr~ */
-{
- int i, j;
- t_float *lp, *rp, *op; /* left, right, and out pointer to vectors */
- t_float scalar;
- int nullret = 0; /* did we have an error */
- struct ex_ex left, right; /* left and right operands */
-
- left.ex_type = 0;
- left.ex_int = 0;
- right.ex_type = 0;
- right.ex_int = 0;
-
- if (!eptr)
- return (exNULL);
- switch (eptr->ex_type) {
- case ET_INT:
- if (optr->ex_type == ET_VEC)
- ex_mkvector(optr->ex_vec, (t_float) eptr->ex_int,
- expr->exp_vsize);
- else
- *optr = *eptr;
- return (++eptr);
-
- case ET_FLT:
-
- if (optr->ex_type == ET_VEC)
- ex_mkvector(optr->ex_vec, eptr->ex_flt, expr->exp_vsize);
- else
- *optr = *eptr;
- return (++eptr);
-
- case ET_SYM:
- if (optr->ex_type == ET_VEC) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: cannot turn string to vector\n");
- return (exNULL);
- }
- *optr = *eptr;
- return (++eptr);
- case ET_II:
- if (eptr->ex_int == -1) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: inlet number not set\n");
- return (exNULL);
- }
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec,
- (t_float)expr->exp_var[eptr->ex_int].ex_int,
- expr->exp_vsize);
- } else {
- optr->ex_type = ET_INT;
- optr->ex_int = expr->exp_var[eptr->ex_int].ex_int;
- }
- return (++eptr);
- case ET_FI:
- if (eptr->ex_int == -1) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: inlet number not set\n");
- return (exNULL);
- }
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec,
- expr->exp_var[eptr->ex_int].ex_flt, expr->exp_vsize);
- } else {
- optr->ex_type = ET_FLT;
- optr->ex_flt = expr->exp_var[eptr->ex_int].ex_flt;
- }
- return (++eptr);
-
- case ET_VSYM:
- if (optr->ex_type == ET_VEC) {
- post_error((fts_object_t *) expr,
- "expr: IntErr. vsym in for vec out\n");
- return (exNULL);
- }
- if (eptr->ex_int == -1) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: inlet number not set\n");
- return (exNULL);
- }
- optr->ex_type = ET_SYM;
- optr->ex_ptr = expr->exp_var[eptr->ex_int].ex_ptr;
- return(++eptr);
-
- case ET_VI:
- if (optr->ex_type != ET_VEC)
- *optr = expr->exp_var[eptr->ex_int];
- else if (optr->ex_vec != expr->exp_var[eptr->ex_int].ex_vec)
- memcpy(optr->ex_vec, expr->exp_var[eptr->ex_int].ex_vec,
- expr->exp_vsize * sizeof (t_float));
- return(++eptr);
- case ET_VEC:
- if (optr->ex_type != ET_VEC) {
- optr->ex_type = ET_VEC;
- optr->ex_vec = eptr->ex_vec;
- eptr->ex_type = ET_INT;
- eptr->ex_int = 0;
- } else if (optr->ex_vec != eptr->ex_vec) {
- memcpy(optr->ex_vec, eptr->ex_vec,
- expr->exp_vsize * sizeof (t_float));
-/* do we need to free here? or can we free higher up */
-/* SDY the next lines do not make sense */
-post("calling fts_free\n");
-abort();
- fts_free(optr->ex_vec);
- optr->ex_type = ET_INT;
- eptr->ex_int = 0;
- } else { /* this should not happen */
- post("expr int. error, optr->ex_vec = %d",optr->ex_vec);
- abort();
- }
- return(++eptr);
- case ET_XI0:
- /* short hand for $x?[0] */
-
- /* SDY delete the following check */
- if (!IS_FEXPR_TILDE(expr) || optr->ex_type==ET_VEC) {
- post("%d:exp->exp_flags = %d", __LINE__,expr->exp_flags);
- abort();
- }
- optr->ex_type = ET_FLT;
- optr->ex_flt = expr->exp_var[eptr->ex_int].ex_vec[idx];
- return(++eptr);
- case ET_YOM1:
- /*
- * short hand for $y?[-1]
- * if we are calculating the first sample of the vector
- * we need to look at the previous results buffer
- */
- optr->ex_type = ET_FLT;
- if (idx == 0)
- optr->ex_flt =
- expr->exp_p_res[eptr->ex_int][expr->exp_vsize - 1];
- else
- optr->ex_flt=expr->exp_tmpres[eptr->ex_int][idx-1];
- return(++eptr);
-
- case ET_YO:
- case ET_XI:
- /* SDY delete the following */
- if (!IS_FEXPR_TILDE(expr) || optr->ex_type==ET_VEC) {
- post("%d:expr->exp_flags = %d", __LINE__,expr->exp_flags);
- abort();
- }
- return (eval_sigidx(expr, eptr, optr, idx));
-
- case ET_TBL:
- case ET_SI:
- return (eval_tab(expr, eptr, optr, idx));
- case ET_FUNC:
- return (eval_func(expr, eptr, optr, idx));
- case ET_VAR:
- return (eval_var(expr, eptr, optr, idx));
- case ET_OP:
- break;
- case ET_STR:
- case ET_LP:
- case ET_LB:
- default:
- post_error((fts_object_t *) expr,
- "expr: ex_eval: unexpected type %d\n", eptr->ex_type);
- return (exNULL);
- }
- if (!eptr[1].ex_type) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: not enough nodes 1\n");
- return (exNULL);
- }
- if (!unary_op(eptr->ex_op) && !eptr[2].ex_type) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: not enough nodes 2\n");
- return (exNULL);
- }
-
- switch((eptr++)->ex_op) {
- case OP_STORE:
- return (eval_store(expr, eptr, optr, idx));
- case OP_NOT:
- EVAL_UNARY(!, +);
- case OP_NEG:
- EVAL_UNARY(~, (long));
- case OP_UMINUS:
- EVAL_UNARY(-, +);
- case OP_MUL:
- EVAL(*);
- case OP_ADD:
- EVAL(+);
- case OP_SUB:
- EVAL(-);
- case OP_LT:
- EVAL(<);
- case OP_LE:
- EVAL(<=);
- case OP_GT:
- EVAL(>);
- case OP_GE:
- EVAL(>=);
- case OP_EQ:
- EVAL(==);
- case OP_NE:
- EVAL(!=);
-/*
- * following operators convert their argument to integer
- */
-#undef DZC
-#define DZC(ARG1,OPR,ARG2) (((int)ARG1) OPR ((int)ARG2))
- case OP_SL:
- EVAL(<<);
- case OP_SR:
- EVAL(>>);
- case OP_AND:
- EVAL(&);
- case OP_XOR:
- EVAL(^);
- case OP_OR:
- EVAL(|);
- case OP_LAND:
- EVAL(&&);
- case OP_LOR:
- EVAL(||);
-/*
- * for modulo we need to convert to integer and check for divide by zero
- */
-#undef DZC
-#define DZC(ARG1,OPR,ARG2) (((ARG2)?(((int)ARG1) OPR ((int)ARG2)) \
- : (ex_dzdetect(expr),0)))
- case OP_MOD:
- EVAL(%);
-/*
- * define the divide by zero check for divide
- */
-#undef DZC
-#define DZC(ARG1,OPR,ARG2) (((ARG2)?(ARG1 OPR ARG2):(ex_dzdetect(expr),0)))
- case OP_DIV:
- EVAL(/);
- case OP_LP:
- case OP_RP:
- case OP_LB:
- case OP_RB:
- case OP_COMMA:
- case OP_SEMI:
- default:
- post_error((fts_object_t *) expr, "expr: ex_print: bad op 0x%x\n", eptr->ex_op);
- return (exNULL);
- }
-
-
- /*
- * the left and right nodes could have been transformed to vectors
- * down the chain
- */
- if (left.ex_type == ET_VEC)
- fts_free(left.ex_vec);
- if (right.ex_type == ET_VEC)
- fts_free(right.ex_vec);
- if (nullret)
- return (exNULL);
- else
- return (eptr);
-}
-
-/*
- * eval_func -- evaluate a function, call ex_eval() on all the arguments
- * so that all of them are terminal nodes. The call the
- * appropriate function
- */
-struct ex_ex *
-eval_func(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-{
- int i;
- struct ex_ex args[MAX_ARGS];
- t_ex_func *f;
-
- f = (t_ex_func *)(eptr++)->ex_ptr;
- if (!f || !f->f_name) {
- return (exNULL);
- }
- if (f->f_argc > MAX_ARGS) {
- post_error((fts_object_t *) expr, "expr: eval_func: asking too many arguments\n");
- return (exNULL);
- }
-
- for (i = 0; i < f->f_argc; i++) {
- args[i].ex_type = 0;
- args[i].ex_int = 0;
- eptr = ex_eval(expr, eptr, &args[i], idx);
- }
- (*f->f_func)(expr, f->f_argc, args, optr);
- for (i = 0; i < f->f_argc; i++) {
- if (args[i].ex_type == ET_VEC)
- fts_free(args[i].ex_vec);
- }
- return (eptr);
-}
-
-
-/*
- * eval_store -- evaluate the '=' operator,
- * make sure the first operator is a legal left operator
- * and call ex_eval on the right operator
- */
-struct ex_ex *
-eval_store(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-{
- struct ex_ex arg;
- int isvalue;
- char *tbl = (char *) 0;
- char *var = (char *) 0;
- int badleft = 0;
-
-post("store called\n");
-ex_print(eptr);
-eptr = ex_eval(expr, ++eptr, optr, idx);
-return (eptr);
-
-#ifdef notdef /* SDY */
- arg.ex_type = ET_INT;
- arg.ex_int = 0;
- if (eptr->ex_type == ET_VAR) {
- var = (char *) eptr->ex_ptr;
-
- eptr = ex_eval(expr, ++eptr, &arg, idx);
- (void)max_ex_var_store(expr, (t_symbol *)var, &arg, optr);
- if (arg.ex_type == ET_VEC)
- fts_free(arg.ex_vec);
- }
-
-
- if (eptr->ex_type == ET_SI) {
- eptr++;
- if (eptr->ex_type =
- }
-
- /* the left operator should either be a value or a array member */
- switch (eptr->ex_type) {
- case ET_SI:
- if ((eptr + 1)->ex_type == OP_LB) {
- }
- if (!expr->exp_var[eptr->ex_int].ex_ptr) {
- if (!(expr->exp_error & EE_NOTABLE)) {
- post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
- post("expr: No more table errors will be reported");
- post("expr: till the next reset");
- expr->exp_error |= EE_NOTABLE;
- }
- badleft++;
- } else
- tbl = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
- break;
- case ET_TBL:
- }
-#endif /* SDY */
-}
-
-/*
- * eval_tab -- evaluate a table operation
- */
-struct ex_ex *
-eval_tab(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-{
- struct ex_ex arg;
- char *tbl = (char *) 0;
- int notable = 0;
-
- if (eptr->ex_type == ET_SI) {
- if (!expr->exp_var[eptr->ex_int].ex_ptr) {
-/* SDY post_error() does not work in MAX/MSP yet
- post_error((fts_object_t *) expr,
- "expr: syntax error: no string for inlet %d\n", eptr->ex_int + 1);
-*/
- if (!(expr->exp_error & EE_NOTABLE)) {
- post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
- post("expr: No more table errors will be reported");
- post("expr: till the next reset");
- expr->exp_error |= EE_NOTABLE;
- }
- notable++;
- } else
- tbl = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
- } else if (eptr->ex_type == ET_TBL)
- tbl = (char *) eptr->ex_ptr;
- else {
- post_error((fts_object_t *) expr, "expr: eval_tbl: bad type %ld\n", eptr->ex_type);
- notable++;
-
- }
- arg.ex_type = 0;
- arg.ex_int = 0;
- eptr = ex_eval(expr, ++eptr, &arg, idx);
-
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- if (!notable)
- (void)max_ex_tab(expr, (t_symbol *)tbl, &arg, optr);
- if (arg.ex_type == ET_VEC)
- fts_free(arg.ex_vec);
- return (eptr);
-}
-
-/*
- * eval_var -- evaluate a variable
- */
-struct ex_ex *
-eval_var(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-{
- struct ex_ex arg;
- char *var = (char *) 0;
- int novar = 0;
-
- if (eptr->ex_type == ET_SI) {
- if (!expr->exp_var[eptr->ex_int].ex_ptr) {
-/* SDY post_error() does not work in MAX/MSP yet
-post_error((fts_object_t *) expr,
-"expr: syntax error: no string for inlet %d\n", eptr->ex_int + 1);
-*/
- if (!(expr->exp_error & EE_NOVAR)) {
- post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
- post("expr: No more table errors will be reported");
- post("expr: till the next reset");
- expr->exp_error |= EE_NOVAR;
- }
- novar++;
- } else
- var = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
- } else if (eptr->ex_type == ET_VAR)
- var = (char *) eptr->ex_ptr;
- else {
- post_error((fts_object_t *) expr, "expr: eval_tbl: bad type %ld\n", eptr->ex_type);
- novar++;
-
- }
-
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- if (!novar)
- (void)max_ex_var(expr, (t_symbol *)var, optr);
- return (++eptr);
-}
-
-/*
- * eval_sigidx -- evaluate the value of an indexed signal for fexpr~
- */
-struct ex_ex *
-eval_sigidx(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-/* the index */
-{
- struct ex_ex arg;
- struct ex_ex *reteptr;
- int i = 0, j = 0;
- t_float fi = 0, /* index in float */
- rem_i = 0; /* remains of the float */
- char *tbl;
-
- arg.ex_type = 0;
- arg.ex_int = 0;
- reteptr = ex_eval(expr, eptr + 1, &arg, idx);
- if (arg.ex_type == ET_FLT) {
- fi = arg.ex_flt; /* float index */
- i = (int) arg.ex_flt; /* integer index */
- rem_i = arg.ex_flt - i; /* remains of integer */
- } else if (arg.ex_type == ET_INT) {
- fi = arg.ex_int; /* float index */
- i = arg.ex_int;
- rem_i = 0;
- } else {
- post("eval_sigidx: bad res type (%d)", arg.ex_type);
- }
- optr->ex_type = ET_FLT;
- /*
- * indexing an input vector
- */
- if (eptr->ex_type == ET_XI) {
- if (fi > 0) {
- if (!(expr->exp_error & EE_BI_INPUT)) {
- expr->exp_error |= EE_BI_INPUT;
- post("expr: input vector index > 0, (vector x%d[%f])",
- eptr->ex_int + 1, i + rem_i);
- post("fexpr~: index assumed to be = 0");
- post("fexpr~: no error report till next reset");
- ex_print(eptr);
- }
- /* just replace it with zero */
- i = 0;
- rem_i = 0;
- }
- if (cal_sigidx(optr, i, rem_i, idx, expr->exp_vsize,
- expr->exp_var[eptr->ex_int].ex_vec,
- expr->exp_p_var[eptr->ex_int])) {
- if (!(expr->exp_error & EE_BI_INPUT)) {
- expr->exp_error |= EE_BI_INPUT;
- post("expr: input vector index < -VectorSize, (vector x%d[%f])", eptr->ex_int + 1, fi);
- ex_print(eptr);
- post("fexpr~: index assumed to be = -%d",
- expr->exp_vsize);
- post("fexpr~: no error report till next reset");
- }
- }
-
- /*
- * indexing an output vector
- */
- } else if (eptr->ex_type == ET_YO) {
- /* for output vectors index of zero is not legal */
- if (fi >= 0) {
- if (!(expr->exp_error & EE_BI_OUTPUT)) {
- expr->exp_error |= EE_BI_OUTPUT;
- post("fexpr~: bad output index, (%f)", fi);
- ex_print(eptr);
- post("fexpr~: no error report till next reset");
- post("fexpr~: index assumed to be = -1");
- }
- i = -1;
- }
- if (eptr->ex_int >= expr->exp_nexpr) {
- post("fexpr~: $y%d illegal: not that many exprs",
- eptr->ex_int);
- optr->ex_flt = 0;
- return (reteptr);
- }
- if (cal_sigidx(optr, i, rem_i, idx, expr->exp_vsize,
- expr->exp_tmpres[eptr->ex_int],
- expr->exp_p_res[eptr->ex_int])) {
- if (!(expr->exp_error & EE_BI_OUTPUT)) {
- expr->exp_error |= EE_BI_OUTPUT;
- post("fexpr~: bad output index, (%f)", fi);
- ex_print(eptr);
- post("fexpr~: index assumed to be = -%d",
- expr->exp_vsize);
- }
- }
- } else {
- optr->ex_flt = 0;
- post("fexpr~:eval_sigidx: internal error - unknown vector (%d)",
- eptr->ex_type);
- }
- return (reteptr);
-}
-
-/*
- * cal_sigidx -- given two tables (one current one previous) calculate an
- * evaluation of a float index into the vectors by linear
- * interpolation
- * return 0 on success, 1 on failure (index out of bound)
- */
-static int
-cal_sigidx(struct ex_ex *optr, /* The output value */
- int i, t_float rem_i,/* integer and fractinal part of index */
- int idx, /* index of current fexpr~ processing */
- int vsize, /* vector size */
- t_float *curvec, t_float *prevec) /* current and previous table */
-{
- int n;
-
- n = i + idx;
- if (n > 0) {
- /* from the curvec */
- if (rem_i)
- optr->ex_flt = curvec[n] +
- rem_i * (curvec[n] - curvec[n - 1]);
- else
- optr->ex_flt = curvec[n];
- return (0);
- }
- if (n == 0) {
- /*
- * this is the case that the remaining float
- * is between two tables
- */
- if (rem_i)
- optr->ex_flt = *curvec +
- rem_i * (*curvec - prevec[vsize - 1]);
- else
- optr->ex_flt = *curvec;
- return (0);
- }
- /* find the index in the saved buffer */
- n = vsize + n;
- if (n > 0) {
- if (rem_i)
- optr->ex_flt = prevec[n] +
- rem_i * (prevec[n] - prevec[n - 1]);
- else
- optr->ex_flt = prevec[n];
- return (0);
- }
- /* out of bound */
- optr->ex_flt = *prevec;
- return (1);
-}
-
-/*
- * getoken -- return 1 on syntax error otherwise 0
- */
-int
-getoken(struct expr *expr, struct ex_ex *eptr)
-{
- char *p;
- long i;
-
-
- if (!expr->exp_str) {
- post("expr: getoken: expression string not set\n");
- return (0);
- }
-retry:
- if (!*expr->exp_str) {
- eptr->ex_type = 0;
- eptr->ex_int = 0;
- return (0);
- }
- if (*expr->exp_str == ';') {
- expr->exp_str++;
- eptr->ex_type = 0;
- eptr->ex_int = 0;
- return (0);
- }
- eptr->ex_type = ET_OP;
- switch (*expr->exp_str++) {
- case '\\':
- case ' ':
- case '\t':
- goto retry;
- case ';':
- post("expr: syntax error: ';' not implemented\n");
- return (1);
- case ',':
- eptr->ex_op = OP_COMMA;
- break;
- case '(':
- eptr->ex_op = OP_LP;
- break;
- case ')':
- eptr->ex_op = OP_RP;
- break;
- case ']':
- eptr->ex_op = OP_RB;
- break;
- case '~':
- eptr->ex_op = OP_NEG;
- break;
- /* we will take care of unary minus later */
- case '*':
- eptr->ex_op = OP_MUL;
- break;
- case '/':
- eptr->ex_op = OP_DIV;
- break;
- case '%':
- eptr->ex_op = OP_MOD;
- break;
- case '+':
- eptr->ex_op = OP_ADD;
- break;
- case '-':
- eptr->ex_op = OP_SUB;
- break;
- case '^':
- eptr->ex_op = OP_XOR;
- break;
- case '[':
- eptr->ex_op = OP_LB;
- break;
- case '!':
- if (*expr->exp_str == '=') {
- eptr->ex_op = OP_NE;
- expr->exp_str++;
- } else
- eptr->ex_op = OP_NOT;
- break;
- case '<':
- switch (*expr->exp_str) {
- case '<':
- eptr->ex_op = OP_SL;
- expr->exp_str++;
- break;
- case '=':
- eptr->ex_op = OP_LE;
- expr->exp_str++;
- break;
- default:
- eptr->ex_op = OP_LT;
- break;
- }
- break;
- case '>':
- switch (*expr->exp_str) {
- case '>':
- eptr->ex_op = OP_SR;
- expr->exp_str++;
- break;
- case '=':
- eptr->ex_op = OP_GE;
- expr->exp_str++;
- break;
- default:
- eptr->ex_op = OP_GT;
- break;
- }
- break;
- case '=':
- if (*expr->exp_str++ != '=') {
- post("expr: syntax error: =\n");
- return (1);
- }
- eptr->ex_op = OP_EQ;
- break;
-/* do not allow the store till the function is fixed
- if (*expr->exp_str != '=')
- eptr->ex_op = OP_STORE;
- else {
- expr->exp_str++;
- eptr->ex_op = OP_EQ;
- }
- break;
-*/
-
- case '&':
- if (*expr->exp_str == '&') {
- expr->exp_str++;
- eptr->ex_op = OP_LAND;
- } else
- eptr->ex_op = OP_AND;
- break;
-
- case '|':
- if ((*expr->exp_str == '|')) {
- expr->exp_str++;
- eptr->ex_op = OP_LOR;
- } else
- eptr->ex_op = OP_OR;
- break;
- case '$':
- switch (*expr->exp_str++) {
- case 'I':
- case 'i':
- eptr->ex_type = ET_II;
- break;
- case 'F':
- case 'f':
- eptr->ex_type = ET_FI;
- break;
- case 'S':
- case 's':
- eptr->ex_type = ET_SI;
- break;
- case 'V':
- case 'v':
- if (IS_EXPR_TILDE(expr)) {
- eptr->ex_type = ET_VI;
- break;
- }
- post("$v? works only for expr~");
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- case 'X':
- case 'x':
- if (IS_FEXPR_TILDE(expr)) {
- eptr->ex_type = ET_XI;
- if (isdigit(*expr->exp_str))
- break;
- /* for $x[] is a shorhand for $x1[] */
- eptr->ex_int = 0;
- goto noinletnum;
- }
- post("$x? works only for fexpr~");
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- case 'y':
- case 'Y':
- if (IS_FEXPR_TILDE(expr)) {
- eptr->ex_type = ET_YO;
- /*$y takes no number */
- if (isdigit(*expr->exp_str))
- break;
- /* for $y[] is a shorhand for $y1[] */
- eptr->ex_int = 0;
- goto noinletnum;
- }
- post("$y works only for fexpr~");
- default:
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- }
- p = atoif(expr->exp_str, &eptr->ex_op, &i);
- if (!p) {
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- }
- if (i != ET_INT) {
- post("expr: syntax error: %s\n", expr->exp_str);
- return (1);
- }
- /*
- * make the user inlets one based rather than zero based
- * therefore we decrement the number that user has supplied
- */
- if (!eptr->ex_op || (eptr->ex_op)-- > MAX_VARS) {
- post("expr: syntax error: inlet or outlet out of range: %s\n",
- expr->exp_str);
- return (1);
- }
-
- /*
- * until we can change the input type of inlets on
- * the fly (at pd_new()
- * time) the first input to expr~ is always a vectore
- * and $f1 or $i1 is
- * illegal for fexr~
- */
- if (eptr->ex_op == 0 &&
- (IS_FEXPR_TILDE(expr) || IS_EXPR_TILDE(expr)) &&
- (eptr->ex_type==ET_II || eptr->ex_type==ET_FI ||
- eptr->ex_type==ET_SI)) {
- post("first inlet of expr~/fexpr~ can only be a vector");
- return (1);
- }
- /* record the inlet or outlet type and check for consistency */
- if (eptr->ex_type == ET_YO ) {
- /* it is an outlet for fexpr~*/
- /* no need to do anything */
- ;
- } else if (!expr->exp_var[eptr->ex_op].ex_type)
- expr->exp_var[eptr->ex_op].ex_type = eptr->ex_type;
- else if (expr->exp_var[eptr->ex_op].ex_type != eptr->ex_type) {
- post("expr: syntax error: inlets can only have one type: %s\n", expr->exp_str);
- return (1);
- }
- expr->exp_str = p;
-noinletnum:
- break;
- case '"':
- {
- struct ex_ex ex;
-
- p = expr->exp_str;
- if (!*expr->exp_str || *expr->exp_str == '"') {
- post("expr: syntax error: empty symbol: %s\n", --expr->exp_str);
- return (1);
- }
- if (getoken(expr, &ex))
- return (1);
- switch (ex.ex_type) {
- case ET_STR:
- if (ex_getsym(ex.ex_ptr, (t_symbol **)&(eptr->ex_ptr))) {
- post("expr: syntax error: getoken: problms with ex_getsym\n");
- return (1);
- }
- eptr->ex_type = ET_SYM;
- break;
- case ET_SI:
- *eptr = ex;
- eptr->ex_type = ET_VSYM;
- break;
- default:
- post("expr: syntax error: bad symbol name: %s\n", p);
- return (1);
- }
- if (*expr->exp_str++ != '"') {
- post("expr: syntax error: missing '\"'\n");
- return (1);
- }
- break;
- }
- case '.':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- p = atoif(--expr->exp_str, &eptr->ex_int, &eptr->ex_type);
- if (!p)
- return (1);
- expr->exp_str = p;
- break;
-
- default:
- /*
- * has to be a string, it should either be a
- * function or a table
- */
- p = --expr->exp_str;
- for (i = 0; name_ok(*p); i++)
- p++;
- if (!i) {
- post("expr: syntax error: %s\n", expr->exp_str);
- return (1);
- }
- eptr->ex_ptr = (char *)fts_malloc(i + 1);
- strncpy(eptr->ex_ptr, expr->exp_str, (int) i);
- (eptr->ex_ptr)[i] = 0;
- expr->exp_str = p;
- /*
- * we mark this as a string and later we will change this
- * to either a function or a table
- */
- eptr->ex_type = ET_STR;
- break;
- }
- return (0);
-}
-
-/*
- * atoif -- ascii to float or integer (understands hex numbers also)
- */
-char *
-atoif(char *s, long int *value, long int *type)
-{
- char *p;
- long int_val = 0;
- int flt = 0;
- t_float pos = 0;
- t_float flt_val = 0;
- int base = 10;
-
- p = s;
- if (*p == '0' && (p[1] == 'x' || p[1] == 'X')) {
- base = 16;
- p += 2;
- }
- while (8) {
- switch (*p) {
- case '.':
- if (flt || base != 10) {
- post("expr: syntax error: %s\n", s);
- return ((char *) 0);
- }
- flt++;
- pos = 10;
- flt_val = int_val;
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (flt) {
- flt_val += (*p - '0') / pos;
- pos *= 10;
- } else {
- int_val *= base;
- int_val += (*p - '0');
- }
- break;
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- if (base != 16 || flt) {
- post("expr: syntax error: %s\n", s);
- return ((char *) 0);
- }
- int_val *= base;
- int_val += (*p - 'a' + 10);
- break;
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- if (base != 16 || flt) {
- post("expr: syntax error: %s\n", s);
- return ((char *) 0);
- }
- int_val *= base;
- int_val += (*p - 'A' + 10);
- break;
- default:
- if (flt) {
- *type = ET_FLT;
- *((t_float *) value) = flt_val;
- } else {
- *type = ET_INT;
- *value = int_val;
- }
- return (p);
- }
- p++;
- }
-}
-
-/*
- * find_func -- returns a pointer to the found function structure
- * otherwise it returns 0
- */
-t_ex_func *
-find_func(char *s)
-{
- t_ex_func *f;
-
- for (f = ex_funcs; f->f_name; f++)
- if (!strcmp(f->f_name, s))
- return (f);
- return ((t_ex_func *) 0);
-}
-
-
-/*
- * ex_print -- print an expression array
- */
-
-void
-ex_print(struct ex_ex *eptr)
-{
-
- while (eptr->ex_type) {
- switch (eptr->ex_type) {
- case ET_INT:
- post("%ld ", eptr->ex_int);
- break;
- case ET_FLT:
- post("%f ", eptr->ex_flt);
- break;
- case ET_STR:
- post("%s ", eptr->ex_ptr);
- break;
- case ET_TBL:
- case ET_VAR:
- post("%s ", ex_symname((fts_symbol_t )eptr->ex_ptr));
- break;
- case ET_SYM:
- post("\"%s\" ", ex_symname((fts_symbol_t )eptr->ex_ptr));
- break;
- case ET_VSYM:
- post("\"$s%ld\" ", eptr->ex_int + 1);
- break;
- case ET_FUNC:
- post("%s ",
- ((t_ex_func *)eptr->ex_ptr)->f_name);
- break;
- case ET_LP:
- post("%c", '(');
- break;
- /* CHANGE
- case ET_RP:
- post("%c ", ')');
- break;
- */
- case ET_LB:
- post("%c", '[');
- break;
- /* CHANGE
- case ET_RB:
- post("%c ", ']');
- break;
- */
- case ET_II:
- post("$i%ld ", eptr->ex_int + 1);
- break;
- case ET_FI:
- post("$f%ld ", eptr->ex_int + 1);
- break;
- case ET_SI:
- post("$s%lx ", eptr->ex_ptr);
- break;
- case ET_VI:
- post("$v%lx ", eptr->ex_vec);
- break;
- case ET_VEC:
- post("vec = %ld ", eptr->ex_vec);
- break;
- case ET_YOM1:
- case ET_YO:
- post("$y%d", eptr->ex_int + 1);
- break;
- case ET_XI:
- case ET_XI0:
- post("$x%d", eptr->ex_int + 1);
- break;
- case ET_OP:
- switch (eptr->ex_op) {
- case OP_LP:
- post("%c", '(');
- break;
- case OP_RP:
- post("%c ", ')');
- break;
- case OP_LB:
- post("%c", '[');
- break;
- case OP_RB:
- post("%c ", ']');
- break;
- case OP_NOT:
- post("%c", '!');
- break;
- case OP_NEG:
- post("%c", '~');
- break;
- case OP_UMINUS:
- post("%c", '-');
- break;
- case OP_MUL:
- post("%c", '*');
- break;
- case OP_DIV:
- post("%c", '/');
- break;
- case OP_MOD:
- post("%c", '%');
- break;
- case OP_ADD:
- post("%c", '+');
- break;
- case OP_SUB:
- post("%c", '-');
- break;
- case OP_SL:
- post("%s", "<<");
- break;
- case OP_SR:
- post("%s", ">>");
- break;
- case OP_LT:
- post("%c", '<');
- break;
- case OP_LE:
- post("%s", "<=");
- break;
- case OP_GT:
- post("%c", '>');
- break;
- case OP_GE:
- post("%s", ">=");
- break;
- case OP_EQ:
- post("%s", "==");
- break;
- case OP_STORE:
- post("%s", "=");
- break;
- case OP_NE:
- post("%s", "!=");
- break;
- case OP_AND:
- post("%c", '&');
- break;
- case OP_XOR:
- post("%c", '^');
- break;
- case OP_OR:
- post("%c", '|');
- break;
- case OP_LAND:
- post("%s", "&&");
- break;
- case OP_LOR:
- post("%s", "||");
- break;
- case OP_COMMA:
- post("%c", ',');
- break;
- case OP_SEMI:
- post("%c", ';');
- break;
- default:
- post("expr: ex_print: bad op 0x%lx\n", eptr->ex_op);
- }
- break;
- default:
- post("expr: ex_print: bad type 0x%lx\n", eptr->ex_type);
- }
- eptr++;
- }
- post("\n");
-}
-
-#ifdef _WIN32
-void ABORT( void) {bug("expr");}
-#endif
diff --git a/externals/extra/0.43.2/expr~/vexp.h b/externals/extra/0.43.2/expr~/vexp.h
deleted file mode 100644
index df5547ea..00000000
--- a/externals/extra/0.43.2/expr~/vexp.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * jMax
- * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * See file LICENSE for further informations on licensing terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Based on Max/ISPW by Miller Puckette.
- *
- * Authors: Maurizio De Cecco, Francois Dechelle, Enzo Maggi, Norbert Schnell.
- *
- */
-
-/* "expr" was written by Shahrokh Yadegari c. 1989. -msp */
-/* "expr~" and "fexpr~" conversion by Shahrokh Yadegari c. 1999,2000 */
-
-#define MSP
-#ifdef PD
-#undef MSP
-#endif
-
-#ifdef PD
-#include "m_pd.h"
-#else /* MSP */
-#include "ext.h"
-#include "z_dsp.h"
-#endif
-
-#include "fts_to_pd.h"
-/* This is put in fts_to_pd.h
-
-#ifdef MSP
-#define t_atom Atom
-#define t_symbol Symbol
-#define pd_new(x) newobject(x);
-#define t_outlet void
-#endif
-*/
-
-/*
- * Currently the maximum number of variables (inlets) that are supported
- * is 10.
- */
-
-#define MAX_VARS 9
-#define MINODES 10 /* was 200 */
-
-/* terminal defines */
-
-/*
- * operations
- * (x<<16|y) x defines the level of precedence,
- * the lower the number the lower the precedence
- * separators are defines as operators just for convenience
- */
-
-#define OP_SEMI ((long)(1<<16|1)) /* ; */
-#define OP_COMMA ((long)(2<<16|2)) /* , */
-#define OP_LOR ((long)(3<<16|3)) /* || */
-#define OP_LAND ((long)(4<<16|4)) /* && */
-#define OP_OR ((long)(5<<16|5)) /* | */
-#define OP_XOR ((long)(6<<16|6)) /* ^ */
-#define OP_AND ((long)(7<<16|7)) /* & */
-#define OP_NE ((long)(8<<16|8)) /* != */
-#define OP_EQ ((long)(8<<16|9)) /* == */
-#define OP_GE ((long)(9<<16|10)) /* >= */
-#define OP_GT ((long)(9<<16|11)) /* > */
-#define OP_LE ((long)(9<<16|12)) /* <= */
-#define OP_LT ((long)(9<<16|13)) /* < */
-#define OP_SR ((long)(10<<16|14)) /* >> */
-#define OP_SL ((long)(10<<16|15)) /* << */
-#define OP_SUB ((long)(11<<16|16)) /* - */
-#define OP_ADD ((long)(11<<16|17)) /* + */
-#define OP_MOD ((long)(12<<16|18)) /* % */
-#define OP_DIV ((long)(12<<16|19)) /* / */
-#define OP_MUL ((long)(12<<16|20)) /* * */
-#define OP_UMINUS ((long)(13<<16|21)) /* - unary minus */
-#define OP_NEG ((long)(13<<16|22)) /* ~ one complement */
-#define OP_NOT ((long)(13<<16|23)) /* ! */
-#define OP_RB ((long)(14<<16|24)) /* ] */
-#define OP_LB ((long)(14<<16|25)) /* [ */
-#define OP_RP ((long)(14<<16|26)) /* ) */
-#define OP_LP ((long)(14<<16|27)) /* ( */
-#define OP_STORE ((long)(15<<16|28)) /* = */
-#define HI_PRE ((long)(100<<16)) /* infinite precedence */
-#define PRE_MASK ((long)0xffff0000) /* precedence level mask */
-
-struct ex_ex;
-
-#define name_ok(c) (((c)=='_') || ((c)>='a' && (c)<='z') || \
- ((c)>='A' && (c)<='Z') || ((c) >= '0' && (c) <= '9'))
-#define unary_op(x) ((x) == OP_NOT || (x) == OP_NEG || (x) == OP_UMINUS)
-
-struct ex_ex {
- union {
- long v_int;
- t_float v_flt;
- t_float *v_vec; /* this is an for allocated vector */
- long op;
- char *ptr;
- } ex_cont; /* content */
-#define ex_int ex_cont.v_int
-#define ex_flt ex_cont.v_flt
-#define ex_vec ex_cont.v_vec
-#define ex_op ex_cont.op
-#define ex_ptr ex_cont.ptr
- long ex_type; /* type of the node */
-};
-#define exNULL ((struct ex_ex *)0)
-
-/* defines for ex_type */
-#define ET_INT 1 /* an int */
-#define ET_FLT 2 /* a float */
-#define ET_OP 3 /* operator */
-#define ET_STR 4 /* string */
-#define ET_TBL 5 /* a table, the content is a pointer */
-#define ET_FUNC 6 /* a function */
-#define ET_SYM 7 /* symbol ("string") */
-#define ET_VSYM 8 /* variable symbol ("$s?") */
- /* we treat parenthesis and brackets */
- /* special to keep a pointer to their */
- /* match in the content */
-#define ET_LP 9 /* left parenthesis */
-#define ET_LB 10 /* left bracket */
-#define ET_II 11 /* and integer inlet */
-#define ET_FI 12 /* float inlet */
-#define ET_SI 13 /* string inlet */
-#define ET_VI 14 /* signal inlet */
-#define ET_VEC 15 /* allocated signal vector */
- /* special types for fexpr~ */
-#define ET_YO 16 /* vector output for fexpr~ */
-#define ET_YOM1 17 /* shorthand for $y?[-1] */
-#define ET_XI 18 /* vector input for fexpr~ */
-#define ET_XI0 20 /* shorthand for $x?[0] */
-#define ET_VAR 21 /* variable */
-
-/* defines for ex_flags */
-#define EF_TYPE_MASK 0x07 /* first three bits define the type of expr */
-#define EF_EXPR 0x01 /* expr - control in and out */
-#define EF_EXPR_TILDE 0x02 /* expr~ signal and control in, signal out */
-#define EF_FEXPR_TILDE 0x04 /* fexpr~ filter expression */
-
-#define EF_STOP 0x08 /* is it stopped used for expr~ and fexpr~ */
-#define EF_VERBOSE 0x10 /* verbose mode */
-
-#define IS_EXPR(x) ((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR) == EF_EXPR)
-#define IS_EXPR_TILDE(x) \
- ((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR_TILDE)==EF_EXPR_TILDE)
-#define IS_FEXPR_TILDE(x) \
- ((((x)->exp_flags&EF_TYPE_MASK)|EF_FEXPR_TILDE)==EF_FEXPR_TILDE)
-
-#define SET_EXPR(x) (x)->exp_flags |= EF_EXPR; \
- (x)->exp_flags &= ~EF_EXPR_TILDE; \
- (x)->exp_flags &= ~EF_FEXPR_TILDE;
-
-#define SET_EXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \
- (x)->exp_flags |= EF_EXPR_TILDE; \
- (x)->exp_flags &= ~EF_FEXPR_TILDE;
-
-#define SET_FEXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \
- (x)->exp_flags &= ~EF_EXPR_TILDE; \
- (x)->exp_flags |= EF_FEXPR_TILDE;
-
-/*
- * defines for expr_error
- */
-#define EE_DZ 0x01 /* divide by zero error */
-#define EE_BI_OUTPUT 0x02 /* Bad output index */
-#define EE_BI_INPUT 0x04 /* Bad input index */
-#define EE_NOTABLE 0x08 /* NO TABLE */
-#define EE_NOVAR 0x10 /* NO VARIABLE */
-
-typedef struct expr {
-#ifdef PD
- t_object exp_ob;
-#else /* MSP */
- t_pxobject exp_ob;
-#endif
- int exp_flags; /* are we expr~, fexpr~, or expr */
- int exp_error; /* reported errors */
- int exp_nexpr; /* number of expressions */
- char *exp_string; /* the full expression string */
- char *exp_str; /* current parsing position */
- t_outlet *exp_outlet[MAX_VARS];
-#ifdef PD
- struct _exprproxy *exp_proxy;
-#else /* MAX */
- void *exp_proxy[MAX_VARS];
- long exp_proxy_id;
-#endif
- struct ex_ex *exp_stack[MAX_VARS];
- struct ex_ex exp_var[MAX_VARS];
- struct ex_ex exp_res[MAX_VARS]; /* the evluation result */
- t_float *exp_p_var[MAX_VARS];
- t_float *exp_p_res[MAX_VARS]; /* the previous evaluation result */
- t_float *exp_tmpres[MAX_VARS]; /* temporty result for fexpr~ */
- int exp_vsize; /* the size of the signal vector */
- int exp_nivec; /* # of vector inlets */
- t_float exp_f; /* control value to be transformed to signal */
-} t_expr;
-
-typedef struct ex_funcs {
- char *f_name; /* function name */
- void (*f_func)(t_expr *, long, struct ex_ex *, struct ex_ex *);
- /* the real function performing the function (void, no return!!!) */
- long f_argc; /* number of arguments */
-} t_ex_func;
-
-/* function prototypes for pd-related functions called withing vexp.h */
-
-extern int max_ex_tab(struct expr *expr, t_symbol *s, struct ex_ex *arg, struct ex_ex *optr);
-extern int max_ex_var(struct expr *expr, t_symbol *s, struct ex_ex *optr);
-extern int ex_getsym(char *p, t_symbol **s);
-extern const char *ex_symname(t_symbol *s);
-void ex_mkvector(t_float *fp, t_float x, int size);
-extern void ex_size(t_expr *expr, long int argc, struct ex_ex *argv,
- struct ex_ex *optr);
-extern void ex_sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_Sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_Avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_store(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-
-int value_getonly(t_symbol *s, t_float *f);
-
-
-/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
-#ifdef _MSC_VER
-#pragma warning (disable: 4305 4244)
-#endif
-
-#ifdef _WIN32
-#define abort ABORT
-void ABORT(void);
-#endif
diff --git a/externals/extra/0.43.2/expr~/vexp_fun.c b/externals/extra/0.43.2/expr~/vexp_fun.c
deleted file mode 100644
index 73c0b5c6..00000000
--- a/externals/extra/0.43.2/expr~/vexp_fun.c
+++ /dev/null
@@ -1,1315 +0,0 @@
-/*
- * jMax
- * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * See file LICENSE for further informations on licensing terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Based on Max/ISPW by Miller Puckette.
- *
- * Authors: Maurizio De Cecco, Francois Dechelle, Enzo Maggi, Norbert Schnell.
- *
- */
-
-/* "expr" was written by Shahrokh Yadegari c. 1989. -msp
- *
- * Nov. 2001 --sdy
- * conversion for expr~
- *
- * Jan, 2002 --sdy
- * added fmod()
- *
- * May 2002
- * added floor and ceil for expr -- Orm Finnendahl
- *
- * July 2002 --sdy
- * added the following math funtions:
- * cbrt - cube root
- * erf - error function
- * erfc - complementary error function
- * expm1 - exponential minus 1,
- * log1p - logarithm of 1 plus
- * isinf - is the value infinite,
- * finite - is the value finite
- * isnan -- is the resut a nan (Not a number)
- * copysign - copy sign of a number
- * ldexp - multiply floating-point number by integral power of 2
- * imodf - get signed integral value from floating-point number
- * modf - get signed fractional value from floating-point number
- * drem - floating-point remainder function
- *
- * The following are done but not popular enough in math libss
- * to be included yet
- * hypoth - Euclidean distance function
- * trunc
- * round
- * nearbyint -
- */
-
-
-
-/*
- * vexp_func.c -- this file include all the functions for vexp.
- * the first two arguments to the function are the number
- * of argument and an array of arguments (argc, argv)
- * the last argument is a pointer to a struct ex_ex for
- * the result. Up do this point, the content of the
- * struct ex_ex that these functions receive are either
- * ET_INT (long), ET_FLT (t_float), or ET_SYM (char **, it is
- * char ** and not char * since NewHandle of Mac returns
- * a char ** for relocatability.) The common practice in
- * these functions is that they figure out the type of their
- * result according to the type of the arguments. In general
- * the ET_SYM is used an ET_INT when we expect a value.
- * It is the users responsibility not to pass strings to the
- * function.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#define __STRICT_BSD__
-#include <math.h>
-#undef __STRICT_BSD__
-
-
-#include "vexp.h"
-
-/* forward declarations */
-
-static void ex_min(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_max(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_toint(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_rint(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_tofloat(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_pow(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_exp(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_log(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_ln(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_sin(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_cos(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_asin(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_acos(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_tan(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_atan(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_sinh(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_cosh(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_asinh(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_acosh(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_tanh(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_atanh(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_atan2(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_sqrt(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_fact(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_random(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_abs(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_fmod(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_ceil(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_floor(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_if(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_ldexp(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_imodf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_modf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-#ifndef _WIN32
-static void ex_cbrt(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_erf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_erfc(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_expm1(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_log1p(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_isinf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_finite(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_isnan(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_copysign(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_drem(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-#endif
-#ifdef notdef
-/* the following will be added once they are more popular in math libraries */
-static void ex_round(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_trunc(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_nearbyint(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_hypoth(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-#endif
-
-
-t_ex_func ex_funcs[] = {
- {"min", ex_min, 2},
- {"max", ex_max, 2},
- {"int", ex_toint, 1},
- {"rint", ex_rint, 1},
- {"float", ex_tofloat, 1},
- {"fmod", ex_fmod, 2},
- {"floor", ex_floor, 2},
- {"ceil", ex_ceil, 2},
- {"pow", ex_pow, 2},
- {"sqrt", ex_sqrt, 1},
- {"exp", ex_exp, 1},
- {"log10", ex_log, 1},
- {"ln", ex_ln, 1},
- {"log", ex_ln, 1},
- {"sin", ex_sin, 1},
- {"cos", ex_cos, 1},
- {"tan", ex_tan, 1},
- {"asin", ex_asin, 1},
- {"acos", ex_acos, 1},
- {"atan", ex_atan, 1},
- {"atan2", ex_atan2, 2},
- {"sinh", ex_sinh, 1},
- {"cosh", ex_cosh, 1},
- {"tanh", ex_tanh, 1},
- {"fact", ex_fact, 1},
- {"random", ex_random, 2}, /* random number */
- {"abs", ex_abs, 1},
- {"if", ex_if, 3},
- {"ldexp ", ex_ldexp, 1},
- {"imodf ", ex_imodf, 1},
- {"modf", ex_modf, 1},
-#ifndef _WIN32
- {"cbrt", ex_cbrt, 1},
- {"erf", ex_erf, 1},
- {"erfc", ex_erfc, 1},
- {"expm1", ex_expm1, 1},
- {"log1p", ex_log1p, 1},
- {"isinf", ex_isinf, 1},
- {"finite", ex_finite, 1},
- {"isnan", ex_isnan, 1},
- {"copysig", ex_copysign, 1},
- {"drem", ex_drem, 1},
- {"asinh", ex_asinh, 1},
- {"acosh", ex_acosh, 1},
- {"atanh", ex_atanh, 1}, /* hyperbolic atan */
-#endif
-#ifdef PD
- {"size", ex_size, 1},
- {"sum", ex_sum, 1},
- {"Sum", ex_Sum, 3},
- {"avg", ex_avg, 1},
- {"Avg", ex_Avg, 3},
- {"store", ex_store, 3},
-#endif
-#ifdef notdef
-/* the following will be added once they are more popular in math libraries */
- {"round", ex_round, 1},
- {"trunc", ex_trunc, 1},
- {"nearbyint", ex_nearbyint, 1},
- {"hypoth", ex_hypoth, 1},
-#endif
- {0, 0, 0}
-};
-
-/*
- * FUN_EVAL -- do type checking, evaluate a function,
- * if fltret is set return float
- * otherwise return value based on regular typechecking,
- */
-#define FUNC_EVAL(left, right, func, leftfuncast, rightfuncast, optr, fltret) \
-switch (left->ex_type) { \
-case ET_INT: \
- switch(right->ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)func(leftfuncast left->ex_int, \
- rightfuncast right->ex_int); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- if (fltret) { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float)func(leftfuncast \
- left->ex_int, rightfuncast right->ex_int); \
- } else { \
- optr->ex_type = ET_INT; \
- optr->ex_int = (int)func(leftfuncast \
- left->ex_int, rightfuncast right->ex_int); \
- } \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)func(leftfuncast left->ex_int, \
- rightfuncast right->ex_flt); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float)func(leftfuncast left->ex_int, \
- rightfuncast right->ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*e->exp_vsize); \
- } \
- scalar = left->ex_int; \
- rp = right->ex_vec; \
- op = optr->ex_vec; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (t_float)func(leftfuncast scalar, \
- rightfuncast *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad right type %ld\n", \
- __LINE__, right->ex_type);\
- } \
- break; \
-case ET_FLT: \
- switch(right->ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_int); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_int); \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_flt); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float) * e->exp_vsize);\
- } \
- scalar = left->ex_flt; \
- rp = right->ex_vec; \
- op = optr->ex_vec; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (t_float)func(leftfuncast scalar, \
- rightfuncast *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad right type %ld\n", \
- __LINE__, right->ex_type);\
- } \
- break; \
-case ET_VEC: \
-case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float) * e->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left->ex_vec; \
- switch(right->ex_type) { \
- case ET_INT: \
- scalar = right->ex_int; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (t_float)func(leftfuncast *lp, \
- rightfuncast scalar); \
- lp++; \
- } \
- break; \
- case ET_FLT: \
- scalar = right->ex_flt; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (t_float)func(leftfuncast *lp, \
- rightfuncast scalar); \
- lp++; \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- rp = right->ex_vec; \
- j = e->exp_vsize; \
- while (j--) { \
- /* \
- * on a RISC processor one could copy \
- * 8 times in each round to get a considerable \
- * improvement \
- */ \
- *op++ = (t_float)func(leftfuncast *lp, \
- rightfuncast *rp); \
- rp++; lp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad right type %ld\n", \
- __LINE__, right->ex_type);\
- } \
- break; \
-case ET_SYM: \
-default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad left type %ld\n", \
- __LINE__, left->ex_type); \
-}
-
-/*
- * FUNC_EVAL_UNARY - evaluate a unary function,
- * if fltret is set return t_float
- * otherwise return value based on regular typechecking,
- */
-#define FUNC_EVAL_UNARY(left, func, leftcast, optr, fltret) \
-switch(left->ex_type) { \
-case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec, \
- (t_float)(func (leftcast left->ex_int)), e->exp_vsize);\
- break; \
- } \
- if (fltret) { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float) func(leftcast left->ex_int); \
- break; \
- } \
- optr->ex_type = ET_INT; \
- optr->ex_int = (int) func(leftcast left->ex_int); \
- break; \
-case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec, \
- (t_float)(func (leftcast left->ex_flt)), e->exp_vsize);\
- break; \
- } \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float) func(leftcast left->ex_flt); \
- break; \
-case ET_VI: \
-case ET_VEC: \
- if (optr->ex_type != ET_VEC) { \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*e->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left->ex_vec; \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = (t_float)(func (leftcast *lp++)); \
- break; \
-default: \
- post_error((fts_object_t *) e, \
- "expr: FUNV_EVAL_UNARY(%d): bad left type %ld\n",\
- __LINE__, left->ex_type); \
-}
-
-#undef min
-#undef max
-#define min(x,y) (x > y ? y : x)
-#define max(x,y) (x > y ? x : y)
-
-#define FUNC_DEF(ex_func, func, castleft, castright, fltret); \
-static void \
-ex_func(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)\
-{ \
- struct ex_ex *left, *right; \
- t_float *op; /* output pointer */ \
- t_float *lp, *rp; /* left and right vector pointers */ \
- t_float scalar; \
- int j; \
- \
- left = argv++; \
- right = argv; \
- FUNC_EVAL(left, right, func, castleft, castright, optr, fltret); \
-}
-
-
-#define FUNC_DEF_UNARY(ex_func, func, cast, fltret); \
-static void \
-ex_func(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)\
-{ \
- struct ex_ex *left; \
- t_float *op; /* output pointer */ \
- t_float *lp, *rp; /* left and right vector pointers */ \
- t_float scalar; \
- int j; \
- \
- left = argv++; \
- \
- FUNC_EVAL_UNARY(left, func, cast, optr, fltret); \
-}
-
-/*
- * ex_min -- if any of the arguments are or the output are vectors, a vector
- * of floats is generated otherwise the type of the result is the
- * type of the smaller value
- */
-static void
-ex_min(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
-
- FUNC_EVAL(left, right, min, (double), (double), optr, 0);
-}
-
-/*
- * ex_max -- if any of the arguments are or the output are vectors, a vector
- * of floats is generated otherwise the type of the result is the
- * type of the larger value
- */
-static void
-ex_max(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
-
- FUNC_EVAL(left, right, max, (double), (double), optr, 0);
-}
-
-/*
- * ex_toint -- convert to integer
- */
-static void
-ex_toint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
-#define toint(x) ((int)(x))
- FUNC_EVAL_UNARY(left, toint, (int), optr, 0);
- }
-
-#ifdef _WIN32
-/* No rint in NT land ??? */
-double rint(double x);
-
-double
-rint(double x)
-{
- return (floor(x + 0.5));
-}
-#endif
-
-/*
- * ex_rint -- rint() round to the nearest int according to the common
- * rounding mechanism
- */
-static void
-ex_rint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
-
- FUNC_EVAL_UNARY(left, rint, (double), optr, 1);
-}
-
-/*
- * ex_tofloat -- convert to t_float
- */
-static void
-ex_tofloat(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
-#define tofloat(x) ((t_float)(x))
- FUNC_EVAL_UNARY(left, tofloat, (int), optr, 1);
-}
-
-
-/*
- * ex_pow -- the power of
- */
-static void
-ex_pow(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, pow, (double), (double), optr, 1);
-}
-
-/*
- * ex_sqrt -- square root
- */
-static void
-ex_sqrt(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, sqrt, (double), optr, 1);
-}
-
-/*
- * ex_exp -- e to the power of
- */
-static void
-ex_exp(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, exp, (double), optr, 1);
-}
-
-/*
- * ex_log -- 10 based logarithm
- */
-static void
-ex_log(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, log10, (double), optr, 1);
-}
-
-/*
- * ex_ln -- natural log
- */
-static void
-ex_ln(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, log, (double), optr, 1);
-}
-
-static void
-ex_sin(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, sin, (double), optr, 1);
-}
-
-static void
-ex_cos(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, cos, (double), optr, 1);
-}
-
-
-static void
-ex_tan(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, tan, (double), optr, 1);
-}
-
-static void
-ex_asin(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, asin, (double), optr, 1);
-}
-
-static void
-ex_acos(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, acos, (double), optr, 1);
-}
-
-
-static void
-ex_atan(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, atan, (double), optr, 1);
-}
-
-/*
- *ex_atan2 --
- */
-static void
-ex_atan2(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, atan2, (double), (double), optr, 1);
-}
-
-/*
- * ex_fmod -- floating point modulo
- */
-static void
-ex_fmod(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, fmod, (double), (double), optr, 1);
-}
-
-
-/*
- * ex_floor -- floor
- */
-static void
-ex_floor(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- FUNC_EVAL_UNARY(left, floor, (double), optr, 1);
-}
-
-
-/*
- * ex_ceil -- ceil
- */
-static void
-ex_ceil(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- FUNC_EVAL_UNARY(left, ceil, (double), optr, 1);
-}
-
-static void
-ex_sinh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, sinh, (double), optr, 1);
-}
-
-static void
-ex_cosh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, cosh, (double), optr, 1);
-}
-
-
-static void
-ex_tanh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, tanh, (double), optr, 1);
-}
-
-
-#ifndef _WIN32
-static void
-ex_asinh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, asinh, (double), optr, 1);
-}
-
-static void
-ex_acosh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, acosh, (double), optr, 1);
-}
-
-static void
-ex_atanh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, atanh, (double), optr, 1);
-}
-#endif
-
-static int
-ex_dofact(int i)
-{
- int ret = 0;
-
- if (i)
- ret = 1;
- else
- return (0);
-
- do {
- ret *= i;
- } while (--i);
-
- return(ret);
-}
-
-static void
-ex_fact(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, ex_dofact, (int), optr, 0);
-}
-
-static int
-ex_dorandom(int i1, int i2)
-{
- return(i1 + (((i2 - i1) * (rand() & 0x7fffL)) >> 15));
-}
-/*
- * ex_random -- return a random number
- */
-static void
-ex_random(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, ex_dorandom, (int), (int), optr, 0);
-}
-
-
-static void
-ex_abs(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, fabs, (double), optr, 0);
-}
-
-/*
- *ex_if -- floating point modulo
- */
-static void
-ex_if(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right, *cond, *res;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float *cp; /* condition pointer */
- t_float leftvalue, rightvalue;
- int j;
-
- cond = argv++;
- left = argv++;
- right = argv;
-
- switch (cond->ex_type) {
- case ET_VEC:
- case ET_VI:
- if (optr->ex_type != ET_VEC) {
- if (optr->ex_type == ET_VI) {
- /* SDY remove this test */
- post("expr~: Int. error %d", __LINE__);
- return;
- }
- optr->ex_type = ET_VEC;
- optr->ex_vec = (t_float *)
- fts_malloc(sizeof (t_float) * e->exp_vsize);
- }
- op = optr->ex_vec;
- j = e->exp_vsize;
- cp = cond->ex_vec;
- switch (left->ex_type) {
- case ET_INT:
- leftvalue = left->ex_int;
- switch (right->ex_type) {
- case ET_INT:
- rightvalue = right->ex_int;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_FLT:
- rightvalue = right->ex_flt;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_VEC:
- case ET_VI:
- rp = right->ex_vec;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = *rp;
- rp++;
- }
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad right type %ld\n",
- __LINE__, right->ex_type);
- return;
- }
- case ET_FLT:
- leftvalue = left->ex_flt;
- switch (right->ex_type) {
- case ET_INT:
- rightvalue = right->ex_int;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_FLT:
- rightvalue = right->ex_flt;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_VEC:
- case ET_VI:
- rp = right->ex_vec;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = *rp;
- rp++;
- }
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad right type %ld\n",
- __LINE__, right->ex_type);
- return;
- }
- case ET_VEC:
- case ET_VI:
- lp = left->ex_vec;
- switch (right->ex_type) {
- case ET_INT:
- rightvalue = right->ex_int;
- while (j--) {
- if (*cp++)
- *op++ = *lp;
- else
- *op++ = rightvalue;
- lp++;
- }
- return;
- case ET_FLT:
- rightvalue = right->ex_flt;
- while (j--) {
- if (*cp++)
- *op++ = *lp;
- else
- *op++ = rightvalue;
- lp++;
- }
- return;
- case ET_VEC:
- case ET_VI:
- rp = right->ex_vec;
- while (j--) {
- if (*cp++)
- *op++ = *lp;
- else
- *op++ = *rp;
- lp++; rp++;
- }
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad right type %ld\n",
- __LINE__, right->ex_type);
- return;
- }
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad left type %ld\n",
- __LINE__, left->ex_type);
- return;
- }
- case ET_INT:
- if (cond->ex_int)
- res = left;
- else
- res = right;
- break;
- case ET_FLT:
- if (cond->ex_flt)
- res = left;
- else
- res = right;
- break;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad condition type %ld\n",
- __LINE__, cond->ex_type);
- return;
- }
- switch(res->ex_type) {
- case ET_INT:
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec, (t_float)res->ex_int,
- e->exp_vsize);
- return;
- }
- *optr = *res;
- return;
- case ET_FLT:
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec, (t_float)res->ex_flt,
- e->exp_vsize);
- return;
- }
- *optr = *res;
- return;
- case ET_VEC:
- case ET_VI:
- if (optr->ex_type != ET_VEC) {
- if (optr->ex_type == ET_VI) {
- /* SDY remove this test */
- post("expr~: Int. error %d", __LINE__);
- return;
- }
- optr->ex_type = ET_VEC;
- optr->ex_vec = (t_float *)
- fts_malloc(sizeof (t_float) * e->exp_vsize);
- }
- memcpy(optr->ex_vec, res->ex_vec, e->exp_vsize*sizeof(t_float));
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad res type %ld\n",
- __LINE__, res->ex_type);
- return;
- }
-
-}
-
-/*
- * ex_imodf - extract signed integral value from floating-point number
- */
-static double
-imodf(double x)
-{
- double xx;
-
- modf(x, &xx);
- return (xx);
-}
-FUNC_DEF_UNARY(ex_imodf, imodf, (double), 1);
-
-/*
- * ex_modf - extract signed fractional value from floating-point number
- *
- * using fracmodf because fmodf() is alrady defined in a .h file
- */
-static double
-fracmodf(double x)
-{
- double xx;
-
- return(modf(x, &xx));
-}
-FUNC_DEF_UNARY(ex_modf, fracmodf, (double), 1);
-
-/*
- * ex_ldexp - multiply floating-point number by integral power of 2
- */
-FUNC_DEF(ex_ldexp, ldexp, (double), (int), 1);
-
-#ifndef _WIN32
-/*
- * ex_cbrt - cube root
- */
-FUNC_DEF_UNARY(ex_cbrt, cbrt, (double), 1);
-
-/*
- * ex_erf - error function
- */
-FUNC_DEF_UNARY(ex_erf, erf, (double), 1);
-
-/*
- * ex_erfc - complementary error function
- */
-FUNC_DEF_UNARY(ex_erfc, erfc, (double), 1);
-
-/*
- * ex_expm1 - exponential minus 1,
- */
-FUNC_DEF_UNARY(ex_expm1, expm1, (double), 1);
-
-/*
- * ex_log1p - logarithm of 1 plus
- */
-FUNC_DEF_UNARY(ex_log1p, log1p, (double), 1);
-
-/*
- * ex_isinf - is the value infinite,
- */
-FUNC_DEF_UNARY(ex_isinf, isinf, (double), 0);
-
-/*
- * ex_finite - is the value finite
- */
-FUNC_DEF_UNARY(ex_finite, finite, (double), 0);
-
-/*
- * ex_isnan -- is the resut a nan (Not a number)
- */
-FUNC_DEF_UNARY(ex_isnan, isnan, (double), 0);
-
-/*
- * ex_copysign - copy sign of a number
- */
-FUNC_DEF(ex_copysign, copysign, (double), (double), 1);
-
-/*
- * ex_drem - floating-point remainder function
- */
-FUNC_DEF(ex_drem, drem, (double), (double), 1);
-#endif
-
-#ifdef notdef
-/* the following will be added once they are more popular in math libraries */
-/*
- * ex_hypoth - Euclidean distance function
- */
-FUNC_DEF(ex_hypoth, hypoth, (double), (double), 1);
-
-/*
- * ex_round - round to nearest integer, away from zero
- */
-FUNC_DEF_UNARY(ex_round, round, (double), 1);
-
-/*
- * ex_trunc - round to interger, towards zero
- */
-FUNC_DEF_UNARY(ex_trunc, trunc, (double), 1);
-
-/*
- * ex_nearbyint - round to nearest integer
- */
-FUNC_DEF_UNARY(ex_nearbyint, nearbyint, (double), 1);
-#endif
diff --git a/externals/extra/0.43.2/expr~/vexp_if.c b/externals/extra/0.43.2/expr~/vexp_if.c
deleted file mode 100644
index 3028ff82..00000000
--- a/externals/extra/0.43.2/expr~/vexp_if.c
+++ /dev/null
@@ -1,1225 +0,0 @@
-/*
- * jMax
- * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * See file LICENSE for further informations on licensing terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Based on Max/ISPW by Miller Puckette.
- *
- * Authors: Maurizio De Cecco, Francois Dechelle, Enzo Maggi, Norbert Schnell.
- *
- */
-
-/* "expr" was written by Shahrokh Yadegari c. 1989. -msp */
-/* "expr~" and "fexpr~" conversion by Shahrokh Yadegari c. 1999,2000 */
-
-/*
- * Feb 2002 - added access to variables
- * multiple expression support
- * new short hand forms for fexpr~
- * now $y or $y1 = $y1[-1] and $y2 = $y2[-1]
- * --sdy
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "vexp.h"
-
-static char *exp_version = "0.4";
-
-extern struct ex_ex *ex_eval(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int n);
-
-#ifdef PD
-static t_class *expr_class;
-static t_class *expr_tilde_class;
-static t_class *fexpr_tilde_class;
-#else /* MSP */
-void *expr_tilde_class;
-#endif
-
-
-/*------------------------- expr class -------------------------------------*/
-
-extern int expr_donew(struct expr *expr, int ac, t_atom *av);
-
-/*#define EXPR_DEBUG*/
-
-static void expr_bang(t_expr *x);
-t_int *expr_perform(t_int *w);
-
-
-static void
-expr_list(t_expr *x, t_symbol *s, int argc, const fts_atom_t *argv)
-{
- int i;
-
- if (argc > MAX_VARS) argc = MAX_VARS;
-
- for (i = 0; i < argc; i++)
- {
- if (argv[i].a_type == A_FLOAT)
- {
- if (x->exp_var[i].ex_type == ET_FI)
- x->exp_var[i].ex_flt = argv[i].a_w.w_float;
- else if (x->exp_var[i].ex_type == ET_II)
- x->exp_var[i].ex_int = argv[i].a_w.w_float;
- else if (x->exp_var[i].ex_type)
- pd_error(x, "expr: type mismatch");
- }
- else if (argv[i].a_type == A_SYMBOL)
- {
- if (x->exp_var[i].ex_type == ET_SI)
- x->exp_var[i].ex_ptr = (char *)argv[i].a_w.w_symbol;
- else if (x->exp_var[i].ex_type)
- pd_error(x, "expr: type mismatch");
- }
- }
- expr_bang(x);
-}
-
-static void
-expr_flt(t_expr *x, t_float f, int in)
-{
- if (in > MAX_VARS)
- return;
-
- if (x->exp_var[in].ex_type == ET_FI)
- x->exp_var[in].ex_flt = f;
- else if (x->exp_var[in].ex_type == ET_II)
- x->exp_var[in].ex_int = f;
-}
-
-static t_class *exprproxy_class;
-
-typedef struct _exprproxy {
- t_pd p_pd;
- int p_index;
- t_expr *p_owner;
- struct _exprproxy *p_next;
-} t_exprproxy;
-
-t_exprproxy *exprproxy_new(t_expr *owner, int indx);
-void exprproxy_float(t_exprproxy *p, t_floatarg f);
-
-t_exprproxy *
-exprproxy_new(t_expr *owner, int indx)
-{
- t_exprproxy *x = (t_exprproxy *)pd_new(exprproxy_class);
- x->p_owner = owner;
- x->p_index = indx;
- x->p_next = owner->exp_proxy;
- owner->exp_proxy = x;
- return (x);
-}
-
-void
-exprproxy_float(t_exprproxy *p, t_floatarg f)
-{
- t_expr *x = p->p_owner;
- int in = p->p_index;
-
- if (in > MAX_VARS)
- return;
-
- if (x->exp_var[in].ex_type == ET_FI)
- x->exp_var[in].ex_flt = f;
- else if (x->exp_var[in].ex_type == ET_II)
- x->exp_var[in].ex_int = f;
-}
-
-/* method definitions */
-static void
-expr_ff(t_expr *x)
-{
- t_exprproxy *y;
- int i;
-
- y = x->exp_proxy;
- while (y)
- {
- x->exp_proxy = y->p_next;
-#ifdef PD
- pd_free(&y->p_pd);
-#else /*MSP */
- /* SDY find out what needs to be called for MSP */
-
-#endif
- y = x->exp_proxy;
- }
- for (i = 0 ; i < x->exp_nexpr; i++);
- if (x->exp_stack[i])
- fts_free(x->exp_stack[i]);
-/*
- * SDY free all the allocated buffers here for expr~ and fexpr~
- * check to see if there are others
- */
- for (i = 0; i < MAX_VARS; i++) {
- if (x->exp_p_var[i])
- fts_free(x->exp_p_var[i]);
- if (x->exp_p_res[i])
- fts_free(x->exp_p_res[i]);
- if (x->exp_tmpres[i])
- fts_free(x->exp_tmpres[i]);
- }
-
-
-}
-
-static void
-expr_bang(t_expr *x)
-{
- int i;
-
-#ifdef EXPR_DEBUG
- {
- struct ex_ex *eptr;
-
- for (i = 0, eptr = x->exp_var; ; eptr++, i++)
- {
- if (!eptr->ex_type)
- break;
- switch (eptr->ex_type)
- {
- case ET_II:
- fprintf(stderr,"ET_II: %d \n", eptr->ex_int);
- break;
-
- case ET_FI:
- fprintf(stderr,"ET_FT: %f \n", eptr->ex_flt);
- break;
-
- default:
- fprintf(stderr,"oups\n");
- }
- }
- }
-#endif
- /* banging a signal or filter object means nothing */
- if (!IS_EXPR(x))
- return;
-
- for (i = x->exp_nexpr - 1; i > -1 ; i--) {
- if (!ex_eval(x, x->exp_stack[i], &x->exp_res[i], 0)) {
- /*fprintf(stderr,"expr_bang(error evaluation)\n"); */
- /* SDY now that we have mutiple ones, on error we should
- * continue
- return;
- */
- }
- switch(x->exp_res[i].ex_type) {
- case ET_INT:
- outlet_float(x->exp_outlet[i],
- (t_float) x->exp_res[i].ex_int);
- break;
-
- case ET_FLT:
- outlet_float(x->exp_outlet[i], x->exp_res[i].ex_flt);
- break;
-
- case ET_SYM:
- /* CHANGE this will have to be taken care of */
-
- default:
- post("expr: bang: unrecognized result %ld\n", x->exp_res[i].ex_type);
- }
- }
-}
-
-static t_expr *
-#ifdef PD
-expr_new(t_symbol *s, int ac, t_atom *av)
-#else /* MSP */
-Nexpr_new(t_symbol *s, int ac, t_atom *av)
-#endif
-{
- struct expr *x;
- int i, ninlet;
- struct ex_ex *eptr;
- t_atom fakearg;
- int dsp_index; /* keeping track of the dsp inlets */
-
-
-/*
- * SDY - we may need to call dsp_setup() in this function
- */
-
- if (!ac)
- {
- ac = 1;
- av = &fakearg;
- SETFLOAT(&fakearg, 0);
- }
-
-#ifdef PD
- /*
- * figure out if we are expr, expr~, or fexpr~
- */
- if (!strcmp("expr", s->s_name)) {
- x = (t_expr *)pd_new(expr_class);
- SET_EXPR(x);
- } else if (!strcmp("expr~", s->s_name)) {
- x = (t_expr *)pd_new(expr_tilde_class);
- SET_EXPR_TILDE(x);
- } else if (!strcmp("fexpr~", s->s_name)) {
- x = (t_expr *)pd_new(fexpr_tilde_class);
- SET_FEXPR_TILDE(x);
- } else {
- post("expr_new: bad object name '%s'");
- /* assume expr */
- x = (t_expr *)pd_new(expr_class);
- SET_EXPR(x);
- }
-#else /* MSP */
- /* for now assume an expr~ */
- x = (t_expr *)pd_new(expr_tilde_class);
- SET_EXPR_TILDE(x);
-#endif
-
- /*
- * initialize the newly allocated object
- */
- x->exp_proxy = 0;
- x->exp_nivec = 0;
- x->exp_nexpr = 0;
- x->exp_error = 0;
- for (i = 0; i < MAX_VARS; i++) {
- x->exp_stack[i] = (struct ex_ex *)0;
- x->exp_outlet[i] = (t_outlet *)0;
- x->exp_res[i].ex_type = 0;
- x->exp_res[i].ex_int = 0;
- x->exp_p_res[i] = (t_float *)0;
- x->exp_var[i].ex_type = 0;
- x->exp_var[i].ex_int = 0;
- x->exp_p_var[i] = (t_float *)0;
- x->exp_tmpres[i] = (t_float *)0;
- x->exp_vsize = 0;
- }
- x->exp_f = 0; /* save the control value to be transformed to signal */
-
-
- if (expr_donew(x, ac, av))
- {
- pd_error(x, "expr: syntax error");
-/*
-SDY the following coredumps why?
- pd_free(&x->exp_ob.ob_pd);
-*/
- return (0);
- }
-
- ninlet = 1;
- for (i = 0, eptr = x->exp_var; i < MAX_VARS ; i++, eptr++)
- if (eptr->ex_type) {
- ninlet = i + 1;
- }
-
- /*
- * create the new inlets
- */
- for (i = 1, eptr = x->exp_var + 1, dsp_index=1; i<ninlet ; i++, eptr++)
- {
- t_exprproxy *p;
- switch (eptr->ex_type)
- {
- case 0:
- /* nothing is using this inlet */
- if (i < ninlet)
-#ifdef PD
- floatinlet_new(&x->exp_ob, &eptr->ex_flt);
-#else /* MSP */
- inlet_new(&x->exp_ob, "float");
-#endif
- break;
-
- case ET_II:
- case ET_FI:
- p = exprproxy_new(x, i);
-#ifdef PD
- inlet_new(&x->exp_ob, &p->p_pd, &s_float, &s_float);
-#else /* MSP */
- inlet_new(&x->exp_ob, "float");
-#endif
- break;
-
- case ET_SI:
-#ifdef PD
- symbolinlet_new(&x->exp_ob, (t_symbol **)&eptr->ex_ptr);
-#else /* MSP */
- inlet_new(&x->exp_ob, "symbol");
-#endif
- break;
-
- case ET_XI:
- case ET_VI:
- if (!IS_EXPR(x)) {
- dsp_index++;
-#ifdef PD
- inlet_new(&x->exp_ob, &x->exp_ob.ob_pd,
- &s_signal, &s_signal);
-#else /* MSP */
- inlet_new(&x->exp_ob, "signal");
-#endif
- break;
- } else
- post("expr: internal error expr_new");
- default:
- pd_error(x, "expr: bad type (%lx) inlet = %d\n",
- eptr->ex_type, i + 1);
- break;
- }
- }
- if (IS_EXPR(x)) {
- for (i = 0; i < x->exp_nexpr; i++)
- x->exp_outlet[i] = outlet_new(&x->exp_ob, 0);
- } else {
- for (i = 0; i < x->exp_nexpr; i++)
- x->exp_outlet[i] = outlet_new(&x->exp_ob,
- gensym("signal"));
- x->exp_nivec = dsp_index;
- }
- /*
- * for now assume a 64 sample size block but this may change once
- * expr_dsp is called
- */
- x->exp_vsize = 64;
- for (i = 0; i < x->exp_nexpr; i++) {
- x->exp_p_res[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- x->exp_tmpres[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- }
- for (i = 0; i < MAX_VARS; i++)
- x->exp_p_var[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
-
- return (x);
-}
-
-t_int *
-expr_perform(t_int *w)
-{
- int i, j;
- t_expr *x = (t_expr *)w[1];
- struct ex_ex res;
- int n;
-
- /* sanity check */
- if (IS_EXPR(x)) {
- post("expr_perform: bad x->exp_flags = %d", x->exp_flags);
- abort();
- }
-
- if (x->exp_flags & EF_STOP) {
- for (i = 0; i < x->exp_nexpr; i++)
- memset(x->exp_res[i].ex_vec, 0,
- x->exp_vsize * sizeof (t_float));
- return (w + 2);
- }
-
- if (IS_EXPR_TILDE(x)) {
- /*
- * if we have only one expression, we can right on
- * on the output directly, otherwise we have to copy
- * the data because, outputs could be the same buffer as
- * inputs
- */
- if ( x->exp_nexpr == 1)
- ex_eval(x, x->exp_stack[0], &x->exp_res[0], 0);
- else {
- res.ex_type = ET_VEC;
- for (i = 0; i < x->exp_nexpr; i++) {
- res.ex_vec = x->exp_tmpres[i];
- ex_eval(x, x->exp_stack[i], &res, 0);
- }
- n = x->exp_vsize * sizeof(t_float);
- for (i = 0; i < x->exp_nexpr; i++)
- memcpy(x->exp_res[i].ex_vec, x->exp_tmpres[i],
- n);
- }
- return (w + 2);
- }
-
- if (!IS_FEXPR_TILDE(x)) {
- post("expr_perform: bad x->exp_flags = %d - expecting fexpr",
- x->exp_flags);
- return (w + 2);
- }
- /*
- * since the output buffer could be the same as one of the inputs
- * we need to keep the output in a different buffer
- */
- for (i = 0; i < x->exp_vsize; i++) for (j = 0; j < x->exp_nexpr; j++) {
- res.ex_type = 0;
- res.ex_int = 0;
- ex_eval(x, x->exp_stack[j], &res, i);
- switch (res.ex_type) {
- case ET_INT:
- x->exp_tmpres[j][i] = (t_float) res.ex_int;
- break;
- case ET_FLT:
- x->exp_tmpres[j][i] = res.ex_flt;
- break;
- default:
- post("expr_perform: bad result type %d", res.ex_type);
- }
- }
- /*
- * copy inputs and results to the save buffers
- * inputs need to be copied first as the output buffer can be
- * same as an input buffer
- */
- n = x->exp_vsize * sizeof(t_float);
- for (i = 0; i < MAX_VARS; i++)
- if (x->exp_var[i].ex_type == ET_XI)
- memcpy(x->exp_p_var[i], x->exp_var[i].ex_vec, n);
- for (i = 0; i < x->exp_nexpr; i++) {
- memcpy(x->exp_p_res[i], x->exp_tmpres[i], n);
- memcpy(x->exp_res[i].ex_vec, x->exp_tmpres[i], n);
- }
- return (w + 2);
-}
-
-static void
-expr_dsp(t_expr *x, t_signal **sp)
-{
- int i, nv;
- int newsize;
-
- x->exp_error = 0; /* reset all errors */
- newsize = (x->exp_vsize != sp[0]->s_n);
- x->exp_vsize = sp[0]->s_n; /* record the vector size */
- for (i = 0; i < x->exp_nexpr; i++) {
- x->exp_res[i].ex_type = ET_VEC;
- x->exp_res[i].ex_vec = sp[x->exp_nivec + i]->s_vec;
- }
- for (i = 0, nv = 0; i < MAX_VARS; i++)
- /*
- * the first inlet is always a signal
- *
- * SDY We are warning the user till this limitation
- * is taken away from pd
- */
- if (!i || x->exp_var[i].ex_type == ET_VI ||
- x->exp_var[i].ex_type == ET_XI) {
- if (nv >= x->exp_nivec) {
- post("expr_dsp int. err nv = %d, x->exp_nive = %d",
- nv, x->exp_nivec);
- abort();
- }
- x->exp_var[i].ex_vec = sp[nv]->s_vec;
- nv++;
- }
- /* we always have one inlet but we may not use it */
- if (nv != x->exp_nivec && (nv != 0 || x->exp_nivec != 1)) {
- post("expr_dsp internal error 2 nv = %d, x->exp_nive = %d",
- nv, x->exp_nivec);
- abort();
- }
-
- dsp_add(expr_perform, 1, (t_int *) x);
-
- /*
- * The buffer are now being allocated for expr~ and fexpr~
- * because if we have more than one expression we need the
- * temporary buffers, The save buffers are not really needed
- if (!IS_FEXPR_TILDE(x))
- return;
- */
- /*
- * if we have already allocated the buffers and we have a
- * new size free all the buffers
- */
- if (x->exp_p_res[0]) {
- if (!newsize)
- return;
- /*
- * if new size, reallocate all the previous buffers for fexpr~
- */
- for (i = 0; i < x->exp_nexpr; i++) {
- fts_free(x->exp_p_res[i]);
- fts_free(x->exp_tmpres[i]);
- }
- for (i = 0; i < MAX_VARS; i++)
- fts_free(x->exp_p_var[i]);
-
- }
- for (i = 0; i < x->exp_nexpr; i++) {
- x->exp_p_res[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- x->exp_tmpres[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- }
- for (i = 0; i < MAX_VARS; i++)
- x->exp_p_var[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
-}
-
-/*
- * expr_verbose -- toggle the verbose switch
- */
-static void
-expr_verbose(t_expr *x)
-{
- if (x->exp_flags & EF_VERBOSE) {
- x->exp_flags &= ~EF_VERBOSE;
- post ("verbose off");
- } else {
- x->exp_flags |= EF_VERBOSE;
- post ("verbose on");
- }
-}
-
-/*
- * expr_start -- turn on expr processing for now only used for fexpr~
- */
-static void
-expr_start(t_expr *x)
-{
- x->exp_flags &= ~EF_STOP;
-}
-
-/*
- * expr_stop -- turn on expr processing for now only used for fexpr~
- */
-static void
-expr_stop(t_expr *x)
-{
- x->exp_flags |= EF_STOP;
-}
-static void
-fexpr_set_usage(void)
-{
- post("fexpr~: set val ...");
- post("fexpr~: set {xy}[#] val ...");
-}
-
-/*
- * fexpr_tilde_set -- set previous values of the buffers
- * set val val ... - sets the first elements of output buffers
- * set x val ... - sets the elements of the first input buffer
- * set x# val ... - sets the elements of the #th input buffers
- * set y val ... - sets the elements of the first output buffer
- * set y# val ... - sets the elements of the #th output buffers
- */
-static void
-fexpr_tilde_set(t_expr *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_symbol *sx;
- int vecno;
- int i, nargs;
-
- if (!argc)
- return;
- sx = atom_getsymbolarg(0, argc, argv);
- switch(sx->s_name[0]) {
- case 'x':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.set: bad set x vector number");
- fexpr_set_usage();
- return;
- }
- if (vecno >= MAX_VARS) {
- post("fexpr~.set: no more than %d inlets",
- MAX_VARS);
- return;
- }
- vecno--;
- }
- if (x->exp_var[vecno].ex_type != ET_XI) {
- post("fexpr~-set: no signal at inlet %d", vecno + 1);
- return;
- }
- nargs = argc - 1;
- if (!nargs) {
- post("fexpr~-set: no argument to set");
- return;
- }
- if (nargs > x->exp_vsize) {
- post("fexpr~.set: %d set values larger than vector size(%d)",
- nargs, x->exp_vsize);
- post("fexpr~.set: only the first %d values will be set",
- x->exp_vsize);
- nargs = x->exp_vsize;
- }
- for (i = 0; i < nargs; i++) {
- x->exp_p_var[vecno][x->exp_vsize - i - 1] =
- atom_getfloatarg(i + 1, argc, argv);
- }
- return;
- case 'y':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.set: bad set y vector number");
- fexpr_set_usage();
- return;
- }
- vecno--;
- }
- if (vecno >= x->exp_nexpr) {
- post("fexpr~.set: only %d outlets", x->exp_nexpr);
- return;
- }
- nargs = argc - 1;
- if (!nargs) {
- post("fexpr~-set: no argument to set");
- return;
- }
- if (nargs > x->exp_vsize) {
- post("fexpr~-set: %d set values larger than vector size(%d)",
- nargs, x->exp_vsize);
- post("fexpr~.set: only the first %d values will be set",
- x->exp_vsize);
- nargs = x->exp_vsize;
- }
- for (i = 0; i < nargs; i++) {
- x->exp_p_res[vecno][x->exp_vsize - i - 1] =
- atom_getfloatarg(i + 1, argc, argv);
- }
- return;
- case 0:
- if (argc > x->exp_nexpr) {
- post("fexpr~.set: only %d outlets available",
- x->exp_nexpr);
- post("fexpr~.set: the extra set values are ignored");
- }
- for (i = 0; i < x->exp_nexpr && i < argc; i++)
- x->exp_p_res[i][x->exp_vsize - 1] =
- atom_getfloatarg(i, argc, argv);
- return;
- default:
- fexpr_set_usage();
- return;
- }
- return;
-}
-
-/*
- * fexpr_tilde_clear - clear the past buffers
- */
-static void
-fexpr_tilde_clear(t_expr *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_symbol *sx;
- int vecno;
- int i, nargs;
-
- /*
- * if no arguement clear all input and output buffers
- */
- if (!argc) {
- for (i = 0; i < x->exp_nexpr; i++)
- memset(x->exp_p_res[i], 0, x->exp_vsize*sizeof(t_float));
- for (i = 0; i < MAX_VARS; i++)
- if (x->exp_var[i].ex_type == ET_XI)
- memset(x->exp_p_var[i], 0,
- x->exp_vsize*sizeof(t_float));
- return;
- }
- if (argc > 1) {
- post("fexpr~ usage: 'clear' or 'clear {xy}[#]'");
- return;
- }
-
- sx = atom_getsymbolarg(0, argc, argv);
- switch(sx->s_name[0]) {
- case 'x':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.clear: bad clear x vector number");
- return;
- }
- if (vecno >= MAX_VARS) {
- post("fexpr~.clear: no more than %d inlets",
- MAX_VARS);
- return;
- }
- vecno--;
- }
- if (x->exp_var[vecno].ex_type != ET_XI) {
- post("fexpr~-clear: no signal at inlet %d", vecno + 1);
- return;
- }
- memset(x->exp_p_var[vecno], 0, x->exp_vsize*sizeof(t_float));
- return;
- case 'y':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.clear: bad clear y vector number");
- return;
- }
- vecno--;
- }
- if (vecno >= x->exp_nexpr) {
- post("fexpr~.clear: only %d outlets", x->exp_nexpr);
- return;
- }
- memset(x->exp_p_res[vecno], 0, x->exp_vsize*sizeof(t_float));
- return;
- return;
- default:
- post("fexpr~ usage: 'clear' or 'clear {xy}[#]'");
- return;
- }
- return;
-}
-
-#ifdef PD
-
-void
-expr_setup(void)
-{
- /*
- * expr initialization
- */
- expr_class = class_new(gensym("expr"), (t_newmethod)expr_new,
- (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
- class_addlist(expr_class, expr_list);
- exprproxy_class = class_new(gensym("exprproxy"), 0,
- 0, sizeof(t_exprproxy), CLASS_PD, 0);
- class_addfloat(exprproxy_class, exprproxy_float);
-
- /*
- * expr~ initialization
- */
- expr_tilde_class = class_new(gensym("expr~"), (t_newmethod)expr_new,
- (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
- class_addmethod(expr_tilde_class, nullfn, gensym("signal"), 0);
- CLASS_MAINSIGNALIN(expr_tilde_class, t_expr, exp_f);
- class_addmethod(expr_tilde_class,(t_method)expr_dsp, gensym("dsp"), 0);
- class_sethelpsymbol(expr_tilde_class, gensym("expr"));
- /*
- * fexpr~ initialization
- */
- fexpr_tilde_class = class_new(gensym("fexpr~"), (t_newmethod)expr_new,
- (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
- class_addmethod(fexpr_tilde_class, nullfn, gensym("signal"), 0);
- class_addmethod(fexpr_tilde_class,(t_method)expr_start,
- gensym("start"), 0);
- class_addmethod(fexpr_tilde_class,(t_method)expr_stop,
- gensym("stop"), 0);
-
- class_addmethod(fexpr_tilde_class,(t_method)expr_dsp,gensym("dsp"), 0);
- class_addmethod(fexpr_tilde_class, (t_method)fexpr_tilde_set,
- gensym("set"), A_GIMME, 0);
- class_addmethod(fexpr_tilde_class, (t_method)fexpr_tilde_clear,
- gensym("clear"), A_GIMME, 0);
- class_addmethod(fexpr_tilde_class,(t_method)expr_verbose,
- gensym("verbose"), 0);
- class_sethelpsymbol(fexpr_tilde_class, gensym("expr"));
-
-
-
- post("expr, expr~, fexpr~ version %s under GNU General Public License ", exp_version);
-
-}
-
-void
-expr_tilde_setup(void)
-{
- expr_setup();
-}
-
-void
-fexpr_tilde_setup(void)
-{
- expr_setup();
-}
-#else /* MSP */
-void
-main(void)
-{
- setup((t_messlist **)&expr_tilde_class, (method)Nexpr_new,
- (method)expr_ff, (short)sizeof(t_expr), 0L, A_GIMME, 0);
- addmess((method)expr_dsp, "dsp", A_CANT, 0); // dsp method
- dsp_initclass();
-}
-#endif
-
-
-/* -- the following functions use Pd internals and so are in the "if" file. */
-
-
-int
-ex_getsym(char *p, fts_symbol_t *s)
-{
- *s = gensym(p);
- return (0);
-}
-
-const char *
-ex_symname(fts_symbol_t s)
-{
- return (fts_symbol_name(s));
-}
-
-/*
- * max_ex_tab -- evaluate this table access
- * eptr is the name of the table and arg is the index we
- * have to put the result in optr
- * return 1 on error and 0 otherwise
- *
- * Arguments:
- * the expr object
- * table
- * the argument
- * the result pointer
- */
-int
-max_ex_tab(struct expr *expr, fts_symbol_t s, struct ex_ex *arg,
- struct ex_ex *optr)
-{
-#ifdef PD
- t_garray *garray;
- int size, indx;
- t_word *wvec;
-
- if (!s || !(garray = (t_garray *)pd_findbyclass(s, garray_class)) ||
- !garray_getfloatwords(garray, &size, &wvec))
- {
- optr->ex_type = ET_FLT;
- optr->ex_flt = 0;
- pd_error(expr, "no such table '%s'", s->s_name);
- return (1);
- }
- optr->ex_type = ET_FLT;
-
- switch (arg->ex_type) {
- case ET_INT:
- indx = arg->ex_int;
- break;
- case ET_FLT:
- /* strange interpolation code deleted here -msp */
- indx = arg->ex_flt;
- break;
-
- default: /* do something with strings */
- pd_error(expr, "expr: bad argument for table '%s'\n", fts_symbol_name(s));
- indx = 0;
- }
- if (indx < 0) indx = 0;
- else if (indx >= size) indx = size - 1;
- optr->ex_flt = wvec[indx].w_float;
-#else /* MSP */
- /*
- * table lookup not done for MSP yet
- */
- post("max_ex_tab: not complete for MSP yet!");
- optr->ex_type = ET_FLT;
- optr->ex_flt = 0;
-#endif
- return (0);
-}
-
-int
-max_ex_var(struct expr *expr, fts_symbol_t var, struct ex_ex *optr)
-{
- optr->ex_type = ET_FLT;
- if (value_getfloat(var, &(optr->ex_flt))) {
- optr->ex_type = ET_FLT;
- optr->ex_flt = 0;
- pd_error(expr, "no such var '%s'", var->s_name);
- return (1);
- }
- return (0);
-}
-
-#ifdef PD /* this goes to the end of this file as the following functions
- * should be defined in the expr object in MSP
- */
-#define ISTABLE(sym, garray, size, vec) \
-if (!sym || !(garray = (t_garray *)pd_findbyclass(sym, garray_class)) || \
- !garray_getfloatwords(garray, &size, &vec)) { \
- optr->ex_type = ET_FLT; \
- optr->ex_int = 0; \
- error("no such table '%s'", sym?(sym->s_name):"(null)"); \
- return; \
-}
-
-/*
- * ex_size -- find the size of a table
- */
-void
-ex_size(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- t_symbol *s;
- t_garray *garray;
- int size;
- t_word *wvec;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: size: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- ISTABLE(s, garray, size, wvec);
-
- optr->ex_type = ET_INT;
- optr->ex_int = size;
-}
-
-/*
- * ex_sum -- calculate the sum of all elements of a table
- */
-
-void
-ex_sum(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- t_symbol *s;
- t_garray *garray;
- int size;
- t_word *wvec;
- t_float sum;
- int indx;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: sum: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- ISTABLE(s, garray, size, wvec);
-
- for (indx = 0, sum = 0; indx < size; indx++)
- sum += wvec[indx].w_float;
-
- optr->ex_type = ET_FLT;
- optr->ex_flt = sum;
-}
-
-
-/*
- * ex_Sum -- calculate the sum of table with the given boundries
- */
-
-void
-ex_Sum(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- t_symbol *s;
- t_garray *garray;
- int size;
- t_word *wvec;
- t_float sum;
- int indx, n1, n2;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: sum: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- ISTABLE(s, garray, size, wvec);
-
- if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
- {
- post("expr: Sum: boundries have to be fix values\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
- n1 = argv->ex_int;
- n2 = argv[1].ex_int;
-
- for (indx = n1, sum = 0; indx < n2; indx++)
- if (indx >= 0 && indx < size)
- sum += wvec[indx].w_float;
-
- optr->ex_type = ET_FLT;
- optr->ex_flt = sum;
-}
-
-/*
- * ex_avg -- calculate the avarage of a table
- */
-
-void
-ex_avg(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
-/* SDY - look into this function */
-#if 0
- fts_symbol_t s;
- fts_integer_vector_t *tw = 0;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: avg: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- tw = table_integer_vector_get_by_name(s);
-
- if (tw)
- {
- optr->ex_type = ET_INT;
-
- if (! fts_integer_vector_get_size(tw))
- optr->ex_int = 0;
- else
- optr->ex_int = fts_integer_vector_get_sum(tw) / fts_integer_vector_get_size(tw);
- }
- else
- {
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- post("expr: avg: no such table %s\n", fts_symbol_name(s));
- }
-#endif
-}
-
-
-/*
- * ex_Avg -- calculate the avarage of table with the given boundries
- */
-
-void
-ex_Avg(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
-/* SDY - look into this function */
-#if 0
- fts_symbol_t s;
- fts_integer_vector_t *tw = 0;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: Avg: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- }
-
- s = (fts_symbol_t ) (argv++)->ex_ptr;
-
- tw = table_integer_vector_get_by_name(s);
-
- if (! tw)
- {
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- post("expr: Avg: no such table %s\n", fts_symbol_name(s));
- return;
- }
-
- if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
- {
- post("expr: Avg: boundries have to be fix values\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- optr->ex_type = ET_INT;
-
- if (argv[1].ex_int - argv->ex_int <= 0)
- optr->ex_int = 0;
- else
- optr->ex_int = (fts_integer_vector_get_sub_sum(tw, argv->ex_int, argv[1].ex_int) /
- (argv[1].ex_int - argv->ex_int));
-#endif
-}
-
-/*
- * ex_store -- store a value in a table
- * if the index is greater the size of the table,
- * we will make a modulo the size of the table
- */
-
-void
-ex_store(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
-/* SDY - look into this function */
-#if 0
- fts_symbol_t s;
- fts_integer_vector_t *tw = 0;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: store: need a table name\n");
- }
-
- s = (fts_symbol_t ) (argv++)->ex_ptr;
-
- tw = table_integer_vector_get_by_name(s);
-
- if (! tw)
- {
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- post("expr: store: no such table %s\n", fts_symbol_name(s));
- return;
- }
-
- if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
- {
- post("expr: store: arguments have to be integer\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- }
-
- fts_integer_vector_set_element(tw, argv->ex_int < 0 ? 0 : argv->ex_int % fts_integer_vector_get_size(tw), argv[1].ex_int);
- *optr = argv[1];
-#endif
-}
-
-#else /* MSP */
-
-void
-pd_error(void *object, char *fmt, ...)
-{
- va_list ap;
- t_int arg[8];
- int i;
- static int saidit = 0;
- va_start(ap, fmt);
-/* SDY
- vsprintf(error_string, fmt, ap);
- */ post(fmt, ap);
- va_end(ap);
-/* SDY
- fprintf(stderr, "error: %s\n", error_string);
- error_object = object;
-*/
- if (!saidit)
- {
- post("... you might be able to track this down from the Find menu.");
- saidit = 1;
- }
-}
-#endif
diff --git a/externals/extra/0.43.2/extra-meta.pd b/externals/extra/0.43.2/extra-meta.pd
deleted file mode 100644
index 2ddfe712..00000000
--- a/externals/extra/0.43.2/extra-meta.pd
+++ /dev/null
@@ -1,7 +0,0 @@
-#N canvas 15 49 200 200 10;
-#N canvas 25 49 420 300 META 1;
-#X text 13 10 NAME extra;
-#X text 10 30 VERSION 0.43.2;
-#X text 10 50 AUTHOR Miller Puckette and others;
-#X text 10 50 LICENSE GPLv2 for expr and BSD for the rest;
-#X restore 10 10 pd META;
diff --git a/externals/extra/0.43.2/fiddle~/fiddle~-help.pd b/externals/extra/0.43.2/fiddle~/fiddle~-help.pd
deleted file mode 100644
index f396725a..00000000
--- a/externals/extra/0.43.2/fiddle~/fiddle~-help.pd
+++ /dev/null
@@ -1,142 +0,0 @@
-#N canvas 93 26 980 745 10;
-#X obj 262 522 phasor~;
-#X obj 531 616 unpack;
-#X floatatom 531 666 0 0 0 0 - - -;
-#X msg 437 449 print;
-#X obj 262 500 sig~;
-#X floatatom 262 478 0 0 0 0 - - -;
-#X obj 262 456 mtof;
-#X floatatom 262 434 0 0 0 0 - - -;
-#X floatatom 545 643 0 0 0 0 - - -;
-#X obj 531 576 route 1 2 3 4;
-#X obj 614 616 unpack;
-#X floatatom 614 666 0 0 0 0 - - -;
-#X floatatom 628 643 0 0 0 0 - - -;
-#X obj 698 616 unpack;
-#X floatatom 698 666 0 0 0 0 - - -;
-#X floatatom 712 643 0 0 0 0 - - -;
-#X obj 389 616 unpack;
-#X floatatom 389 666 0 0 0 0 - - -;
-#X floatatom 403 643 0 0 0 0 - - -;
-#X obj 334 545 *~;
-#X obj 322 394 loadbang;
-#X obj 353 522 sig~;
-#X floatatom 353 500 0 0 0 0 - - -;
-#X msg 322 478 1;
-#X msg 353 478 0;
-#X floatatom 466 666 0 0 0 0 - - -;
-#X obj 281 666 print attack;
-#X obj 190 666 print pitch;
-#X msg 555 45 \; pd dsp 1;
-#X text 460 39 click here;
-#X text 460 61 to start DSP;
-#X text 226 4 FIDDLE - pitch estimator and sinusoidal peak finder;
-#X text 8 70 The Fiddle object estimates the pitch and amplitude of
-an incoming sound \, both continuously and as a stream of discrete
-"note" events. Fiddle optionally outputs a list of detected sinusoidal
-peaks used to make the pitch determination. Fiddle is described theoretically
-in the 1998 ICMC proceedings \, reprinted on http://man104nfs.ucsd.edu/~mpuckett.
-;
-#X text 8 170 Fiddle's creation arguments specify an analysis window
-size \, the maximum polyphony (i.e. \, the number of simultaneous "pitches"
-to try to find) \, the number of peaks in the spectrum to consider
-\, and the number of peaks \, if any \, to output "raw." The outlets
-give discrete pitch (a number) \, detected attacks in the amplitude
-envelope (a bang) \, one or more voices of continuous pitch and amplitude
-\, overall amplitude \, and optionally a sequence of messages with
-the peaks.;
-#X text 8 296 The analysis hop size is half the window size so in the
-example shown here \, one analysis is done every 512 samples (11.6
-msec at 44K1) \, and the analysis uses the most recent 1024 samples
-(23.2 msec at 44K1). The minimum frequency that Fiddle will report
-is 2-1/2 cycles per analysis windows \, or about 108 Hz. (just below
-MIDI 45.);
-#X text 669 535 number of pitch outlets (1-3 \, default 1);
-#X text 669 557 number of peaks to find (1-100 \, default 20);
-#X text 669 579 number of peaks to output (default 0.);
-#X msg 441 107 amp-range 40 50;
-#X msg 439 227 reattack 100 10;
-#X msg 438 282 npartial 7;
-#X msg 438 170 vibrato 50 0.5;
-#X text 560 91 a low and high amplitude threshold: if signal amplitude
-is below the low threshold \, no pitches or peaks are output. The high
-threshold is a minimum at which "cooked" outputs may appear.;
-#X text 560 152 A period in milliseconds (50) over which the raw pitch
-may not deviate more than an interval in half-tones (0.5) from the
-average pitch to report it as a note to the "cooked" pitch outlet.
-;
-#X text 560 213 A period in milliseconds (100) over which a re-attack
-is reported if the amplitude rises more than (1) dB. The re-attack
-will result in a "bang" in the attack outlet and may give rise to repeated
-notes in the cooked pitch output.;
-#X text 142 432 test input pitch;
-#X text 330 444 test input;
-#X text 330 457 amplitude;
-#X obj 410 545 fiddle~ 1024 1 20 3;
-#X text 538 690 individual sinusoidal components;
-#X text 466 688 amplitude;
-#X text 476 703 (dB);
-#X text 389 688 raw pitch;
-#X text 376 712 and amplitude;
-#X text 364 729 (up to 3 outputs);
-#X text 287 686 bang on;
-#X text 287 708 attack;
-#X text 185 686 cooked pitch;
-#X text 202 703 output;
-#X text 545 545 ------ arguments:;
-#X msg 262 412 57;
-#X msg 440 331 auto 1;
-#X msg 440 353 auto 0;
-#X msg 439 418 bang;
-#X text 561 416 poll current values --- useful if not in auto mode
-\,;
-#X text 560 274 Higher partials are weighed less strongly than lower
-ones in determining the pitch. This specifies the number of the partial
-(7) which will be weighted half as strongly as the fundamental.;
-#X text 560 335 start and stop "auto" mode (on by default.) If off
-\, output only appears on "bang" (poll mode).;
-#X text 561 448 print out all settings;
-#X text 669 513 window size (128-2048 \, default 1024);
-#X msg 440 375 npoints 2048;
-#X text 562 384 number of points in analysis window (power of 2 \,
-128-2048);
-#X msg 439 396 npoints 1024;
-#X connect 0 0 19 0;
-#X connect 1 0 2 0;
-#X connect 1 1 8 0;
-#X connect 3 0 48 0;
-#X connect 4 0 0 0;
-#X connect 5 0 4 0;
-#X connect 6 0 5 0;
-#X connect 7 0 6 0;
-#X connect 9 0 1 0;
-#X connect 9 1 10 0;
-#X connect 9 2 13 0;
-#X connect 10 0 11 0;
-#X connect 10 1 12 0;
-#X connect 13 0 14 0;
-#X connect 13 1 15 0;
-#X connect 16 0 17 0;
-#X connect 16 1 18 0;
-#X connect 19 0 48 0;
-#X connect 20 0 60 0;
-#X connect 20 0 23 0;
-#X connect 21 0 19 1;
-#X connect 22 0 21 0;
-#X connect 23 0 22 0;
-#X connect 24 0 22 0;
-#X connect 38 0 48 0;
-#X connect 39 0 48 0;
-#X connect 40 0 48 0;
-#X connect 41 0 48 0;
-#X connect 48 0 27 0;
-#X connect 48 1 26 0;
-#X connect 48 2 16 0;
-#X connect 48 3 25 0;
-#X connect 48 4 9 0;
-#X connect 60 0 7 0;
-#X connect 61 0 48 0;
-#X connect 62 0 48 0;
-#X connect 63 0 48 0;
-#X connect 69 0 48 0;
-#X connect 71 0 48 0;
diff --git a/externals/extra/0.43.2/fiddle~/fiddle~.c b/externals/extra/0.43.2/fiddle~/fiddle~.c
deleted file mode 100644
index ea676784..00000000
--- a/externals/extra/0.43.2/fiddle~/fiddle~.c
+++ /dev/null
@@ -1,1851 +0,0 @@
-/* Copyright (c) 1997-1999 Miller Puckette and Ted Apel.
-* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-
-/*
- * Fiddle is a pitch tracker hardwired to have hop size ("H") equal to
- * half its window size ("N").
- *
- * This version should compile for Max "0.26," JMAX, Pd, or Max/MSP.
- *
- * The "lastanalysis" field holds the shifted FT of the previous H
- * samples. The buffer contains in effect points 1/2, 3/2, ..., (N-1)/2
- * of the DTFT of a real vector of length N, half of whose points are zero,
- * i.e., only the first H points are used. Put another way, we get the
- * the odd-numbered points of the FFT of the H points, zero padded to 4*H in
- * length. The integer points 0, 1, ..., H-1
- * are found by interpolating these others, using the fact that the
- * half-integer points are band-limited (they only have positive frequencies.)
- * To facilitate the interpolation the "lastanalysis" buffer contains
- * FILTSIZE extra points (1/2-FILTSIZE, ..., -1/2) at the beginning and
- * FILTSIZE again at the end ((N+1)/2, ..., FILTSIZE+(N-1)/2). The buffer
- * therefore has N+4*FILTSIZE floating-point numbers in it.
- *
- * after doing this I found out that you can just do a real FFT
- * of the H new points, zero-padded to contain N points, and using a similar
- * but simpler interpolation scheme you can still get 2N points of the DTFT
- * of the N points. Jean Laroche is a big fat hen.
- *
- */
-
-
-/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
-#ifdef _MSC_VER
-#pragma warning (disable: 4305 4244)
-#endif
-
-/* this #ifdef does nothing, but its there... */
-#ifdef _WIN32
-#define flog log
-#define fexp exp
-#define fsqrt sqrt
-#else
-#define flog log
-#define fexp exp
-#define fsqrt sqrt
-#endif
-
-char fiddle_version[] = "fiddle version 1.1 TEST4";
-
-#ifdef JMAX
-#include "fts.h"
-#include <stdio.h>
-#include <stdlib.h>
-typedef float t_float;
-typedef float t_floatarg;
-typedef fts_symbol_t t_symbol;
-
-static void *getbytes(size_t nbytes)
-{
- void *ret;
- if (nbytes < 1) nbytes = 1;
- ret = (void *)malloc(nbytes);
- return (ret);
-}
-
-static void *resizebytes(void *old, size_t oldsize, size_t newsize)
-{
- void *ret;
- if (newsize < 1) newsize = 1;
- ret = (void *)realloc((char *)old, newsize);
- return (ret);
-}
-
-static void freebytes(void *fatso, size_t nbytes)
-{
- free(fatso);
-}
-
-#define CLASSNAME "fiddle"
-
-#define OUTLETpower 5
-#define OUTLETmicropitch1 4
-#define OUTLETmicropitch2 3
-#define OUTLETmicropitch3 2
-#define OUTLETattack 1
-#define OUTLETpitch 0
-
-static fts_symbol_t *dsp_symbol = 0;
-#define error post
-
-#endif /* FTS */
-
-#ifdef MAX26
-#define t_floatarg double
-#include "m_extern.h"
-#include "d_graph.h"
-#include "d_ugen.h"
-#endif /* MAX26 */
-
-#ifdef PD
-#include "m_pd.h"
-#endif /* PD */
-
-#ifdef MSP
-#define flog log
-#define fexp exp
-#define fsqrt sqrt
-#endif /* MSP */
-
-#ifdef MSP
-#define t_floatarg double
-#include "ext.h"
-#include "z_dsp.h"
-#include "fft_mayer.proto.h"
-
-#endif /* MSP */
-
-#include <math.h>
-
-
-#define MINBIN 3
-#define DEFAMPLO 40
-#define DEFAMPHI 50
-#define DEFATTACKTIME 100
-#define DEFATTACKTHRESH 10
-#define DEFVIBTIME 50
-#define DEFVIBDEPTH 0.5
-#define GLISS 0.7f
-#define DBFUDGE 30.8f
-#define MINFREQINBINS 5 /* minimum frequency in bins for reliable output */
-
-#define MAXNPITCH 3
-#define MAXHIST 3 /* find N hottest peaks in histogram */
-
-#define MAXPOINTS 8192
-#define MINPOINTS 128
-#define DEFAULTPOINTS 1024
-
-#define HISTORY 20
-#define MAXPEAK 100 /* maximum number of peaks */
-#define DEFNPEAK 20 /* default number of peaks */
-
-#define MAXNPEAK (MAXLOWPEAK + MAXSTRONGPEAK)
-#define MINBW (0.03f) /* consider BW >= 0.03 FFT bins */
-
-#define BINPEROCT 48 /* bins per octave */
-#define BPERO_OVER_LOG2 69.24936196f /* BINSPEROCT/log(2) */
-#define FACTORTOBINS (t_float)(4/0.0145453) /* 4 / (pow(2.,1/48.) - 1) */
-#define BINGUARD 10 /* extra bins to throw in front */
-#define PARTIALDEVIANCE 0.023f /* acceptable partial detuning in % */
-#define LOGTODB 4.34294481903f /* 20/log(10) */
-
-#define KNOCKTHRESH 10.f /* don't know how to describe this */
-
-
-static t_float sigfiddle_partialonset[] =
-{
-0,
-48,
-76.0782000346154967102,
-96,
-111.45254855459339269887,
-124.07820003461549671089,
-134.75303625876499715823,
-144,
-152.15640006923099342109,
-159.45254855459339269887,
-166.05271769459026829915,
-172.07820003461549671088,
-177.62110647077242370064,
-182.75303625876499715892,
-187.53074858920888940907,
-192,
-};
-
-#define NPARTIALONSET ((int)(sizeof(sigfiddle_partialonset)/sizeof(t_float)))
-
-static int sigfiddle_intpartialonset[] =
-{
-0,
-48,
-76,
-96,
-111,
-124,
-135,
-144,
-152,
-159,
-166,
-172,
-178,
-183,
-188,
-192,
-};
-
-/* these coefficients, which come from the "upsamp" subdirectory,
-are a filter kernel for upsampling by a factor of two, assuming
-the sound to be upsampled has no energy above half the Nyquist, i.e.,
-that it's already 2x oversampled compared to the theoretically possible
-sample rate. I got these by trial and error. */
-
-#define FILT1 ((t_float)(.5 * 1.227054))
-#define FILT2 ((t_float)(.5 * -0.302385))
-#define FILT3 ((t_float)(.5 * 0.095326))
-#define FILT4 ((t_float)(.5 * -0.022748))
-#define FILT5 ((t_float)(.5 * 0.002533))
-#define FILTSIZE 5
-
-typedef struct peakout /* a peak for output */
-{
- t_float po_freq; /* frequency in hz */
- t_float po_amp; /* amplitude */
-} t_peakout;
-
-typedef struct peak /* a peak for analysis */
-{
- t_float p_freq; /* frequency in bins */
- t_float p_width; /* peak width in bins */
- t_float p_pow; /* peak power */
- t_float p_loudness; /* 4th root of power */
- t_float *p_fp; /* pointer back to spectrum */
-} t_peak;
-
-typedef struct histopeak
-{
- t_float h_pitch; /* estimated pitch */
- t_float h_value; /* value of peak */
- t_float h_loud; /* combined strength of found partials */
- int h_index; /* index of bin holding peak */
- int h_used; /* true if an x_hist entry points here */
-} t_histopeak;
-
-typedef struct pitchhist /* struct for keeping history by pitch */
-{
- t_float h_pitch; /* pitch to output */
- t_float h_amps[HISTORY]; /* past amplitudes */
- t_float h_pitches[HISTORY]; /* past pitches */
- t_float h_noted; /* last pitch output */
- int h_age; /* number of frames pitch has been there */
- t_histopeak *h_wherefrom; /* new histogram peak to incorporate */
- void *h_outlet;
-} t_pitchhist;
-
-typedef struct sigfiddle /* instance struct */
-{
-#ifdef JMAX
- fts_object_t x_h; /* object header */
- fts_alarm_t x_clock; /* callback for timeouts */
-#endif
-#ifdef MAX26
- t_head x_h; /* header for tilde objects */
- t_sig *x_io[IN1+OUT0]; /* number of signal inputs and outputs */
- void *x_clock; /* a "clock" object */
-#endif
-#ifdef PD
- t_object x_ob; /* object header */
- t_clock *x_clock; /* callback for timeouts */
-#endif
-#ifdef MSP
- t_pxobject x_obj;
- void *x_clock;
- long x_downsample; /* downsample feature because of
- MSP's large sig vector sizes */
-#endif
- t_float *x_inbuf; /* buffer to analyze, npoints/2 elems */
- t_float *x_lastanalysis; /* FT of last buffer (see main comment) */
- t_float *x_spiral; /* 1/4-wave complex exponential */
- t_peakout *x_peakbuf; /* spectral peaks for output */
- int x_npeakout; /* number of spectral peaks to output */
- int x_npeakanal; /* number of spectral peaks to analyze */
- int x_phase; /* number of points since last output */
- int x_histphase; /* phase into amplitude history vector */
- int x_hop; /* period of output, npoints/2 */
- t_float x_sr; /* sample rate */
- t_pitchhist x_hist[MAXNPITCH]; /* history of current pitches */
- int x_nprint; /* how many periods to print */
- int x_npitch; /* number of simultaneous pitches */
- t_float x_dbs[HISTORY]; /* DB history, indexed by "histphase" */
- t_float x_peaked; /* peak since last attack */
- int x_dbage; /* number of bins DB has met threshold */
- int x_auto; /* true if generating continuous output */
-/* parameters */
- t_float x_amplo;
- t_float x_amphi;
- int x_attacktime;
- int x_attackbins;
- t_float x_attackthresh;
- int x_vibtime;
- int x_vibbins;
- t_float x_vibdepth;
- t_float x_npartial;
-/* outlets & clock */
- void *x_envout;
- int x_attackvalue;
- void *x_attackout;
- void *x_noteout;
- void *x_peakout;
-} t_sigfiddle;
-
-#if CHECKER
-t_float fiddle_checker[1024];
-#endif
-
-#ifdef MSP
-/* Mac compiler requires prototypes for everything */
-
-int sigfiddle_ilog2(int n);
-t_float fiddle_mtof(t_float f);
-t_float fiddle_ftom(t_float f);
-void sigfiddle_doit(t_sigfiddle *x);
-void sigfiddle_debug(t_sigfiddle *x);
-void sigfiddle_print(t_sigfiddle *x);
-void sigfiddle_assist(t_sigfiddle *x, void *b, long m, long a, char *s);
-void sigfiddle_amprange(t_sigfiddle *x, double amplo, double amphi);
-void sigfiddle_reattack(t_sigfiddle *x, t_floatarg attacktime, t_floatarg
-attackthresh);
-void sigfiddle_vibrato(t_sigfiddle *x, t_floatarg vibtime, t_floatarg
-vibdepth);
-void sigfiddle_npartial(t_sigfiddle *x, double npartial);
-void sigfiddle_auto(t_sigfiddle *x, t_floatarg f);
-void sigfiddle_setnpoints(t_sigfiddle *x, t_floatarg f);
-int sigfiddle_doinit(t_sigfiddle *x, long npoints, long npitch, long
-npeakanal, long npeakout);
-static t_int *fiddle_perform(t_int *w);
-void sigfiddle_dsp(t_sigfiddle *x, t_signal **sp);
-void sigfiddle_tick(t_sigfiddle *x);
-void sigfiddle_bang(t_sigfiddle *x);
-void sigfiddle_ff(t_sigfiddle *x);
-void *sigfiddle_new(long npoints, long npitch,
- long npeakanal, long npeakout);
-void msp_fft(t_float *buf, long np, long inv);
-t_float msp_ffttemp[MAXPOINTS*2];
-int errno;
-#endif
-
-int sigfiddle_ilog2(int n)
-{
- int ret = -1;
- while (n)
- {
- n >>= 1;
- ret++;
- }
- return (ret);
-}
-
-t_float fiddle_mtof(t_float f)
-{
- return (8.17579891564 * exp(.0577622650 * f));
-}
-
-t_float fiddle_ftom(t_float f)
-{
- return (17.3123405046 * log(.12231220585 * f));
-}
-#define ftom fiddle_ftom
-#define mtof fiddle_mtof
-
-void sigfiddle_doit(t_sigfiddle *x)
-{
-#ifdef MSP
- /* prevents interrupt-level stack overflow crash with Netscape. */
- static t_float spect1[4*MAXPOINTS];
- static t_float spect2[MAXPOINTS + 4*FILTSIZE];
-#else
- t_float spect1[4*MAXPOINTS];
- t_float spect2[MAXPOINTS + 4*FILTSIZE];
-#endif
-#if CHECKER
- t_float checker3[4*MAXPOINTS];
-#endif
-
- t_peak peaklist[MAXPEAK + 1], *pk1;
- t_peakout *pk2;
- t_histopeak histvec[MAXHIST], *hp1;
- int i, j, k, hop = x->x_hop, n = 2*hop, npeak, npitch,
- logn = sigfiddle_ilog2(n), newphase, oldphase;
- t_float *fp, *fp1, *fp2, *fp3, total_power, total_loudness, total_db;
- t_float maxbin = BINPEROCT * (logn-2), *histogram = spect2 + BINGUARD;
- t_pitchhist *phist;
- t_float hzperbin = x->x_sr / (2.0f * n);
- int npeakout = x->x_npeakout, npeakanal = x->x_npeakanal;
- int npeaktot = (npeakout > npeakanal ? npeakout : npeakanal);
-
- oldphase = x->x_histphase;
- newphase = x->x_histphase + 1;
- if (newphase == HISTORY) newphase = 0;
- x->x_histphase = newphase;
-
- /*
- * multiply the H points by a 1/4-wave complex exponential,
- * and take FFT of the result.
- */
- for (i = 0, fp1 = x->x_inbuf, fp2 = x->x_spiral, fp3 = spect1;
- i < hop; i++, fp1++, fp2 += 2, fp3 += 2)
- fp3[0] = fp1[0] * fp2[0], fp3[1] = fp1[0] * fp2[1];
-
-#ifdef MAX26
- fft(spect1, hop, 0);
-#endif
-#ifdef PD
- pd_fft(spect1, hop, 0);
-#endif
-#ifdef JMAX
- fts_cfft_inplc((complex *)spect1, hop);
-#endif
-#ifdef MSP
- msp_fft(spect1,hop,0);
-#endif
- /*
- * now redistribute the points to get in effect the odd-numbered
- * points of the FFT of the H points, zero padded to 4*H in length.
- */
- for (i = 0, fp1 = spect1, fp2 = spect2 + (2*FILTSIZE);
- i < (hop>>1); i++, fp1 += 2, fp2 += 4)
- fp2[0] = fp1[0], fp2[1] = fp1[1];
- for (i = 0, fp1 = spect1 + n - 2, fp2 = spect2 + (2*FILTSIZE+2);
- i < (hop>>1); i++, fp1 -= 2, fp2 += 4)
- fp2[0] = fp1[0], fp2[1] = -fp1[1];
- for (i = 0, fp1 = spect2 + (2*FILTSIZE), fp2 = spect2 + (2*FILTSIZE-2);
- i<FILTSIZE; i++, fp1+=2, fp2-=2)
- fp2[0] = fp1[0], fp2[1] = -fp1[1];
- for (i = 0, fp1 = spect2 + (2*FILTSIZE+n-2), fp2 = spect2 + (2*FILTSIZE+n);
- i<FILTSIZE; i++, fp1-=2, fp2+=2)
- fp2[0] = fp1[0], fp2[1] = -fp1[1];
-#if 0
- {
- fp = spect2 + 2*FILTSIZE;
- post("x1 re %12.4f %12.4f %12.4f %12.4f %12.4f",
- fp[0], fp[2], fp[4], fp[6], fp[8]);
- post("x1 im %12.4f %12.4f %12.4f %12.4f %12.4f",
- fp[1], fp[3], fp[5], fp[7], fp[9]);
- }
-#endif
- /* spect2 is now prepared; now combine spect2 and lastanalysis into
- * spect1. Odd-numbered points of spect1 are the points of "last"
- * plus (-i, i, -i, ...) times spect1. Even-numbered points are
- * the interpolated points of "last" plus (1, -1, 1, ...) times the
- * interpolated points of spect1.
- *
- * To interpolate, take FILT1 exp(-pi/4) times
- * the previous point, FILT2*exp(-3*pi/4) times 3 bins before,
- * etc, and FILT1 exp(pi/4), FILT2 exp(3pi/4), etc., to weight
- * the +1, +3, etc., points.
- *
- * In this calculation, we take (1, i, -1, -i, 1) times the
- * -9, -7, ..., -1 points, and (i, -1, -i, 1, i) times the 1, 3,..., 9
- * points of the OLD spectrum, alternately adding and subtracting
- * the new spectrum to the old; then we multiply the whole thing
- * by exp(-i pi/4).
- */
- for (i = 0, fp1 = spect1, fp2 = x->x_lastanalysis + 2*FILTSIZE,
- fp3 = spect2 + 2*FILTSIZE;
- i < (hop>>1); i++)
- {
- t_float re, im;
-
- re= FILT1 * ( fp2[ -2] -fp2[ 1] +fp3[ -2] -fp3[ 1]) +
- FILT2 * ( fp2[ -3] -fp2[ 2] +fp3[ -3] -fp3[ 2]) +
- FILT3 * (-fp2[ -6] +fp2[ 5] -fp3[ -6] +fp3[ 5]) +
- FILT4 * (-fp2[ -7] +fp2[ 6] -fp3[ -7] +fp3[ 6]) +
- FILT5 * ( fp2[-10] -fp2[ 9] +fp3[-10] -fp3[ 9]);
-
- im= FILT1 * ( fp2[ -1] +fp2[ 0] +fp3[ -1] +fp3[ 0]) +
- FILT2 * (-fp2[ -4] -fp2[ 3] -fp3[ -4] -fp3[ 3]) +
- FILT3 * (-fp2[ -5] -fp2[ 4] -fp3[ -5] -fp3[ 4]) +
- FILT4 * ( fp2[ -8] +fp2[ 7] +fp3[ -8] +fp3[ 7]) +
- FILT5 * ( fp2[ -9] +fp2[ 8] +fp3[ -9] +fp3[ 8]);
-
- fp1[0] = 0.7071f * (re + im);
- fp1[1] = 0.7071f * (im - re);
- fp1[4] = fp2[0] + fp3[1];
- fp1[5] = fp2[1] - fp3[0];
-
- fp1 += 8, fp2 += 2, fp3 += 2;
- re= FILT1 * ( fp2[ -2] -fp2[ 1] -fp3[ -2] +fp3[ 1]) +
- FILT2 * ( fp2[ -3] -fp2[ 2] -fp3[ -3] +fp3[ 2]) +
- FILT3 * (-fp2[ -6] +fp2[ 5] +fp3[ -6] -fp3[ 5]) +
- FILT4 * (-fp2[ -7] +fp2[ 6] +fp3[ -7] -fp3[ 6]) +
- FILT5 * ( fp2[-10] -fp2[ 9] -fp3[-10] +fp3[ 9]);
-
- im= FILT1 * ( fp2[ -1] +fp2[ 0] -fp3[ -1] -fp3[ 0]) +
- FILT2 * (-fp2[ -4] -fp2[ 3] +fp3[ -4] +fp3[ 3]) +
- FILT3 * (-fp2[ -5] -fp2[ 4] +fp3[ -5] +fp3[ 4]) +
- FILT4 * ( fp2[ -8] +fp2[ 7] -fp3[ -8] -fp3[ 7]) +
- FILT5 * ( fp2[ -9] +fp2[ 8] -fp3[ -9] -fp3[ 8]);
-
- fp1[0] = 0.7071f * (re + im);
- fp1[1] = 0.7071f * (im - re);
- fp1[4] = fp2[0] - fp3[1];
- fp1[5] = fp2[1] + fp3[0];
-
- fp1 += 8, fp2 += 2, fp3 += 2;
- }
-#if 0
- if (x->x_nprint)
- {
- for (i = 0, fp = spect1; i < 16; i++, fp+= 4)
- post("spect %d %f %f --> %f", i, fp[0], fp[1],
- sqrt(fp[0] * fp[0] + fp[1] * fp[1]));
- }
-#endif
- /* copy new spectrum out */
- for (i = 0, fp1 = spect2, fp2 = x->x_lastanalysis;
- i < n + 4*FILTSIZE; i++) *fp2++ = *fp1++;
-
- for (i = 0; i < MINBIN; i++) spect1[4*i + 2] = spect1[4*i + 3] = 0;
- /* starting at bin MINBIN, compute hanning windowed power spectrum */
- for (i = MINBIN, fp1 = spect1+4*MINBIN, total_power = 0;
- i < n-2; i++, fp1 += 4)
- {
- t_float re = fp1[0] - 0.5 * (fp1[-8] + fp1[8]);
- t_float im = fp1[1] - 0.5 * (fp1[-7] + fp1[9]);
- fp1[3] = (total_power += (fp1[2] = re * re + im * im));
- }
-
- if (total_power > 1e-9f)
- {
- total_db = (100.f - DBFUDGE) + LOGTODB * log(total_power/n);
- total_loudness = fsqrt(fsqrt(total_power));
- if (total_db < 0) total_db = 0;
- }
- else total_db = total_loudness = 0;
- /* store new db in history vector */
- x->x_dbs[newphase] = total_db;
- if (total_db < x->x_amplo) goto nopow;
-#if 1
- if (x->x_nprint) post("power %f", total_power);
-#endif
-
-#if CHECKER
- /* verify that our FFT resampling thing is putting out good results */
- for (i = 0; i < hop; i++)
- {
- checker3[2*i] = fiddle_checker[i];
- checker3[2*i + 1] = 0;
- checker3[n + 2*i] = fiddle_checker[i] = x->x_inbuf[i];
- checker3[n + 2*i + 1] = 0;
- }
- for (i = 2*n; i < 4*n; i++) checker3[i] = 0;
- fft(checker3, 2*n, 0);
- if (x->x_nprint)
- {
- for (i = 0, fp = checker3; i < 16; i++, fp += 2)
- post("spect %d %f %f --> %f", i, fp[0], fp[1],
- sqrt(fp[0] * fp[0] + fp[1] * fp[1]));
- }
-
-#endif
- npeak = 0;
-
- /* search for peaks */
- for (i = MINBIN, fp = spect1+4*MINBIN, pk1 = peaklist;
- i < n-2 && npeak < npeaktot; i++, fp += 4)
- {
- t_float height = fp[2], h1 = fp[-2], h2 = fp[6];
- t_float totalfreq, pfreq, f1, f2, m, var, stdev;
-
- if (height < h1 || height < h2 ||
- h1 < 0.00001f*total_power || h2 < 0.00001f*total_power)
- continue;
-
- /* use an informal phase vocoder to estimate the frequency.
- Do this for the two adjacent bins too. */
- pfreq= ((fp[-8] - fp[8]) * (2.0f * fp[0] - fp[8] - fp[-8]) +
- (fp[-7] - fp[9]) * (2.0f * fp[1] - fp[9] - fp[-7])) /
- (2.0f * height);
- f1= ((fp[-12] - fp[4]) * (2.0f * fp[-4] - fp[4] - fp[-12]) +
- (fp[-11] - fp[5]) * (2.0f * fp[-3] - fp[5] - fp[-11])) /
- (2.0f * h1) - 1;
- f2= ((fp[-4] - fp[12]) * (2.0f * fp[4] - fp[12] - fp[-4]) +
- (fp[-3] - fp[13]) * (2.0f * fp[5] - fp[13] - fp[-3])) /
- (2.0f * h2) + 1;
-
- /* get sample mean and variance of the three */
- m = 0.333333f * (pfreq + f1 + f2);
- var = 0.5f * ((pfreq-m)*(pfreq-m) + (f1-m)*(f1-m) + (f2-m)*(f2-m));
-
- totalfreq = i + m;
- if (var * total_power > KNOCKTHRESH * height || var < 1e-30)
- {
-#if 0
- if (x->x_nprint)
- post("cancel: %.2f hz, index %.1f, power %.5f, stdev=%.2f",
- totalfreq * hzperbin, BPERO_OVER_LOG2 * log(totalfreq) - 96,
- height, sqrt(var));
-#endif
- continue;
- }
- stdev = fsqrt(var);
- if (totalfreq < 4)
- {
- if (x->x_nprint) post("oops: was %d, freq %f, m %f, stdev %f h %f",
- i, totalfreq, m, stdev, height);
- totalfreq = 4;
- }
- pk1->p_width = stdev;
-
- pk1->p_pow = height;
- pk1->p_loudness = fsqrt(fsqrt(height));
- pk1->p_fp = fp;
- pk1->p_freq = totalfreq;
- npeak++;
-#if 1
- if (x->x_nprint)
- {
- post("peak: %.2f hz. index %.1f, power %.5f, stdev=%.2f",
- pk1->p_freq * hzperbin,
- BPERO_OVER_LOG2 * log(pk1->p_freq) - 96,
- height, stdev);
- }
-#endif
- pk1++;
- }
-
- /* prepare the raw peaks for output */
- for (i = 0, pk1 = peaklist, pk2 = x->x_peakbuf; i < npeak;
- i++, pk1++, pk2++)
- {
- t_float loudness = pk1->p_loudness;
- if (i >= npeakout) break;
- pk2->po_freq = hzperbin * pk1->p_freq;
- pk2->po_amp = (2. / (t_float)n) * (loudness * loudness);
- }
- for (; i < npeakout; i++, pk2++) pk2->po_amp = pk2->po_freq = 0;
-
- /* now, working back into spect2, make a sort of "liklihood"
- * spectrum. Proceeding in 48ths of an octave, from 2 to
- * n/2 (in bins), the likelihood of each pitch range is contributed
- * to by every peak in peaklist that's an integer multiple of it
- * in frequency.
- */
-
- if (npeak > npeakanal) npeak = npeakanal; /* max # peaks to analyze */
- for (i = 0, fp1 = histogram; i < maxbin; i++) *fp1++ = 0;
- for (i = 0, pk1 = peaklist; i < npeak; i++, pk1++)
- {
- t_float pit = BPERO_OVER_LOG2 * flog(pk1->p_freq) - 96.0;
- t_float binbandwidth = FACTORTOBINS * pk1->p_width/pk1->p_freq;
- t_float putbandwidth = (binbandwidth < 2 ? 2 : binbandwidth);
- t_float weightbandwidth = (binbandwidth < 1.0 ? 1.0 : binbandwidth);
- /* t_float weightamp = 1.0f + 3.0f * pk1->p_pow / pow; */
- t_float weightamp = 4. * pk1->p_loudness / total_loudness;
- for (j = 0, fp2 = sigfiddle_partialonset; j < NPARTIALONSET; j++, fp2++)
- {
- t_float bin = pit - *fp2;
- if (bin < maxbin)
- {
- t_float para, pphase, score = 30.0 * weightamp /
- ((j+x->x_npartial) * weightbandwidth);
- int firstbin = bin + 0.5f - 0.5f * putbandwidth;
- int lastbin = bin + 0.5f + 0.5f * putbandwidth;
- int ibw = lastbin - firstbin;
- if (firstbin < -BINGUARD) break;
- para = 1.0f / (putbandwidth * putbandwidth);
- for (k = 0, fp3 = histogram + firstbin,
- pphase = firstbin-bin; k <= ibw;
- k++, fp3++, pphase += 1.0f)
- {
- *fp3 += score * (1.0f - para * pphase * pphase);
- }
- }
- }
- }
-#if 1
- if (x->x_nprint)
- {
- for (i = 0; i < 6*5; i++)
- {
- t_float fhz = hzperbin * exp ((8*i + 96) * (1./BPERO_OVER_LOG2));
- if (!(i % 6)) post("-- bin %d pitch %f freq %f----", 8*i,
- ftom(fhz), fhz);;
- post("%3d %3d %3d %3d %3d %3d %3d %3d",
- (int)(histogram[8*i]),
- (int)(histogram[8*i+1]),
- (int)(histogram[8*i+2]),
- (int)(histogram[8*i+3]),
- (int)(histogram[8*i+4]),
- (int)(histogram[8*i+5]),
- (int)(histogram[8*i+6]),
- (int)(histogram[8*i+7]));
- }
- }
-
-#endif
-
- /*
- * Next we find up to NPITCH strongest peaks in the histogram.
- * if a peak is related to a stronger one via an interval in
- * the sigfiddle_partialonset array, we suppress it.
- */
-
- for (npitch = 0; npitch < x->x_npitch; npitch++)
- {
- int indx;
- t_float best;
- if (npitch)
- {
- for (best = 0, indx = -1, j=1; j < maxbin-1; j++)
- {
- if (histogram[j] > best && histogram[j] > histogram[j-1] &&
- histogram[j] > histogram[j+1])
- {
- for (k = 0; k < npitch; k++)
- if (histvec[k].h_index == j)
- goto peaknogood;
- for (k = 0; k < NPARTIALONSET; k++)
- {
- if (j - sigfiddle_intpartialonset[k] < 0) break;
- if (histogram[j - sigfiddle_intpartialonset[k]]
- > histogram[j]) goto peaknogood;
- }
- for (k = 0; k < NPARTIALONSET; k++)
- {
- if (j + sigfiddle_intpartialonset[k] >= maxbin) break;
- if (histogram[j + sigfiddle_intpartialonset[k]]
- > histogram[j]) goto peaknogood;
- }
- indx = j;
- best = histogram[j];
- }
- peaknogood: ;
- }
- }
- else
- {
- for (best = 0, indx = -1, j=0; j < maxbin; j++)
- if (histogram[j] > best)
- indx = j, best = histogram[j];
- }
- if (indx < 0) break;
- histvec[npitch].h_value = best;
- histvec[npitch].h_index = indx;
- }
-#if 1
- if (x->x_nprint)
- {
- for (i = 0; i < npitch; i++)
- {
- post("index %d freq %f --> value %f", histvec[i].h_index,
- exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 96)),
- histvec[i].h_value);
- post("next %f , prev %f",
- exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 97)),
- exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 95)) );
- }
- }
-#endif
-
- /* for each histogram peak, we now search back through the
- * FFT peaks. A peak is a pitch if either there are several
- * harmonics that match it, or else if (a) the fundamental is
- * present, and (b) the sum of the powers of the contributing peaks
- * is at least 1/100 of the total power.
- *
- * A peak is a contributor if its frequency is within 25 cents of
- * a partial from 1 to 16.
- *
- * Finally, we have to be at least 5 bins in frequency, which
- * corresponds to 2-1/5 periods fitting in the analysis window.
- */
-
- for (i = 0; i < npitch; i++)
- {
- t_float cumpow = 0, cumstrength = 0, freqnum = 0, freqden = 0;
- int npartials = 0, nbelow8 = 0;
- /* guessed-at frequency in bins */
- t_float putfreq = fexp((1.0 / BPERO_OVER_LOG2) *
- (histvec[i].h_index + 96.0f));
- for (j = 0; j < npeak; j++)
- {
- t_float fpnum = peaklist[j].p_freq/putfreq;
- int pnum = fpnum + 0.5f;
- t_float fipnum = pnum;
- t_float deviation;
- if (pnum > 16 || pnum < 1) continue;
- deviation = 1.0f - fpnum/fipnum;
- if (deviation > -PARTIALDEVIANCE && deviation < PARTIALDEVIANCE)
- {
- /*
- * we figure this is a partial since it's within 1/4 of
- * a halftone of a multiple of the putative frequency.
- */
-
- t_float stdev, weight;
- npartials++;
- if (pnum < 8) nbelow8++;
- cumpow += peaklist[j].p_pow;
- cumstrength += fsqrt(fsqrt(peaklist[j].p_pow));
- stdev = (peaklist[j].p_width > MINBW ?
- peaklist[j].p_width : MINBW);
- weight = 1.0f / ((stdev*fipnum) * (stdev*fipnum));
- freqden += weight;
- freqnum += weight * peaklist[j].p_freq/fipnum;
-#if 1
- if (x->x_nprint)
- {
- post("peak %d partial %d f=%f w=%f",
- j, pnum, peaklist[j].p_freq/fipnum, weight);
- }
-#endif
- }
-#if 1
- else if (x->x_nprint) post("peak %d partial %d dev %f",
- j, pnum, deviation);
-#endif
- }
- if ((nbelow8 < 4 || npartials < 7) && cumpow < 0.01f * total_power)
- histvec[i].h_value = 0;
- else
- {
- t_float pitchpow = (cumstrength * cumstrength) *
- (cumstrength * cumstrength);
- t_float freqinbins = freqnum/freqden;
- /* check for minimum output frequency */
-
- if (freqinbins < MINFREQINBINS)
- histvec[i].h_value = 0;
- else
- {
- /* we passed all tests... save the values we got */
- histvec[i].h_pitch = ftom(hzperbin * freqnum/freqden);
- histvec[i].h_loud = (100.0f -DBFUDGE) +
- (LOGTODB) * log(pitchpow/n);
- }
- }
- }
-#if 1
- if (x->x_nprint)
- {
- for (i = 0; i < npitch; i++)
- {
- if (histvec[i].h_value > 0)
- post("index %d pit %f loud %f", histvec[i].h_index,
- histvec[i].h_pitch, histvec[i].h_loud);
- else post("-- cancelled --");
- }
- }
-#endif
-
- /* now try to find continuous pitch tracks that match the new
- * pitches. First mark each peak unmatched.
- */
- for (i = 0, hp1 = histvec; i < npitch; i++, hp1++)
- hp1->h_used = 0;
-
- /* for each old pitch, try to match a new one to it. */
- for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
- {
- t_float thispitch = phist->h_pitches[oldphase];
- phist->h_pitch = 0; /* no output, thanks */
- phist->h_wherefrom = 0;
- if (thispitch == 0.0f) continue;
- for (j = 0, hp1 = histvec; j < npitch; j++, hp1++)
- if ((hp1->h_value > 0) && hp1->h_pitch > thispitch - GLISS
- && hp1->h_pitch < thispitch + GLISS)
- {
- phist->h_wherefrom = hp1;
- hp1->h_used = 1;
- }
- }
- for (i = 0, hp1 = histvec; i < npitch; i++, hp1++)
- if ((hp1->h_value > 0) && !hp1->h_used)
- {
- for (j = 0, phist = x->x_hist; j < x->x_npitch; j++, phist++)
- if (!phist->h_wherefrom)
- {
- phist->h_wherefrom = hp1;
- phist->h_age = 0;
- phist->h_noted = 0;
- hp1->h_used = 1;
- goto happy;
- }
- break;
- happy: ;
- }
- /* copy the pitch info into the history vector */
- for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
- {
- if (phist->h_wherefrom)
- {
- phist->h_amps[newphase] = phist->h_wherefrom->h_loud;
- phist->h_pitches[newphase] =
- phist->h_wherefrom->h_pitch;
- (phist->h_age)++;
- }
- else
- {
- phist->h_age = 0;
- phist->h_amps[newphase] = phist->h_pitches[newphase] = 0;
- }
- }
-#if 1
- if (x->x_nprint)
- {
- post("vibrato %d %f", x->x_vibbins, x->x_vibdepth);
- for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
- {
- post("noted %f, age %d", phist->h_noted, phist->h_age);
-#ifndef I860
- post("values %f %f %f %f %f",
- phist->h_pitches[newphase],
- phist->h_pitches[(newphase + HISTORY-1)%HISTORY],
- phist->h_pitches[(newphase + HISTORY-2)%HISTORY],
- phist->h_pitches[(newphase + HISTORY-3)%HISTORY],
- phist->h_pitches[(newphase + HISTORY-4)%HISTORY]);
-#endif
- }
- }
-#endif
- /* look for envelope attacks */
-
- x->x_attackvalue = 0;
-
- if (x->x_peaked)
- {
- if (total_db > x->x_amphi)
- {
- int binlook = newphase - x->x_attackbins;
- if (binlook < 0) binlook += HISTORY;
- if (total_db > x->x_dbs[binlook] + x->x_attackthresh)
- {
- x->x_attackvalue = 1;
- x->x_peaked = 0;
- }
- }
- }
- else
- {
- int binlook = newphase - x->x_attackbins;
- if (binlook < 0) binlook += HISTORY;
- if (x->x_dbs[binlook] > x->x_amphi && x->x_dbs[binlook] > total_db)
- x->x_peaked = 1;
- }
-
- /* for each current frequency track, test for a new note using a
- * stability criterion. Later perhaps we should also do as in
- * pitch~ and check for unstable notes a posteriori when
- * there's a new attack with no note found since the last onset;
- * but what's an attack &/or onset when we're polyphonic?
- */
-
- for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
- {
- /*
- * if we've found a pitch but we've now strayed from it turn
- * it off.
- */
- if (phist->h_noted)
- {
- if (phist->h_pitches[newphase] > phist->h_noted + x->x_vibdepth
- || phist->h_pitches[newphase] < phist->h_noted - x->x_vibdepth)
- phist->h_noted = 0;
- }
- else
- {
- if (phist->h_wherefrom && phist->h_age >= x->x_vibbins)
- {
- t_float centroid = 0;
- int not = 0;
- for (j = 0, k = newphase; j < x->x_vibbins; j++)
- {
- centroid += phist->h_pitches[k];
- k--;
- if (k < 0) k = HISTORY-1;
- }
- centroid /= x->x_vibbins;
- for (j = 0, k = newphase; j < x->x_vibbins; j++)
- {
- /* calculate deviation from norm */
- t_float dev = centroid - phist->h_pitches[k];
- k--;
- if (k < 0) k = HISTORY-1;
- if (dev > x->x_vibdepth ||
- -dev > x->x_vibdepth) not = 1;
- }
- if (!not)
- {
- phist->h_pitch = phist->h_noted = centroid;
- }
- }
- }
- }
- return;
-
-nopow:
- for (i = 0; i < x->x_npitch; i++)
- {
- x->x_hist[i].h_pitch = x->x_hist[i].h_noted =
- x->x_hist[i].h_pitches[newphase] =
- x->x_hist[i].h_amps[newphase] = 0;
- x->x_hist[i].h_age = 0;
- }
- x->x_peaked = 1;
- x->x_dbage = 0;
-}
-
-void sigfiddle_debug(t_sigfiddle *x)
-{
- x->x_nprint = 1;
-}
-
-void sigfiddle_print(t_sigfiddle *x)
-{
- post("npoints %d,", 2 * x->x_hop);
- post("amp-range %f %f,", x->x_amplo, x->x_amphi);
- post("reattack %d %f,", x->x_attacktime, x->x_attackthresh);
- post("vibrato %d %f", x->x_vibtime, x->x_vibdepth);
- post("npartial %f", x->x_npartial);
- post("auto %d", x->x_auto);
-}
-
-void sigfiddle_amprange(t_sigfiddle *x, t_floatarg amplo, t_floatarg amphi)
-{
- if (amplo < 0) amplo = 0;
- if (amphi < amplo) amphi = amplo + 1;
- x->x_amplo = amplo;
- x->x_amphi = amphi;
-}
-
-void sigfiddle_reattack(t_sigfiddle *x,
- t_floatarg attacktime, t_floatarg attackthresh)
-{
- if (attacktime < 0) attacktime = 0;
- if (attackthresh <= 0) attackthresh = 1000;
- x->x_attacktime = attacktime;
- x->x_attackthresh = attackthresh;
- x->x_attackbins = (x->x_sr * 0.001 * attacktime) / x->x_hop;
- if (x->x_attackbins >= HISTORY) x->x_attackbins = HISTORY - 1;
-}
-
-void sigfiddle_vibrato(t_sigfiddle *x, t_floatarg vibtime, t_floatarg vibdepth)
-{
- if (vibtime < 0) vibtime = 0;
- if (vibdepth <= 0) vibdepth = 1000;
- x->x_vibtime = vibtime;
- x->x_vibdepth = vibdepth;
- x->x_vibbins = (x->x_sr * 0.001 * vibtime) / x->x_hop;
- if (x->x_vibbins >= HISTORY) x->x_vibbins = HISTORY - 1;
- if (x->x_vibbins < 1) x->x_vibbins = 1;
-}
-
-void sigfiddle_npartial(t_sigfiddle *x, t_floatarg npartial)
-{
- if (npartial < 0.1) npartial = 0.1;
- x->x_npartial = npartial;
-}
-
-void sigfiddle_auto(t_sigfiddle *x, t_floatarg f)
-{
- x->x_auto = (f != 0);
-}
-
-static void sigfiddle_freebird(t_sigfiddle *x)
-{
- if (x->x_inbuf)
- {
- freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
- x->x_inbuf = 0;
- }
- if (x->x_lastanalysis)
- {
- freebytes(x->x_lastanalysis,
- sizeof(t_float) * (2 * x->x_hop + 4 * FILTSIZE));
- x->x_lastanalysis = 0;
- }
- if (x->x_spiral)
- {
- freebytes(x->x_spiral, sizeof(t_float) * 2 * x->x_hop);
- x->x_spiral = 0;
- }
- x->x_hop = 0;
-}
-
-int sigfiddle_setnpoints(t_sigfiddle *x, t_floatarg fnpoints)
-{
- int i, npoints = fnpoints;
- sigfiddle_freebird(x);
- if (npoints < MINPOINTS || npoints > MAXPOINTS)
- {
- error("fiddle~: npoints out of range; using %d",
- npoints = DEFAULTPOINTS);
- }
- if (npoints != (1 << sigfiddle_ilog2(npoints)))
- {
- error("fiddle~: npoints not a power of 2; using %d",
- npoints = (1 << sigfiddle_ilog2(npoints)));
- }
- x->x_hop = npoints >> 1;
- if (!(x->x_inbuf = (t_float *)getbytes(sizeof(t_float) * x->x_hop)))
- goto fail;
- if (!(x->x_lastanalysis = (t_float *)getbytes(
- sizeof(t_float) * (2 * x->x_hop + 4 * FILTSIZE))))
- goto fail;
- if (!(x->x_spiral = (t_float *)getbytes(sizeof(t_float) * 2 * x->x_hop)))
- goto fail;
- for (i = 0; i < x->x_hop; i++)
- x->x_inbuf[i] = 0;
- for (i = 0; i < npoints + 4 * FILTSIZE; i++)
- x->x_lastanalysis[i] = 0;
- for (i = 0; i < x->x_hop; i++)
- x->x_spiral[2*i] = cos((3.14159*i)/(npoints)),
- x->x_spiral[2*i+1] = -sin((3.14159*i)/(npoints));
- x->x_phase = 0;
- return (1);
-fail:
- sigfiddle_freebird(x);
- return (0);
-}
-
-int sigfiddle_doinit(t_sigfiddle *x, long npoints, long npitch,
- long npeakanal, long npeakout)
-{
- t_float *buf1, *buf2, *buf3;
- t_peakout *buf4;
- int i;
-
- if (!npeakanal && !npeakout) npeakanal = DEFNPEAK, npeakout = 0;
- if (!npeakanal < 0) npeakanal = 0;
- else if (npeakanal > MAXPEAK) npeakanal = MAXPEAK;
- if (!npeakout < 0) npeakout = 0;
- else if (npeakout > MAXPEAK) npeakout = MAXPEAK;
- if (npitch <= 0) npitch = 0;
- else if (npitch > MAXNPITCH) npitch = MAXNPITCH;
- if (npeakanal && !npitch) npitch = 1;
- if (!npoints)
- npoints = DEFAULTPOINTS;
- if (!sigfiddle_setnpoints(x, npoints))
- {
- error("fiddle~: out of memory");
- return (0);
- }
- if (!(buf4 = (t_peakout *)getbytes(sizeof(*buf4) * npeakout)))
- {
- sigfiddle_freebird(x);
- error("fiddle~: out of memory");
- return (0);
- }
- for (i = 0; i < npeakout; i++)
- buf4[i].po_freq = buf4[i].po_amp = 0;
- x->x_peakbuf = buf4;
-
- x->x_npeakout = npeakout;
- x->x_npeakanal = npeakanal;
- x->x_phase = 0;
- x->x_histphase = 0;
- x->x_sr = 44100; /* this and the next are filled in later */
- for (i = 0; i < MAXNPITCH; i++)
- {
- int j;
- x->x_hist[i].h_pitch = x->x_hist[i].h_noted = 0;
- x->x_hist[i].h_age = 0;
- x->x_hist[i].h_wherefrom = 0;
- x->x_hist[i].h_outlet = 0;
- for (j = 0; j < HISTORY; j++)
- x->x_hist[i].h_amps[j] = x->x_hist[i].h_pitches[j] = 0;
- }
- x->x_nprint = 0;
- x->x_npitch = npitch;
- for (i = 0; i < HISTORY; i++) x->x_dbs[i] = 0;
- x->x_dbage = 0;
- x->x_peaked = 0;
- x->x_auto = 1;
- x->x_amplo = DEFAMPLO;
- x->x_amphi = DEFAMPHI;
- x->x_attacktime = DEFATTACKTIME;
- x->x_attackbins = 1; /* real value calculated afterward */
- x->x_attackthresh = DEFATTACKTHRESH;
- x->x_vibtime = DEFVIBTIME;
- x->x_vibbins = 1; /* real value calculated afterward */
- x->x_vibdepth = DEFVIBDEPTH;
- x->x_npartial = 7;
- x->x_attackvalue = 0;
- return (1);
-}
-
- /* formalities for JMAX */
-
-#ifdef JMAX
-
-void sigfiddle_debug13(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- sigfiddle_debug(x);
-}
-
-void sigfiddle_print13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- sigfiddle_print(x);
-}
-
-void sigfiddle_amprange13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- t_float lo = (t_float) fts_get_float_arg(ac, at, 0, 0);
- t_float hi = (t_float) fts_get_float_arg(ac, at, 1, 0);
- sigfiddle_amprange(x, lo, hi);
-}
-
-void sigfiddle_reattack13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- long msec = fts_get_float_arg(ac, at, 0, 0);
- t_float db = (t_float) fts_get_float_arg(ac, at, 1, 0);
- sigfiddle_reattack(x, msec, db);
-}
-
-void sigfiddle_vibrato13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- long msec = fts_get_float_arg(ac, at, 0, 0);
- t_float halftones = (t_float) fts_get_float_arg(ac, at, 1, 0);
- sigfiddle_vibrato(x, msec, halftones);
-}
-
-void sigfiddle_npartial13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- t_float npartial = (t_float) fts_get_float_arg(ac, at, 0, 0);
- sigfiddle_npartial(x, npartial);
-}
-
-
-void ftl_sigfiddle(fts_word_t *a)
-{
- t_sigfiddle *x = (t_sigfiddle *)fts_word_get_long(a);
- t_float *in = (t_float *)fts_word_get_long(a + 1);
- long n_tick = fts_word_get_long(a + 2);
-
- int count;
- t_float *fp, *fp2;
- for (count = 0, fp = x->x_inbuf + x->x_phase;
- count < n_tick; count++) *fp++ = *in++;
- if (fp == x->x_inbuf + x->x_hop)
- {
- sigfiddle_doit(x);
- x->x_phase = 0;
- fts_alarm_set_delay(&x->x_clock, 0L); /* output bang */
- fts_alarm_arm(&x->x_clock);
-
- if (x->x_nprint) x->x_nprint--;
- }
- else x->x_phase += n_tick;
-}
-
-void sigfiddle_put(fts_object_t *o, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- fts_dsp_descr_t *dsp = (fts_dsp_descr_t *)fts_get_long_arg(ac, at, 0, 0);
- fts_atom_t a[3];
-
- x->x_sr = fts_dsp_get_input_srate(dsp, 0);
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
- sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
-
- fts_set_long(a, (long)x);
- fts_set_symbol(a+1, fts_dsp_get_input_name(dsp, 0));
- fts_set_long(a+2, fts_dsp_get_input_size(dsp, 0));
- dsp_add_funcall(dsp_symbol, 3, a);
-}
-
-void sigfiddle_tick(fts_alarm_t *alarm, void *p)
-{
- fts_object_t *o = (fts_object_t *)p;
- t_sigfiddle *x = (t_sigfiddle *)p;
-
- int i;
- t_pitchhist *ph;
- fts_outlet_float(o, OUTLETpower, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- fts_atom_t at[2];
- fts_set_float(at, ph->h_pitches[x->x_histphase]);
- fts_set_float(at+1, ph->h_amps[x->x_histphase]);
- fts_outlet_list(o, OUTLETmicropitch3 - i, 2, at);
- }
- if (x->x_attackvalue) fts_outlet_bang(o, OUTLETattack);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) fts_outlet_float(o, OUTLETpitch, ph->h_pitch);
-}
-
-static void sigfiddle_delete(fts_object_t *o, int winlet, fts_symbol_t *s, int ac,
- const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
-
- fts_free(x->x_inbuf);
- fts_free(x->x_lastanalysis);
- fts_free(x->x_spiral);
- dsp_list_remove(o);
-}
-
-static void sigfiddle_init(fts_object_t *o, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- t_float *buf1, *buf2, *buf3;
- int i, hop;
- long npoints = fts_get_long_arg(ac, at, 1, 0);
- long npitch = fts_get_long_arg(ac, at, 2, 0);
- long npeakanal = fts_get_long_arg(ac, at, 3, 0);
- long npeakout = fts_get_long_arg(ac, at, 4, 0);
-
- if (!sigfiddle_doinit(x, npoints, npitch, npeakanal, npeakout))
- {
- post("fiddle~: initialization failed");
- return;
- }
- hop = npoints>>1;
- if (fts_fft_declaresize(hop) != fts_Success)
- post("fiddle~: bad FFT size");
-
- fts_alarm_init(&(x->x_clock), 0, sigfiddle_tick, x);
- dsp_list_insert(o);
-}
-
-static fts_status_t sigfiddle_instantiate(fts_class_t *cl, int ac,
- const fts_atom_t *at)
-{
- int i;
- fts_type_t a[5];
-
- fts_class_init(cl, sizeof(t_sigfiddle), 1, 6, 0); /* 1 inlet + 6 outlets */
-
- /* the system methods */
-
- a[0] = fts_Symbol;
- a[1] = fts_Long | fts_OptArg;
- a[2] = fts_Long | fts_OptArg;
- fts_method_define(cl, fts_SystemInlet, fts_s_init, sigfiddle_init, 3, a);
-
- fts_method_define(cl, fts_SystemInlet, fts_s_delete, sigfiddle_delete, 0, a);
- a[0] = fts_Object;
- fts_method_define(cl, fts_SystemInlet, fts_s_put, sigfiddle_put, 1, a);
-
- /* class' own methods */
- fts_method_define(cl, 0, fts_new_symbol("print"), sigfiddle_print13, 0, a);
- fts_method_define(cl, 0, fts_new_symbol("debug"), sigfiddle_debug13, 0, a);
- fts_method_define(cl, 0, fts_new_symbol("amp-range"), sigfiddle_amprange13,
- 0, a);
- fts_method_define(cl, 0, fts_new_symbol("reattack"), sigfiddle_reattack13,
- 0, a);
- fts_method_define(cl, 0, fts_new_symbol("vibrato"), sigfiddle_vibrato13,
- 0, a);
- fts_method_define(cl, 0, fts_new_symbol("npartial"), sigfiddle_npartial13,
- 0, a);
-
- /* classes signal inlets */
- dsp_sig_inlet(cl, 0); /* declare signal input #0 */
-
- /* classes outlets */
- a[0] = fts_Float;
- fts_outlet_type_define(cl, OUTLETpitch, fts_s_float, 1, a); /* declare outlet #0 */
- fts_outlet_type_define(cl, OUTLETattack, fts_s_bang, 0, a); /* declare outlet #1 */
- a[0] = fts_VarArgs;
- fts_outlet_type_define(cl, OUTLETmicropitch1, fts_s_list, 1, a); /* declare outlet #2 */
- fts_outlet_type_define(cl, OUTLETmicropitch2, fts_s_list, 1, a); /* declare outlet #3 */
- fts_outlet_type_define(cl, OUTLETmicropitch3, fts_s_list, 1, a); /* declare outlet #4 */
- a[0] = fts_Float;
- fts_outlet_type_define(cl, OUTLETpower, fts_s_float, 1, a); /* declare outlet #5 */
-
- dsp_symbol = fts_new_symbol("fiddle");
- dsp_declare_function(dsp_symbol, ftl_sigfiddle);
-
- /* DSP properties */
-
- fts_class_put_prop(cl, fts_s_dsp_is_sink, fts_true);
-
- return(fts_Success);
-}
-
-void fiddle_config(void)
-{
- sys_log(fiddle_version);
- fts_metaclass_create(fts_new_symbol(CLASSNAME), sigfiddle_instantiate, fts_always_equiv);
-}
-
-fts_module_t fiddle_module =
- {"fiddle", "sonic meat fiddle", fiddle_config, 0};
-
-#endif /* JMAX */
-
-#ifdef PD
-
-static t_int *fiddle_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_sigfiddle *x = (t_sigfiddle *)(w[2]);
- int n = (int)(w[3]);
- int count;
- t_float *fp;
- if (!x->x_hop)
- goto nono;
- for (count = 0, fp = x->x_inbuf + x->x_phase; count < n; count++)
- *fp++ = *in++;
- if (fp == x->x_inbuf + x->x_hop)
- {
- sigfiddle_doit(x);
- x->x_phase = 0;
- if (x->x_auto) clock_delay(x->x_clock, 0L);
- if (x->x_nprint) x->x_nprint--;
- }
- else x->x_phase += n;
-nono:
- return (w+4);
-}
-
-void sigfiddle_dsp(t_sigfiddle *x, t_signal **sp)
-{
- x->x_sr = sp[0]->s_sr;
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
- sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
- dsp_add(fiddle_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
-}
-
- /* This is the callback function for the clock, but also acts as
- the "bang" method; you can leave "auto" on to get this called
- automatically (the default) or turn auto off and bang it yourself. */
-
-void sigfiddle_bang(t_sigfiddle *x)
-{
- int i;
- t_pitchhist *ph;
- if (x->x_npeakout)
- {
- int npeakout = x->x_npeakout;
- t_peakout *po;
- for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
- {
- t_atom at[3];
- SETFLOAT(at, i+1);
- SETFLOAT(at+1, po->po_freq);
- SETFLOAT(at+2, po->po_amp);
- outlet_list(x->x_peakout, 0, 3, at);
- }
- }
- outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, 0, 2, at);
- }
- if (x->x_attackvalue) outlet_bang(x->x_attackout);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
-}
-
-void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free */
-{
- if (x->x_inbuf)
- {
- freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
- freebytes(x->x_lastanalysis, sizeof(t_float) * (2*x->x_hop + 4 * FILTSIZE));
- freebytes(x->x_spiral, sizeof(t_float) * 2*x->x_hop);
- freebytes(x->x_peakbuf, sizeof(*x->x_peakbuf) * x->x_npeakout);
- clock_free(x->x_clock);
- }
-}
-
-static t_class *sigfiddle_class;
-
-void *sigfiddle_new(t_floatarg npoints, t_floatarg npitch,
- t_floatarg fnpeakanal, t_floatarg fnpeakout)
-{
- t_sigfiddle *x = (t_sigfiddle *)pd_new(sigfiddle_class);
- int i;
- int npeakanal = fnpeakanal, npeakout = fnpeakout;
-
-
- if (!sigfiddle_doinit(x, npoints, npitch,
- npeakanal, npeakout))
- {
- x->x_inbuf = 0; /* prevent the free routine from cleaning up */
- pd_free(&x->x_ob.ob_pd);
- return (0);
- }
- x->x_noteout = outlet_new(&x->x_ob, gensym("float"));
- x->x_attackout = outlet_new(&x->x_ob, gensym("bang"));
- for (i = 0; i < x->x_npitch; i++)
- x->x_hist[i].h_outlet = outlet_new(&x->x_ob, gensym("list"));
- x->x_envout = outlet_new(&x->x_ob, gensym("float"));
- if (x->x_npeakout)
- x->x_peakout = outlet_new(&x->x_ob, gensym("list"));
- else x->x_peakout = 0;
- x->x_clock = clock_new(&x->x_ob.ob_pd, (t_method)sigfiddle_bang);
- return (x);
-}
-
-void fiddle_tilde_setup(void)
-{
- sigfiddle_class = class_new(gensym("fiddle~"), (t_newmethod)sigfiddle_new,
- (t_method)sigfiddle_ff, sizeof(t_sigfiddle), 0,
- A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_dsp,
- gensym("dsp"), 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_debug,
- gensym("debug"), 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_setnpoints,
- gensym("npoints"), A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_amprange,
- gensym("amp-range"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_reattack,
- gensym("reattack"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_vibrato,
- gensym("vibrato"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_npartial,
- gensym("npartial"), A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_auto,
- gensym("auto"), A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_print,
- gensym("print"), 0);
- class_addmethod(sigfiddle_class, nullfn, gensym("signal"), 0);
- class_addbang(sigfiddle_class, sigfiddle_bang);
- class_addcreator((t_newmethod)sigfiddle_new, gensym("fiddle"),
- A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- post(fiddle_version);
-}
-
-void fiddle_setup(void)
-{
- fiddle_tilde_setup();
-}
-#endif /* PD */
-
-#ifdef MAX26
-
-void cu_fiddle(t_float *in1, t_sigfiddle *x, int n)
-{
- int count;
- t_float *fp, *fp2;
- for (count = 0, fp = x->x_inbuf + x->x_phase;
- count < n; count++) *fp++ = *in1++;
- if (fp == x->x_inbuf + x->x_hop)
- {
- sigfiddle_doit(x);
- x->x_phase = 0;
- if (x->x_auto) clock_delay(x->x_clock, 0L);
- if (x->x_nprint) x->x_nprint--;
- }
- else x->x_phase += n;
-}
-
-void sigfiddle_put(t_sigfiddle *x, long whether)
-{
- if (whether)
- {
- u_stdout(x);
- x->x_sr = x->x_io[0]->s_sr;
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
- sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
- dspchain_addc(cu_fiddle, 3,
- x->x_io[0]->s_shit, x, x->x_io[0]->s_n);
- }
-}
-
-void sigfiddle_tick(t_sigfiddle *x) /* callback function for the clock */
-{
- int i;
- t_pitchhist *ph;
- outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, NIL, 2, at);
- }
- if (x->x_attackvalue) outlet_bang(x->x_attackout);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
-}
-
-void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free */
-{
- if (x->x_inbuf)
- {
- freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
- freebytes(x->x_lastanalysis, sizeof(t_float) * (2*x->x_hop + 4 * FILTSIZE));
- freebytes(x->x_spiral, sizeof(t_float) * 2*x->x_hop);
- clock_free(x->x_clock);
- u_clean(x);
- }
-}
-
-t_externclass *sigfiddle_class;
-
-void *sigfiddle_new(long npoints, long npitch,
- long npeakanal, long npeakout)
-{
- t_sigfiddle *x = (t_sigfiddle *)obj_new(&sigfiddle_class, 0);
- int i;
-
- if (!sigfiddle_doinit(x, npoints, npitch, npeakanal, npeakout))
- {
- x->x_inbuf = 0; /* prevent the free routine from cleaning up */
- obj_free(x);
- return (0);
- }
- u_setup(x, IN1, OUT0);
- x->x_envout = outlet_new(x, gensym("float"));
- for (i = 0; i < x->x_npitch; i++)
- x->x_hist[i].h_outlet = outlet_new(x, gensym("list"));
- x->x_attackout = outlet_new(x, gensym("bang"));
- x->x_noteout = outlet_new(x, gensym("float"));
- x->x_clock = clock_new(x, sigfiddle_tick);
- return (x);
-}
-
-void fiddle_setup()
-{
- c_extern(&sigfiddle_class, sigfiddle_new, sigfiddle_ff,
- gensym("fiddle"), sizeof(t_sigfiddle), 0, A_DEFLONG, A_DEFLONG,
- A_DEFLONG, A_DEFLONG, 0);
- c_addmess(sigfiddle_put, gensym("put"), A_CANT, 0);
- c_addmess(sigfiddle_debug, gensym("debug"), 0);
- c_addmess(sigfiddle_amprange, gensym("amp-range"), A_FLOAT, A_FLOAT, 0);
- c_addmess(sigfiddle_reattack, gensym("reattack"), A_FLOAT, A_FLOAT, 0);
- c_addmess(sigfiddle_vibrato, gensym("vibrato"), A_LONG, A_FLOAT, 0);
- c_addmess(sigfiddle_npartial, gensym("npartial"), A_FLOAT, 0);
- c_addmess(sigfiddle_print, gensym("print"), 0);
- u_inletmethod(0); /* one signal input */
-#ifdef MAX
- post(fiddle_version);
-#endif
-}
-
-#endif /* MAX26 */
-
-/************* Beginning of MSP Code ******************************/
-
-#ifdef MSP
-
-static t_int *fiddle_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_sigfiddle *x = (t_sigfiddle *)(w[2]);
- int n = (int)(w[3]);
- int count,inc = x->x_downsample;
- t_float *fp;
-
- if (x->x_obj.z_disabled)
- goto skip;
- for (count = 0, fp = x->x_inbuf + x->x_phase; count < n; count+=inc) {
- *fp++ = *in;
- in += inc;
- }
- if (fp == x->x_inbuf + x->x_hop)
- {
- sigfiddle_doit(x);
- x->x_phase = 0;
- if (x->x_auto) clock_delay(x->x_clock, 0L);
- if (x->x_nprint) x->x_nprint--;
- }
- else x->x_phase += n;
-skip:
- return (w+4);
-}
-
-void sigfiddle_dsp(t_sigfiddle *x, t_signal **sp)
-{
- if (sp[0]->s_n > x->x_hop) {
- x->x_downsample = sp[0]->s_n / x->x_hop;
- post("* warning: fiddle~: will downsample input by %ld",x->x_downsample);
- x->x_sr = sp[0]->s_sr / x->x_downsample;
- } else {
- x->x_downsample = 1;
- x->x_sr = sp[0]->s_sr;
- }
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
- sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
- dsp_add(fiddle_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
-}
-
-void sigfiddle_tick(t_sigfiddle *x) /* callback function for the clock MSP*/
-{
- int i;
- t_pitchhist *ph;
- if (x->x_npeakout)
- {
- int npeakout = x->x_npeakout;
- t_peakout *po;
- for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
- {
- t_atom at[3];
- SETINT(at, i+1);
- SETFLOAT(at+1, po->po_freq);
- SETFLOAT(at+2, po->po_amp);
- outlet_list(x->x_peakout, 0, 3, at);
- }
- }
- outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, 0, 2, at);
- }
- if (x->x_attackvalue) outlet_bang(x->x_attackout);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
-}
-
-void sigfiddle_bang(t_sigfiddle *x)
-{
- int i;
- t_pitchhist *ph;
- if (x->x_npeakout)
- {
- int npeakout = x->x_npeakout;
- t_peakout *po;
- for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
- {
- t_atom at[3];
- SETLONG(at, i+1);
- SETFLOAT(at+1, po->po_freq);
- SETFLOAT(at+2, po->po_amp);
- outlet_list(x->x_peakout, 0, 3, at);
- }
- }
- outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, 0, 2, at);
- }
- if (x->x_attackvalue) outlet_bang(x->x_attackout);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
-}
-
-
-void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free MSP */
-{
-
- if (x->x_inbuf)
- {
- t_freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
- t_freebytes(x->x_lastanalysis, sizeof(t_float) * (2*x->x_hop + 4 *
-FILTSIZE));
- t_freebytes(x->x_spiral, sizeof(t_float) * 2*x->x_hop);
- t_freebytes(x->x_peakbuf, sizeof(*x->x_peakbuf) * x->x_npeakout);
- }
- dsp_free((t_pxobject *)x);
-}
-
-void *sigfiddle_class;
-
-void *sigfiddle_new(long npoints, long npitch,
- long npeakanal, long npeakout)
-{
- t_sigfiddle *x = (t_sigfiddle *)newobject(sigfiddle_class);
- int i;
-
- if (!sigfiddle_doinit(x, npoints, npitch, npeakanal, npeakout))
- {
- x->x_inbuf = 0; /* prevent the free routine from cleaning up */
- return (0);
- }
- dsp_setup((t_pxobject *)x,1);
-
- x->x_clock = clock_new(x, (method)sigfiddle_tick);
- if (x->x_npeakout)
- x->x_peakout = listout((t_object *)x);
- else x->x_peakout = 0;
- x->x_envout = floatout((t_object *)x);
- for (i = 0; i < x->x_npitch; i++)
- x->x_hist[i].h_outlet = listout((t_object *)x);
- x->x_attackout = bangout((t_object *)x);
- x->x_noteout = floatout((t_object *)x);
- return (x);
-
-
-}
-
-void main()
-{
- setup(&sigfiddle_class, sigfiddle_new, (method)sigfiddle_ff,
- (short)sizeof(t_sigfiddle), 0L, A_DEFLONG, A_DEFLONG,
-A_DEFLONG, A_DEFLONG, 0);
- addmess((method)sigfiddle_dsp, "dsp",
- A_CANT, 0);
- addmess((method)sigfiddle_debug, "debug", 0);
- addmess((method)sigfiddle_setnpoints, "npoints", A_FLOAT, 0);
- addmess((method)sigfiddle_amprange, "amp-range", A_FLOAT, A_FLOAT, 0);
- addmess((method)sigfiddle_reattack, "reattack", A_FLOAT, A_FLOAT, 0);
- addmess((method)sigfiddle_vibrato, "vibrato", A_FLOAT,
-A_FLOAT, 0);
- addmess((method)sigfiddle_npartial, "npartial", A_FLOAT, 0);
- addmess((method)sigfiddle_auto, "auto",
- A_FLOAT, 0);
- addmess((method)sigfiddle_print, "print", 0);
- addmess((method)sigfiddle_assist, "assist",
- A_CANT, 0);
- addbang((method)sigfiddle_bang);
- dsp_initclass();
- rescopy('STR#',3748);
- post(fiddle_version);
-}
-
-void sigfiddle_assist(t_sigfiddle *x, void *b, long m, long a, char *s)
-{
- assist_string(3748,m,a,1,2,s);
-}
-
-void msp_fft(t_float *buf, long np, long inv)
-{
- t_float *src,*real,*rp,*imag,*ip;
- long i;
-
- /*
- // because this fft algorithm uses separate real and imaginary
- // buffers
- // we must split the real and imaginary parts into two buffers,
- // then do the opposite on output
- // a more ambitious person would either do an in-place conversion
- // or rewrite the fft algorithm
- */
-
- real = rp = msp_ffttemp;
- imag = ip = real + MAXPOINTS;
- src = buf;
- for (i = 0; i < np; i++) {
- *rp++ = *src++;
- *ip++ = *src++;
- }
- if (inv)
- ifft(np,real,imag);
- else
- fft(np,real,imag);
- rp = real;
- ip = imag;
- src = buf;
- for (i = 0; i < np; i++) {
- *src++ = *rp++;
- *src++ = *ip++;
- }
-}
-
-#endif /* MSP */
diff --git a/externals/extra/0.43.2/hilbert~-help.pd b/externals/extra/0.43.2/hilbert~-help.pd
deleted file mode 100644
index 130ec750..00000000
--- a/externals/extra/0.43.2/hilbert~-help.pd
+++ /dev/null
@@ -1,18 +0,0 @@
-#N canvas 156 234 600 488 12;
-#X obj 67 124 hilbert~;
-#X obj 66 85 osc~ 440;
-#X graph graph1 0 -1 882 1 279 209 579 39;
-#X array out-left 882 float;
-#X array out-right 882 float;
-#X pop;
-#X obj 67 274 tabwrite~ out-left;
-#X obj 118 248 tabwrite~ out-right;
-#X msg 137 188 bang \; pd dsp 1;
-#X floatatom 66 57;
-#X text 71 319 The Hilbert transform (the name is abused here according to computer music tradition) puts out a phase quadrature version of the input signal suitable for signal sideband modulation via complex-mod~.;
-#X connect 0 0 3 0;
-#X connect 0 1 4 0;
-#X connect 1 0 0 0;
-#X connect 5 0 3 0;
-#X connect 5 0 4 0;
-#X connect 6 0 1 0;
diff --git a/externals/extra/0.43.2/hilbert~.pd b/externals/extra/0.43.2/hilbert~.pd
deleted file mode 100644
index 152c2082..00000000
--- a/externals/extra/0.43.2/hilbert~.pd
+++ /dev/null
@@ -1,27 +0,0 @@
-#N canvas 269 0 593 306 12;
-#X obj 105 92 biquad~ 0.83774 -0.06338 0.06338 -0.83774 1;
-#X obj 105 66 biquad~ 1.94632 -0.94657 0.94657 -1.94632 1;
-#X obj 86 149 biquad~ -0.02569 0.260502 -0.260502 0.02569 1;
-#X obj 86 175 biquad~ 1.8685 -0.870686 0.870686 -1.8685 1;
-#X obj 86 39 inlet~;
-#X obj 105 121 outlet~;
-#X obj 86 202 outlet~;
-#X text 34 232 This is a pair of 4th-order all-pass filters whose outputs
-somehow manage to be about 90 degrees out of phase from each other.
-Both have different phases from the original. Adapted from a 4X patch
-by Emmanuel Favreau \, circa 1982;
-#X obj 502 39 inlet;
-#X text 461 13 bang to clear;
-#X text 80 16 signal in;
-#X msg 502 112 clear;
-#X connect 0 0 5 0;
-#X connect 1 0 0 0;
-#X connect 2 0 3 0;
-#X connect 3 0 6 0;
-#X connect 4 0 1 0;
-#X connect 4 0 2 0;
-#X connect 8 0 11 0;
-#X connect 11 0 1 0;
-#X connect 11 0 0 0;
-#X connect 11 0 2 0;
-#X connect 11 0 3 0;
diff --git a/externals/extra/0.43.2/loop~/loop~-help.pd b/externals/extra/0.43.2/loop~/loop~-help.pd
deleted file mode 100644
index ff3d3a63..00000000
--- a/externals/extra/0.43.2/loop~/loop~-help.pd
+++ /dev/null
@@ -1,74 +0,0 @@
-#N canvas 234 90 647 662 12;
-#X floatatom 41 204 0 0 0 0 - - -;
-#X obj 254 382 print~;
-#X msg 254 347 bang;
-#X obj 41 338 loop~;
-#X floatatom 66 279 0 0 0 0 - - -;
-#X msg 55 252 bang;
-#X obj 183 382 print~;
-#X msg 183 347 bang;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array array2 150000 float 0;
-#X coords 0 1 150000 -1 200 150 1;
-#X restore 393 464 graph;
-#X msg 393 622 \; array2 resize 150000;
-#X obj 25 613 soundfiler;
-#X obj 16 453 tabread4~ array2;
-#X obj 16 407 *~;
-#X obj 16 522 dac~;
-#X obj 16 499 hip~ 5;
-#X obj 62 411 samphold~;
-#X obj 16 430 +~;
-#X floatatom 96 303 0 0 0 0 - - -;
-#X obj 96 326 *~ 1000;
-#X msg 43 568 read ../doc/sound/bell.aiff array2;
-#X msg 47 229 set 0.5;
-#X text 95 196 left signal input is transposition (1 is normal \, 2
-is up an octave \, etc);
-#X text 82 4 loop~ - phase generator for looping samplers;
-#X text 116 228 set phase (0 to 1);
-#X text 104 253 reset phase to 0;
-#X text 104 278 right signal input is window size in samples;
-#X text 134 302 here's how to handle onsets;
-#X obj 16 476 *~;
-#X floatatom 167 432 0 0 0 0 - - -;
-#X obj 167 501 line~;
-#X obj 167 455 dbtorms;
-#X obj 167 478 pack 0 50;
-#X text 201 431 output level 0-100;
-#X text 187 326 print outputs;
-#X text 33 32 loop~ takes input signals to set a window size and transposition
-\, and outputs a phase and a sampled window size. The window size only
-changes at phase zero crossings and the phase output is adjusted so
-that changing window size doesn't change the transposition.;
-#X text 33 112 You can send "bang" or "set" message to force the phase
-to zero--you should mute the output before doing so. This may be desirable
-if you've set a large window size but then want to decrease it without
-waiting for the next phase crossing.;
-#X msg 43 591 read ../doc/sound/voice.wav array2;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 6 0;
-#X connect 3 0 12 0;
-#X connect 3 0 15 1;
-#X connect 3 1 1 0;
-#X connect 3 1 12 1;
-#X connect 4 0 3 1;
-#X connect 5 0 3 0;
-#X connect 7 0 6 0;
-#X connect 11 0 27 0;
-#X connect 12 0 16 0;
-#X connect 14 0 13 0;
-#X connect 14 0 13 1;
-#X connect 15 0 16 1;
-#X connect 16 0 11 0;
-#X connect 17 0 18 0;
-#X connect 18 0 15 0;
-#X connect 19 0 10 0;
-#X connect 20 0 3 0;
-#X connect 27 0 14 0;
-#X connect 28 0 30 0;
-#X connect 29 0 27 1;
-#X connect 30 0 31 0;
-#X connect 31 0 29 0;
-#X connect 36 0 10 0;
diff --git a/externals/extra/0.43.2/loop~/loop~.c b/externals/extra/0.43.2/loop~/loop~.c
deleted file mode 100644
index ebe3d9d5..00000000
--- a/externals/extra/0.43.2/loop~/loop~.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* loop~ -- loop generator for sampling */
-
-/* Copyright 1997-1999 Miller Puckette.
-Permission is granted to use this software for any purpose provided you
-keep this copyright notice intact.
-
-THE AUTHOR AND HIS EMPLOYERS MAKE NO WARRANTY, EXPRESS OR IMPLIED,
-IN CONNECTION WITH THIS SOFTWARE.
-
-This file is downloadable from http://www.crca.ucsd.edu/~msp .
-
-*/
-
-#ifdef PD
-#include "m_pd.h"
-#else
-#define t_sample float
-#define t_float float
-#endif
-
-
-
-typedef struct _loopctl
-{
- double l_phase;
- t_sample l_invwindow;
- t_sample l_window;
- int l_resync;
-} t_loopctl;
-
-static void loopctl_run(t_loopctl *x, t_sample *transposein,
- t_sample *windowin, t_sample *rawout, t_sample *windowout, int n)
-{
- t_sample window, invwindow;
- double phase = x->l_phase;
- if (x->l_resync)
- {
- window = *windowin;
- if (window < 0)
- {
- if (window > -1)
- window = -1;
- invwindow = -1/window;
- }
- else
- {
- if (window < 1)
- window = 1;
- invwindow = 1/window;
- }
- x->l_resync = 0;
- }
- else
- {
- window = x->l_window;
- phase = x->l_phase;
- invwindow = x->l_invwindow;
- }
- while (n--)
- {
- double phaseinc = invwindow * *transposein++;
- double newphase;
- t_sample nwind = *windowin++;
- if (phaseinc >= 1 || phaseinc < 0)
- phaseinc = 0;
- newphase = phase + phaseinc;
- if (newphase >= 1)
- {
- window = nwind;
- if (window < 0)
- {
- if (window > -1)
- window = -1;
- invwindow = -1/window;
- }
- else
- {
- if (window < 1)
- window = 1;
- invwindow = 1/window;
- }
- newphase -= 1.;
- }
- phase = newphase;
- *rawout++ = (t_sample)phase;
- *windowout++ = window;
- }
- x->l_invwindow = invwindow;
- x->l_window = window;
- x->l_phase = phase;
-}
-
-static void loopctl_init(t_loopctl *x)
-{
- x->l_window = 1;
- x->l_invwindow = 1;
- x->l_phase = 0;
-}
-
-static void loopctl_set(t_loopctl *x, t_float val)
-{
- if (val < 0 || val > 1)
- val = 0;
- x->l_phase = val;
- x->l_resync = 1;
-}
-
-#ifdef PD
-
-typedef struct _loop
-{
- t_object x_obj;
- t_float x_f;
- t_loopctl x_loopctl;
-} t_loop;
-
-static t_class *loop_class;
-
-static void *loop_new(void)
-{
- t_loop *x = (t_loop *)pd_new(loop_class);
- loopctl_init(&x->x_loopctl);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- outlet_new(&x->x_obj, gensym("signal"));
- outlet_new(&x->x_obj, gensym("signal"));
- return (x);
-}
-
-static t_int *loop_perform(t_int *w)
-{
- t_loopctl *ctl = (t_loopctl *)(w[1]);
- t_sample *in1 = (t_sample *)(w[2]);
- t_sample *in2 = (t_sample *)(w[3]);
- t_sample *out1 = (t_sample *)(w[4]);
- t_sample *out2 = (t_sample *)(w[5]);
- int n = (int)(w[6]);
- loopctl_run(ctl, in1, in2, out1, out2, n);
- return (w+7);
-}
-
-static void loop_dsp(t_loop *x, t_signal **sp)
-{
- dsp_add(loop_perform, 6,
- &x->x_loopctl, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,
- sp[0]->s_n);
-}
-
-static void loop_set(t_loop *x, t_floatarg val)
-{
- loopctl_set(&x->x_loopctl, val);
-}
-
-static void loop_bang(t_loop *x)
-{
- loopctl_set(&x->x_loopctl, 0);
-}
-
-void loop_tilde_setup(void)
-{
- loop_class = class_new(gensym("loop~"), (t_newmethod)loop_new, 0,
- sizeof(t_loop), 0, 0);
- class_addmethod(loop_class, (t_method)loop_dsp, gensym("dsp"), A_CANT, 0);
- CLASS_MAINSIGNALIN(loop_class, t_loop, x_f);
- class_addmethod(loop_class, (t_method)loop_set, gensym("set"),
- A_DEFFLOAT, 0);
- class_addbang(loop_class, loop_bang);
-}
-
-#endif /* PD */
diff --git a/externals/extra/0.43.2/loop~/test-loop~.pd b/externals/extra/0.43.2/loop~/test-loop~.pd
deleted file mode 100644
index 9966483d..00000000
--- a/externals/extra/0.43.2/loop~/test-loop~.pd
+++ /dev/null
@@ -1,58 +0,0 @@
-#N canvas 33 0 680 609 12;
-#X floatatom 52 262 0 0 0 0 - - -;
-#X obj 261 346 print~;
-#X msg 47 373 bang;
-#X msg 274 313 bang;
-#X obj 52 306 loop~;
-#X floatatom 102 245 0 0 0 0 - - -;
-#N canvas 0 0 450 300 graph1 0;
-#X array array1 44100 float 0;
-#X coords 0 10 44100 0 200 150 1;
-#X restore 65 17 graph;
-#X msg 43 204 \; array1 resize 44100;
-#X obj 25 401 tabwrite~ array1;
-#X msg 208 371 bang;
-#X obj 176 402 tabwrite~ array1;
-#X msg 194 261 bang;
-#X obj 204 347 print~;
-#X msg 217 314 bang;
-#N canvas 0 0 450 300 graph1 0;
-#X array array2 150000 float 0;
-#X coords 0 1 150000 -1 200 150 1;
-#X restore 332 398 graph;
-#X msg 326 274 \; array2 resize 150000;
-#X obj 103 529 tabread4~ array2;
-#X obj 64 481 *~;
-#X obj 107 581 dac~;
-#X obj 105 552 hip~ 5;
-#X obj 123 482 samphold~;
-#X obj 102 506 +~;
-#X floatatom 106 430 0 0 0 0 - - -;
-#X obj 108 453 *~ 1000;
-#X obj 312 215 soundfiler;
-#X msg 330 170 read ../doc/sound/bell.aiff array2;
-#X msg 330 193 read ../doc/sound/vocal.aiff array2;
-#X connect 0 0 4 0;
-#X connect 2 0 8 0;
-#X connect 3 0 1 0;
-#X connect 4 0 12 0;
-#X connect 4 0 17 0;
-#X connect 4 0 8 0;
-#X connect 4 0 20 1;
-#X connect 4 1 10 0;
-#X connect 4 1 1 0;
-#X connect 4 1 17 1;
-#X connect 5 0 4 1;
-#X connect 9 0 10 0;
-#X connect 11 0 4 0;
-#X connect 13 0 12 0;
-#X connect 16 0 19 0;
-#X connect 17 0 21 0;
-#X connect 19 0 18 0;
-#X connect 19 0 18 1;
-#X connect 20 0 21 1;
-#X connect 21 0 16 0;
-#X connect 22 0 23 0;
-#X connect 23 0 20 0;
-#X connect 25 0 24 0;
-#X connect 26 0 24 0;
diff --git a/externals/extra/0.43.2/lrshift~/lrshift~-help.pd b/externals/extra/0.43.2/lrshift~/lrshift~-help.pd
deleted file mode 100644
index fdf7b0c5..00000000
--- a/externals/extra/0.43.2/lrshift~/lrshift~-help.pd
+++ /dev/null
@@ -1,33 +0,0 @@
-#N canvas 143 0 673 325 12;
-#X msg 268 277 bang;
-#X obj 244 303 print~;
-#X msg 185 278 bang;
-#X obj 161 304 print~;
-#X text 53 117 click here first;
-#X msg 72 270 bang;
-#X obj 48 296 print~;
-#X text 162 222 shift left;
-#X text 243 224 shift right;
-#X obj 161 252 lrshift~ 1;
-#X obj 244 251 lrshift~ -1;
-#X text 39 37 Acting at whatever vector size the window is running
-at \, lrshift~ shifts samples to the left (toward the beginning sample)
-or to the right. The argument gives the direction and the amount of
-the shift. The rightmost (or leftmost) samples are set to zero.;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array shiftin 64 float 0;
-#X coords 0 1 63 0 200 140 1;
-#X restore 448 118 graph;
-#X text 115 11 -- shift signal vector elements left or right;
-#X msg 54 138 \; pd dsp 1 \; shiftin 1 1;
-#X obj 48 204 tabreceive~ shiftin;
-#X text 525 308 Updated for Pd 0.31.;
-#X obj 47 11 lrshift~;
-#X connect 0 0 1 0;
-#X connect 2 0 3 0;
-#X connect 5 0 6 0;
-#X connect 9 0 3 0;
-#X connect 10 0 1 0;
-#X connect 15 0 6 0;
-#X connect 15 0 9 0;
-#X connect 15 0 10 0;
diff --git a/externals/extra/0.43.2/lrshift~/lrshift~.c b/externals/extra/0.43.2/lrshift~/lrshift~.c
deleted file mode 100644
index 19dcb93d..00000000
--- a/externals/extra/0.43.2/lrshift~/lrshift~.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "m_pd.h"
-
-/* ------------------------ lrshift~ ----------------------------- */
-
-static t_class *lrshift_tilde_class;
-
-typedef struct _lrshift_tilde
-{
- t_object x_obj;
- int x_n;
- t_float x_f;
-} t_lrshift_tilde;
-
-static t_int *leftshift_perform(t_int *w)
-{
- t_sample *in = (t_sample *)(w[1]);
- t_sample *out= (t_sample *)(w[2]);
- int n = (int)(w[3]);
- int shift = (int)(w[4]);
- in += shift;
- n -= shift;
- while (n--)
- *out++ = *in++;
- while (shift--)
- *out++ = 0;
- return (w+5);
-}
-
-static t_int *rightshift_perform(t_int *w)
-{
- t_sample *in = (t_sample *)(w[1]);
- t_sample *out= (t_sample *)(w[2]);
- int n = (int)(w[3]);
- int shift = (int)(w[4]);
- n -= shift;
- in -= shift;
- while (n--)
- *--out = *--in;
- while (shift--)
- *--out = 0;
- return (w+5);
-}
-
-static void lrshift_tilde_dsp(t_lrshift_tilde *x, t_signal **sp)
-{
- int n = sp[0]->s_n;
- int shift = x->x_n;
- if (shift > n)
- shift = n;
- if (shift < -n)
- shift = -n;
- if (shift < 0)
- dsp_add(rightshift_perform, 4,
- sp[0]->s_vec + n, sp[1]->s_vec + n, n, -shift);
- else dsp_add(leftshift_perform, 4,
- sp[0]->s_vec, sp[1]->s_vec, n, shift);
-}
-
-static void *lrshift_tilde_new(t_floatarg f)
-{
- t_lrshift_tilde *x = (t_lrshift_tilde *)pd_new(lrshift_tilde_class);
- x->x_n = f;
- x->x_f = 0;
- outlet_new(&x->x_obj, gensym("signal"));
- return (x);
-}
-
-void lrshift_tilde_setup(void)
-{
- lrshift_tilde_class = class_new(gensym("lrshift~"),
- (t_newmethod)lrshift_tilde_new, 0, sizeof(t_lrshift_tilde), 0,
- A_DEFFLOAT, 0);
- CLASS_MAINSIGNALIN(lrshift_tilde_class, t_lrshift_tilde, x_f);
- class_addmethod(lrshift_tilde_class, (t_method)lrshift_tilde_dsp,
- gensym("dsp"), 0);
-}
diff --git a/externals/extra/0.43.2/pd~/notes.txt b/externals/extra/0.43.2/pd~/notes.txt
deleted file mode 100644
index 59129d5a..00000000
--- a/externals/extra/0.43.2/pd~/notes.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-pd -schedlib `pwd`/pdsched
-
-dolist:
-pd~ to delay starting subproc until asked
-figure out about setting nchannels from command line
-fix maximum nchannels in and out
-
-
diff --git a/externals/extra/0.43.2/pd~/pdsched.c b/externals/extra/0.43.2/pd~/pdsched.c
deleted file mode 100644
index 43a5ccf1..00000000
--- a/externals/extra/0.43.2/pd~/pdsched.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright 2008 Miller Puckette. Berkeley license; see the
-file LICENSE.txt in this distribution. */
-
-/* A plug-in scheduler that turns Pd into a filter that inputs and
-outputs audio and messages. */
-
-/* todo:
- fix schedlib code to use extent2
- figure out about if (sys_externalschedlib) { return; } in s_audio.c
- make buffer size ynamically growable
-
-*/
-#include "m_pd.h"
-#include "s_stuff.h"
-#include <stdio.h>
-
-#define BUFSIZE 65536
-static char inbuf[BUFSIZE];
-
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
-void glob_watchdog(t_pd *dummy);
-
-static void pollwatchdog( void)
-{
- static int sched_diddsp, sched_nextpingtime;
- sched_diddsp++;
- if (sys_nogui && sys_hipriority && (sched_diddsp - sched_nextpingtime > 0))
- {
- glob_watchdog(0);
- /* ping every 2 seconds */
- sched_nextpingtime = sched_diddsp +
- 2 * (int)(sys_dacsr /(double)sys_schedblocksize);
- }
-}
-#endif
-
-int pd_extern_sched(char *flags)
-{
- int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV];
- int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV];
- int i, j, rate, advance, callback, chin, chout, fill = 0, c, blocksize;
- t_binbuf *b = binbuf_new();
-
- sys_get_audio_params(&naudioindev, audioindev, chindev,
- &naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback,
- &blocksize);
-
- chin = (naudioindev < 1 ? 0 : chindev[0]);
- chout = (naudiooutdev < 1 ? 0 : choutdev[0]);
-
- /* fprintf(stderr, "Pd plug-in scheduler called, chans %d %d, sr %d\n",
- chin, chout, (int)rate); */
- sys_setchsr(chin, chout, rate);
- sys_audioapi = API_NONE;
- while ((c = getchar()) != EOF)
- {
- if (c == ';')
- {
- int n;
- t_atom *ap;
- binbuf_text(b, inbuf, fill);
- n = binbuf_getnatom(b);
- ap = binbuf_getvec(b);
- fill = 0;
- if (n > 0 && ap[0].a_type == A_FLOAT)
- {
- /* a list -- take it as incoming signals. */
- int chan, nchan = n/DEFDACBLKSIZE;
- t_sample *fp;
- for (i = chan = 0, fp = sys_soundin; chan < nchan; chan++)
- for (j = 0; j < DEFDACBLKSIZE; j++)
- *fp++ = atom_getfloat(ap++);
- for (; chan < chin; chan++)
- for (j = 0; j < DEFDACBLKSIZE; j++)
- *fp++ = 0;
- sched_tick(sys_time+sys_time_per_dsp_tick);
- sys_pollgui();
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
- pollwatchdog();
-#endif
- printf(";\n");
- for (i = chout*DEFDACBLKSIZE, fp = sys_soundout; i--; fp++)
- {
- printf("%g\n", *fp);
- *fp = 0;
- }
- printf(";\n");
- fflush(stdout);
- }
- else if (n > 1 && ap[0].a_type == A_SYMBOL)
- {
- t_pd *whom = ap[0].a_w.w_symbol->s_thing;
- if (!whom)
- error("%s: no such object", ap[0].a_w.w_symbol->s_name);
- else if (ap[1].a_type == A_SYMBOL)
- typedmess(whom, ap[1].a_w.w_symbol, n-2, ap+2);
- else pd_list(whom, 0, n-1, ap+1);
- }
- }
- else if (fill < BUFSIZE)
- inbuf[fill++] = c;
- else if (fill == BUFSIZE)
- fprintf(stderr, "pd-extern: input buffer overflow\n");
- }
- return (0);
-}
diff --git a/externals/extra/0.43.2/pd~/pd~-help.pd b/externals/extra/0.43.2/pd~/pd~-help.pd
deleted file mode 100644
index 8bc357e0..00000000
--- a/externals/extra/0.43.2/pd~/pd~-help.pd
+++ /dev/null
@@ -1,75 +0,0 @@
-#N canvas 12 0 566 872 12;
-#X msg 31 406 foo bar baz;
-#X obj 189 466 osc~ 440;
-#X obj 127 645 env~ 8192;
-#X floatatom 127 694 5 0 0 0 - - -;
-#X msg 434 807 \; pd dsp 1;
-#X msg 24 332 pd~ stop;
-#X obj 127 670 i;
-#X obj 241 643 env~ 8192;
-#X floatatom 241 693 5 0 0 0 - - -;
-#X obj 241 669 i;
-#X obj 123 489 *~;
-#X obj 158 490 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X obj 189 490 *~;
-#X obj 224 491 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X obj 434 781 loadbang;
-#X obj 14 691 print x;
-#X msg 15 309 pd~ start pd~-subprocess.pd;
-#X obj 14 532 pd~ -ninsig 2 -noutsig 2 -fifo 20;
-#X obj 37 20 pd~;
-#X text 69 22 - run a pd sub-process;
-#X text 27 57 The pd~ object starts and manages a Pd sub-process that
-can communicate with the super-process (this one) via audio channels
-and/or Pd messages. In this way you can take advantage of multi-core
-CPUs \, and/or use Pd features from within Max (if you're using the
-Max version of pd~).;
-#X text 24 251 Sending a new "start" message will stop the sub-process
-and start a new one. If you just want to stop the sub-process \, send
-"stop".;
-#X text 33 353 Any message besides "pd~" is sent to the sub-process.
-For instance \, the message below sends "bar baz" to any object in
-the sub-process named "foo" \, such as a "receive" object.;
-#X text 43 430 Audio signals appear in adc~ objects in the sub-process.
-The sub-process doesn't open real audio devices.;
-#X text 281 473 Creation args:;
-#X text 265 490 -insig <n> sets input audio channels;
-#X text 266 508 -outsig <n> sets output channels;
-#X text 269 542 -fifo <n> sets round-trip delay in blocks;
-#X text 272 559 -pddir <s> sets Pd directory \, e.g. \,;
-#X text 299 574 .../Pd-0.42.app/Contents/Resources;
-#X text 272 590 -scheddir <s> sets scheduler dir \, e.g. \,;
-#X text 297 607 .../.../Resources/extra/pd~;
-#X text 267 524 -sr <n> sets sample rate;
-#X text 20 716 The first outlet reports messages the sub-process sends
-us via "stdout" objects. Any other outlets are signals corresponding
-to "dac~" objects in the sub-process.;
-#X text 10 784 ATTENTION: DSP must be running in this process for the
-sub-process to run. This is because its clock is slaved to audio I/O
-it gets from us!;
-#X text 359 849 Updated for Pd version 0.42.;
-#X text 24 138 Messages with "pd~" selector control the sub-process.
-"pd~ start" takes as arguments any startup arguments you wish to send
-the sub-process. For example \, specify "-nogui" to stop the sub-process's
-GUI from appearing. You don't have to specify the number of channels
-in and out \, since that's set by creation arguments below. Audio config
-arguments arguments (-audiobuf \, -audiodev \, etc.) are ignored.;
-#X connect 0 0 17 0;
-#X connect 1 0 10 0;
-#X connect 1 0 12 0;
-#X connect 2 0 6 0;
-#X connect 5 0 17 0;
-#X connect 6 0 3 0;
-#X connect 7 0 9 0;
-#X connect 9 0 8 0;
-#X connect 10 0 17 0;
-#X connect 11 0 10 1;
-#X connect 12 0 17 1;
-#X connect 13 0 12 1;
-#X connect 14 0 4 0;
-#X connect 16 0 17 0;
-#X connect 17 0 15 0;
-#X connect 17 1 2 0;
-#X connect 17 2 7 0;
diff --git a/externals/extra/0.43.2/pd~/pd~-subprocess.pd b/externals/extra/0.43.2/pd~/pd~-subprocess.pd
deleted file mode 100644
index 1d883ab1..00000000
--- a/externals/extra/0.43.2/pd~/pd~-subprocess.pd
+++ /dev/null
@@ -1,60 +0,0 @@
-#N canvas 577 21 563 559 12;
-#X obj 202 395 r foo;
-#X obj 202 423 print foo;
-#X obj 87 174 adc~;
-#X obj 72 442 stdout;
-#X msg 72 364 a b c;
-#X msg 455 441 \; pd dsp 1;
-#X obj 87 201 env~ 8192;
-#X floatatom 87 250 5 0 0 0 - - -;
-#X obj 87 226 i;
-#X obj 263 253 dac~;
-#X obj 262 185 osc~ 440;
-#X obj 262 219 *~;
-#X obj 297 220 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X obj 332 186 osc~ 440;
-#X obj 332 220 *~;
-#X obj 367 221 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X msg 86 411 bang;
-#X obj 455 417 loadbang;
-#X obj 160 201 env~ 8192;
-#X floatatom 160 250 5 0 0 0 - - -;
-#X obj 160 226 i;
-#X msg 86 388 4;
-#X text 62 8 This is a test patch to demonstrate the Pd~ object. It's
-intended as the patch to run in the sub-process. The sub-process (which
-is a separate instance of Pd) can be called from a Max or Pd super-process.
-;
-#X text 63 73 Audio inlets and outlets on the Pd~ object (in the super-process)
-talk to adc~ and dac~ objects here - so \, for instance \, the first
-adc~ here is the first inlet of the pd~ object \, and the first chanel
-of dac~ goes to the second outlet of pd~ (because the first one is
-for messages \, as shown further below.);
-#X text 58 283 Any message sent to a stdout object in this sub-process
-(below) appears on the first \, message outlet of the pd~ object in
-the super-process. The super-process can send messages to any "receive"
-object in this sub-process.;
-#X text 137 478 We turn DSP on at load for convenience - control objects
-in this patch will still work without it (unlike in the super-process
-\, where DSP must be on for time to move forward in the sub-process.)
-;
-#X text 351 538 Updated for Pd version 0.42.;
-#X connect 0 0 1 0;
-#X connect 2 0 6 0;
-#X connect 2 1 18 0;
-#X connect 4 0 3 0;
-#X connect 6 0 8 0;
-#X connect 8 0 7 0;
-#X connect 10 0 11 0;
-#X connect 11 0 9 0;
-#X connect 12 0 11 1;
-#X connect 13 0 14 0;
-#X connect 14 0 9 1;
-#X connect 15 0 14 1;
-#X connect 16 0 3 0;
-#X connect 17 0 5 0;
-#X connect 18 0 20 0;
-#X connect 20 0 19 0;
-#X connect 21 0 3 0;
diff --git a/externals/extra/0.43.2/pd~/pd~.c b/externals/extra/0.43.2/pd~/pd~.c
deleted file mode 100644
index 9c9d335e..00000000
--- a/externals/extra/0.43.2/pd~/pd~.c
+++ /dev/null
@@ -1,771 +0,0 @@
-/*
- pd~.c - embed a Pd process within Pd or Max.
-
- Copyright 2008 Miller Puckette
- BSD license; see README.txt in this distribution for details.
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-
-#ifdef _MSC_VER
-#pragma warning (disable: 4305 4244)
-#endif
-
-#ifdef MSP
-#include "ext.h"
-#include "z_dsp.h"
-#include "math.h"
-#include "ext_support.h"
-#include "ext_proto.h"
-#include "ext_obex.h"
-
-typedef double t_floatarg;
-#define w_symbol w_sym
-#define A_SYMBOL A_SYM
-#define getbytes t_getbytes
-#define freebytes t_freebytes
-#define ERROR error(
-void *pd_tilde_class;
-#define MAXPDSTRING 4096
-#define DEFDACBLKSIZE 64
-#endif /* MSP */
-
-#ifdef PD
-#include "m_pd.h"
-#include "s_stuff.h"
-static t_class *pd_tilde_class;
-char *class_gethelpdir(t_class *c);
-#define ERROR pd_error(x,
-
-#endif
-
-#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
-#ifdef __x86_64__
-static char pd_tilde_dllextent[] = ".l_ia64",
- pd_tilde_dllextent2[] = ".pd_linux";
-#else
-static char pd_tilde_dllextent[] = ".l_i386",
- pd_tilde_dllextent2[] = ".pd_linux";
-#endif
-#endif
-#ifdef __APPLE__
-static char pd_tilde_dllextent[] = ".d_fat",
- pd_tilde_dllextent2[] = ".pd_darwin";
-#endif
-#if defined(_WIN32) || defined(__CYGWIN__)
-static char pd_tilde_dllextent[] = ".m_i386", pd_tilde_dllextent2[] = ".dll";
-#endif
-
-/* ------------------------ pd_tilde~ ----------------------------- */
-
-#define MSGBUFSIZE 65536
-
-typedef struct _pd_tilde
-{
-#ifdef PD
- t_object x_obj;
- t_clock *x_clock;
- t_outlet *x_outlet1; /* for messages back from subproc */
- t_canvas *x_canvas;
-#endif /* PD */
-#ifdef MSP
- t_pxobject x_obj;
- void *x_outlet1;
- void *x_clock;
-#endif /* MSP */
- FILE *x_infd;
- FILE *x_outfd;
- char *x_msgbuf;
- int x_msgbufsize;
- int x_infill;
- int x_childpid;
- int x_ninsig;
- int x_noutsig;
- int x_fifo;
- t_float x_sr;
- t_symbol *x_pddir;
- t_symbol *x_schedlibdir;
- t_sample **x_insig;
- t_sample **x_outsig;
-} t_pd_tilde;
-
-#ifdef MSP
-static void *pd_tilde_new(t_symbol *s, long ac, t_atom *av);
-static void pd_tilde_tick(t_pd_tilde *x);
-static t_int *pd_tilde_perform(t_int *w);
-static void pd_tilde_dsp(t_pd_tilde *x, t_signal **sp);
-void pd_tilde_assist(t_pd_tilde *x, void *b, long m, long a, char *s);
-static void pd_tilde_free(t_pd_tilde *x);
-void pd_tilde_setup(void);
-int main();
-void pd_tilde_minvel_set(t_pd_tilde *x, void *attr, long ac, t_atom *av);
-char *strcpy(char *s1, const char *s2);
-#endif
-
-static void pd_tilde_tick(t_pd_tilde *x);
-static void pd_tilde_close(t_pd_tilde *x)
-{
- if (x->x_outfd)
- fclose(x->x_outfd);
- if (x->x_infd)
- fclose(x->x_infd);
- if (x->x_childpid > 0)
- waitpid(x->x_childpid, 0, 0);
- if (x->x_msgbuf)
- free(x->x_msgbuf);
- x->x_infd = x->x_outfd = 0;
- x->x_childpid = -1;
- x->x_msgbuf = 0;
- x->x_msgbufsize = 0;
-}
-
-static void pd_tilde_readmessages(t_pd_tilde *x)
-{
- int gotsomething = 0, setclock = 0, wasempty = (x->x_infill == 0);
- FILE *infd = x->x_infd;
- while (1)
- {
- int c = getc(infd);
- if (c == EOF)
- {
- ERROR "pd~: %s", strerror(errno));
- pd_tilde_close(x);
- break;
- }
- if (x->x_infill >= x->x_msgbufsize)
- {
- char *z = realloc(x->x_msgbuf, x->x_msgbufsize+MSGBUFSIZE);
- if (!z)
- {
- ERROR "pd~: failed to grow input buffer");
- pd_tilde_close(x);
- break;
- }
- x->x_msgbuf = z;
- x->x_msgbufsize += MSGBUFSIZE;
- }
- x->x_msgbuf[x->x_infill++] = c;
- if (c == ';')
- {
- if (!gotsomething)
- break;
- gotsomething = 0;
- }
- else if (!isspace(c))
- gotsomething = setclock = 1;
- }
- if (setclock)
- clock_delay(x->x_clock, 0);
- else if (wasempty)
- x->x_infill = 0;
-}
-
-static void pd_tilde_donew(t_pd_tilde *x, char *pddir, char *schedlibdir,
- char *patchdir, char *pdargs, int ninsig, int noutsig, int fifo,
- t_float samplerate)
-{
- int i, pid, pipe1[2], pipe2[2];
- char cmdbuf[MAXPDSTRING], pdexecbuf[MAXPDSTRING], schedbuf[MAXPDSTRING];
- struct stat statbuf;
- x->x_infd = x->x_outfd = 0;
- x->x_childpid = -1;
- snprintf(pdexecbuf, MAXPDSTRING, "%s/bin/pd", pddir);
- if (stat(pdexecbuf, &statbuf) < 0)
- {
- snprintf(pdexecbuf, MAXPDSTRING, "%s/../../../bin/pd", pddir);
- if (stat(pdexecbuf, &statbuf) < 0)
- {
- snprintf(pdexecbuf, MAXPDSTRING, "%s/pd", pddir);
- if (stat(pdexecbuf, &statbuf) < 0)
- {
- ERROR "pd~: can't stat %s", pdexecbuf);
- goto fail1;
- }
- }
- }
- snprintf(schedbuf, MAXPDSTRING, "%s/pdsched%s", schedlibdir,
- pd_tilde_dllextent);
- if (stat(schedbuf, &statbuf) < 0)
- {
- snprintf(schedbuf, MAXPDSTRING, "%s/pdsched%s", schedlibdir,
- pd_tilde_dllextent2);
- if (stat(schedbuf, &statbuf) < 0)
- {
- ERROR "pd~: can't stat %s", schedbuf);
- goto fail1;
- }
- }
- snprintf(cmdbuf, MAXPDSTRING,
-"'%s' -schedlib '%s'/pdsched -path '%s' -inchannels %d -outchannels %d -r %g %s\n",
- pdexecbuf, schedlibdir, patchdir, ninsig, noutsig, samplerate, pdargs);
-#if 0
-#ifdef PD
- fprintf(stderr, "%s", cmdbuf);
-#endif
- post("cmd: %s", cmdbuf);
-#endif
- if (pipe(pipe1) < 0)
- {
- ERROR "pd~: can't create pipe");
- goto fail1;
- }
- if (pipe(pipe2) < 0)
- {
- ERROR "pd~: can't create pipe");
- goto fail2;
- }
- if ((pid = fork()) < 0)
- {
- ERROR "pd~: can't fork");
- goto fail3;
- }
- else if (pid == 0)
- {
- /* child process */
- if (pipe2[1] == 0)
- {
- dup2(pipe2[1], 20);
- close(pipe2[1]);
- pipe2[1] = 20;
- }
- dup2(pipe1[0], 0);
- dup2(pipe2[1], 1);
- if (pipe1[0] >= 2)
- close(pipe1[0]);
- if (pipe1[1] >= 2)
- close(pipe1[1]);
- if (pipe2[0] >= 2)
- close(pipe2[0]);
- if (pipe2[1] >= 2)
- close(pipe2[1]);
- execl("/bin/sh", "sh", "-c", cmdbuf, (char*)0);
- _exit(1);
- }
- /* OK, we're parent */
- close(pipe1[0]);
- close(pipe2[1]);
- fcntl(pipe1[1], F_SETFD, FD_CLOEXEC);
- fcntl(pipe2[0], F_SETFD, FD_CLOEXEC);
- x->x_outfd = fdopen(pipe1[1], "w");
- x->x_infd = fdopen(pipe2[0], "r");
- x->x_childpid = pid;
- for (i = 0; i < fifo; i++)
- fprintf(x->x_outfd, "%s", ";\n0;\n");
- fflush(x->x_outfd);
- if (!(x->x_msgbuf = calloc(MSGBUFSIZE, 1)))
- {
- ERROR "pd~: can't allocate message buffer");
- goto fail3;
- }
- x->x_msgbufsize = MSGBUFSIZE;
- x->x_infill = 0;
- /* fprintf(stderr, "read...\n"); */
- pd_tilde_readmessages(x);
- /* fprintf(stderr, "... done.\n"); */
- return;
-fail3:
- close(pipe2[0]);
- close(pipe2[1]);
- if (x->x_childpid > 0)
- waitpid(x->x_childpid, 0, 0);
-fail2:
- close(pipe1[0]);
- close(pipe1[1]);
-fail1:
- x->x_infd = x->x_outfd = 0;
- x->x_childpid = -1;
- return;
-}
-
-static t_int *pd_tilde_perform(t_int *w)
-{
- t_pd_tilde *x = (t_pd_tilde *)(w[1]);
- int n = (int)(w[2]), i, j, numbuffill = 0, c;
- char numbuf[80];
- FILE *infd = x->x_infd;
- if (!infd)
- goto zeroit;
- fprintf(x->x_outfd, ";\n");
- if (!x->x_ninsig)
- fprintf(x->x_outfd, "0\n");
- else for (i = 0; i < x->x_ninsig; i++)
- {
- t_sample *fp = x->x_insig[i];
- for (j = 0; j < n; j++)
- fprintf(x->x_outfd, "%g\n", *fp++);
- for (; j < DEFDACBLKSIZE; j++)
- fprintf(x->x_outfd, "0\n");
- }
- fprintf(x->x_outfd, ";\n");
- fflush(x->x_outfd);
- i = j = 0;
- while (1)
- {
- while (1)
- {
- c = getc(infd);
- if (c == EOF)
- {
- if (errno)
- ERROR "pd~: %s", strerror(errno));
- else ERROR "pd~: subprocess exited");
- pd_tilde_close(x);
- goto zeroit;
- }
- else if (!isspace(c) && c != ';')
- {
- if (numbuffill < (80-1))
- numbuf[numbuffill++] = c;
- }
- else
- {
- t_sample z;
- if (numbuffill)
- {
- numbuf[numbuffill] = 0;
- if (sscanf(numbuf, "%f", &z) < 1)
- continue;
- if (i < x->x_noutsig)
- x->x_outsig[i][j] = z;
- if (++j >= DEFDACBLKSIZE)
- j = 0, i++;
- }
- numbuffill = 0;
- break;
- }
- }
- /* message terminated */
- if (c == ';')
- break;
- }
- for (; i < x->x_noutsig; i++, j = 0)
- {
- for (; j < DEFDACBLKSIZE; j++)
- x->x_outsig[i][j] = 0;
- }
- pd_tilde_readmessages(x);
- return (w+3);
-zeroit:
- for (i = 0; i < x->x_noutsig; i++)
- {
- for (j = 0; j < DEFDACBLKSIZE; j++)
- x->x_outsig[i][j] = 0;
- }
- return (w+3);
-}
-
-static void pd_tilde_dsp(t_pd_tilde *x, t_signal **sp)
-{
- int i, n = (x->x_ninsig || x->x_noutsig ? sp[0]->s_n : 1);
- t_sample **g;
-
- for (i = 0, g = x->x_insig; i < x->x_ninsig; i++, g++)
- *g = (*(sp++))->s_vec;
-
- for (i = 0, g = x->x_outsig; i < x->x_noutsig; i++, g++)
- *g = (*(sp++))->s_vec;
-
- dsp_add(pd_tilde_perform, 2, x, n);
-}
-
-static void pd_tilde_pdtilde(t_pd_tilde *x, t_symbol *s,
- int argc, t_atom *argv)
-{
- t_symbol *sel = ((argc > 0 && argv->a_type == A_SYMBOL) ?
- argv->a_w.w_symbol : gensym("?")), *schedlibdir;
- char *patchdir;
- if (sel == gensym("start"))
- {
- char pdargstring[MAXPDSTRING];
- if (x->x_infd)
- pd_tilde_close(x);
- pdargstring[0] = 0;
- argc--; argv++;
-#ifdef PD
- while (argc--)
- {
- atom_string(argv++, pdargstring + strlen(pdargstring),
- MAXPDSTRING - strlen(pdargstring));
- if (strlen(pdargstring) < MAXPDSTRING-1)
- strcat(pdargstring, " ");
- }
- patchdir = canvas_getdir(x->x_canvas)->s_name;
-#endif
-#ifdef MSP
- while (argc--)
- {
- /* because Mac pathnames sometimes have an evil preceeding
- colon character, we test for and silently eat them */
- if (argv->a_type == A_SYM)
- strncat(pdargstring, (*argv->a_w.w_sym->s_name == ':'?
- argv->a_w.w_sym->s_name+1 : argv->a_w.w_sym->s_name),
- MAXPDSTRING - strlen(pdargstring)-3);
- else if (argv->a_type == A_LONG)
- snprintf(pdargstring+strlen(pdargstring),
- MAXPDSTRING - strlen(pdargstring)-3, "%ld",
- argv->a_w.w_long);
- else if (argv->a_type == A_FLOAT)
- snprintf(pdargstring+strlen(pdargstring),
- MAXPDSTRING - strlen(pdargstring)-3, "%f",
- argv->a_w.w_float);
- strcat(pdargstring, " ");
- argv++;
- }
- patchdir = ".";
-#endif
- schedlibdir = x->x_schedlibdir;
- if (schedlibdir == gensym(".") && x->x_pddir != gensym("."))
- {
- char *pds = x->x_pddir->s_name, scheddirstring[MAXPDSTRING];
- int l = strlen(pds);
- if (l >= 4 && (!strcmp(pds+l-3, "bin") || !strcmp(pds+l-4, "bin/")))
- snprintf(scheddirstring, MAXPDSTRING, "%s/../extra/pd~", pds);
- else snprintf(scheddirstring, MAXPDSTRING, "%s/extra/pd~", pds);
- schedlibdir = gensym(scheddirstring);
- }
- pd_tilde_donew(x, x->x_pddir->s_name, schedlibdir->s_name,
- patchdir, pdargstring, x->x_ninsig, x->x_noutsig, x->x_fifo,
- x->x_sr);
- }
- else if (sel == gensym("stop"))
- {
- if (x->x_infd)
- pd_tilde_close(x);
- }
- else if (sel == gensym("pddir"))
- {
- if ((argc > 1) && argv[1].a_type == A_SYMBOL)
- {
- t_symbol *sym = argv[1].a_w.w_symbol;
-#ifdef MSP
- if (sym->s_name[0] == ':')
- sym = gensym(s->s_name+1);
-#endif
- x->x_pddir = sym;
- }
- else ERROR "pd~ pddir: needs symbol argument");
- }
- else ERROR "pd~: unknown control message: %s", sel->s_name);
-}
-
-static void pd_tilde_free(t_pd_tilde *x)
-{
-#ifdef MSP
- dsp_free((t_pxobject *)x);
-#endif
- pd_tilde_close(x);
- clock_free(x->x_clock);
-}
-
-/* -------------------------- Pd glue ------------------------- */
-#ifdef PD
-
-static void pd_tilde_tick(t_pd_tilde *x)
-{
- int messstart = 0, i, n;
- t_atom *vec;
- t_binbuf *b;
- if (!x->x_msgbuf)
- return;
- b = binbuf_new();
- binbuf_text(b, x->x_msgbuf, x->x_infill);
- /* binbuf_print(b); */
- n = binbuf_getnatom(b);
- vec = binbuf_getvec(b);
- for (i = 0; i < n; i++)
- {
- if (vec[i].a_type == A_SEMI)
- {
- if (i > messstart && vec[messstart].a_type == A_SYMBOL)
- outlet_anything(x->x_outlet1, vec[messstart].a_w.w_symbol,
- i-(messstart+1), vec+(messstart+1));
- else if (i > messstart)
- outlet_list(x->x_outlet1, 0, i-messstart, vec+messstart);
- messstart = i+1;
- }
- }
- binbuf_free(b);
- x->x_infill = 0;
-}
-
-static void pd_tilde_anything(t_pd_tilde *x, t_symbol *s,
- int argc, t_atom *argv)
-{
- char msgbuf[MAXPDSTRING];
- if (!x->x_outfd)
- return;
- fprintf(x->x_outfd, "%s ", s->s_name);
- while (argc--)
- {
- atom_string(argv++, msgbuf, MAXPDSTRING);
- fprintf(x->x_outfd, "%s ", msgbuf);
- }
- fprintf(x->x_outfd, ";\n");
-}
-
-static void *pd_tilde_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_pd_tilde *x = (t_pd_tilde *)pd_new(pd_tilde_class);
- int ninsig = 2, noutsig = 2, j, fifo = 5;
- t_float sr = sys_getsr();
- t_sample **g;
- t_symbol *pddir = sys_libdir,
- *scheddir = gensym(class_gethelpdir(pd_tilde_class));
- /* fprintf(stderr, "pd %s, sched %s\n", pddir->s_name, scheddir->s_name); */
- while (argc > 0)
- {
- t_symbol *firstarg = atom_getsymbolarg(0, argc, argv);
- if (!strcmp(firstarg->s_name, "-sr") && argc > 1)
- {
- sr = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-ninsig") && argc > 1)
- {
- ninsig = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-noutsig") && argc > 1)
- {
- noutsig = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-fifo") && argc > 1)
- {
- fifo = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-pddir") && argc > 1)
- {
- pddir = atom_getsymbolarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-scheddir") && argc > 1)
- {
- scheddir = atom_getsymbolarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else break;
- }
-
- if (argc)
- {
- pd_error(x,
-"usage: pd~ [-sr #] [-ninsig #] [-noutsig #] [-fifo #] [-pddir <>]");
- post(
-"... [-scheddir <>]");
- }
-
- x->x_clock = clock_new(x, (t_method)pd_tilde_tick);
- x->x_insig = (t_sample **)getbytes(ninsig * sizeof(*x->x_insig));
- x->x_outsig = (t_sample **)getbytes(noutsig * sizeof(*x->x_outsig));
- x->x_ninsig = ninsig;
- x->x_noutsig = noutsig;
- x->x_fifo = fifo;
- x->x_sr = sr;
- x->x_pddir = pddir;
- x->x_schedlibdir = scheddir;
- x->x_infd = 0;
- x->x_outfd = 0;
- x->x_outfd = 0;
- x->x_childpid = -1;
- x->x_msgbuf = 0;
- x->x_canvas = canvas_getcurrent();
- for (j = 1, g = x->x_insig; j < ninsig; j++, g++)
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- x->x_outlet1 = outlet_new(&x->x_obj, 0);
- for (j = 0, g = x->x_outsig; j < noutsig; j++, g++)
- outlet_new(&x->x_obj, &s_signal);
- signal(SIGPIPE, SIG_IGN);
-
- return (x);
-}
-
-void pd_tilde_setup(void)
-{
- pd_tilde_class = class_new(gensym("pd~"), (t_newmethod)pd_tilde_new,
- (t_method)pd_tilde_free, sizeof(t_pd_tilde), 0, A_GIMME, 0);
- class_addmethod(pd_tilde_class, nullfn, gensym("signal"), 0);
- class_addmethod(pd_tilde_class, (t_method)pd_tilde_dsp, gensym("dsp"), 0);
- class_addmethod(pd_tilde_class, (t_method)pd_tilde_pdtilde, gensym("pd~"), A_GIMME, 0);
- class_addanything(pd_tilde_class, pd_tilde_anything);
- post("pd~ version 0.2");
-}
-#endif
-
-/* -------------------------- MSP glue ------------------------- */
-#ifdef MSP
-
-#define LOTS 10000
-
-static void pd_tilde_tick(t_pd_tilde *x)
-{
- int messstart = 0, i, n = 0;
- t_atom vec[LOTS];
- long z1 = 0, z2 = 0;
- void *b;
- if (!x->x_msgbuf)
- return;
- b = binbuf_new();
- binbuf_text(b, &x->x_msgbuf, x->x_infill);
- /* binbuf_print(b); */
- while (!binbuf_getatom(b, &z1, &z2, vec+n))
- if (++n >= LOTS)
- break;
- for (i = 0; i < n; i++)
- {
- if (vec[i].a_type == A_SEMI)
- {
- if (i > messstart + 1)
- {
- void *whom;
- if (vec[messstart].a_type == A_SYM)
- outlet_anything(x->x_outlet1, vec[messstart].a_w.w_sym,
- i-messstart-1, vec+(messstart+1));
- else if (vec[messstart].a_type == A_FLOAT && i == messstart+1)
- outlet_float(x->x_outlet1, vec[messstart].a_w.w_float);
- else if (vec[messstart].a_type == A_LONG && i == messstart+1)
- outlet_int(x->x_outlet1, vec[messstart].a_w.w_long);
- else outlet_list(x->x_outlet1, gensym("list"),
- i-messstart, vec+(messstart));
- }
- messstart = i+1;
- }
- }
- binbuf_free(b);
- x->x_infill = 0;
-}
-
-static void pd_tilde_anything(t_pd_tilde *x, t_symbol *s,
- long ac, t_atom *av)
-{
- char msgbuf[MAXPDSTRING], *sp, *ep = msgbuf+MAXPDSTRING;
- if (!x->x_outfd)
- return;
- msgbuf[0] = 0;
- strncpy(msgbuf, s->s_name, MAXPDSTRING);
- msgbuf[MAXPDSTRING-1] = 0;
- sp = msgbuf + strlen(msgbuf);
- while (ac--)
- {
- if (sp < ep-1)
- sp[0] = ' ', sp[1] = 0, sp++;
- if (sp < ep - 80)
- {
- if (av->a_type == A_SYM && strlen(av->a_w.w_sym->s_name) < ep - sp-20)
- strcpy(sp, av->a_w.w_sym->s_name);
- else if (av->a_type == A_LONG)
- sprintf(sp, "%ld" ,av->a_w.w_long);
- else if (av->a_type == A_FLOAT)
- sprintf(sp, "%g" ,av->a_w.w_float);
- }
- sp += strlen(sp);
- av++;
- }
- fprintf(x->x_outfd, "%s;\n", msgbuf);
-}
-
-int main()
-{
- t_class *c;
-
- c = class_new("pd_tilde~", (method)pd_tilde_new, (method)pd_tilde_free, sizeof(t_pd_tilde), (method)0L, A_GIMME, 0);
-
- class_addmethod(c, (method)pd_tilde_dsp, "dsp", A_CANT, 0);
- class_addmethod(c, (method)pd_tilde_assist, "assist", A_CANT, 0);
- class_addmethod(c, (method)pd_tilde_pdtilde, "pd~", A_GIMME, 0);
- class_addmethod(c, (method)pd_tilde_anything, "anything", A_GIMME, 0);
- class_dspinit(c);
-
- class_register(CLASS_BOX, c);
- pd_tilde_class = c;
- post("pd~ version 0.2");
- return (0);
-}
-
-static void *pd_tilde_new(t_symbol *s, long ac, t_atom *av)
-{
- int ninsig = 2, noutsig = 2, fifo = 5, j;
- t_float sr = sys_getsr();
- t_symbol *pddir = gensym("."), *scheddir = gensym(".");
- t_pd_tilde *x;
-
- if (x = (t_pd_tilde *)object_alloc(pd_tilde_class))
- {
- while (ac > 0 && av[0].a_type == A_SYM)
- {
- char *flag = av[0].a_w.w_sym->s_name;
- if (!strcmp(flag, "-sr") && ac > 1)
- {
- sr = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float :
- (av[1].a_type == A_LONG ? av[1].a_w.w_long : 0));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-ninsig") && ac > 1)
- {
- ninsig = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float :
- (av[1].a_type == A_LONG ? av[1].a_w.w_long : 0));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-noutsig") && ac > 1)
- {
- noutsig = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float :
- (av[1].a_type == A_LONG ? av[1].a_w.w_long : 0));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-fifo") && ac > 1)
- {
- fifo = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float :
- (av[1].a_type == A_LONG ? av[1].a_w.w_long : 0));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-pddir") && ac > 1)
- {
- pddir = (av[1].a_type == A_SYM ? av[1].a_w.w_sym : gensym("."));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-scheddir") && ac > 1)
- {
- scheddir = (av[1].a_type == A_SYM ? av[1].a_w.w_sym : gensym("."));
- ac -= 2; av += 2;
- }
- else break;
- }
- if (ac)
- post("pd~: warning: ignoring extra arguments");
- dsp_setup((t_pxobject *)x, ninsig);
- x->x_outlet1 = outlet_new(&x->x_obj, 0);
- for (j = 0; j < noutsig; j++)
- outlet_new((t_pxobject *)x, "signal");
- x->x_clock = clock_new(x, (method)pd_tilde_tick);
- x->x_insig = (t_sample **)getbytes(ninsig * sizeof(*x->x_insig));
- x->x_outsig = (t_sample **)getbytes(noutsig * sizeof(*x->x_outsig));
- x->x_ninsig = ninsig;
- x->x_noutsig = noutsig;
- x->x_fifo = fifo;
- x->x_sr = sr;
- x->x_pddir = pddir;
- x->x_schedlibdir = scheddir;
- x->x_infd = 0;
- x->x_outfd = 0;
- x->x_outfd = 0;
- x->x_childpid = -1;
- x->x_msgbuf = 0;
- }
- return (x);
-}
-
-void pd_tilde_assist(t_pd_tilde *x, void *b, long m, long a, char *s)
-{
-}
-
-#endif /* MSP */
diff --git a/externals/extra/0.43.2/pd~/z.pd b/externals/extra/0.43.2/pd~/z.pd
deleted file mode 100644
index 373201da..00000000
--- a/externals/extra/0.43.2/pd~/z.pd
+++ /dev/null
@@ -1,15 +0,0 @@
-#N canvas 686 241 450 300 10;
-#X obj 65 58 r foo;
-#X obj 62 100 print foo;
-#X obj 244 59 adc~;
-#X obj 238 102 env~ 8192;
-#X floatatom 236 140 5 0 0 0 - - -;
-#X obj 155 234 dac~;
-#X obj 155 191 osc~ 440;
-#X obj 287 204 stdout;
-#X msg 307 153 a b c;
-#X connect 0 0 1 0;
-#X connect 2 0 3 0;
-#X connect 3 0 4 0;
-#X connect 6 0 5 0;
-#X connect 8 0 7 0;
diff --git a/externals/extra/0.43.2/pique/pique-help.pd b/externals/extra/0.43.2/pique/pique-help.pd
deleted file mode 100644
index 1689c95b..00000000
--- a/externals/extra/0.43.2/pique/pique-help.pd
+++ /dev/null
@@ -1,33 +0,0 @@
-#N canvas 143 0 729 407 12;
-#X obj 47 11 pique;
-#X text 105 12 -- find peaks in an FFT spectrum;
-#X obj 214 174 rfft~;
-#X obj 131 129 osc~ 2000;
-#X graph graph2 0 -64 63 64 519 179 719 39;
-#X array fft-real 64 float;
-#X pop;
-#X graph graph3 0 -64 63 64 519 327 719 187;
-#X array fft-imag 64 float;
-#X pop;
-#X obj 214 215 tabwrite~ fft-real;
-#X obj 245 240 tabwrite~ fft-imag;
-#X obj 315 158 metro 1000;
-#X obj 315 116 loadbang;
-#X msg 315 138 1;
-#X obj 91 349 pique;
-#X msg 91 322 64 fft-real fft-imag 10;
-#X obj 91 376 print;
-#X obj 205 132 osc~ 5000;
-#X text 25 37 pique takes unwindowed FFT analyses as input (they should be stored in arrays) and outputs a list of peaks \, giving their peak number \, frequency \, amplitude \, and phase (as a cosine/sine pair.);
-#X text 13 289 message argumnets: number of FFT points \, fft real part \, fft imaginary part \, maximum number of peaks to report.;
-#X text 578 387 updated for Pd 0.31.;
-#X connect 2 0 6 0;
-#X connect 2 1 7 0;
-#X connect 3 0 2 0;
-#X connect 8 0 6 0;
-#X connect 8 0 7 0;
-#X connect 9 0 10 0;
-#X connect 10 0 8 0;
-#X connect 11 0 13 0;
-#X connect 12 0 11 0;
-#X connect 14 0 2 0;
diff --git a/externals/extra/0.43.2/pique/pique.c b/externals/extra/0.43.2/pique/pique.c
deleted file mode 100644
index 7c8b899b..00000000
--- a/externals/extra/0.43.2/pique/pique.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/* Copyright (c) 1999 Miller Puckette. The
-contents of this file are free for any use, but BOTH THE AUTHOR AND UCSD
-DISCLAIM ALL WARRANTIES related to it. Although not written in Java, this
-still should not be used to control any machinery containing a sharp blade or
-combustible materiel, or as part of any life support system or weapon. */
-
-#include "m_pd.h"
-#include <math.h>
-#include <stdio.h>
-/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
-#ifdef _MSC_VER
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-static t_class *pique_class;
-
-typedef struct _pique
-{
- t_object x_obj;
- int x_n;
- t_float x_errthresh;
- t_float *x_freq;
- t_float *x_amp;
- t_float *x_ampre;
- t_float *x_ampim;
-} t_pique;
-
-static void *pique_new(t_floatarg f)
-{
- int n = f;
- t_pique *x = (t_pique *)pd_new(pique_class);
- if (n < 1) n = 100;
- x->x_n = n;
- x->x_errthresh = 0;
- x->x_freq = t_getbytes(n * sizeof(*x->x_freq));
- x->x_amp = t_getbytes(n * sizeof(*x->x_amp));
- x->x_ampre = t_getbytes(n * sizeof(*x->x_ampre));
- x->x_ampim = t_getbytes(n * sizeof(*x->x_ampim));
- outlet_new(&x->x_obj, &s_list);
- return (x);
-}
-
-static t_float hanning(t_float pidetune, t_float sinpidetune)
-{
- t_float pi = 3.141592653589793;
- if (pidetune < 0.01 && pidetune > -0.01) return (1);
- else if (pidetune > 3.14 && pidetune < 3.143) return (0.5);
- else if (pidetune < -3.14 && pidetune > -3.143) return (0.5);
- else return (sinpidetune/pidetune - 0.5 *
- (sinpidetune/(pidetune+pi) + sinpidetune/(pidetune-pi)));
-}
-
-static t_float peakerror(t_word *fpreal, t_word *fpimag, t_float pidetune,
- t_float norm, t_float peakreal, t_float peakimag)
-{
- t_float sinpidetune = sin(pidetune);
- t_float cospidetune = cos(pidetune);
- t_float windowshould = hanning(pidetune, sinpidetune);
- t_float realshould = windowshould * (
- peakreal * cospidetune + peakimag * sinpidetune);
- t_float imagshould = windowshould * (
- peakimag * cospidetune - peakreal * sinpidetune);
- t_float realgot = norm * (fpreal[0].w_float -
- 0.5 * (fpreal[1].w_float + fpreal[-1].w_float));
- t_float imaggot = norm * (fpimag[0].w_float -
- 0.5 * (fpimag[1].w_float + fpimag[-1].w_float));
- t_float realdev = realshould - realgot, imagdev = imagshould - imaggot;
-
- /* post("real %f->%f; imag %f->%f", realshould, realgot,
- imagshould, imaggot); */
- return (realdev * realdev + imagdev * imagdev);
-}
-
-static void pique_doit(int npts, t_word *fpreal, t_word *fpimag,
- int npeak, int *nfound, t_float *fpfreq, t_float *fpamp,
- t_float *fpampre, t_float *fpampim, t_float errthresh)
-{
- t_float srate = sys_getsr(); /* not sure how to get this correctly */
- t_float oneovern = 1.0/ (t_float)npts;
- t_float fperbin = srate * oneovern;
- t_float pow1, pow2 = 0, pow3 = 0, pow4 = 0, pow5 = 0;
- t_float re1, re2 = 0, re3 = fpreal->w_float;
- t_float im1, im2 = 0, im3 = 0, powthresh, relativeerror;
- int count, peakcount = 0, n2 = (npts >> 1);
- t_float *fp1, *fp2;
- t_word *wp1, *wp2;
- for (count = n2, wp1 = fpreal, wp2 = fpimag, powthresh = 0;
- count--; wp1++, wp2++)
- powthresh += (wp1->w_float) * (wp1->w_float) +
- (wp2->w_float) * (wp2->w_float) ;
- powthresh *= 0.00001;
- for (count = 1; count < n2; count++)
- {
- t_float windreal, windimag, pi = 3.141592653589793;
- t_float detune, pidetune, sinpidetune, cospidetune,
- ampcorrect, freqout, ampout, ampoutreal, ampoutimag;
- t_float rpeak, rpeaknext, rpeakprev;
- t_float ipeak, ipeaknext, ipeakprev;
- t_float errleft, errright;
- fpreal++;
- fpimag++;
- re1 = re2;
- re2 = re3;
- re3 = fpreal->w_float;
- im1 = im2;
- im2 = im3;
- im3 = fpimag->w_float;
- if (count < 2) continue;
- pow1 = pow2;
- pow2 = pow3;
- pow3 = pow4;
- pow4 = pow5;
- /* get Hanning-windowed spectrum by convolution */
- windreal = re2 - 0.5 * (re1 + re3);
- windimag = im2 - 0.5 * (im1 + im3);
- pow5 = windreal * windreal + windimag * windimag;
- /* if (count < 30) post("power %f", pow5); */
- if (count < 5) continue;
- /* check for a peak. The actual bin is count-3. */
- if (pow3 <= pow2 || pow3 <= pow4 || pow3 <= pow1 || pow3 <= pow5
- || pow3 < powthresh)
- continue;
- /* go back for the raw FFT values around the peak. */
- rpeak = fpreal[-3].w_float;
- rpeaknext = fpreal[-2].w_float;
- rpeakprev = fpreal[-4].w_float;
- ipeak = fpimag[-3].w_float;
- ipeaknext = fpimag[-2].w_float;
- ipeakprev = fpimag[-4].w_float;
- /* recalculate Hanning-windowed spectrum by convolution */
- windreal = rpeak - 0.5 * (rpeaknext + rpeakprev);
- windimag = ipeak - 0.5 * (ipeaknext + ipeakprev);
-
- detune = ((rpeakprev - rpeaknext) *
- (2.0 * rpeak - rpeakprev - rpeaknext) +
- (ipeakprev - ipeaknext) *
- (2.0 * ipeak - ipeakprev - ipeaknext)) /
- (4.0 * pow3);
- /* if (count < 30) post("detune %f", detune); */
- if (detune > 0.7 || detune < -0.7) continue;
- /* the frequency is the sum of the bin frequency and detuning */
- freqout = fperbin * ((t_float)(count-3) + detune);
- pidetune = pi * detune;
- sinpidetune = sin(pidetune);
- cospidetune = cos(pidetune);
- ampcorrect = 1.0 / hanning(pidetune, sinpidetune);
- /* Multiply by 2 to get real-sinusoid peak amplitude
- and divide by N to normalize FFT */
- ampcorrect *= 2. * oneovern;
- /* amplitude is peak height, corrected for Hanning window shape */
-
- ampout = ampcorrect * sqrt(pow3);
- ampoutreal = ampcorrect *
- (windreal * cospidetune - windimag * sinpidetune);
- ampoutimag = ampcorrect *
- (windreal * sinpidetune + windimag * cospidetune);
- if (errthresh > 0)
- {
- /* post("peak %f %f", freqout, ampout); */
- errleft = peakerror(fpreal-4, fpimag-4, pidetune+pi,
- 2. * oneovern, ampoutreal, ampoutimag);
- errright = peakerror(fpreal-2, fpimag-2, pidetune-pi,
- 2. * oneovern, ampoutreal, ampoutimag);
- relativeerror = (errleft + errright)/(ampout * ampout);
- if (relativeerror > errthresh) continue;
- }
- /* post("power %f, error %f, relative %f",
- pow3, errleft + errright, relativeerror); */
- *fpfreq++ = freqout;
- *fpamp++ = ampout;
- *fpampre++ = ampoutreal;
- *fpampim++ = ampoutimag;
- if (++peakcount == npeak) break;
- }
- *nfound = peakcount;
-}
-
-static void pique_list(t_pique *x, t_symbol *s, int argc, t_atom *argv)
-{
- int npts = atom_getintarg(0, argc, argv);
- t_symbol *symreal = atom_getsymbolarg(1, argc, argv);
- t_symbol *symimag = atom_getsymbolarg(2, argc, argv);
- int npeak = atom_getintarg(3, argc, argv);
- int n;
- t_garray *a;
- t_word *fpreal, *fpimag;
- if (npts < 8 || npeak < 1) error("pique: bad npoints or npeak");
- if (npeak > x->x_n) npeak = x->x_n;
- if (!(a = (t_garray *)pd_findbyclass(symreal, garray_class)) ||
- !garray_getfloatwords(a, &n, &fpreal) ||
- n < npts)
- error("%s: missing or bad array", symreal->s_name);
- else if (!(a = (t_garray *)pd_findbyclass(symimag, garray_class)) ||
- !garray_getfloatwords(a, &n, &fpimag) ||
- n < npts)
- error("%s: missing or bad array", symimag->s_name);
- else
- {
- int nfound, i;
- t_float *fpfreq = x->x_freq;
- t_float *fpamp = x->x_amp;
- t_float *fpampre = x->x_ampre;
- t_float *fpampim = x->x_ampim;
- pique_doit(npts, fpreal, fpimag, npeak,
- &nfound, fpfreq, fpamp, fpampre, fpampim, x->x_errthresh);
- for (i = 0; i < nfound; i++, fpamp++, fpfreq++, fpampre++, fpampim++)
- {
- t_atom at[5];
- SETFLOAT(at, (t_float)i);
- SETFLOAT(at+1, *fpfreq);
- SETFLOAT(at+2, *fpamp);
- SETFLOAT(at+3, *fpampre);
- SETFLOAT(at+4, *fpampim);
- outlet_list(x->x_obj.ob_outlet, &s_list, 5, at);
- }
- }
-}
-
-static void pique_errthresh(t_pique *x, t_floatarg f)
-{
- x->x_errthresh = f;
-}
-
-static void pique_free(t_pique *x)
-{
- int n = x->x_n;
- t_freebytes(x->x_freq, n * sizeof(*x->x_freq));
- t_freebytes(x->x_amp, n * sizeof(*x->x_amp));
- t_freebytes(x->x_ampre, n * sizeof(*x->x_ampre));
- t_freebytes(x->x_ampim, n * sizeof(*x->x_ampim));
-}
-
-void pique_setup(void)
-{
- pique_class = class_new(gensym("pique"), (t_newmethod)pique_new,
- (t_method)pique_free, sizeof(t_pique),0, A_DEFFLOAT, 0);
- class_addlist(pique_class, pique_list);
- class_addmethod(pique_class, (t_method)pique_errthresh,
- gensym("errthresh"), A_FLOAT, 0);
- post("pique 0.1 for PD version 23");
-}
-
diff --git a/externals/extra/0.43.2/rev1-final.pd b/externals/extra/0.43.2/rev1-final.pd
deleted file mode 100644
index 0ed091c4..00000000
--- a/externals/extra/0.43.2/rev1-final.pd
+++ /dev/null
@@ -1,106 +0,0 @@
-#N canvas 133 53 729 468 10;
-#X obj 72 240 inlet~;
-#X obj 347 28 loadbang;
-#X obj 90 376 +~;
-#X obj 52 408 +~;
-#X obj 52 437 outlet~;
-#X obj 409 96 pow;
-#X obj 372 118 *;
-#X floatatom 372 159;
-#X obj 82 264 *~ 0;
-#X obj 177 175 pow;
-#X text 386 140 delay \, msec;
-#X floatatom 201 237;
-#X obj 190 150 * 0.001;
-#X text 206 220 gain for this stage;
-#X obj 103 327 *~ 0;
-#X obj 201 202 *;
-#X text 25 13 Allpass filter for mono reverberator. Arg 1 = delay name \, arg2 = stage number \, arg 3 = delay time;
-#X obj 373 76 8;
-#X obj 409 75 1.79;
-#X obj 114 175 0.7;
-#X obj 363 50 t b b b b;
-#X obj 177 108 0;
-#X obj 372 207 abs;
-#X obj 372 229 moses 0.01;
-#X obj 443 229 print wrong-delay-time;
-#X obj 233 391 inlet~;
-#X obj 219 419 +~;
-#X obj 219 443 outlet~;
-#X text 74 83 decay after;
-#X text 85 98 1 second;
-#X obj 83 119 r \$1-decay;
-#X obj 327 262 r \$1-clear;
-#X obj 240 298 0;
-#X obj 327 281 t b;
-#X obj 327 344 delay;
-#X obj 327 322 + 5;
-#X obj 158 279 delread~ \$2 \$4;
-#X obj 90 397 delwrite~ \$2 \$4;
-#X obj 327 302 f \$4;
-#X obj 371 184 - \$4;
-#X obj 446 75 float \$3;
-#X obj 241 318 1;
-#X obj 158 300 *~ 1;
-#X obj 52 298 *~ 0;
-#X obj 10 209 t b f f;
-#X obj 28 233 *;
-#X obj 10 256 -;
-#X obj 41 258 * -1;
-#X obj 11 297 *~ 0;
-#X obj 214 181 sqrt;
-#X connect 0 0 8 0;
-#X connect 1 0 20 0;
-#X connect 2 0 37 0;
-#X connect 3 0 4 0;
-#X connect 3 0 26 0;
-#X connect 5 0 6 1;
-#X connect 6 0 7 0;
-#X connect 6 0 12 0;
-#X connect 7 0 39 0;
-#X connect 8 0 43 0;
-#X connect 8 0 48 0;
-#X connect 9 0 15 0;
-#X connect 9 0 14 1;
-#X connect 12 0 9 1;
-#X connect 14 0 2 1;
-#X connect 14 0 3 1;
-#X connect 15 0 11 0;
-#X connect 15 0 8 1;
-#X connect 17 0 6 0;
-#X connect 18 0 5 0;
-#X connect 18 0 49 0;
-#X connect 19 0 44 0;
-#X connect 19 0 47 0;
-#X connect 20 0 21 0;
-#X connect 20 0 19 0;
-#X connect 20 1 17 0;
-#X connect 20 2 18 0;
-#X connect 20 3 40 0;
-#X connect 21 0 9 0;
-#X connect 22 0 23 0;
-#X connect 23 1 24 0;
-#X connect 25 0 26 1;
-#X connect 26 0 27 0;
-#X connect 30 0 9 0;
-#X connect 31 0 33 0;
-#X connect 32 0 42 1;
-#X connect 33 0 32 0;
-#X connect 33 0 38 0;
-#X connect 34 0 41 0;
-#X connect 35 0 34 0;
-#X connect 36 0 42 0;
-#X connect 38 0 35 0;
-#X connect 39 0 22 0;
-#X connect 40 0 5 1;
-#X connect 41 0 42 1;
-#X connect 42 0 14 0;
-#X connect 43 0 3 0;
-#X connect 44 0 46 0;
-#X connect 44 1 45 0;
-#X connect 44 2 45 1;
-#X connect 45 0 46 1;
-#X connect 46 0 48 1;
-#X connect 47 0 43 1;
-#X connect 48 0 2 0;
-#X connect 49 0 15 1;
diff --git a/externals/extra/0.43.2/rev1-stage.pd b/externals/extra/0.43.2/rev1-stage.pd
deleted file mode 100644
index c1ee6574..00000000
--- a/externals/extra/0.43.2/rev1-stage.pd
+++ /dev/null
@@ -1,99 +0,0 @@
-#N canvas 86 133 729 452 10;
-#X obj 27 238 inlet~;
-#X obj 347 28 loadbang;
-#X obj 171 281 * -1;
-#X obj 36 353 +~;
-#X obj 69 395 +~;
-#X obj 69 424 outlet~;
-#X obj 409 96 pow;
-#X obj 372 118 *;
-#X floatatom 372 159;
-#X obj 37 262 *~ 0;
-#X obj 177 175 pow;
-#X text 408 162 delay \, msec;
-#X floatatom 177 238;
-#X obj 190 150 * 0.001;
-#X text 182 221 gain for this stage;
-#X obj 49 332 *~ 0;
-#X obj 47 375 *~ 0;
-#X obj 177 203 *;
-#X floatatom 409 119;
-#X text 25 13 Allpass filter for mono reverberator. Arg 1 = delay name \, arg2 = stage number \, arg 3 = delay time;
-#X obj 373 76 8;
-#X obj 409 75 1.79;
-#X obj 68 185 0.7;
-#X obj 363 50 t b b b b;
-#X obj 177 108 0;
-#X obj 372 207 abs;
-#X obj 372 229 moses 0.01;
-#X obj 443 229 print wrong-delay-time;
-#X obj 233 391 inlet~;
-#X obj 219 419 +~;
-#X obj 219 443 outlet~;
-#X text 74 83 decay after;
-#X text 85 98 1 second;
-#X obj 83 119 r \$1-decay;
-#X obj 259 256 r \$1-clear;
-#X obj 206 301 0;
-#X obj 259 275 t b;
-#X obj 259 338 delay;
-#X obj 259 316 + 5;
-#X obj 79 280 delread~ \$2 \$4;
-#X obj 36 447 delwrite~ \$2 \$4;
-#X obj 259 296 f \$4;
-#X obj 371 184 - \$4;
-#X obj 446 75 float \$3;
-#X obj 207 321 1;
-#X obj 79 301 *~ 1;
-#X obj 207 188 sqrt;
-#X floatatom 35 148;
-#X connect 0 0 9 0;
-#X connect 1 0 23 0;
-#X connect 2 0 16 1;
-#X connect 3 0 16 0;
-#X connect 3 0 40 0;
-#X connect 4 0 5 0;
-#X connect 4 0 29 0;
-#X connect 6 0 7 1;
-#X connect 6 0 18 0;
-#X connect 7 0 8 0;
-#X connect 7 0 13 0;
-#X connect 8 0 42 0;
-#X connect 9 0 3 0;
-#X connect 10 0 17 0;
-#X connect 13 0 10 1;
-#X connect 15 0 3 1;
-#X connect 16 0 4 0;
-#X connect 17 0 12 0;
-#X connect 17 0 9 1;
-#X connect 20 0 7 0;
-#X connect 21 0 6 0;
-#X connect 21 0 46 0;
-#X connect 22 0 2 0;
-#X connect 22 0 15 1;
-#X connect 23 0 24 0;
-#X connect 23 0 22 0;
-#X connect 23 1 20 0;
-#X connect 23 2 21 0;
-#X connect 23 3 43 0;
-#X connect 24 0 10 0;
-#X connect 25 0 26 0;
-#X connect 26 1 27 0;
-#X connect 28 0 29 1;
-#X connect 29 0 30 0;
-#X connect 33 0 10 0;
-#X connect 33 0 47 0;
-#X connect 34 0 36 0;
-#X connect 35 0 45 1;
-#X connect 36 0 35 0;
-#X connect 36 0 41 0;
-#X connect 37 0 44 0;
-#X connect 38 0 37 0;
-#X connect 39 0 45 0;
-#X connect 41 0 38 0;
-#X connect 42 0 25 0;
-#X connect 43 0 6 1;
-#X connect 44 0 45 1;
-#X connect 45 0 15 0;
-#X connect 45 0 4 1;
-#X connect 46 0 17 1;
diff --git a/externals/extra/0.43.2/rev1~-help.pd b/externals/extra/0.43.2/rev1~-help.pd
deleted file mode 100644
index 55580bd5..00000000
--- a/externals/extra/0.43.2/rev1~-help.pd
+++ /dev/null
@@ -1,119 +0,0 @@
-#N canvas 55 21 1008 526 12;
-#X obj 148 439 dac~;
-#X obj 58 72 line~;
-#X msg 58 49 0 \, 10000 5;
-#X obj 58 118 cos~;
-#X msg 146 70 1;
-#X obj 146 47 loadbang;
-#X obj 58 95 clip~ 0 0.25;
-#X floatatom 173 264 0 0 0;
-#X obj 251 134 line~;
-#X obj 251 157 cos~;
-#X msg 324 54 -0.25 \, 0.25 100;
-#X obj 251 8 loadbang;
-#X msg 251 31 -0.25;
-#X obj 251 203 *~;
-#X obj 58 140 hip~ 5;
-#X floatatom 162 328 0 0 0;
-#X obj 162 373 pack 0 100;
-#X obj 162 396 line~;
-#X obj 148 416 *~;
-#X obj 162 350 dbtorms;
-#X msg 324 77 -0.25 \, 0.25 400;
-#X floatatom 324 145 0 0 0;
-#X obj 324 191 osc~ 440;
-#X obj 324 168 mtof;
-#X msg 324 31 -0.25 \, 0.25 20;
-#X obj 251 180 *~ 0.1;
-#X msg 324 100 -0.25 \, 0.25 1000;
-#X msg 324 122 -0.25 \, 0.25 2000;
-#X obj 324 226 *~;
-#X obj 342 252 *~;
-#X obj 58 439 dac~;
-#X floatatom 68 323 0 0 0;
-#X obj 68 368 pack 0 100;
-#X obj 68 391 line~;
-#X obj 58 416 *~;
-#X obj 68 346 dbtorms;
-#X msg 324 8 0;
-#X obj 308 257 *~;
-#X obj 58 26 metro 2000;
-#X floatatom 58 4 0 0 0;
-#X msg 220 265 bang;
-#X obj 284 322 env~ 32768;
-#X floatatom 284 344 0 0 0;
-#X text 166 244 1 sec;
-#X text 143 226 dB after;
-#X text 220 245 clear;
-#X text 1 51 impulse;
-#X text 362 7 tone;
-#X text 484 31 beeps;
-#X text 428 167 This is an experimental reverberator design composed
-of a series of allpass filters with exponentially growing delay times.
-Each allpass filter has a gain of 0.7. The reverb time is adjusted
-by adjusting the input gains of the allpass filters. The last unit
-is modified so that its first two "echos" mimic those of an allpass
-but its loop gain depends on reverb time.;
-#X text 430 299 Reverb time is controlled by specifying the dB gain
-(100 normal) after one second \, so that 100 corresponds to infinite
-reverb time \, 70 to two seconds \, 40 to one second \, and 0 to 0
-;
-#X text 671 499 modified for Pd version 0.30.;
-#X msg 560 34 \; pd dsp 1;
-#X text 427 475 The rev1~ module eats about 18% of my 300mHz P2 machine.
-;
-#X obj 148 289 rev1~;
-#X text 428 381 The "clear" button impolitely clears out all the delay
-lines \, You may immediately resume pumping the reverberator \, but
-the input signal should be cleanly enveloped. The output \, too \,
-must be enveloped and may not be opened until 5 msec after the "clear"
-message is sent.;
-#X connect 1 0 6 0;
-#X connect 2 0 1 0;
-#X connect 3 0 14 0;
-#X connect 4 0 1 0;
-#X connect 5 0 4 0;
-#X connect 6 0 3 0;
-#X connect 7 0 54 1;
-#X connect 8 0 9 0;
-#X connect 9 0 25 0;
-#X connect 10 0 8 0;
-#X connect 11 0 12 0;
-#X connect 12 0 8 0;
-#X connect 13 0 14 0;
-#X connect 14 0 34 0;
-#X connect 14 0 54 0;
-#X connect 15 0 19 0;
-#X connect 16 0 17 0;
-#X connect 17 0 18 1;
-#X connect 18 0 0 0;
-#X connect 19 0 16 0;
-#X connect 20 0 8 0;
-#X connect 21 0 23 0;
-#X connect 22 0 13 1;
-#X connect 22 0 28 0;
-#X connect 22 0 28 1;
-#X connect 22 0 29 0;
-#X connect 23 0 22 0;
-#X connect 24 0 8 0;
-#X connect 25 0 13 0;
-#X connect 26 0 8 0;
-#X connect 27 0 8 0;
-#X connect 28 0 29 1;
-#X connect 28 0 13 1;
-#X connect 28 0 37 0;
-#X connect 28 0 37 1;
-#X connect 29 0 13 1;
-#X connect 31 0 35 0;
-#X connect 32 0 33 0;
-#X connect 33 0 34 1;
-#X connect 34 0 30 0;
-#X connect 35 0 32 0;
-#X connect 36 0 8 0;
-#X connect 37 0 13 1;
-#X connect 38 0 2 0;
-#X connect 39 0 38 0;
-#X connect 40 0 54 2;
-#X connect 41 0 42 0;
-#X connect 54 0 18 0;
-#X connect 54 0 41 0;
diff --git a/externals/extra/0.43.2/rev1~.pd b/externals/extra/0.43.2/rev1~.pd
deleted file mode 100644
index 83fd6d20..00000000
--- a/externals/extra/0.43.2/rev1~.pd
+++ /dev/null
@@ -1,64 +0,0 @@
-#N canvas 66 116 512 312 10;
-#X obj 345 154 dbtorms;
-#X obj 316 120 min 100;
-#X obj 316 100 inlet;
-#X obj 45 16 inlet~;
-#X obj 254 298 outlet~;
-#X obj 432 106 inlet;
-#X obj 432 130 t b;
-#X obj 269 145 t b f;
-#X obj 281 185 -;
-#X obj 282 254 line~;
-#X obj 282 233 pack 0 100;
-#X obj 269 166 105;
-#X obj 256 276 *~;
-#X obj 282 210 * 0.01;
-#X text 282 65 reverb decay speed;
-#X text 278 79 (dB left after 1 sec);
-#X text 425 84 bang to clear;
-#X obj 44 41 rev1-stage \$0 \$0-del1 0 8;
-#X obj 44 64 rev1-stage \$0 \$0-del2 1 14.32;
-#X obj 44 87 rev1-stage \$0 \$0-del3 2 25.6328;
-#X obj 44 110 rev1-stage \$0 \$0-del4 3 45.8827;
-#X obj 44 133 rev1-stage \$0 \$0-del5 4 82.1301;
-#X obj 44 156 rev1-stage \$0 \$0-del6 5 147.013;
-#X obj 44 179 rev1-stage \$0 \$0-del7 6 263.153;
-#X obj 44 202 rev1-stage \$0 \$0-del8 7 471.044;
-#X obj 44 225 rev1-stage \$0 \$0-del9 8 843.168;
-#X obj 44 248 rev1-final \$0 \$0-del10 9 1509.27;
-#X obj 346 177 s \$0-decay;
-#X obj 432 153 s \$0-clear;
-#X connect 0 0 27 0;
-#X connect 1 0 0 0;
-#X connect 1 0 7 0;
-#X connect 2 0 1 0;
-#X connect 3 0 17 0;
-#X connect 5 0 6 0;
-#X connect 6 0 28 0;
-#X connect 7 0 11 0;
-#X connect 7 1 8 1;
-#X connect 8 0 13 0;
-#X connect 9 0 12 1;
-#X connect 10 0 9 0;
-#X connect 11 0 8 0;
-#X connect 12 0 4 0;
-#X connect 13 0 10 0;
-#X connect 17 0 18 0;
-#X connect 17 1 18 1;
-#X connect 18 0 19 0;
-#X connect 18 1 19 1;
-#X connect 19 0 20 0;
-#X connect 19 1 20 1;
-#X connect 20 0 21 0;
-#X connect 20 1 21 1;
-#X connect 21 0 22 0;
-#X connect 21 1 22 1;
-#X connect 22 0 23 0;
-#X connect 22 1 23 1;
-#X connect 23 0 24 0;
-#X connect 23 1 24 1;
-#X connect 24 0 25 0;
-#X connect 24 1 25 1;
-#X connect 25 0 26 0;
-#X connect 25 1 26 1;
-#X connect 26 1 12 0;
diff --git a/externals/extra/0.43.2/rev2~-help.pd b/externals/extra/0.43.2/rev2~-help.pd
deleted file mode 100644
index 8f9fbaaf..00000000
--- a/externals/extra/0.43.2/rev2~-help.pd
+++ /dev/null
@@ -1,134 +0,0 @@
-#N canvas 167 160 766 354 12;
-#X floatatom 73 185 0 0 120 0 - - -;
-#X floatatom 106 323 0 0 120 0 - - -;
-#N canvas 0 0 539 448 tests 0;
-#X obj 67 33 inlet;
-#X obj 309 189 inlet;
-#X obj 235 207 line~;
-#X obj 235 230 cos~;
-#X obj 235 68 loadbang;
-#X msg 235 91 -0.25;
-#X obj 235 276 *~;
-#X obj 186 309 hip~ 5;
-#X floatatom 308 218 0 0 0 0 - - -;
-#X obj 308 264 osc~ 440;
-#X obj 308 241 mtof;
-#X obj 235 253 *~ 0.1;
-#X obj 308 299 *~;
-#X obj 326 325 *~;
-#X obj 292 330 *~;
-#X msg 279 150 -0.25 \, 0.25 \$1;
-#X obj 41 148 biquad~ 0 0 1 -1 0;
-#X obj 63 70 t b;
-#X obj 104 72 del 3;
-#X obj 57 101 1;
-#X obj 96 101 0;
-#X obj 41 355 outlet~;
-#X obj 279 126 inlet;
-#X obj 40 175 *~;
-#X connect 0 0 17 0;
-#X connect 1 0 8 0;
-#X connect 2 0 3 0;
-#X connect 3 0 11 0;
-#X connect 4 0 5 0;
-#X connect 5 0 2 0;
-#X connect 6 0 7 0;
-#X connect 7 0 21 0;
-#X connect 8 0 10 0;
-#X connect 9 0 6 1;
-#X connect 9 0 12 0;
-#X connect 9 0 12 1;
-#X connect 9 0 13 0;
-#X connect 10 0 9 0;
-#X connect 11 0 6 0;
-#X connect 12 0 13 1;
-#X connect 12 0 6 1;
-#X connect 12 0 14 0;
-#X connect 12 0 14 1;
-#X connect 13 0 6 1;
-#X connect 14 0 6 1;
-#X connect 15 0 2 0;
-#X connect 16 0 23 0;
-#X connect 17 0 18 0;
-#X connect 17 0 19 0;
-#X connect 18 0 20 0;
-#X connect 19 0 16 0;
-#X connect 19 0 23 1;
-#X connect 20 0 16 0;
-#X connect 20 0 23 1;
-#X connect 22 0 15 0;
-#X connect 23 0 21 0;
-#X restore 17 154 pd tests;
-#X msg 56 35 10;
-#X msg 54 62 20;
-#X msg 53 90 100;
-#X msg 52 115 500;
-#X obj 17 15 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X text 37 9 impulse;
-#N canvas 0 0 450 300 output 0;
-#X obj 54 202 dac~;
-#X obj 132 119 pack 0 100;
-#X obj 132 142 line~;
-#X obj 54 165 *~;
-#X obj 132 97 dbtorms;
-#X obj 33 42 inlet~;
-#X obj 177 42 inlet;
-#X obj 177 74 clip 0 120;
-#X msg 257 133 \; pd dsp 1;
-#X obj 98 42 inlet~;
-#X obj 94 168 *~;
-#X connect 1 0 2 0;
-#X connect 2 0 3 1;
-#X connect 2 0 10 1;
-#X connect 3 0 0 0;
-#X connect 4 0 1 0;
-#X connect 5 0 3 0;
-#X connect 6 0 7 0;
-#X connect 6 0 8 0;
-#X connect 7 0 4 0;
-#X connect 9 0 10 0;
-#X connect 10 0 0 1;
-#X restore 18 324 pd output;
-#X floatatom 97 127 0 0 0 0 - - -;
-#X text 136 96 tone;
-#X text 135 112 pitch;
-#X text 114 185 level \, dB;
-#X floatatom 117 209 0 0 100 0 - - -;
-#X text 158 209 liveness \, 0-100;
-#X text 505 330 modified for Pd version 0.37;
-#X floatatom 161 235 0 0 120 0 - - -;
-#X floatatom 205 259 0 0 120 0 - - -;
-#X text 192 235 crossover frequency \, Hz.;
-#X text 238 260 HF damping \, percent;
-#X obj 30 290 rev2~ 100 90 3000 20;
-#X text 141 324 output level \, dB;
-#X text 281 8 REV2~ - a simple 1-in \, 4-out reverberator;
-#X text 95 35 tone;
-#X text 96 52 bursts;
-#X text 231 37 The creation arguments (level \, liveness \, crossover
-frequency \, HF damping) may also be supplied in four inlets as shown.
-The "liveness" (actually the internal feedback percentage) should be
-100 for infinite reverb \, 90 for longish \, and 80 for short. The
-crossover frequency and HF damping work together: at frequencies above
-crossover \, the feedback is diminished by the "damping" as a percentage.
-So zero HF damping means equal reverb time at all frequencies \, and
-100% damping means almost nothing above the crossover frequency gets
-through.;
-#X text 132 130 (60 for;
-#X text 115 150 middle C);
-#X connect 0 0 21 1;
-#X connect 1 0 9 2;
-#X connect 2 0 9 0;
-#X connect 2 0 21 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 1;
-#X connect 6 0 2 1;
-#X connect 7 0 2 0;
-#X connect 10 0 2 2;
-#X connect 14 0 21 2;
-#X connect 17 0 21 3;
-#X connect 18 0 21 4;
-#X connect 21 0 9 0;
-#X connect 21 1 9 1;
diff --git a/externals/extra/0.43.2/rev2~.pd b/externals/extra/0.43.2/rev2~.pd
deleted file mode 100644
index 5b87faa7..00000000
--- a/externals/extra/0.43.2/rev2~.pd
+++ /dev/null
@@ -1,237 +0,0 @@
-#N canvas 333 147 832 664 12;
-#X obj 161 497 +~;
-#X obj 520 105 inlet;
-#X obj 184 407 *~;
-#X obj 486 412 *~;
-#X obj 285 412 *~;
-#X obj 387 412 *~;
-#X obj 443 546 -~;
-#X obj 364 545 -~;
-#X obj 239 537 +~;
-#X obj 161 534 +~;
-#X obj 162 444 +~;
-#X obj 262 440 +~;
-#X obj 464 501 -~;
-#X obj 387 499 +~;
-#X obj 239 500 -~;
-#X obj 452 105 inlet;
-#X obj 609 429 line~;
-#X obj 509 374 line~;
-#X obj 16 121 delread~ \$0-del1 58.6435;
-#X obj 94 143 delread~ \$0-del2 69.4325;
-#X obj 176 165 delread~ \$0-del3 74.5234;
-#X obj 258 189 delread~ \$0-del4 86.1244;
-#X obj 530 500 *~;
-#X obj 599 501 *~;
-#X obj 161 641 delwrite~ \$0-del1 58.6435;
-#X obj 240 617 delwrite~ \$0-del2 69.4325;
-#X obj 365 595 delwrite~ \$0-del3 74.5234;
-#X obj 444 573 delwrite~ \$0-del4 86.1244;
-#X obj 609 357 dbtorms;
-#X obj 609 403 pack 0 30;
-#X obj 520 211 pack 0 50;
-#X obj 9 390 inlet~;
-#X obj 530 525 outlet~;
-#X obj 599 525 outlet~;
-#X obj 520 187 / 200;
-#X obj 520 162 clip 0 100;
-#X obj 52 236 lop~;
-#X obj 452 137 f \$1;
-#X obj 520 138 f \$2;
-#X obj 625 143 f \$3;
-#X obj 696 143 f \$4;
-#X obj 367 106 loadbang;
-#X obj 667 500 *~;
-#X obj 735 501 *~;
-#X obj 667 525 outlet~;
-#X obj 735 525 outlet~;
-#X obj 625 167 moses 1;
-#X msg 631 193 3000;
-#X obj 705 193 clip 0 100;
-#N canvas 345 88 355 597 early-reflect 0;
-#X obj 119 477 delread~ \$0-ref6 13.645;
-#X obj 119 453 delwrite~ \$0-ref6 13.645;
-#X obj 106 400 delread~ \$0-ref5 16.364;
-#X obj 106 376 delwrite~ \$0-ref5 16.364;
-#X obj 102 324 delread~ \$0-ref4 19.392;
-#X obj 102 300 delwrite~ \$0-ref4 19.392;
-#X obj 106 247 delread~ \$0-ref3 25.796;
-#X obj 106 223 delwrite~ \$0-ref3 25.796;
-#X obj 107 169 delread~ \$0-ref2 43.5337;
-#X obj 107 145 delwrite~ \$0-ref2 43.5337;
-#X obj 110 90 delread~ \$0-ref1 75.2546;
-#X obj 84 119 -~;
-#X obj 49 119 +~;
-#X obj 50 195 +~;
-#X obj 85 196 -~;
-#X obj 84 275 -~;
-#X obj 49 274 +~;
-#X obj 82 349 -~;
-#X obj 48 350 +~;
-#X obj 83 428 -~;
-#X obj 49 428 +~;
-#X obj 65 7 inlet~;
-#X obj 110 66 delwrite~ \$0-ref1 75.2546;
-#X obj 49 508 outlet~;
-#X obj 119 507 outlet~;
-#X connect 0 0 24 0;
-#X connect 2 0 20 1;
-#X connect 2 0 19 1;
-#X connect 4 0 18 1;
-#X connect 4 0 17 1;
-#X connect 6 0 16 1;
-#X connect 6 0 15 1;
-#X connect 8 0 13 1;
-#X connect 8 0 14 1;
-#X connect 10 0 12 1;
-#X connect 10 0 11 1;
-#X connect 11 0 9 0;
-#X connect 12 0 14 0;
-#X connect 12 0 13 0;
-#X connect 13 0 16 0;
-#X connect 13 0 15 0;
-#X connect 14 0 7 0;
-#X connect 15 0 5 0;
-#X connect 16 0 18 0;
-#X connect 16 0 17 0;
-#X connect 17 0 3 0;
-#X connect 18 0 20 0;
-#X connect 18 0 19 0;
-#X connect 19 0 1 0;
-#X connect 20 0 23 0;
-#X connect 21 0 12 0;
-#X connect 21 0 11 0;
-#X connect 21 0 22 0;
-#X restore 9 416 pd early-reflect;
-#X obj 618 216 f;
-#X obj 618 105 inlet;
-#X obj 696 109 inlet;
-#X obj 705 216 f;
-#X obj 705 239 * 0.01;
-#X obj 705 263 pack 0 50;
-#X obj 705 287 line~;
-#X obj 29 269 -~;
-#X obj 28 300 *~;
-#X obj 16 331 +~;
-#X obj 132 240 lop~;
-#X obj 106 274 -~;
-#X obj 105 309 *~;
-#X obj 95 333 +~;
-#X obj 214 245 lop~;
-#X obj 188 273 -~;
-#X obj 187 314 *~;
-#X obj 176 339 +~;
-#X obj 308 249 lop~;
-#X obj 281 274 -~;
-#X obj 281 318 *~;
-#X obj 258 342 +~;
-#X obj 609 379 * 0.125;
-#X text 403 10 control inlets:;
-#X text 9 9 rev2 - simple \, cheap reverberator with;
-#X text 400 29 1: output level \, dB \, 0-100;
-#X text 8 30 one signal inlet and four signal outlets.;
-#X text 399 79 4: high frequency damping \, 0-100;
-#X text 400 62 3: crossover frequency in Hz. (3000 default);
-#X text 400 45 2: liveness \, 0-100 \, usually between 85 and 100;
-#X connect 0 0 9 0;
-#X connect 0 0 7 0;
-#X connect 1 0 38 0;
-#X connect 2 0 10 1;
-#X connect 3 0 12 1;
-#X connect 3 0 13 1;
-#X connect 3 0 43 0;
-#X connect 4 0 11 1;
-#X connect 5 0 13 0;
-#X connect 5 0 12 0;
-#X connect 5 0 42 0;
-#X connect 6 0 27 0;
-#X connect 7 0 26 0;
-#X connect 8 0 25 0;
-#X connect 9 0 24 0;
-#X connect 10 0 14 0;
-#X connect 10 0 0 0;
-#X connect 10 0 22 0;
-#X connect 11 0 0 1;
-#X connect 11 0 14 1;
-#X connect 11 0 23 0;
-#X connect 12 0 8 1;
-#X connect 12 0 6 1;
-#X connect 13 0 9 1;
-#X connect 13 0 7 1;
-#X connect 14 0 8 0;
-#X connect 14 0 6 0;
-#X connect 15 0 37 0;
-#X connect 16 0 22 1;
-#X connect 16 0 23 1;
-#X connect 16 0 42 1;
-#X connect 16 0 43 1;
-#X connect 17 0 4 1;
-#X connect 17 0 2 1;
-#X connect 17 0 5 1;
-#X connect 17 0 3 1;
-#X connect 18 0 36 0;
-#X connect 18 0 57 1;
-#X connect 18 0 59 0;
-#X connect 19 0 60 0;
-#X connect 19 0 61 1;
-#X connect 19 0 63 0;
-#X connect 20 0 67 0;
-#X connect 20 0 64 0;
-#X connect 20 0 65 1;
-#X connect 21 0 71 0;
-#X connect 21 0 69 1;
-#X connect 21 0 68 0;
-#X connect 22 0 32 0;
-#X connect 23 0 33 0;
-#X connect 28 0 72 0;
-#X connect 29 0 16 0;
-#X connect 30 0 17 0;
-#X connect 31 0 49 0;
-#X connect 34 0 30 0;
-#X connect 35 0 34 0;
-#X connect 36 0 57 0;
-#X connect 37 0 28 0;
-#X connect 38 0 35 0;
-#X connect 39 0 46 0;
-#X connect 40 0 48 0;
-#X connect 41 0 37 0;
-#X connect 41 0 38 0;
-#X connect 41 0 39 0;
-#X connect 41 0 40 0;
-#X connect 42 0 44 0;
-#X connect 43 0 45 0;
-#X connect 46 0 47 0;
-#X connect 46 1 50 0;
-#X connect 47 0 50 0;
-#X connect 48 0 53 0;
-#X connect 49 0 10 0;
-#X connect 49 1 11 0;
-#X connect 50 0 36 1;
-#X connect 50 0 60 1;
-#X connect 50 0 64 1;
-#X connect 50 0 68 1;
-#X connect 51 0 50 0;
-#X connect 52 0 40 0;
-#X connect 53 0 54 0;
-#X connect 54 0 55 0;
-#X connect 55 0 56 0;
-#X connect 56 0 58 1;
-#X connect 56 0 62 1;
-#X connect 56 0 66 1;
-#X connect 56 0 70 1;
-#X connect 57 0 58 0;
-#X connect 58 0 59 1;
-#X connect 59 0 2 0;
-#X connect 60 0 61 0;
-#X connect 61 0 62 0;
-#X connect 62 0 63 1;
-#X connect 63 0 4 0;
-#X connect 64 0 65 0;
-#X connect 65 0 66 0;
-#X connect 66 0 67 1;
-#X connect 67 0 5 0;
-#X connect 68 0 69 0;
-#X connect 69 0 70 0;
-#X connect 70 0 71 1;
-#X connect 71 0 3 0;
-#X connect 72 0 29 0;
diff --git a/externals/extra/0.43.2/rev3~-help.pd b/externals/extra/0.43.2/rev3~-help.pd
deleted file mode 100644
index 78ef15f5..00000000
--- a/externals/extra/0.43.2/rev3~-help.pd
+++ /dev/null
@@ -1,136 +0,0 @@
-#N canvas 70 263 765 380 12;
-#X floatatom 99 212 0 0 120 0 - - -;
-#X floatatom 105 340 0 0 120 0 - - -;
-#N canvas 0 0 539 448 tests 0;
-#X obj 67 33 inlet;
-#X obj 309 189 inlet;
-#X obj 235 207 line~;
-#X obj 235 230 cos~;
-#X obj 235 68 loadbang;
-#X msg 235 91 -0.25;
-#X obj 235 276 *~;
-#X obj 186 309 hip~ 5;
-#X floatatom 308 218 0 0 0 0 - - -;
-#X obj 308 264 osc~ 440;
-#X obj 308 241 mtof;
-#X obj 235 253 *~ 0.1;
-#X obj 308 299 *~;
-#X obj 326 325 *~;
-#X obj 292 330 *~;
-#X msg 279 150 -0.25 \, 0.25 \$1;
-#X obj 41 148 biquad~ 0 0 1 -1 0;
-#X obj 63 70 t b;
-#X obj 104 72 del 3;
-#X obj 57 101 1;
-#X obj 96 101 0;
-#X obj 41 355 outlet~;
-#X obj 279 126 inlet;
-#X obj 51 192 *~;
-#X connect 0 0 17 0;
-#X connect 1 0 8 0;
-#X connect 2 0 3 0;
-#X connect 3 0 11 0;
-#X connect 4 0 5 0;
-#X connect 5 0 2 0;
-#X connect 6 0 7 0;
-#X connect 7 0 21 0;
-#X connect 8 0 10 0;
-#X connect 9 0 6 1;
-#X connect 9 0 12 0;
-#X connect 9 0 12 1;
-#X connect 9 0 13 0;
-#X connect 10 0 9 0;
-#X connect 11 0 6 0;
-#X connect 12 0 13 1;
-#X connect 12 0 6 1;
-#X connect 12 0 14 0;
-#X connect 12 0 14 1;
-#X connect 13 0 6 1;
-#X connect 14 0 6 1;
-#X connect 15 0 2 0;
-#X connect 16 0 23 0;
-#X connect 17 0 18 0;
-#X connect 17 0 19 0;
-#X connect 18 0 20 0;
-#X connect 19 0 16 0;
-#X connect 19 0 23 1;
-#X connect 20 0 16 0;
-#X connect 20 0 23 1;
-#X connect 22 0 15 0;
-#X connect 23 0 21 0;
-#X restore 16 171 pd tests;
-#X msg 55 52 10;
-#X msg 53 79 20;
-#X msg 52 107 100;
-#X msg 51 132 500;
-#X obj 16 32 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X text 36 26 impulse;
-#N canvas 0 0 450 300 output 0;
-#X obj 54 202 dac~;
-#X obj 132 119 pack 0 100;
-#X obj 132 142 line~;
-#X obj 54 165 *~;
-#X obj 132 97 dbtorms;
-#X obj 33 42 inlet~;
-#X obj 177 42 inlet;
-#X obj 177 74 clip 0 120;
-#X msg 257 133 \; pd dsp 1;
-#X obj 98 42 inlet~;
-#X obj 94 168 *~;
-#X connect 1 0 2 0;
-#X connect 2 0 3 1;
-#X connect 2 0 10 1;
-#X connect 3 0 0 0;
-#X connect 4 0 1 0;
-#X connect 5 0 3 0;
-#X connect 6 0 7 0;
-#X connect 6 0 8 0;
-#X connect 7 0 4 0;
-#X connect 9 0 10 0;
-#X connect 10 0 0 1;
-#X restore 17 340 pd output;
-#X floatatom 96 144 0 0 0 0 - - -;
-#X text 135 113 tone;
-#X text 134 129 pitch;
-#X text 140 212 level \, dB;
-#X floatatom 134 234 0 0 100 0 - - -;
-#X text 175 234 liveness \, 0-100;
-#X floatatom 169 258 4 0 5000 0 - - -;
-#X floatatom 204 281 0 0 100 0 - - -;
-#X text 217 256 crossover frequency \, Hz.;
-#X text 240 283 HF damping \, percent;
-#X text 140 341 output level \, dB;
-#X text 94 52 tone;
-#X text 95 69 bursts;
-#X text 131 147 (60 for;
-#X text 114 167 middle C);
-#X obj 29 307 rev3~ 100 90 3000 20;
-#X text 263 4 REV3~ - hard-core \, 2-in \, 4-out reverberator;
-#X text 236 56 The creation arguments (level \, liveness \, crossover
-frequency \, HF damping) may also be supplied in four inlets as shown.
-The "liveness" (actually the internal feedback percentage) should be
-100 for infinite reverb \, 90 for longish \, and 80 for short. The
-crossover frequency and HF damping work together: at frequencies above
-crossover \, the feedback is diminished by the "damping" as a percentage.
-So zero HF damping means equal reverb time at all frequencies \, and
-100% damping means almost nothing above the crossover frequency gets
-through.;
-#X text 236 29 (A more expensive \, presumably better \, one than rev2~.)
-;
-#X text 470 352 modified for Pd version 0.37-1;
-#X connect 0 0 25 2;
-#X connect 1 0 9 2;
-#X connect 2 0 9 0;
-#X connect 2 0 25 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 1;
-#X connect 6 0 2 1;
-#X connect 7 0 2 0;
-#X connect 10 0 2 2;
-#X connect 14 0 25 3;
-#X connect 16 0 25 4;
-#X connect 17 0 25 5;
-#X connect 25 0 9 0;
-#X connect 25 1 9 1;
diff --git a/externals/extra/0.43.2/rev3~.pd b/externals/extra/0.43.2/rev3~.pd
deleted file mode 100644
index 0d8ea472..00000000
--- a/externals/extra/0.43.2/rev3~.pd
+++ /dev/null
@@ -1,439 +0,0 @@
-#N canvas 220 79 810 570 12;
-#X obj 520 105 inlet;
-#X obj 452 105 inlet;
-#X obj 370 335 line~;
-#X obj 232 394 *~;
-#X obj 301 395 *~;
-#X obj 370 284 dbtorms;
-#X obj 370 309 pack 0 30;
-#X obj 520 211 pack 0 50;
-#X obj 232 419 outlet~;
-#X obj 301 419 outlet~;
-#X obj 520 162 clip 0 100;
-#X obj 452 137 f \$1;
-#X obj 520 138 f \$2;
-#X obj 625 143 f \$3;
-#X obj 696 143 f \$4;
-#X obj 367 106 loadbang;
-#X obj 369 394 *~;
-#X obj 437 395 *~;
-#X obj 369 419 outlet~;
-#X obj 437 419 outlet~;
-#X obj 625 167 moses 1;
-#X msg 631 193 3000;
-#X obj 705 193 clip 0 100;
-#X obj 616 218 f;
-#X obj 618 105 inlet;
-#X obj 696 109 inlet;
-#X obj 705 216 f;
-#X obj 705 239 * 0.01;
-#X obj 705 263 pack 0 50;
-#X text 403 10 control inlets:;
-#X text 400 29 1: output level \, dB \, 0-100;
-#X text 399 79 4: high frequency damping \, 0-100;
-#X text 400 62 3: crossover frequency in Hz. (3000 default);
-#X text 400 45 2: liveness \, 0-100 \, usually between 85 and 100;
-#X obj 616 242 s \$0-lop;
-#N canvas 169 94 919 805 doit 0;
-#X obj 218 386 *~;
-#X obj 341 396 *~;
-#X obj 267 389 *~;
-#X obj 305 392 *~;
-#X obj 28 175 lop~;
-#X obj 27 204 -~;
-#X obj 27 291 *~;
-#X obj 16 319 +~;
-#X obj 75 182 lop~;
-#X obj 76 214 -~;
-#X obj 77 294 *~;
-#X obj 67 318 +~;
-#X obj 124 187 lop~;
-#X obj 124 214 -~;
-#X obj 125 297 *~;
-#X obj 116 322 +~;
-#X obj 176 191 lop~;
-#X obj 175 218 -~;
-#X obj 175 301 *~;
-#X obj 168 326 +~;
-#X obj 15 372 *~;
-#X obj 169 383 *~;
-#X obj 67 376 *~;
-#X obj 115 380 *~;
-#X obj 207 160 r \$0-lop;
-#X obj 183 246 r \$0-damp;
-#X obj 183 271 line~;
-#X obj 17 14 delread~ \$0-del1 10;
-#X obj 117 56 delread~ \$0-del3 13.4567;
-#X obj 68 35 delread~ \$0-del2 11.6356;
-#X obj 171 77 delread~ \$0-del4 16.7345;
-#X obj 524 407 *~;
-#X obj 631 409 *~;
-#X obj 560 408 *~;
-#X obj 595 409 *~;
-#X obj 377 399 *~;
-#X obj 488 406 *~;
-#X obj 414 402 *~;
-#X obj 451 405 *~;
-#X obj 654 354 line~;
-#X obj 708 387 r \$0-fb;
-#X obj 218 100 delread~ \$0-del5 20.1862;
-#X obj 267 121 delread~ \$0-del6 25.7417;
-#X obj 304 142 delread~ \$0-del7 31.4693;
-#X obj 341 163 delread~ \$0-del8 38.2944;
-#X obj 376 184 delread~ \$0-del9 46.6838;
-#X obj 414 205 delread~ \$0-del10 55.4567;
-#X obj 488 247 delread~ \$0-del12 76.8243;
-#X obj 524 268 delread~ \$0-del13 88.5623;
-#X obj 561 289 delread~ \$0-del14 101.278;
-#X obj 595 310 delread~ \$0-del15 115.397;
-#X obj 632 331 delread~ \$0-del16 130.502;
-#X obj 25 346 inlet~;
-#X obj 87 346 inlet~;
-#X obj 69 440 +~;
-#X obj 105 440 -~;
-#X obj 141 440 +~;
-#X obj 177 440 -~;
-#X obj 214 440 +~;
-#X obj 250 440 -~;
-#X obj 286 440 +~;
-#X obj 322 440 -~;
-#X obj 359 440 +~;
-#X obj 395 440 -~;
-#X obj 431 440 +~;
-#X obj 467 440 -~;
-#X obj 504 440 +~;
-#X obj 540 440 -~;
-#X obj 576 440 +~;
-#X obj 612 440 -~;
-#X obj 69 474 +~;
-#X obj 177 474 -~;
-#X obj 105 474 +~;
-#X obj 141 474 -~;
-#X obj 214 474 +~;
-#X obj 322 474 -~;
-#X obj 250 474 +~;
-#X obj 286 474 -~;
-#X obj 359 474 +~;
-#X obj 467 474 -~;
-#X obj 395 474 +~;
-#X obj 431 474 -~;
-#X obj 504 474 +~;
-#X obj 612 474 -~;
-#X obj 540 474 +~;
-#X obj 576 474 -~;
-#X obj 69 518 +~;
-#X obj 105 518 +~;
-#X obj 322 518 -~;
-#X obj 286 518 -~;
-#X obj 141 518 +~;
-#X obj 177 518 +~;
-#X obj 214 518 -~;
-#X obj 250 518 -~;
-#X obj 360 518 +~;
-#X obj 396 518 +~;
-#X obj 613 518 -~;
-#X obj 577 518 -~;
-#X obj 432 518 +~;
-#X obj 468 518 +~;
-#X obj 505 518 -~;
-#X obj 541 518 -~;
-#X obj 70 575 +~;
-#X obj 106 575 +~;
-#X obj 469 575 -~;
-#X obj 433 575 -~;
-#X obj 142 575 +~;
-#X obj 178 575 +~;
-#X obj 361 575 -~;
-#X obj 397 575 -~;
-#X obj 215 575 +~;
-#X obj 251 575 +~;
-#X obj 287 575 +~;
-#X obj 323 575 +~;
-#X obj 614 575 -~;
-#X obj 578 575 -~;
-#X obj 506 575 -~;
-#X obj 542 575 -~;
-#X obj 628 606 outlet~;
-#X obj 698 606 outlet~;
-#X obj 768 607 outlet~;
-#X obj 838 607 outlet~;
-#X obj 451 226 delread~ \$0-del11 65.1755;
-#X obj 614 629 delwrite~ \$0-del16 130.502;
-#X obj 361 776 delwrite~ \$0-del9 46.6838;
-#X obj 398 755 delwrite~ \$0-del10 55.4567;
-#X obj 434 734 delwrite~ \$0-del11 65.1755;
-#X obj 470 713 delwrite~ \$0-del12 76.8243;
-#X obj 506 692 delwrite~ \$0-del13 88.5623;
-#X obj 542 671 delwrite~ \$0-del14 101.278;
-#X obj 579 650 delwrite~ \$0-del15 115.397;
-#X obj 323 606 delwrite~ \$0-del8 38.2944;
-#X obj 287 628 delwrite~ \$0-del7 31.4693;
-#X obj 252 650 delwrite~ \$0-del6 25.7417;
-#X obj 215 672 delwrite~ \$0-del5 20.1862;
-#X obj 71 761 delwrite~ \$0-del1 10;
-#X obj 106 737 delwrite~ \$0-del2 11.6356;
-#X obj 141 715 delwrite~ \$0-del3 13.4567;
-#X obj 179 693 delwrite~ \$0-del4 16.7345;
-#X connect 0 0 58 0;
-#X connect 0 0 59 0;
-#X connect 1 0 60 1;
-#X connect 1 0 61 1;
-#X connect 2 0 58 1;
-#X connect 2 0 59 1;
-#X connect 3 0 60 0;
-#X connect 3 0 61 0;
-#X connect 4 0 5 0;
-#X connect 5 0 6 0;
-#X connect 6 0 7 1;
-#X connect 7 0 20 0;
-#X connect 8 0 9 0;
-#X connect 9 0 10 0;
-#X connect 10 0 11 1;
-#X connect 11 0 22 0;
-#X connect 12 0 13 0;
-#X connect 13 0 14 0;
-#X connect 14 0 15 1;
-#X connect 15 0 23 0;
-#X connect 16 0 17 0;
-#X connect 17 0 18 0;
-#X connect 18 0 19 1;
-#X connect 19 0 21 0;
-#X connect 20 0 54 0;
-#X connect 20 0 55 0;
-#X connect 21 0 56 1;
-#X connect 21 0 57 1;
-#X connect 22 0 55 1;
-#X connect 22 0 54 1;
-#X connect 23 0 56 0;
-#X connect 23 0 57 0;
-#X connect 24 0 16 1;
-#X connect 24 0 12 1;
-#X connect 24 0 8 1;
-#X connect 24 0 4 1;
-#X connect 25 0 26 0;
-#X connect 26 0 18 1;
-#X connect 26 0 14 1;
-#X connect 26 0 10 1;
-#X connect 26 0 6 1;
-#X connect 27 0 4 0;
-#X connect 27 0 5 1;
-#X connect 27 0 7 0;
-#X connect 28 0 15 0;
-#X connect 28 0 12 0;
-#X connect 28 0 13 1;
-#X connect 29 0 8 0;
-#X connect 29 0 9 1;
-#X connect 29 0 11 0;
-#X connect 30 0 19 0;
-#X connect 30 0 17 1;
-#X connect 30 0 16 0;
-#X connect 31 0 66 0;
-#X connect 31 0 67 0;
-#X connect 32 0 68 1;
-#X connect 32 0 69 1;
-#X connect 33 0 66 1;
-#X connect 33 0 67 1;
-#X connect 34 0 68 0;
-#X connect 34 0 69 0;
-#X connect 35 0 62 0;
-#X connect 35 0 63 0;
-#X connect 36 0 64 1;
-#X connect 36 0 65 1;
-#X connect 37 0 62 1;
-#X connect 37 0 63 1;
-#X connect 38 0 64 0;
-#X connect 38 0 65 0;
-#X connect 39 0 2 1;
-#X connect 39 0 0 1;
-#X connect 39 0 3 1;
-#X connect 39 0 1 1;
-#X connect 39 0 21 1;
-#X connect 39 0 23 1;
-#X connect 39 0 22 1;
-#X connect 39 0 20 1;
-#X connect 39 0 35 1;
-#X connect 39 0 38 1;
-#X connect 39 0 36 1;
-#X connect 39 0 31 1;
-#X connect 39 0 33 1;
-#X connect 39 0 34 1;
-#X connect 39 0 32 1;
-#X connect 39 0 37 1;
-#X connect 40 0 39 0;
-#X connect 41 0 0 0;
-#X connect 42 0 2 0;
-#X connect 43 0 3 0;
-#X connect 44 0 1 0;
-#X connect 45 0 35 0;
-#X connect 46 0 37 0;
-#X connect 47 0 36 0;
-#X connect 48 0 31 0;
-#X connect 49 0 33 0;
-#X connect 50 0 34 0;
-#X connect 51 0 32 0;
-#X connect 52 0 20 0;
-#X connect 53 0 22 0;
-#X connect 54 0 70 0;
-#X connect 54 0 73 0;
-#X connect 55 0 72 0;
-#X connect 55 0 71 0;
-#X connect 56 0 70 1;
-#X connect 56 0 73 1;
-#X connect 57 0 72 1;
-#X connect 57 0 71 1;
-#X connect 58 0 74 0;
-#X connect 58 0 77 0;
-#X connect 59 0 76 0;
-#X connect 59 0 75 0;
-#X connect 60 0 74 1;
-#X connect 60 0 77 1;
-#X connect 61 0 76 1;
-#X connect 61 0 75 1;
-#X connect 62 0 78 0;
-#X connect 62 0 81 0;
-#X connect 63 0 80 0;
-#X connect 63 0 79 0;
-#X connect 64 0 78 1;
-#X connect 64 0 81 1;
-#X connect 65 0 80 1;
-#X connect 65 0 79 1;
-#X connect 66 0 82 0;
-#X connect 66 0 85 0;
-#X connect 67 0 84 0;
-#X connect 67 0 83 0;
-#X connect 68 0 82 1;
-#X connect 68 0 85 1;
-#X connect 69 0 84 1;
-#X connect 69 0 83 1;
-#X connect 70 0 86 0;
-#X connect 70 0 92 0;
-#X connect 71 0 91 0;
-#X connect 71 0 88 0;
-#X connect 72 0 87 0;
-#X connect 72 0 93 0;
-#X connect 73 0 90 0;
-#X connect 73 0 89 0;
-#X connect 74 0 86 1;
-#X connect 74 0 92 1;
-#X connect 75 0 91 1;
-#X connect 75 0 88 1;
-#X connect 76 0 87 1;
-#X connect 76 0 93 1;
-#X connect 77 0 90 1;
-#X connect 77 0 89 1;
-#X connect 78 0 94 0;
-#X connect 78 0 100 0;
-#X connect 79 0 99 0;
-#X connect 79 0 96 0;
-#X connect 80 0 95 0;
-#X connect 80 0 101 0;
-#X connect 81 0 98 0;
-#X connect 81 0 97 0;
-#X connect 82 0 94 1;
-#X connect 82 0 100 1;
-#X connect 83 0 99 1;
-#X connect 83 0 96 1;
-#X connect 84 0 95 1;
-#X connect 84 0 101 1;
-#X connect 85 0 98 1;
-#X connect 85 0 97 1;
-#X connect 86 0 102 0;
-#X connect 86 0 108 0;
-#X connect 87 0 103 0;
-#X connect 87 0 109 0;
-#X connect 88 0 113 0;
-#X connect 88 0 114 0;
-#X connect 89 0 112 0;
-#X connect 89 0 115 0;
-#X connect 90 0 106 0;
-#X connect 90 0 105 0;
-#X connect 91 0 107 0;
-#X connect 91 0 104 0;
-#X connect 92 0 110 0;
-#X connect 92 0 116 0;
-#X connect 93 0 111 0;
-#X connect 93 0 117 0;
-#X connect 94 0 108 1;
-#X connect 94 0 102 1;
-#X connect 95 0 109 1;
-#X connect 95 0 103 1;
-#X connect 96 0 114 1;
-#X connect 96 0 113 1;
-#X connect 97 0 115 1;
-#X connect 97 0 112 1;
-#X connect 98 0 105 1;
-#X connect 98 0 106 1;
-#X connect 99 0 104 1;
-#X connect 99 0 107 1;
-#X connect 100 0 116 1;
-#X connect 100 0 110 1;
-#X connect 101 0 117 1;
-#X connect 101 0 111 1;
-#X connect 102 0 135 0;
-#X connect 103 0 136 0;
-#X connect 104 0 127 0;
-#X connect 105 0 126 0;
-#X connect 106 0 137 0;
-#X connect 107 0 138 0;
-#X connect 108 0 124 0;
-#X connect 109 0 125 0;
-#X connect 110 0 134 0;
-#X connect 111 0 133 0;
-#X connect 112 0 132 0;
-#X connect 113 0 131 0;
-#X connect 114 0 121 0;
-#X connect 114 0 123 0;
-#X connect 115 0 120 0;
-#X connect 115 0 130 0;
-#X connect 116 0 118 0;
-#X connect 116 0 128 0;
-#X connect 117 0 119 0;
-#X connect 117 0 129 0;
-#X connect 122 0 38 0;
-#X restore 164 317 pd doit;
-#X obj 165 255 inlet~;
-#X obj 222 255 inlet~;
-#X obj 520 241 s \$0-fb;
-#X obj 705 290 s \$0-damp;
-#X text 57 490 rev3 - 16-delay reverberator. Like rev2~ but presumably
-higher-quality and takes two audio inputs.;
-#X obj 520 187 / 400;
-#X connect 0 0 12 0;
-#X connect 1 0 11 0;
-#X connect 2 0 3 1;
-#X connect 2 0 4 1;
-#X connect 2 0 16 1;
-#X connect 2 0 17 1;
-#X connect 3 0 8 0;
-#X connect 4 0 9 0;
-#X connect 5 0 6 0;
-#X connect 6 0 2 0;
-#X connect 7 0 38 0;
-#X connect 10 0 41 0;
-#X connect 11 0 5 0;
-#X connect 12 0 10 0;
-#X connect 13 0 20 0;
-#X connect 14 0 22 0;
-#X connect 15 0 11 0;
-#X connect 15 0 12 0;
-#X connect 15 0 13 0;
-#X connect 15 0 14 0;
-#X connect 16 0 18 0;
-#X connect 17 0 19 0;
-#X connect 20 0 21 0;
-#X connect 20 1 23 0;
-#X connect 21 0 23 0;
-#X connect 22 0 26 0;
-#X connect 23 0 34 0;
-#X connect 24 0 23 0;
-#X connect 25 0 14 0;
-#X connect 26 0 27 0;
-#X connect 27 0 28 0;
-#X connect 28 0 39 0;
-#X connect 35 0 3 0;
-#X connect 35 1 4 0;
-#X connect 35 2 16 0;
-#X connect 35 3 17 0;
-#X connect 36 0 35 0;
-#X connect 37 0 35 1;
-#X connect 41 0 7 0;
diff --git a/externals/extra/0.43.2/sigmund~/sigmund~-help.pd b/externals/extra/0.43.2/sigmund~/sigmund~-help.pd
deleted file mode 100644
index 5ddbf6d1..00000000
--- a/externals/extra/0.43.2/sigmund~/sigmund~-help.pd
+++ /dev/null
@@ -1,194 +0,0 @@
-#N canvas 167 -7 580 617 12;
-#X text 42 4 sigmund~ - sinusoidal analysis and pitch tracking;
-#N canvas 432 117 573 597 using-with-tables 0;
-#X obj 29 368 print peak;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array insignal 1024 float 2;
-#X coords 0 1 1023 -1 200 140 1;
-#X restore 83 426 graph;
-#X obj 314 513 phasor~;
-#X obj 294 429 loadbang;
-#X obj 314 461 440;
-#X floatatom 313 488 5 0 0 0 - - -;
-#X obj 305 544 tabwrite~ insignal;
-#X obj 290 516 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
--1 -1;
-#X text 114 11 Using sigmund~ on arrays;
-#X text 42 33 If invoked with the "-t" flag (as a creation argument)
-\, sigmund~ analyzes waveforms stored in arrays. Instead of an incoming
-signal \, feed it "list" messages with the following arguments:;
-#X text 37 118 table name (a symbol);
-#X text 38 137 number of points;
-#X obj 29 342 sigmund~ -t -npeak 10 -maxfreq 5000 peaks;
-#X msg 29 316 list insignal 1024 0 44100 0;
-#X text 37 158 index of first point;
-#X text 39 179 sample rate;
-#X text 38 200 debug flag (print debugging info if nonzero);
-#X text 23 232 In this mode \, only the "env" \, "pitch" \, and "peaks"
-outputs are meaningful.;
-#X text 31 294 click here to test:;
-#X connect 2 0 6 0;
-#X connect 3 0 4 0;
-#X connect 4 0 5 0;
-#X connect 5 0 2 0;
-#X connect 5 0 7 0;
-#X connect 7 0 6 0;
-#X connect 12 0 0 0;
-#X connect 13 0 12 0;
-#X restore 330 553 pd using-with-tables;
-#X obj 40 512 phasor~;
-#X obj 40 425 loadbang;
-#X floatatom 40 471 5 0 120 0 - - -;
-#X floatatom 39 561 5 0 0 0 - - -;
-#X floatatom 245 563 5 0 0 0 - - -;
-#X obj 40 490 mtof;
-#X obj 40 448 69;
-#X text 38 579 pitch;
-#X text 222 582 envelope;
-#X text 13 28 Sigmund~ analyzes an incoming sound into sinusoidal components
-\, which may be reported individually or combined to form a pitch estimate.
-Possible outputs are specified as creation arguments:;
-#X text 56 95 pitch - output pitch continuously;
-#N canvas 518 74 588 728 setting-parameters 0;
-#X msg 182 66 print;
-#X floatatom 192 92 5 0 0 0 - - -;
-#X msg 192 113 minpower \$1;
-#X obj 182 139 sigmund~ -minpower 40;
-#X text 39 14 You can set parameters either by creation arguments \,
-or else using messages. The "print" message gives you the current values
-of all the parameters:;
-#X text 28 169 npts: number of points used in an analysis. Must be
-a power of two \, at least 128 The minimum frequency that can be tracked
-is about 2(sample_rate)/npts.;
-#X text 26 219 hop: number of points between analyses. Must be a power
-of two \, at least the DSP vector size (usually 64). This regulates
-the number of analyses done per unit of time.;
-#X text 28 271 npeak: maximum number of sinusoidal peaks to look for.
-The computation time is quadratic in the number of peaks actually found
-(this number only sets an upper limit). Use it to balance CPU time
-with quality of results.;
-#X text 30 336 maxfreq: maximum frequency of sinusoidal peaks to look
-for. This can be useful in situations where background noise creates
-high-frequency \, spurious peaks..;
-#X text 37 388 vibrato: maximum deviation from "pitch" to accept as
-normal vibrato (affects "notes" output only). If the value is too small.
-vibratos will appear as trills. If too large \, very small melodic
-intervals may not be reported as new notes.;
-#X text 33 457 stabletime: time period to wait before reporting a note
-(affects "notes" output only). The "pitch" must be present and must
-not vary more than "vibrato" for this entire period to report a note.
-If too large \, the "notes" will be unnecessarily delayed. If too small
-\, spurious notes get output.;
-#X text 31 551 minpower: minimum measured RMS level to report a pitch
-(affects "pitch" and "notes" output only). Signals quieter than this
-will be assumed to be crosstalk and ignored.;
-#X text 32 602 growth: minimum measured RMS growth to report a new
-note (affects "notes" output only). The RMS level must rise by this
-many dB (within a time period given by "stabletime") to report a repetition
-of a note at or near the previously output pitch.;
-#X connect 0 0 3 0;
-#X connect 1 0 2 0;
-#X connect 2 0 3 0;
-#X restore 330 531 pd setting-parameters;
-#N canvas 67 29 641 815 sinusoid-tracking 0;
-#X obj 124 267 sigmund~ -npeak 10 peaks;
-#X obj 124 214 phasor~;
-#X obj 124 144 loadbang;
-#X floatatom 124 190 5 0 120 0 - - -;
-#X obj 124 295 route 0 1 2 3 4 5 6 7 8 9;
-#X obj 82 339 unpack 0 0 0 0;
-#X floatatom 82 461 5 0 0 0 - - -;
-#X floatatom 122 431 5 0 0 0 - - -;
-#X floatatom 162 406 5 0 0 0 - - -;
-#X obj 124 167 440;
-#X floatatom 203 380 5 0 0 0 - - -;
-#X obj 322 349 unpack 0 0 0 0;
-#X floatatom 322 471 5 0 0 0 - - -;
-#X floatatom 362 441 5 0 0 0 - - -;
-#X floatatom 402 416 5 0 0 0 - - -;
-#X floatatom 443 390 5 0 0 0 - - -;
-#X text 385 475 frequency (Hz.);
-#X text 419 442 peak amplitude (linear);
-#X text 464 416 cosine component;
-#X text 499 390 sine component;
-#X text 79 505 loudest partial;
-#X text 332 508 quietest partial;
-#X text 36 4 You can ask for sinusoidal peaks in decreasing order of
-amplitude or arranged into maximally continuous tracks for resynthesis.
-(Or you can ask for both.) If you ask for peaks \, out come lists of
-five numbers \, one for each sinusoid at each analysis period. The
-first is the index number of the sinusoid (so you can use "route" to
-claw them apart). The other four are as shown:;
-#X obj 204 611 osc~ 440;
-#X obj 204 635 *~;
-#X obj 205 689 unpack 0 0 0 0;
-#X floatatom 205 782 5 0 0 0 - - -;
-#X floatatom 245 760 5 0 0 0 - - -;
-#X floatatom 285 737 5 0 0 0 - - -;
-#X floatatom 326 713 5 0 0 0 - - -;
-#X obj 246 638 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X text 43 535 If you ask for "tracks" \, the output is four numbers:
-index \, frequency \, and amplitude as before \, and finally a flag
-which is one for a new track \, zero for a continuation \, minus one
-for an empty track.;
-#X obj 205 662 sigmund~ -npts 16384 -hop 8192 -npeak 1 tracks;
-#X connect 0 0 4 0;
-#X connect 1 0 0 0;
-#X connect 2 0 9 0;
-#X connect 3 0 1 0;
-#X connect 4 0 5 0;
-#X connect 4 9 11 0;
-#X connect 5 0 6 0;
-#X connect 5 1 7 0;
-#X connect 5 2 8 0;
-#X connect 5 3 10 0;
-#X connect 9 0 3 0;
-#X connect 11 0 12 0;
-#X connect 11 1 13 0;
-#X connect 11 2 14 0;
-#X connect 11 3 15 0;
-#X connect 23 0 24 0;
-#X connect 24 0 32 0;
-#X connect 25 0 26 0;
-#X connect 25 1 27 0;
-#X connect 25 2 28 0;
-#X connect 25 3 29 0;
-#X connect 30 0 24 1;
-#X connect 32 0 25 0;
-#X restore 330 508 pd sinusoid-tracking;
-#X text 52 165 tracks - output sinusoidal peaks organized into tracks
-;
-#X text 56 111 notes - output pitch at the beginning of notes;
-#X text 339 485 more details:;
-#X text 10 184 Parameters you may set (in creation arguments or messages):
-;
-#X text 60 207 npts - number of points in each analysis window (1024)
-;
-#X text 60 225 hop - number of points between each analysis (512);
-#X text 60 242 npeak - number of sinusoidal peaks (20);
-#X text 61 279 vibrato - depth of vibrato to expect in 1/2-tones (1)
-;
-#X text 60 298 stabletime - time (msec) to wait to report notes (50)
-;
-#X obj 39 535 sigmund~ -hop 4096 pitch env;
-#X text 62 316 minpower - minimum power (dB) to report a pitch (50)
-;
-#X text 62 335 growth - growth (dB) to report a new note (7);
-#X text 54 147 peaks - output all sinusoidal peaks in order of amplitude
-;
-#X text 11 356 The npts and hop parameters are in samples \, and are
-powers of two. The example below specifies a huge hop of 4096 (to slow
-the output down) and to output "pitch" and "env". (Those are the default
-outputs.);
-#X text 61 260 maxfreq - maximum sinusoid frequency in Hz. (1000000)
-;
-#X text 55 128 env - output amplitude continuously;
-#X text 380 596 updated for Pd v0.41;
-#X connect 2 0 24 0;
-#X connect 3 0 8 0;
-#X connect 4 0 7 0;
-#X connect 7 0 2 0;
-#X connect 8 0 4 0;
-#X connect 24 0 5 0;
-#X connect 24 1 6 0;
diff --git a/externals/extra/0.43.2/sigmund~/sigmund~.c b/externals/extra/0.43.2/sigmund~/sigmund~.c
deleted file mode 100644
index 5d1d72f6..00000000
--- a/externals/extra/0.43.2/sigmund~/sigmund~.c
+++ /dev/null
@@ -1,1655 +0,0 @@
-/* Copyright (c) 2005 Miller Puckette. BSD licensed. No warranties. */
-
-/*
- fix parameter settings
- not to report pitch if evidence too scanty?
- note-on detection triggered by falling envelope (a posteriori)
- reentrancy bug setting loud flag (other parameters too?)
- tweaked freqs still not stable enough
- implement block ("-b") mode
-*/
-
-#ifdef PD
-#include "m_pd.h"
-#endif
-#ifdef MSP
-#include "ext.h"
-#include "z_dsp.h"
-#include "ext_support.h"
-#include "ext_proto.h"
-#include "ext_obex.h"
-typedef double t_floatarg;
-#define t_resizebytes(a, b, c) t_resizebytes((char *)(a), (b), (c))
-#endif
-
-/* From here to the next "#ifdef PD" or "#ifdef Max" should be extractable
-and usable in other contexts. The one external requirement is a real
-single-precision FFT, invoked as in the Mayer one: */
-
-#ifdef _MSC_VER /* this is only needed with Microsoft's compiler */
-__declspec(dllimport) extern
-#endif
-void mayer_realfft(int npoints, t_sample *buf);
-
-/* this routine is passed a buffer of npoints values, and returns the
-N/2+1 real parts of the DFT (frequency zero through Nyquist), followed
-by the N/2-1 imaginary points, in order of decreasing frequency. Pd 0.41,
-for example, defines this in the file d_fft_mayer.c or d_fft_fftsg.c. */
-
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef _WIN32
-#include <malloc.h>
-#elif ! defined(_MSC_VER)
-#include <alloca.h>
-#endif
-#include <stdlib.h>
-#ifdef _MSC_VER
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-typedef struct peak
-{
- t_float p_freq;
- t_float p_amp;
- t_float p_ampreal;
- t_float p_ampimag;
- t_float p_pit;
- t_float p_db;
- t_float p_salience;
- t_float p_tmp;
-} t_peak;
-
-/********************** service routines **************************/
-
-/* these three are dapted from elsewhere in Pd but included here for
-cmolpeteness */
-static int sigmund_ilog2(int n)
-{
- int ret = -1;
- while (n)
- {
- n >>= 1;
- ret++;
- }
- return (ret);
-}
-
-static t_float sigmund_ftom(t_float f)
-{
- return (f > 0 ? 17.3123405046 * log(.12231220585 * f) : -1500);
-}
-
-#define LOGTEN 2.302585092994
-static t_float sigmund_powtodb(t_float f)
-{
- if (f <= 0) return (0);
- else
- {
- t_float val = 100 + 10./LOGTEN * log(f);
- return (val < 0 ? 0 : val);
- }
-}
-
-/* parameters for von Hann window (change these to get Hamming if desired) */
-#define W_ALPHA 0.5
-#define W_BETA 0.5
-#define NEGBINS 4 /* number of bins of negative frequency we'll need */
-
-#define PI 3.141592653589793
-#define LOG2 0.693147180559945
-#define LOG10 2.302585092994046
-
-static t_float sinx(t_float theta, t_float sintheta)
-{
- if (theta > -0.003 && theta < 0.003)
- return (1);
- else return (sintheta/theta);
-}
-
-static t_float window_hann_mag(t_float pidetune, t_float sinpidetune)
-{
- return (W_ALPHA * sinx(pidetune, sinpidetune)
- - 0.5 * W_BETA *
- (sinx(pidetune+PI, sinpidetune) + sinx(pidetune-PI, sinpidetune)));
-}
-
-static t_float window_mag(t_float pidetune, t_float cospidetune)
-{
- return (sinx(pidetune + (PI/2), cospidetune)
- + sinx(pidetune - (PI/2), -cospidetune));
-}
-
-/*********** Routines to analyze a window into sinusoidal peaks *************/
-
-static int sigmund_cmp_freq(const void *p1, const void *p2)
-{
- if ((*(t_peak **)p1)->p_freq > (*(t_peak **)p2)->p_freq)
- return (1);
- else if ((*(t_peak **)p1)->p_freq < (*(t_peak **)p2)->p_freq)
- return (-1);
- else return (0);
-}
-
-static void sigmund_tweak(int npts, t_float *ftreal, t_float *ftimag,
- int npeak, t_peak *peaks, t_float fperbin, int loud)
-{
- t_peak **peakptrs = (t_peak **)alloca(sizeof (*peakptrs) * (npeak+1));
- t_peak negpeak;
- int peaki, j, k;
- t_float ampreal[3], ampimag[3];
- t_float binperf = 1./fperbin;
- t_float phaseperbin = (npts-0.5)/npts, oneovern = 1./npts;
- if (npeak < 1)
- return;
- for (peaki = 0; peaki < npeak; peaki++)
- peakptrs[peaki+1] = &peaks[peaki];
- qsort(peakptrs+1, npeak, sizeof (*peakptrs), sigmund_cmp_freq);
- peakptrs[0] = &negpeak;
- negpeak.p_ampreal = peakptrs[1]->p_ampreal;
- negpeak.p_ampimag = -peakptrs[1]->p_ampimag;
- negpeak.p_freq = -peakptrs[1]->p_freq;
- for (peaki = 1; peaki <= npeak; peaki++)
- {
- int cbin = peakptrs[peaki]->p_freq*binperf + 0.5;
- int nsub = (peaki == npeak ? 1:2);
- t_float windreal, windimag, windpower, detune, pidetune, sinpidetune,
- cospidetune, ampcorrect, ampout, ampoutreal, ampoutimag, freqout;
- /* post("3 nsub %d amp %f freq %f", nsub,
- peakptrs[peaki]->p_amp, peakptrs[peaki]->p_freq); */
- if (cbin < 0 || cbin > 2*npts - 3)
- continue;
- for (j = 0; j < 3; j++)
- ampreal[j] = ftreal[cbin+2*j-2], ampimag[j] = ftimag[cbin+2*j-2];
- /* post("a %f %f", ampreal[1], ampimag[1]); */
- for (j = 0; j < nsub; j++)
- {
- t_peak *neighbor = peakptrs[(peaki-1) + 2*j];
- t_float neighborreal = npts * neighbor->p_ampreal;
- t_float neighborimag = npts * neighbor->p_ampimag;
- for (k = 0; k < 3; k++)
- {
- t_float freqdiff = (0.5*PI) * ((cbin + 2*k-2)
- -binperf * neighbor->p_freq);
- t_float sx = sinx(freqdiff, sin(freqdiff));
- t_float phasere = cos(freqdiff * phaseperbin);
- t_float phaseim = sin(freqdiff * phaseperbin);
- ampreal[k] -=
- sx * (phasere * neighborreal - phaseim * neighborimag);
- ampimag[k] -=
- sx * (phaseim * neighborreal + phasere * neighborimag);
- }
- /* post("b %f %f", ampreal[1], ampimag[1]); */
- }
-
- windreal = W_ALPHA * ampreal[1] -
- (0.5 * W_BETA) * (ampreal[0] + ampreal[2]);
- windimag = W_ALPHA * ampimag[1] -
- (0.5 * W_BETA) * (ampimag[0] + ampimag[2]);
- windpower = windreal * windreal + windimag * windimag;
- detune = (
- W_BETA*(ampreal[0] - ampreal[2]) *
- (2.0*W_ALPHA * ampreal[1] - W_BETA * (ampreal[0] + ampreal[2]))
- +
- W_BETA*(ampimag[0] - ampimag[2]) *
- (2.0*W_ALPHA * ampimag[1] - W_BETA * (ampimag[0] + ampimag[2]))
- ) / (4.0 * windpower);
- if (detune > 0.5)
- detune = 0.5;
- else if (detune < -0.5)
- detune = -0.5;
- /* if (loud > 0)
- post("tweak: windpower %f, bin %d, detune %f",
- windpower, cbin, detune); */
- pidetune = PI * detune;
- sinpidetune = sin(pidetune);
- cospidetune = cos(pidetune);
-
- ampcorrect = 1.0 / window_hann_mag(pidetune, sinpidetune);
-
- ampout = oneovern * ampcorrect *sqrt(windpower);
- ampoutreal = oneovern * ampcorrect *
- (windreal * cospidetune - windimag * sinpidetune);
- ampoutimag = oneovern * ampcorrect *
- (windreal * sinpidetune + windimag * cospidetune);
- freqout = (cbin + 2*detune) * fperbin;
- /* if (loud > 1)
- post("amp %f, freq %f", ampout, freqout); */
-
- peakptrs[peaki]->p_freq = freqout;
- peakptrs[peaki]->p_amp = ampout;
- peakptrs[peaki]->p_ampreal = ampoutreal;
- peakptrs[peaki]->p_ampimag = ampoutimag;
- }
-}
-
-static void sigmund_remask(int maxbin, int bestindex, t_float powmask,
- t_float maxpower, t_float *maskbuf)
-{
- int bin;
- int bin1 = (bestindex > 52 ? bestindex-50:2);
- int bin2 = (maxbin < bestindex + 50 ? bestindex + 50 : maxbin);
- for (bin = bin1; bin < bin2; bin++)
- {
- t_float bindiff = bin - bestindex;
- t_float mymask;
- mymask = powmask/ (1. + bindiff * bindiff * bindiff * bindiff);
- if (bindiff < 2 && bindiff > -2)
- mymask = 2*maxpower;
- if (mymask > maskbuf[bin])
- maskbuf[bin] = mymask;
- }
-}
-
-#define PEAKMASKFACTOR 1.
-#define PEAKTHRESHFACTOR 0.6
-
-static void sigmund_getrawpeaks(int npts, t_float *insamps,
- int npeak, t_peak *peakv, int *nfound, t_float *power, t_float srate, int loud,
- t_float hifreq)
-{
- t_float oneovern = 1.0/ (t_float)npts;
- t_float fperbin = 0.5 * srate * oneovern, totalpower = 0;
- int npts2 = 2*npts, i, bin;
- int peakcount = 0;
- t_float *fp1, *fp2;
- t_float *rawreal, *rawimag, *maskbuf, *powbuf;
- t_float *bigbuf = alloca(sizeof (t_float ) * (2*NEGBINS + 6*npts));
- int maxbin = hifreq/fperbin;
- if (maxbin > npts - NEGBINS)
- maxbin = npts - NEGBINS;
- /* if (loud) post("tweak %d", tweak); */
- maskbuf = bigbuf + npts2;
- powbuf = maskbuf + npts;
- rawreal = powbuf + npts+NEGBINS;
- rawimag = rawreal+npts+NEGBINS;
- for (i = 0; i < npts; i++)
- maskbuf[i] = 0;
-
- for (i = 0; i < npts; i++)
- bigbuf[i] = insamps[i];
- for (i = npts; i < 2*npts; i++)
- bigbuf[i] = 0;
- mayer_realfft(npts2, bigbuf);
- for (i = 0; i < npts; i++)
- rawreal[i] = bigbuf[i];
- for (i = 1; i < npts-1; i++)
- rawimag[i] = bigbuf[npts2-i];
- rawreal[-1] = rawreal[1];
- rawreal[-2] = rawreal[2];
- rawreal[-3] = rawreal[3];
- rawreal[-4] = rawreal[4];
- rawimag[0] = rawimag[npts-1] = 0;
- rawimag[-1] = -rawimag[1];
- rawimag[-2] = -rawimag[2];
- rawimag[-3] = -rawimag[3];
- rawimag[-4] = -rawimag[4];
-#if 1
- for (i = 0, fp1 = rawreal, fp2 = rawimag; i < maxbin; i++, fp1++, fp2++)
- {
- t_float x1 = fp1[1] - fp1[-1], x2 = fp2[1] - fp2[-1], p = powbuf[i] = x1*x1+x2*x2;
- if (i >= 2)
- totalpower += p;
- }
- powbuf[maxbin] = powbuf[maxbin+1] = 0;
- *power = 0.5 * totalpower *oneovern * oneovern;
-#endif
- for (peakcount = 0; peakcount < npeak; peakcount++)
- {
- t_float pow1, maxpower = 0, windreal, windimag, windpower,
- detune, pidetune, sinpidetune, cospidetune, ampcorrect, ampout,
- ampoutreal, ampoutimag, freqout, powmask;
- int bestindex = -1;
-
- for (bin = 2, fp1 = rawreal+2, fp2 = rawimag+2;
- bin < maxbin; bin++, fp1++, fp2++)
- {
- pow1 = powbuf[bin];
- if (pow1 > maxpower && pow1 > maskbuf[bin])
- {
- t_float thresh = PEAKTHRESHFACTOR * (powbuf[bin-2]+powbuf[bin+2]);
- if (pow1 > thresh)
- maxpower = pow1, bestindex = bin;
- }
- }
-
- if (totalpower <= 0 || maxpower < 1e-10*totalpower || bestindex < 0)
- break;
- fp1 = rawreal+bestindex;
- fp2 = rawimag+bestindex;
- powmask = maxpower * PEAKMASKFACTOR;
- /* if (loud > 2)
- post("maxpower %f, powmask %f, param1 %f",
- maxpower, powmask, param1); */
- sigmund_remask(maxbin, bestindex, powmask, maxpower, maskbuf);
-
- /* if (loud > 1)
- post("best index %d, total power %f", bestindex, totalpower); */
-
- windreal = fp1[1] - fp1[-1];
- windimag = fp2[1] - fp2[-1];
- windpower = windreal * windreal + windimag * windimag;
- detune = ((fp1[1] * fp1[1] - fp1[-1]*fp1[-1])
- + (fp2[1] * fp2[1] - fp2[-1]*fp2[-1])) / (2 * windpower);
-
- if (detune > 0.5)
- detune = 0.5;
- else if (detune < -0.5)
- detune = -0.5;
- /* if (loud > 1)
- post("windpower %f, index %d, detune %f",
- windpower, bestindex, detune); */
- pidetune = PI * detune;
- sinpidetune = sin(pidetune);
- cospidetune = cos(pidetune);
- ampcorrect = 1.0 / window_mag(pidetune, cospidetune);
-
- ampout = ampcorrect *sqrt(windpower);
- ampoutreal = ampcorrect *
- (windreal * cospidetune - windimag * sinpidetune);
- ampoutimag = ampcorrect *
- (windreal * sinpidetune + windimag * cospidetune);
-
- /* the frequency is the sum of the bin frequency and detuning */
-
- peakv[peakcount].p_freq = (freqout = (bestindex + 2*detune)) * fperbin;
- peakv[peakcount].p_amp = oneovern * ampout;
- peakv[peakcount].p_ampreal = oneovern * ampoutreal;
- peakv[peakcount].p_ampimag = oneovern * ampoutimag;
- }
- sigmund_tweak(npts, rawreal, rawimag, peakcount, peakv, fperbin, loud);
- sigmund_tweak(npts, rawreal, rawimag, peakcount, peakv, fperbin, loud);
- for (i = 0; i < peakcount; i++)
- {
- peakv[i].p_pit = sigmund_ftom(peakv[i].p_freq);
- peakv[i].p_db = sigmund_powtodb(peakv[i].p_amp);
- }
- *nfound = peakcount;
-}
-
-/*************** Routines for finding fundamental pitch *************/
-
-#define PITCHNPEAK 12
-#define HALFTONEINC 0.059
-#define SUBHARMONICS 16
-#define DBPERHALFTONE 0.0
-
-static void sigmund_getpitch(int npeak, t_peak *peakv, t_float *freqp,
- t_float npts, t_float srate, t_float nharmonics, t_float amppower, int loud)
-{
- t_float fperbin = 0.5 * srate / npts;
- int npit = 48 * sigmund_ilog2(npts), i, j, k, nsalient;
- t_float bestbin, bestweight, sumamp, sumweight, sumfreq, freq;
- t_float *weights = (t_float *)alloca(sizeof(t_float) * npit);
- t_peak *bigpeaks[PITCHNPEAK];
- if (npeak < 1)
- {
- freq = 0;
- goto done;
- }
- for (i = 0; i < npit; i++)
- weights[i] = 0;
- for (i = 0; i < npeak; i++)
- {
- peakv[i].p_tmp = 0;
- peakv[i].p_salience = peakv[i].p_db - DBPERHALFTONE * peakv[i].p_pit;
- }
- for (nsalient = 0; nsalient < PITCHNPEAK; nsalient++)
- {
- t_peak *bestpeak = 0;
- t_float bestsalience = -1e20;
- for (j = 0; j < npeak; j++)
- if (peakv[j].p_tmp == 0 && peakv[j].p_salience > bestsalience)
- {
- bestsalience = peakv[j].p_salience;
- bestpeak = &peakv[j];
- }
- if (!bestpeak)
- break;
- bigpeaks[nsalient] = bestpeak;
- bestpeak->p_tmp = 1;
- /* post("peak f=%f a=%f", bestpeak->p_freq, bestpeak->p_amp); */
- }
- sumweight = 0;
- for (i = 0; i < nsalient; i++)
- {
- t_peak *thispeak = bigpeaks[i];
- t_float weightindex = (48./LOG2) *
- log(thispeak->p_freq/(2.*fperbin));
- t_float loudness = pow(thispeak->p_amp, amppower);
- /* post("index %f, uncertainty %f", weightindex, pitchuncertainty); */
- for (j = 0; j < SUBHARMONICS; j++)
- {
- t_float subindex = weightindex -
- (48./LOG2) * log(j + 1.);
- int loindex = subindex - 0.5;
- int hiindex = loindex+2;
- if (hiindex < 0)
- break;
- if (hiindex >= npit)
- continue;
- if (loindex < 0)
- loindex = 0;
- for (k = loindex; k <= hiindex; k++)
- weights[k] += loudness * nharmonics / (nharmonics + j);
- }
- sumweight += loudness;
- }
- bestbin = -1;
- bestweight = -1e20;
- for (i = 0; i < npit; i++)
- if (weights[i] > bestweight)
- bestweight = weights[i], bestbin = i;
- if (bestweight < sumweight * 0.4)
- bestbin = -1;
-
- if (bestbin < 0)
- {
- freq = 0;
- goto done;
- }
- if (bestbin > 0 && bestbin < npit-1)
- {
- int ibest = bestbin;
- bestbin += (weights[ibest+1] - weights[ibest-1]) /
- (weights[ibest+1] + weights[ibest] + weights[ibest-1]);
- }
- freq = 2*fperbin * exp((LOG2/48.)*bestbin);
- for (sumamp = sumweight = sumfreq = 0, i = 0; i < nsalient; i++)
- {
- t_peak *thispeak = bigpeaks[i];
- t_float thisloudness = thispeak->p_amp;
- t_float thisfreq = thispeak->p_freq;
- t_float harmonic = thisfreq/freq;
- t_float intpart = (int)(0.5 + harmonic);
- t_float inharm = harmonic - intpart;
-#if 0
- if (loud)
- post("freq %f intpart %f inharm %f", freq, intpart, inharm);
-#endif
- if (intpart >= 1 && intpart <= 16 &&
- inharm < 0.015 * intpart && inharm > - (0.015 * intpart))
- {
- t_float weight = thisloudness * intpart;
- sumweight += weight;
- sumfreq += weight*thisfreq/intpart;
-#if 0
- if (loud)
- post("weight %f freq %f", weight, thisfreq);
-#endif
- }
- }
- if (sumweight > 0)
- freq = sumfreq / sumweight;
-done:
- if (!(freq >= 0 || freq <= 0))
- {
- /* post("freq nan cancelled"); */
- freq = 0;
- }
- *freqp = freq;
-}
-
-/*************** gather peak lists into sinusoidal tracks *************/
-
-static void sigmund_peaktrack(int ninpeak, t_peak *inpeakv,
- int noutpeak, t_peak *outpeakv, int loud)
-{
- int incnt, outcnt;
- for (outcnt = 0; outcnt < noutpeak; outcnt++)
- outpeakv[outcnt].p_tmp = -1;
-
- /* first pass. Match each "in" peak with the closest previous
- "out" peak, but no two to the same one. */
- for (incnt = 0; incnt < ninpeak; incnt++)
- {
- t_float besterror = 1e20;
- int bestcnt = -1;
- inpeakv[incnt].p_tmp = -1;
- for (outcnt = 0; outcnt < noutpeak; outcnt++)
- {
- t_float thiserror =
- inpeakv[incnt].p_freq - outpeakv[outcnt].p_freq;
- if (thiserror < 0)
- thiserror = -thiserror;
- if (thiserror < besterror)
- {
- besterror = thiserror;
- bestcnt = outcnt;
- }
- }
- if (outpeakv[bestcnt].p_tmp < 0)
- {
- outpeakv[bestcnt] = inpeakv[incnt];
- inpeakv[incnt].p_tmp = 0;
- outpeakv[bestcnt].p_tmp = 0;
- }
- }
- /* second pass. Unmatched "in" peaks assigned to free "out"
- peaks */
- for (incnt = 0; incnt < ninpeak; incnt++)
- if (inpeakv[incnt].p_tmp < 0)
- {
- for (outcnt = 0; outcnt < noutpeak; outcnt++)
- if (outpeakv[outcnt].p_tmp < 0)
- {
- outpeakv[outcnt] = inpeakv[incnt];
- inpeakv[incnt].p_tmp = 0;
- outpeakv[outcnt].p_tmp = 1;
- break;
- }
- }
- for (outcnt = 0; outcnt < noutpeak; outcnt++)
- if (outpeakv[outcnt].p_tmp == -1)
- outpeakv[outcnt].p_amp = 0;
-}
-
-/**************** parse continuous pitch into note starts ***************/
-
-#define NHISTPOINT 100
-
-typedef struct _histpoint
-{
- t_float h_freq;
- t_float h_power;
-} t_histpoint;
-
-typedef struct _notefinder
-{
- t_float n_age;
- t_float n_hifreq;
- t_float n_lofreq;
- int n_peaked;
- t_histpoint n_hist[NHISTPOINT];
- int n_histphase;
-} t_notefinder;
-
-
-static void notefinder_init(t_notefinder *x)
-{
- int i;
- x->n_peaked = x->n_age = 0;
- x->n_hifreq = x->n_lofreq = 0;
- x->n_histphase = 0;
- for (i = 0; i < NHISTPOINT; i++)
- x->n_hist[i].h_freq =x->n_hist[i].h_power = 0;
-}
-
-static void notefinder_doit(t_notefinder *x, t_float freq, t_float power,
- t_float *note, t_float vibrato, int stableperiod, t_float powerthresh,
- t_float growththresh, int loud)
-{
- /* calculate frequency ratio between allowable vibrato extremes
- (equal to twice the vibrato deviation from center) */
- t_float vibmultiple = exp((2*LOG2/12) * vibrato);
- int oldhistphase, i, k;
- if (stableperiod > NHISTPOINT - 1)
- stableperiod = NHISTPOINT - 1;
- else if (stableperiod < 1)
- stableperiod = 1;
- if (++x->n_histphase == NHISTPOINT)
- x->n_histphase = 0;
- x->n_hist[x->n_histphase].h_freq = freq;
- x->n_hist[x->n_histphase].h_power = power;
- x->n_age++;
- *note = 0;
-#if 0
- if (loud)
- {
- post("stable %d, age %d, vibmultiple %f, powerthresh %f, hifreq %f",
- stableperiod, (int)x->n_age ,vibmultiple, powerthresh, x->n_hifreq);
- post("histfreq %f %f %f %f",
- x->n_hist[x->n_histphase].h_freq,
- x->n_hist[(x->n_histphase+NHISTPOINT-1)%NHISTPOINT].h_freq,
- x->n_hist[(x->n_histphase+NHISTPOINT-2)%NHISTPOINT].h_freq,
- x->n_hist[(x->n_histphase+NHISTPOINT-3)%NHISTPOINT].h_freq);
- post("power %f %f %f %f",
- x->n_hist[x->n_histphase].h_power,
- x->n_hist[(x->n_histphase+NHISTPOINT-1)%NHISTPOINT].h_power,
- x->n_hist[(x->n_histphase+NHISTPOINT-2)%NHISTPOINT].h_power,
- x->n_hist[(x->n_histphase+NHISTPOINT-3)%NHISTPOINT].h_power);
- for (i = 0, k = x->n_histphase; i < stableperiod; i++)
- {
- post("pit %5.1f pow %f", sigmund_ftom(x->n_hist[k].h_freq),
- x->n_hist[k].h_power);
- if (--k < 0)
- k = NHISTPOINT - 1;
- }
- }
-#endif
- /* look for shorter notes than "stableperiod" in length.
- The amplitude must rise and then fall while the pitch holds
- steady. */
- if (x->n_hifreq <= 0 && x->n_age > stableperiod)
- {
- t_float maxpow = 0, freqatmaxpow = 0,
- localhifreq = -1e20, locallofreq = 1e20;
- int startphase = x->n_histphase - stableperiod + 1;
- if (startphase < 0)
- startphase += NHISTPOINT;
- for (i = 0, k = startphase; i < stableperiod; i++)
- {
- if (x->n_hist[k].h_freq <= 0)
- break;
- if (x->n_hist[k].h_power > maxpow)
- maxpow = x->n_hist[k].h_power,
- freqatmaxpow = x->n_hist[k].h_freq;
- if (x->n_hist[k].h_freq > localhifreq)
- localhifreq = x->n_hist[k].h_freq;
- if (x->n_hist[k].h_freq < locallofreq)
- locallofreq = x->n_hist[k].h_freq;
- if (localhifreq > locallofreq * vibmultiple)
- break;
- if (maxpow > power * growththresh &&
- maxpow > x->n_hist[startphase].h_power * growththresh &&
- localhifreq < vibmultiple * locallofreq
- && freqatmaxpow > 0 && maxpow > powerthresh)
- {
- x->n_hifreq = x->n_lofreq = *note = freqatmaxpow;
- x->n_age = 0;
- x->n_peaked = 0;
- /* post("got short note"); */
- return;
- }
- if (++k >= NHISTPOINT)
- k = 0;
- }
-
- }
- if (x->n_hifreq > 0)
- {
- /* test if we're within "vibrato" range, and if so update range */
- if (freq * vibmultiple >= x->n_hifreq &&
- x->n_lofreq * vibmultiple >= freq)
- {
- if (freq > x->n_hifreq)
- x->n_hifreq = freq;
- if (freq < x->n_lofreq)
- x->n_lofreq = freq;
- }
- else if (x->n_hifreq > 0 && x->n_age > stableperiod)
- {
- /* if we've been out of range at least 1/2 the
- last "stableperiod+1" analyses, clear the note */
- int nbad = 0;
- for (i = 0, k = x->n_histphase; i < stableperiod + 1; i++)
- {
- if (--k < 0)
- k = NHISTPOINT - 1;
- if (x->n_hist[k].h_freq * vibmultiple <= x->n_hifreq ||
- x->n_lofreq * vibmultiple <= x->n_hist[k].h_freq)
- nbad++;
- }
- if (2 * nbad >= stableperiod + 1)
- {
- x->n_hifreq = x->n_lofreq = 0;
- x->n_age = 0;
- }
- }
- }
-
- oldhistphase = x->n_histphase - stableperiod;
- if (oldhistphase < 0)
- oldhistphase += NHISTPOINT;
-
- /* look for envelope attacks */
-
- if (x->n_hifreq > 0 && x->n_peaked)
- {
- if (freq > 0 && power > powerthresh &&
- power > x->n_hist[oldhistphase].h_power *
- exp((LOG10*0.1)*growththresh))
- {
- /* clear it and fall through for new stable-note test */
- x->n_peaked = 0;
- x->n_hifreq = x->n_lofreq = 0;
- x->n_age = 0;
- }
- }
- else if (!x->n_peaked)
- {
- if (x->n_hist[oldhistphase].h_power > powerthresh &&
- x->n_hist[oldhistphase].h_power > power)
- x->n_peaked = 1;
- }
-
- /* test for a new note using a stability criterion. */
-
- if (freq >= 0 &&
- (x->n_hifreq <= 0 || freq > x->n_hifreq || freq < x->n_lofreq))
- {
- t_float testfhi = freq, testflo = freq,
- maxpow = x->n_hist[x->n_histphase].h_freq;
- for (i = 0, k = x->n_histphase; i < stableperiod-1; i++)
- {
- if (--k < 0)
- k = NHISTPOINT - 1;
- if (x->n_hist[k].h_freq > testfhi)
- testfhi = x->n_hist[k].h_freq;
- if (x->n_hist[k].h_freq < testflo)
- testflo = x->n_hist[k].h_freq;
- if (x->n_hist[k].h_power > maxpow)
- maxpow = x->n_hist[k].h_power;
- }
-#if 0
- if (loud)
- post("freq %.2g testfhi %.2g testflo %.2g maxpow %.2g",
- freq, testfhi, testflo, maxpow);
-#endif
- if (testflo > 0 && testfhi <= vibmultiple * testflo
- && maxpow > powerthresh)
- {
- /* report new note */
- t_float sumf = 0, sumw = 0, thisw;
- for (i = 0, k = x->n_histphase; i < stableperiod; i++)
- {
- thisw = x->n_hist[k].h_power;
- sumw += thisw;
- sumf += thisw*x->n_hist[k].h_freq;
- if (--k < 0)
- k = NHISTPOINT - 1;
- }
- x->n_hifreq = x->n_lofreq = *note = (sumw > 0 ? sumf/sumw : 0);
-#if 0
- /* debugging printout */
- for (i = 0; i < stableperiod; i++)
- {
- int k3 = x->n_histphase - i;
- if (k3 < 0)
- k3 += NHISTPOINT;
- startpost("%5.1f ", sigmund_ftom(x->n_hist[k3].h_freq));
- }
- post("");
-#endif
- x->n_age = 0;
- x->n_peaked = 0;
- return;
- }
- }
- *note = 0;
- return;
-}
-
-/**************** object structure for Pd and Max. *********************/
-
-/* From here onward, the code is specific to eithr Pd, Max, or both. If
-neither "PD 'nor "MSP" is defined, none of this is compiled, so that the
-whole file can be included in other, non-PD and non-Max projects. */
-
-#if (defined(PD) || defined (MSP))
-
-#define NHIST 100
-
-#define MODE_STREAM 1
-#define MODE_BLOCK 2 /* unimplemented */
-#define MODE_TABLE 3
-
-#define NPOINTS_DEF 1024
-#define NPOINTS_MIN 128
-
-#define HOP_DEF 512
-#define NPEAK_DEF 20
-
-#define VIBRATO_DEF 1
-#define STABLETIME_DEF 50
-#define MINPOWER_DEF 50
-#define GROWTH_DEF 7
-
-#define OUT_PITCH 0
-#define OUT_ENV 1
-#define OUT_NOTE 2
-#define OUT_PEAKS 3
-#define OUT_TRACKS 4
-#define OUT_SMSPITCH 5
-#define OUT_SMSNONPITCH 6
-
-typedef struct _varout
-{
-#ifdef PD
- t_outlet *v_outlet;
-#endif /* PD */
-#ifdef MSP
- void *v_outlet;
-#endif /* MSP */
- int v_what;
-} t_varout;
-
-typedef struct _sigmund
-{
-#ifdef PD
- t_object x_obj;
- t_clock *x_clock;
- t_float x_f; /* for main signal inlet */
-#endif /* PD */
-#ifdef MSP
- t_pxobject x_obj;
- void *obex;
- void *x_clock;
- t_sample *x_inbuf2; /* extra input buffer to eat clock/DSP jitter */
-#endif /* MSP */
- t_varout *x_varoutv;
- int x_nvarout;
- t_float x_sr; /* sample rate */
- int x_mode; /* MODE_STREAM, etc. */
- int x_npts; /* number of points in analysis window */
- int x_npeak; /* number of peaks to find */
- int x_loud; /* debug level */
- t_sample *x_inbuf; /* input buffer */
- int x_infill; /* number of points filled */
- int x_countdown; /* countdown to start filling buffer */
- int x_hop; /* samples between analyses */
- t_float x_maxfreq; /* highest-frequency peak to report */
- t_float x_vibrato; /* vibrato depth in half tones */
- t_float x_stabletime; /* period of stability needed for note */
- t_float x_growth; /* growth to set off a new note */
- t_float x_minpower; /* minimum power, in DB, for a note */
- t_float x_param1; /* three parameters for temporary use */
- t_float x_param2;
- t_float x_param3;
- t_notefinder x_notefinder; /* note parsing state */
- t_peak *x_trackv; /* peak tracking state */
- int x_ntrack; /* number of peaks tracked */
- unsigned int x_dopitch:1; /* which things to calculate */
- unsigned int x_donote:1;
- unsigned int x_dotracks:1;
-} t_sigmund;
-
-static void sigmund_preinit(t_sigmund *x)
-{
- x->x_npts = NPOINTS_DEF;
- x->x_param1 = 6;
- x->x_param2 = 0.5;
- x->x_param3 = 0;
- x->x_hop = HOP_DEF;
- x->x_mode = MODE_STREAM;
- x->x_npeak = NPEAK_DEF;
- x->x_vibrato = VIBRATO_DEF;
- x->x_stabletime = STABLETIME_DEF;
- x->x_growth = GROWTH_DEF;
- x->x_minpower = MINPOWER_DEF;
- x->x_maxfreq = 1000000;
- x->x_loud = 0;
- x->x_sr = 1;
- x->x_nvarout = 0;
- x->x_varoutv = (t_varout *)getbytes(0);
- x->x_trackv = 0;
- x->x_ntrack = 0;
- x->x_dopitch = x->x_donote = x->x_dotracks = 0;
- x->x_inbuf = 0;
-#ifdef MSP
- x->x_inbuf2 = 0;
-#endif
-}
-
-static void sigmund_npts(t_sigmund *x, t_floatarg f)
-{
- int nwas = x->x_npts, npts = f;
- /* check parameter ranges */
- if (npts < NPOINTS_MIN)
- post("sigmund~: minimum points %d", NPOINTS_MIN),
- npts = NPOINTS_MIN;
- if (npts != (1 << sigmund_ilog2(npts)))
- post("sigmund~: adjusting analysis size to %d points",
- (npts = (1 << sigmund_ilog2(npts))));
- if (npts != nwas)
- x->x_countdown = x->x_infill = 0;
- if (x->x_mode == MODE_STREAM)
- {
- if (x->x_inbuf)
- {
- x->x_inbuf = (t_sample *)t_resizebytes(x->x_inbuf,
- sizeof(*x->x_inbuf) * nwas, sizeof(*x->x_inbuf) * npts);
-#ifdef MSP
- x->x_inbuf2 = (t_sample *)t_resizebytes(x->x_inbuf2,
- sizeof(*x->x_inbuf2) * nwas, sizeof(*x->x_inbuf2) * npts);
-#endif
- }
- else
- {
- x->x_inbuf = (t_sample *)getbytes(sizeof(*x->x_inbuf) * npts);
- memset((char *)(x->x_inbuf), 0, sizeof(*x->x_inbuf) * npts);
-#ifdef MSP
- x->x_inbuf2 = (t_sample *)getbytes(sizeof(*x->x_inbuf2) * npts);
- memset((char *)(x->x_inbuf2), 0, sizeof(*x->x_inbuf2) * npts);
-#endif
- }
- }
- else x->x_inbuf = 0;
- x->x_npts = npts;
-}
-
-static void sigmund_hop(t_sigmund *x, t_floatarg f)
-{
- x->x_hop = f;
- /* check parameter ranges */
- if (x->x_hop != (1 << sigmund_ilog2(x->x_hop)))
- post("sigmund~: adjusting analysis size to %d points",
- (x->x_hop = (1 << sigmund_ilog2(x->x_hop))));
-}
-
-static void sigmund_npeak(t_sigmund *x, t_floatarg f)
-{
- if (f < 1)
- f = 1;
- x->x_npeak = f;
-}
-
-static void sigmund_maxfreq(t_sigmund *x, t_floatarg f)
-{
- x->x_maxfreq = f;
-}
-
-static void sigmund_vibrato(t_sigmund *x, t_floatarg f)
-{
- if (f < 0)
- f = 0;
- x->x_vibrato = f;
-}
-
-static void sigmund_stabletime(t_sigmund *x, t_floatarg f)
-{
- if (f < 0)
- f = 0;
- x->x_stabletime = f;
-}
-
-static void sigmund_growth(t_sigmund *x, t_floatarg f)
-{
- if (f < 0)
- f = 0;
- x->x_growth = f;
-}
-
-static void sigmund_minpower(t_sigmund *x, t_floatarg f)
-{
- if (f < 0)
- f = 0;
- x->x_minpower = f;
-}
-
-static void sigmund_doit(t_sigmund *x, int npts, t_float *arraypoints,
- int loud, t_float srate)
-{
- t_peak *peakv = (t_peak *)alloca(sizeof(t_peak) * x->x_npeak);
- int nfound, i, cnt;
- t_float freq = 0, power, note = 0;
- sigmund_getrawpeaks(npts, arraypoints, x->x_npeak, peakv,
- &nfound, &power, srate, loud, x->x_maxfreq);
- if (x->x_dopitch)
- sigmund_getpitch(nfound, peakv, &freq, npts, srate,
- x->x_param1, x->x_param2, loud);
- if (x->x_donote)
- notefinder_doit(&x->x_notefinder, freq, power, &note, x->x_vibrato,
- 1 + x->x_stabletime * 0.001 * x->x_sr / (t_float)x->x_hop,
- exp(LOG10*0.1*(x->x_minpower - 100)), x->x_growth, loud);
- if (x->x_dotracks)
- sigmund_peaktrack(nfound, peakv, x->x_ntrack, x->x_trackv, loud);
-
- for (cnt = x->x_nvarout; cnt--;)
- {
- t_varout *v = &x->x_varoutv[cnt];
- switch (v->v_what)
- {
- case OUT_PITCH:
- outlet_float(v->v_outlet, sigmund_ftom(freq));
- break;
- case OUT_ENV:
- outlet_float(v->v_outlet, sigmund_powtodb(power));
- break;
- case OUT_NOTE:
- if (note > 0)
- outlet_float(v->v_outlet, sigmund_ftom(note));
- break;
- case OUT_PEAKS:
- for (i = 0; i < nfound; i++)
- {
- t_atom at[5];
- SETFLOAT(at, (t_float)i);
- SETFLOAT(at+1, peakv[i].p_freq);
- SETFLOAT(at+2, 2*peakv[i].p_amp);
- SETFLOAT(at+3, 2*peakv[i].p_ampreal);
- SETFLOAT(at+4, 2*peakv[i].p_ampimag);
- outlet_list(v->v_outlet, 0, 5, at);
- }
- break;
- case OUT_TRACKS:
- for (i = 0; i < x->x_ntrack; i++)
- {
- t_atom at[4];
- SETFLOAT(at, (t_float)i);
- SETFLOAT(at+1, x->x_trackv[i].p_freq);
- SETFLOAT(at+2, 2*x->x_trackv[i].p_amp);
- SETFLOAT(at+3, x->x_trackv[i].p_tmp);
- outlet_list(v->v_outlet, 0, 4, at);
- }
- break;
- }
- }
-}
-
-static t_int *sigmund_perform(t_int *w);
-static void sigmund_dsp(t_sigmund *x, t_signal **sp)
-{
- if (x->x_mode == MODE_STREAM)
- {
- if (x->x_hop % sp[0]->s_n)
- post("sigmund: adjusting hop size to %d",
- (x->x_hop = sp[0]->s_n * (x->x_hop / sp[0]->s_n)));
- x->x_sr = sp[0]->s_sr;
- dsp_add(sigmund_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
- }
-}
-
-static void sigmund_print(t_sigmund *x)
-{
- post("sigmund~ settings:");
- post("npts %d", (int)x->x_npts);
- post("hop %d", (int)x->x_hop);
- post("npeak %d", (int)x->x_npeak);
- post("maxfreq %g", x->x_maxfreq);
- post("vibrato %g", x->x_vibrato);
- post("stabletime %g", x->x_stabletime);
- post("growth %g", x->x_growth);
- post("minpower %g", x->x_minpower);
- x->x_loud = 1;
-}
-
-static void sigmund_free(t_sigmund *x)
-{
- if (x->x_inbuf)
- {
- freebytes(x->x_inbuf, x->x_npts * sizeof(*x->x_inbuf));
-#ifdef MSP
- freebytes(x->x_inbuf2, x->x_npts * sizeof(*x->x_inbuf2));
-#endif
- }
- if (x->x_trackv)
- freebytes(x->x_trackv, x->x_ntrack * sizeof(*x->x_trackv));
- clock_free(x->x_clock);
-}
-
-#endif /* PD or MSP */
-/*************************** Glue for Pd ************************/
-#ifdef PD
-
-static t_class *sigmund_class;
-
-static void sigmund_tick(t_sigmund *x);
-static void sigmund_clear(t_sigmund *x);
-static void sigmund_npts(t_sigmund *x, t_floatarg f);
-static void sigmund_hop(t_sigmund *x, t_floatarg f);
-static void sigmund_npeak(t_sigmund *x, t_floatarg f);
-static void sigmund_maxfreq(t_sigmund *x, t_floatarg f);
-static void sigmund_vibrato(t_sigmund *x, t_floatarg f);
-static void sigmund_stabletime(t_sigmund *x, t_floatarg f);
-static void sigmund_growth(t_sigmund *x, t_floatarg f);
-static void sigmund_minpower(t_sigmund *x, t_floatarg f);
-
-static void sigmund_tick(t_sigmund *x)
-{
- if (x->x_infill == x->x_npts)
- {
- sigmund_doit(x, x->x_npts, x->x_inbuf, x->x_loud, x->x_sr);
- if (x->x_hop >= x->x_npts)
- {
- x->x_infill = 0;
- x->x_countdown = x->x_hop - x->x_npts;
- }
- else
- {
- memmove(x->x_inbuf, x->x_inbuf + x->x_hop,
- (x->x_infill = x->x_npts - x->x_hop) * sizeof(*x->x_inbuf));
- x->x_countdown = 0;
- }
- if (x->x_loud)
- x->x_loud--;
- }
-}
-
-static t_int *sigmund_perform(t_int *w)
-{
- t_sigmund *x = (t_sigmund *)(w[1]);
- t_sample *in = (t_sample *)(w[2]);
- int n = (int)(w[3]);
-
- if (x->x_hop % n)
- return (w+4);
- if (x->x_countdown > 0)
- x->x_countdown -= n;
- else if (x->x_infill != x->x_npts)
- {
- int j;
- t_float *fp = x->x_inbuf + x->x_infill;
- for (j = 0; j < n; j++)
- *fp++ = *in++;
- x->x_infill += n;
- if (x->x_infill == x->x_npts)
- clock_delay(x->x_clock, 0);
- }
- return (w+4);
-}
-
-static void *sigmund_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_sigmund *x = (t_sigmund *)pd_new(sigmund_class);
- sigmund_preinit(x);
-
- while (argc > 0)
- {
- t_symbol *firstarg = atom_getsymbolarg(0, argc, argv);
- if (!strcmp(firstarg->s_name, "-t"))
- {
- x->x_mode = MODE_TABLE;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "-s"))
- {
- x->x_mode = MODE_STREAM;
- argc--, argv++;
- }
-#if 0
- else if (!strcmp(firstarg->s_name, "-b"))
- {
- x->x_mode = MODE_BLOCK;
- argc--, argv++;
- }
-#endif
- else if (!strcmp(firstarg->s_name, "-npts") && argc > 1)
- {
- x->x_npts = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-hop") && argc > 1)
- {
- sigmund_hop(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-npeak") && argc > 1)
- {
- sigmund_npeak(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-maxfreq") && argc > 1)
- {
- sigmund_maxfreq(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-vibrato") && argc > 1)
- {
- sigmund_vibrato(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-stabletime") && argc > 1)
- {
- sigmund_stabletime(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-growth") && argc > 1)
- {
- sigmund_growth(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-minpower") && argc > 1)
- {
- sigmund_minpower(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "pitch"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[x->x_nvarout].v_what = OUT_PITCH;
- x->x_nvarout = n2;
- x->x_dopitch = 1;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "env"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[x->x_nvarout].v_what = OUT_ENV;
- x->x_nvarout = n2;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "note")
- || !strcmp(firstarg->s_name, "notes"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[x->x_nvarout].v_what = OUT_NOTE;
- x->x_nvarout = n2;
- x->x_dopitch = x->x_donote = 1;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "peaks"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_list);
- x->x_varoutv[x->x_nvarout].v_what = OUT_PEAKS;
- x->x_nvarout = n2;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "tracks"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_list);
- x->x_varoutv[x->x_nvarout].v_what = OUT_TRACKS;
- x->x_nvarout = n2;
- x->x_dotracks = 1;
- argc--, argv++;
- }
- else
- {
- pd_error(x, "sigmund: %s: unknown flag or argument missing",
- firstarg->s_name);
- argc--, argv++;
- }
- }
- if (!x->x_nvarout)
- {
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- 0, 2*sizeof(t_varout));
- x->x_varoutv[0].v_outlet = outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[0].v_what = OUT_PITCH;
- x->x_varoutv[1].v_outlet = outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[1].v_what = OUT_ENV;
- x->x_nvarout = 2;
- x->x_dopitch = 1;
- }
- if (x->x_dotracks)
- {
- x->x_ntrack = x->x_npeak;
- x->x_trackv = (t_peak *)getbytes(x->x_ntrack * sizeof(*x->x_trackv));
- }
- x->x_clock = clock_new(&x->x_obj.ob_pd, (t_method)sigmund_tick);
-
- x->x_infill = 0;
- x->x_countdown = 0;
- sigmund_npts(x, x->x_npts);
- notefinder_init(&x->x_notefinder);
- sigmund_clear(x);
- return (x);
-}
-
-static void sigmund_list(t_sigmund *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_symbol *syminput = atom_getsymbolarg(0, argc, argv);
- int npts = atom_getintarg(1, argc, argv);
- int onset = atom_getintarg(2, argc, argv);
- t_float srate = atom_getfloatarg(3, argc, argv);
- int loud = atom_getfloatarg(4, argc, argv);
- int arraysize, totstorage, nfound, i;
- t_garray *a;
- t_float *arraypoints, pit;
- t_word *wordarray = 0;
- if (argc < 5)
- {
- post(
- "sigmund: array-name, npts, array-onset, samplerate, loud");
- return;
- }
- if (npts < 64 || npts != (1 << ilog2(npts)))
- {
- error("sigmund: bad npoints");
- return;
- }
- if (onset < 0)
- {
- error("sigmund: negative onset");
- return;
- }
- arraypoints = alloca(sizeof(t_float)*npts);
- if (!(a = (t_garray *)pd_findbyclass(syminput, garray_class)) ||
- !garray_getfloatwords(a, &arraysize, &wordarray) ||
- arraysize < onset + npts)
- {
- error("%s: array missing or too small", syminput->s_name);
- return;
- }
- if (arraysize < npts)
- {
- error("sigmund~: too few points in array");
- return;
- }
- for (i = 0; i < npts; i++)
- arraypoints[i] = wordarray[i+onset].w_float;
- sigmund_doit(x, npts, arraypoints, loud, srate);
-}
-
-static void sigmund_clear(t_sigmund *x)
-{
- if (x->x_trackv)
- memset(x->x_trackv, 0, x->x_ntrack * sizeof(*x->x_trackv));
- x->x_infill = x->x_countdown = 0;
-}
-
- /* these are for testing; their meanings vary... */
-static void sigmund_param1(t_sigmund *x, t_floatarg f)
-{
- x->x_param1 = f;
-}
-
-static void sigmund_param2(t_sigmund *x, t_floatarg f)
-{
- x->x_param2 = f;
-}
-
-static void sigmund_param3(t_sigmund *x, t_floatarg f)
-{
- x->x_param3 = f;
-}
-
-static void sigmund_printnext(t_sigmund *x, t_float f)
-{
- x->x_loud = f;
-}
-
-void sigmund_tilde_setup(void)
-{
- sigmund_class = class_new(gensym("sigmund~"), (t_newmethod)sigmund_new,
- (t_method)sigmund_free, sizeof(t_sigmund), 0, A_GIMME, 0);
- class_addlist(sigmund_class, sigmund_list);
- class_addmethod(sigmund_class, (t_method)sigmund_dsp, gensym("dsp"), 0);
- CLASS_MAINSIGNALIN(sigmund_class, t_sigmund, x_f);
- class_addmethod(sigmund_class, (t_method)sigmund_param1,
- gensym("param1"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_param2,
- gensym("param2"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_param3,
- gensym("param3"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_npts,
- gensym("npts"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_hop,
- gensym("hop"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_maxfreq,
- gensym("maxfreq"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_npeak,
- gensym("npeak"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_vibrato,
- gensym("vibrato"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_stabletime,
- gensym("stabletime"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_growth,
- gensym("growth"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_minpower,
- gensym("minpower"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_print,
- gensym("print"), 0);
- class_addmethod(sigmund_class, (t_method)sigmund_printnext,
- gensym("printnext"), A_FLOAT, 0);
- post("sigmund~ version 0.07");
-}
-
-#endif /* PD */
-
-/************************ Max/MSP glue **********************************/
-
-/* -------------------------- MSP glue ------------------------- */
-#ifdef MSP
-static void *sigmund_class;
-
-/* Max/MSP has laxer sync between DSP and "tick"s - so in the perf routine we
-keep a circular buffer that is rectified into inbuf only when the tick comes. */
-
-static void sigmund_tick(t_sigmund *x)
-{
- int i, j, npts = x->x_npts;
- if (!x->x_inbuf)
- return;
- for (i = x->x_infill, j = 0; i < npts; i++, j++)
- x->x_inbuf[j] = x->x_inbuf2[i];
- for (i = 0; j < npts; i++, j++)
- x->x_inbuf[j] = x->x_inbuf2[i];
- sigmund_doit(x, x->x_npts, x->x_inbuf, x->x_loud, x->x_sr);
- x->x_loud = 0;
-}
-
-static t_int *sigmund_perform(t_int *w)
-{
- t_sigmund *x = (t_sigmund *)(w[1]);
- t_float *in = (t_float *)(w[2]);
- int n = (int)(w[3]), j;
- int infill = x->x_infill;
- t_float *fp = x->x_inbuf2 + infill;
-
- if (x->x_obj.z_disabled) /* return if in muted MSP subpatch -Rd */
- return (w+4);
-
- if (infill < 0 || infill >= x->x_npts)
- infill = 0;
- /* for some reason this sometimes happens: */
- if (!x->x_inbuf2)
- return (w+4);
- for (j = 0; j < n; j++)
- {
- *fp++ = *in++;
- if (++infill == x->x_npts)
- infill = 0, fp = x->x_inbuf2;
- }
- x->x_infill = infill;
- if (x->x_countdown <= 0)
- {
- x->x_countdown = x->x_hop;
- clock_delay(x->x_clock, 0);
- }
- x->x_countdown -= n;
- return (w+4);
-}
-
-static void *sigmund_new(t_symbol *s, long ac, t_atom *av)
-{
- t_sigmund *x;
- t_varout *g;
- int i, j;
- if (!(x = (t_sigmund *)object_alloc(sigmund_class)))
- return (0);
- sigmund_preinit(x);
- attr_args_process(x, ac, av);
- dsp_setup((t_pxobject *)x, 1);
- object_obex_store(x, gensym("dumpout"), outlet_new(x, NULL));
-
- for (i = 0; i < ac; i++)
- if (av[i].a_type == A_SYM)
- {
- char *s = av[i].a_w.w_sym->s_name;
- if (!strcmp(s, "pitch"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_PITCH;
- x->x_nvarout = n2;
- x->x_dopitch = 1;
- }
- else if (!strcmp(s, "env"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_ENV;
- x->x_nvarout = n2;
- }
- else if (!strcmp(s, "note") || !strcmp(s, "notes"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_NOTE;
- x->x_nvarout = n2;
- x->x_dopitch = x->x_donote = 1;
- }
- else if (!strcmp(s, "peaks"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_PEAKS;
- x->x_nvarout = n2;
- }
- else if (!strcmp(s, "tracks"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_TRACKS;
- x->x_nvarout = n2;
- x->x_dotracks = 1;
- }
- else if (s[0] != '@')
- post("sigmund: ignoring unknown argument '%s'" ,s);
- }
- if (!x->x_nvarout)
- {
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- 0, 2*sizeof(t_varout));
- x->x_varoutv[0].v_what = OUT_PITCH;
- x->x_varoutv[1].v_what = OUT_ENV;
- x->x_nvarout = 2;
- x->x_dopitch = 1;
- }
- for (j = 0, g = x->x_varoutv + x->x_nvarout-1; j < x->x_nvarout; j++, g--)
- g->v_outlet = ((g->v_what == OUT_PITCH || g->v_what == OUT_ENV ||
- g->v_what == OUT_NOTE) ?
- floatout((t_object *)x) : listout((t_object *)x));
- if (x->x_dotracks)
- {
- x->x_ntrack = x->x_npeak;
- x->x_trackv = (t_peak *)getbytes(x->x_ntrack * sizeof(*x->x_trackv));
- }
- x->x_clock = clock_new(x, (method)sigmund_tick);
- x->x_infill = 0;
- x->x_countdown = 0;
- sigmund_npts(x, x->x_npts);
- notefinder_init(&x->x_notefinder);
- return (x);
-}
-
-/* Attribute setters. */
-void sigmund_npts_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_npts(x, atom_getfloat(av));
-}
-
-void sigmund_hop_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_hop(x, atom_getfloat(av));
-}
-
-void sigmund_npeak_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_npeak(x, atom_getfloat(av));
-}
-
-void sigmund_maxfreq_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_maxfreq(x, atom_getfloat(av));
-}
-
-void sigmund_vibrato_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_vibrato(x, atom_getfloat(av));
-}
-
-void sigmund_stabletime_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_stabletime(x, atom_getfloat(av));
-}
-
-void sigmund_growth_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_growth(x, atom_getfloat(av));
-}
-
-void sigmund_minpower_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_minpower(x, atom_getfloat(av));
-}
-
-/* end attr setters */
-
-void sigmund_assist(t_sigmund *x, void *b, long m, long a, char *s)
-{
-}
-
-int main()
-{
- t_class *c;
- long attrflags = 0;
- t_symbol *sym_long = gensym("long"), *sym_float32 = gensym("float32");
-
- c = class_new("sigmund~", (method)sigmund_new,
- (method)sigmund_free, sizeof(t_sigmund), (method)0L, A_GIMME, 0);
-
- class_obexoffset_set(c, calcoffset(t_sigmund, obex));
-
- class_addattr(c, attr_offset_new("npts", sym_long, attrflags,
- (method)0L, (method)sigmund_npts_set,
- calcoffset(t_sigmund, x_npts)));
- class_addattr(c ,attr_offset_new("hop", sym_long, attrflags,
- (method)0L, (method)sigmund_hop_set,
- calcoffset(t_sigmund, x_hop)));
- class_addattr(c ,attr_offset_new("maxfreq", sym_float32, attrflags,
- (method)0L, (method)sigmund_maxfreq_set,
- calcoffset(t_sigmund, x_maxfreq)));
- class_addattr(c ,attr_offset_new("npeak", sym_long, attrflags,
- (method)0L, (method)sigmund_npeak_set,
- calcoffset(t_sigmund, x_npeak)));
- class_addattr(c ,attr_offset_new("vibrato", sym_float32, attrflags,
- (method)0L, (method)sigmund_vibrato_set,
- calcoffset(t_sigmund, x_vibrato)));
- class_addattr(c ,attr_offset_new("stabletime", sym_float32, attrflags,
- (method)0L, (method)sigmund_stabletime_set,
- calcoffset(t_sigmund, x_stabletime)));
- class_addattr(c ,attr_offset_new("growth", sym_float32, attrflags,
- (method)0L, (method)sigmund_growth_set,
- calcoffset(t_sigmund, x_growth)));
- class_addattr(c ,attr_offset_new("minpower", sym_float32, attrflags,
- (method)0L, (method)sigmund_minpower_set,
- calcoffset(t_sigmund, x_minpower)));
-
- class_addmethod(c, (method)sigmund_dsp, "dsp", A_CANT, 0);
- class_addmethod(c, (method)sigmund_print, "print", 0);
- class_addmethod(c, (method)sigmund_print, "printnext", A_DEFFLOAT, 0);
- class_addmethod(c, (method)sigmund_assist, "assist", A_CANT, 0);
-
- class_addmethod(c, (method)object_obex_dumpout, "dumpout", A_CANT, 0);
- class_addmethod(c, (method)object_obex_quickref, "quickref", A_CANT, 0);
-
- class_dspinit(c);
-
- class_register(CLASS_BOX, c);
- sigmund_class = c;
-
- post("sigmund~ version 0.07");
- return (0);
-}
-
-
-#endif /* MSP */
-
-
diff --git a/externals/extra/0.43.2/stdout/stdout-help.pd b/externals/extra/0.43.2/stdout/stdout-help.pd
deleted file mode 100644
index 91edbc41..00000000
--- a/externals/extra/0.43.2/stdout/stdout-help.pd
+++ /dev/null
@@ -1,19 +0,0 @@
-#N canvas 121 60 488 321 12;
-#X msg 126 203 walk the dog;
-#X msg 117 156 1;
-#X obj 117 240 stdout;
-#X text 269 287 updated for Pd version 0.42;
-#X obj 14 13 stdout;
-#X text 67 14 - write messages to standard output;
-#X msg 122 179 1 2;
-#X obj 119 291 pd~;
-#X text 44 291 see also:;
-#X text 34 39 Sends messages to Pd's standard output. This is useful
-in conjunction with the pd~ object \, which starts a pd sub-process.
-Messages sent to the sub-process standard output appear on the output
-of the pd~ object in the owning process. This might also be useful
-in other situations. Note that there's no corresponding "stdin" object
-- there seems to be no one canonical way such a thing should act.;
-#X connect 0 0 2 0;
-#X connect 1 0 2 0;
-#X connect 6 0 2 0;
diff --git a/externals/extra/0.43.2/stdout/stdout.c b/externals/extra/0.43.2/stdout/stdout.c
deleted file mode 100644
index 5cd52f25..00000000
--- a/externals/extra/0.43.2/stdout/stdout.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* stdout -- write messages to standard output.
-
- Copyright 2008 Miller Puckette
- BSD license; see README.txt in this distribution for details.
-*/
-
-#include "m_pd.h"
-#include <stdio.h>
-#include <string.h>
-static t_class *stdout_class;
-
-typedef struct _stdout
-{
- t_object x_obj;
-} t_stdout;
-
-static void *stdout_new(t_float fnonrepeat)
-{
- t_stdout *x = (t_stdout *)pd_new(stdout_class);
- return (x);
-}
-
-static void stdout_anything(t_stdout *x, t_symbol *s, int argc, t_atom *argv)
-{
- char msgbuf[MAXPDSTRING], *sp, *ep = msgbuf+MAXPDSTRING;
- msgbuf[0] = 0;
- strncpy(msgbuf, s->s_name, MAXPDSTRING);
- msgbuf[MAXPDSTRING-1] = 0;
- sp = msgbuf + strlen(msgbuf);
- while (argc--)
- {
- if (sp < ep-1)
- sp[0] = ' ', sp[1] = 0, sp++;
- atom_string(argv++, sp, ep-sp);
- sp += strlen(sp);
- }
- printf("%s;\n", msgbuf);
-}
-
-static void stdout_free(t_stdout *x)
-{
- fflush(stdout);
-}
-
-void stdout_setup(void)
-{
- stdout_class = class_new(gensym("stdout"), (t_newmethod)stdout_new,
- (t_method)stdout_free, sizeof(t_stdout), 0, 0);
- class_addanything(stdout_class, stdout_anything);
-}
diff --git a/externals/extra/0.43.3/0.43.2/LICENSE.txt b/externals/extra/0.43.3/0.43.2/LICENSE.txt
deleted file mode 100644
index bb6c6e6e..00000000
--- a/externals/extra/0.43.3/0.43.2/LICENSE.txt
+++ /dev/null
@@ -1,378 +0,0 @@
-
-Most of the code is covered by a BSD license, but the 'expr' code is covered by a GPL license:
-
-------------------------------------------------------------------------------
-
-This software is copyrighted by Miller Puckette and others. The following
-terms (the "Standard Improved BSD License") apply to all files associated with
-the software unless explicitly disclaimed in individual files:
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-3. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior
- written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
-
-------------------------------------------------------------------------------
-
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/externals/extra/0.43.3/0.43.2/Makefile b/externals/extra/0.43.3/0.43.2/Makefile
deleted file mode 100644
index e3b0e63e..00000000
--- a/externals/extra/0.43.3/0.43.2/Makefile
+++ /dev/null
@@ -1,263 +0,0 @@
-# To use this Makefile for your project, first put the name of your library in
-# LIBRARY_NAME variable. The folder for your project should have the same name
-# as your library.
-LIBRARY_NAME = extra
-
-# Next, add your source files to the SOURCES variable.
-SOURCES = bonk~/bonk~.c choice/choice.c fiddle~/fiddle~.c loop~/loop~.c lrshift~/lrshift~.c pique/pique.c sigmund~/sigmund~.c stdout/stdout.c
-
-# For objects that only build on certain platforms, add those to the SOURCES
-# line for the right platforms.
-SOURCES_Darwin = pd~/pd~.c
-SOURCES_Linux = pd~/pd~.c
-
-# include these abstractions with their help patches
-PD_OBJECTS = complex-mod~.pd hilbert~.pd rev1~.pd rev2~.pd rev3~.pd
-
-# these are meant to be customizable
-CFLAGS = -Wall -W -g
-LDFLAGS =
-
-#------------------------------------------------------------------------------#
-#
-# you shouldn't need to edit anything below here, if we did it right :)
-#
-#------------------------------------------------------------------------------#
-
-# where Pd lives
-PD_PATH = ../../pd
-# where to install the library
-prefix = /usr/local
-libdir = $(prefix)/lib
-pkglibdir = $(libdir)/pd-externals
-objectsdir = $(pkglibdir)
-
-ALL_CFLAGS = -DPD -I$(PD_PATH)/src
-ALL_LDFLAGS =
-LIBS =
-
-LN_S = ln -s
-
-INSTALL = install
-INSTALL_PROGRAM = $(INSTALL) -p -m 644
-INSTALL_DATA = $(INSTALL) -p -m 644
-INSTALL_DIR = $(INSTALL) -p -m 755 -d
-
-UNAME := $(shell uname -s)
-ifeq ($(UNAME),Darwin)
- SOURCES += $(SOURCES_Darwin)
- EXTENSION = pd_darwin
- OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast
- FAT_FLAGS = -arch i386 -arch ppc -mmacosx-version-min=10.4
- ALL_CFLAGS += -fPIC $(FAT_FLAGS)
- ALL_LDFLAGS += -bundle -undefined dynamic_lookup $(FAT_FLAGS)
- LIBS += -lc -lm
- STRIP = strip -x
- endif
-ifeq ($(UNAME),Linux)
- SOURCES += $(SOURCES_Linux)
- EXTENSION = pd_linux
- OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
- ALL_CFLAGS += -fPIC
- ALL_LDFLAGS += -Wl,--export-dynamic -shared -fPIC
- LIBS += -lc
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-ifeq ($(UNAME),GNU)
- # GNU/Hurd, should work like GNU/Linux for basically all externals
- SOURCES += $(SOURCES_linux)
- EXTENSION = pd_linux
- OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
- ALL_CFLAGS += -fPIC
- ALL_LDFLAGS += -Wl,--export-dynamic -shared -fPIC
- LIBS += -lc
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-ifeq ($(UNAME),GNU/kFreeBSD)
- # Debian GNU/kFreeBSD, should work like GNU/Linux for basically all externals
- SOURCES += $(SOURCES_linux)
- EXTENSION = pd_linux
- OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
- ALL_CFLAGS += -fPIC
- ALL_LDFLAGS += -Wl,--export-dynamic -shared -fPIC
- LIBS += -lc
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME)))
-# SOURCES += $(SOURCES_Linux)
- EXTENSION = dll
- OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
- ALL_CFLAGS += -fPIC
- ALL_LDFLAGS += -L$(PD_PATH)/src -Wl,--export-dynamic -shared -fPIC
- LIBS += -lc -lpd
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-ifeq (MINGW,$(findstring MINGW,$(UNAME)))
- SOURCES += $(SOURCES_Windows)
- EXTENSION = dll
- CC=gcc
- OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer -march=i686 -mtune=pentium4
- WINDOWS_HACKS = -D'O_NONBLOCK=1'
- ALL_CFLAGS += -mms-bitfields $(WINDOWS_HACKS)
- ALL_LDFLAGS += -s -shared -Wl,--enable-auto-import
- LIBS += -L$(PD_PATH)/src -lpd -lwsock32 -lkernel32 -luser32 -lgdi32
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-
-ALL_CFLAGS += $(OPT_CFLAGS)
-
-
-.PHONY = install libdir_install single_install install-doc install-exec clean dist etags
-
-# kludges for objects with strange build requirements
-EXPR_OBJECTS = expr~/expr~.$(EXTENSION) fexpr~.$(EXTENSION) expr.$(EXTENSION)
-# special cases, where there are multiple .c files for a single class
-EXPR_SOURCES = expr~/vexp.c expr~/vexp_fun.c expr~/vexp_if.c
-
-
-# get library version from meta file
-LIBRARY_VERSION = $(shell sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' $(LIBRARY_NAME)-meta.pd)
-DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION)
-ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION)
-
-
-all: $(SOURCES:.c=.$(EXTENSION)) $(EXPR_OBJECTS) pd~/pdsched.$(EXTENSION)
-
-%.o: %.c
- $(CC) $(ALL_CFLAGS) $(CFLAGS) -o "$*.o" -c "$*.c"
-
-%.$(EXTENSION): %.o
- $(CC) $(ALL_LDFLAGS) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS)
- chmod a-x "$*.$(EXTENSION)"
-
-
-expr~/expr~.$(EXTENSION): $(EXPR_SOURCES:.c=.o)
- $(CC) $(ALL_LDFLAGS) $(LDFLAGS) -o expr~/expr~.$(EXTENSION) $(EXPR_SOURCES:.c=.o) $(LIBS)
- chmod a-x expr~/expr~.$(EXTENSION)
-
-expr.$(EXTENSION): expr~/expr~.$(EXTENSION)
- test -e expr.$(EXTENSION) || \
- $(LN_S) expr~/expr~.$(EXTENSION) expr.$(EXTENSION)
-
-fexpr~.$(EXTENSION): expr~/expr~.$(EXTENSION)
- test -e fexpr~.$(EXTENSION) || \
- $(LN_S) expr~/expr~.$(EXTENSION) fexpr~.$(EXTENSION)
-
-install: all install-doc install-exec install-special
-
-# install all the weird old kludgey build stuff here
-install-special:
- $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) extra-meta.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(EXPR_OBJECTS) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(SOURCES:.c=-help.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) rev1-final.pd rev1-stage.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) expr-help.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/*.$(EXTENSION)
-
-install-doc:
- $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(SOURCES:.c=-help.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(PD_OBJECTS:.pd=-help.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) pd~/pd~-subprocess.pd pd~/z.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) README.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt
-
-install-exec:
- $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(PD_OBJECTS) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) pd~/pdsched.$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
-
-dist:
- $(INSTALL_DIR) $(DISTDIR)
- $(INSTALL_DATA) Makefile $(DISTDIR)
- $(INSTALL_DATA) README.txt $(DISTDIR)
- $(INSTALL_DATA) LICENSE.txt $(DISTDIR)
- $(INSTALL_DATA) extra-meta.pd $(DISTDIR)
- $(INSTALL_DATA) complex-mod~-help.pd $(DISTDIR)
- $(INSTALL_DATA) complex-mod~.pd $(DISTDIR)
- $(INSTALL_DATA) hilbert~-help.pd $(DISTDIR)
- $(INSTALL_DATA) hilbert~.pd $(DISTDIR)
- $(INSTALL_DATA) rev1-final.pd $(DISTDIR)
- $(INSTALL_DATA) rev1~-help.pd $(DISTDIR)
- $(INSTALL_DATA) rev1~.pd $(DISTDIR)
- $(INSTALL_DATA) rev1-stage.pd $(DISTDIR)
- $(INSTALL_DATA) rev2~-help.pd $(DISTDIR)
- $(INSTALL_DATA) rev2~.pd $(DISTDIR)
- $(INSTALL_DATA) rev3~-help.pd $(DISTDIR)
- $(INSTALL_DATA) rev3~.pd $(DISTDIR)
- $(INSTALL_DATA) expr-help.pd $(DISTDIR)
- $(INSTALL_DIR) $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/fts_to_pd.h $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/LICENSE.txt $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/README.txt $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/vexp.c $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/vexp_fun.c $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/vexp.h $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/vexp_if.c $(DISTDIR)/expr~
- $(INSTALL_DIR) $(DISTDIR)/bonk~
- $(INSTALL_DATA) bonk~/bonk~.c $(DISTDIR)/bonk~
- $(INSTALL_DATA) bonk~/bonk~-help.pd $(DISTDIR)/bonk~
- $(INSTALL_DATA) bonk~/templates.txt $(DISTDIR)/bonk~
- $(INSTALL_DIR) $(DISTDIR)/choice
- $(INSTALL_DATA) choice/choice.c $(DISTDIR)/choice
- $(INSTALL_DATA) choice/choice-help.pd $(DISTDIR)/choice
- $(INSTALL_DIR) $(DISTDIR)/fiddle~
- $(INSTALL_DATA) fiddle~/fiddle~.c $(DISTDIR)/fiddle~
- $(INSTALL_DATA) fiddle~/fiddle~-help.pd $(DISTDIR)/fiddle~
- $(INSTALL_DIR) $(DISTDIR)/loop~
- $(INSTALL_DATA) loop~/loop~.c $(DISTDIR)/loop~
- $(INSTALL_DATA) loop~/loop~-help.pd $(DISTDIR)/loop~
- $(INSTALL_DATA) loop~/test-loop~.pd $(DISTDIR)/loop~
- $(INSTALL_DIR) $(DISTDIR)/lrshift~
- $(INSTALL_DATA) lrshift~/lrshift~.c $(DISTDIR)/lrshift~
- $(INSTALL_DATA) lrshift~/lrshift~-help.pd $(DISTDIR)/lrshift~
- $(INSTALL_DIR) $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/notes.txt $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/pd~.c $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/pd~-help.pd $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/pdsched.c $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/pd~-subprocess.pd $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/z.pd $(DISTDIR)/pd~
- $(INSTALL_DIR) $(DISTDIR)/pique
- $(INSTALL_DATA) pique/pique.c $(DISTDIR)/pique
- $(INSTALL_DATA) pique/pique-help.pd $(DISTDIR)/pique
- $(INSTALL_DIR) $(DISTDIR)/sigmund~
- $(INSTALL_DATA) sigmund~/sigmund~.c $(DISTDIR)/sigmund~
- $(INSTALL_DATA) sigmund~/sigmund~-help.pd $(DISTDIR)/sigmund~
- $(INSTALL_DIR) $(DISTDIR)/stdout
- $(INSTALL_DATA) stdout/stdout.c $(DISTDIR)/stdout
- $(INSTALL_DATA) stdout/stdout-help.pd $(DISTDIR)/stdout
- tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR)
-
-distclean: clean
- -rm -f -- $(DISTBINDIR).tar.gz
- -rm -rf -- $(DISTBINDIR)
- -rm -f -- $(DISTDIR).tar.gz
- -rm -rf -- $(DISTDIR)
- -rm -f -- $(ORIGDIR).tar.gz
- -rm -rf -- $(ORIGDIR)
-
-# make a Debian source package
-dpkg-source:
- debclean
- make distclean dist
- mv $(DISTDIR) $(ORIGDIR)
- tar --exclude-vcs -czpf ../$(ORIGDIR).orig.tar.gz $(ORIGDIR)
- rm -f -- $(DISTDIR).tar.gz
- rm -rf -- $(DISTDIR) $(ORIGDIR)
- cd .. && dpkg-source -b $(LIBRARY_NAME)
-
-clean:
- -rm -f -- $(SOURCES:.c=.o)
- -rm -f -- $(SOURCES:.c=.$(EXTENSION))
- -rm -f -- $(LIBRARY_NAME).$(EXTENSION)
- -rm -f -- $(EXPR_SOURCES:.c=.o)
- -rm -f -- $(EXPR_OBJECTS) pd~/pdsched.$(EXTENSION)
-
-showpaths:
- @echo "PD_PATH: $(PD_PATH)"
- @echo "objectsdir: $(objectsdir)"
- @echo "LIBRARY_NAME: $(LIBRARY_NAME)"
- @echo "SOURCES: $(SOURCES)"
diff --git a/externals/extra/0.43.3/0.43.2/README.txt b/externals/extra/0.43.3/0.43.2/README.txt
deleted file mode 100644
index 850e3032..00000000
--- a/externals/extra/0.43.3/0.43.2/README.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-This is the README file for the "extras" library, consisting of Pd
-objects which are too specialized or otherwise non-canonical for
-inclusion into Pd proper. These files are open source; see
-LICENSE.txt in this distribution for details.
-Note however that "expr" is GPL (the rest is all BSD).
-
-This package should run in Pd under linux, MSW, or Mac OSX.
-You can additionally compile fiddle~. bonk~, and paf~ for Max/MSP.
-
-contents:
-
-externs:
-fiddle~ -- pitch tracker
-bonk~ - percussion detector
-choose - find the "best fit" of incoming vector with stored profiles
-paf~ -- phase aligned formant generator
-loop~ -- sample looper
-expr -- arithmetic expression evaluation (Shahrokh Yadegari)
-pique - fft-based peak finder
-lrshift~ - left or right shift an audio vector
-
-abstractions:
-hilbert~ - Hilbert transform for SSB modulation
-complex-mod~ - ring modulation for complex (real+imaginary) audio signals
-rev1~, etc. - reverberators
-
-These objects are part of the regular Pd distribution as of Pd version
-0.30. Macintosh versions of fiddle~, bonk~, and paf~ are available
-from http://www.crca.ucsd.edu/~tapel
-- msp@ucsd.edu
diff --git a/externals/extra/0.43.3/0.43.2/bonk~/bonk~-help.pd b/externals/extra/0.43.3/0.43.2/bonk~/bonk~-help.pd
deleted file mode 100644
index 4666d6f5..00000000
--- a/externals/extra/0.43.3/0.43.2/bonk~/bonk~-help.pd
+++ /dev/null
@@ -1,209 +0,0 @@
-#N canvas 0 0 1052 581 12;
-#X obj 382 492 spigot;
-#X msg 484 293 bang;
-#X obj 483 454 bonk~;
-#X msg 483 357 print;
-#X obj 435 428 adc~;
-#X msg 637 506 \; pd dsp 1;
-#X obj 300 492 spigot;
-#N canvas 366 126 604 404 synth 0;
-#X obj 112 24 r bonk-cooked;
-#X obj 112 49 unpack;
-#X obj 112 99 * 12;
-#X obj 112 124 div 7;
-#X obj 112 74 + 1;
-#X obj 112 174 mtof;
-#X obj 112 224 osc~;
-#X obj 112 249 cos~;
-#X obj 112 149 + 47;
-#X obj 209 247 line~;
-#X obj 209 272 *~;
-#X obj 209 297 lop~ 500;
-#X obj 112 274 *~;
-#X obj 103 361 dac~;
-#X obj 253 165 dbtorms;
-#X obj 253 115 * 0.5;
-#X obj 253 140 + 50;
-#X obj 211 189 f;
-#X msg 173 159 bang;
-#X obj 258 83 inlet;
-#X obj 111 307 hip~ 5;
-#X msg 34 24 0 60;
-#X obj 112 199 sig~;
-#X msg 209 222 \$1 \, 0 200;
-#X connect 0 0 1 0;
-#X connect 1 0 4 0;
-#X connect 2 0 3 0;
-#X connect 3 0 8 0;
-#X connect 4 0 2 0;
-#X connect 5 0 18 0;
-#X connect 5 0 22 0;
-#X connect 6 0 7 0;
-#X connect 7 0 12 0;
-#X connect 8 0 5 0;
-#X connect 9 0 10 0;
-#X connect 9 0 10 1;
-#X connect 10 0 11 0;
-#X connect 11 0 12 1;
-#X connect 12 0 20 0;
-#X connect 14 0 17 1;
-#X connect 15 0 16 0;
-#X connect 16 0 14 0;
-#X connect 17 0 23 0;
-#X connect 18 0 17 0;
-#X connect 19 0 15 0;
-#X connect 20 0 13 1;
-#X connect 20 0 13 0;
-#X connect 21 0 1 0;
-#X connect 22 0 6 0;
-#X connect 23 0 9 0;
-#X restore 869 523 pd synth;
-#X floatatom 869 500 0 0 0 0 - - -;
-#X msg 869 470 0;
-#X msg 900 470 90;
-#X text 625 472 click here;
-#X text 626 485 to start DSP;
-#X text 5 285 In this patch \, after starting DSP \, you can print
-out the raw or cooked output using the two "spigots" or listen to a
-synthesizer output by raising its volume.;
-#X text 770 469 output volume;
-#X text 784 487 (0-100);
-#X msg 483 138 mask 4 0.7;
-#X text 578 120 Describes how energy in each frequency band masks later
-energy in the band. Here the masking is total for 4 analysis periods
-and then drops by 0.7 each period.;
-#X text 528 286 Poll the current spectrum via "raw" outlet \, You can
-set a very high threshold if you don't want attacks mixed in.;
-#X msg 483 331 debug 0;
-#X text 561 331 turn debugging on or off.;
-#X obj 349 493 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 431 493 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 382 522 print cooked;
-#X obj 300 522 print raw;
-#X text 162 491 enable printout:;
-#X text 560 202 Minimum "velocity" to output (quieter notes are ignored.)
-;
-#X obj 485 481 s bonk-cooked;
-#X text 8 145 Bonk's two outputs are the raw spectrum of the attack
-(provided as a list of 11 numbers giving the signal "loudness" in the
-11 frequency bands used) \, and the "cooked" output which gives only
-an instrument number (counting up from zero) and a "velocity". This
-"velocity" is the sum of the square roots of the amplitudes of the
-bands \, normalized so that 100 is an attack of amplitude of about
-1 The instrument number is significant only if Bonk has a "template
-set" in memory.;
-#X text 580 35 Set low and high thresholds. Signal growth must exceed
-the high one and then fall to the low one to make an attack. The unit
-is the sum of the proportional growth in the 11 filter bands. Proportional
-growth is essentially the logarithmic time derivative.;
-#X msg 483 384 print 1;
-#X text 551 386 print out filterbank settings;
-#X text 9 33 The Bonk object takes an audio signal input and looks
-for "attacks" defined as sharp changes in the spectral envelope of
-the incoming sound. Optionally \, and less reliably \, you can have
-Bonk check the attack against a collection of stored templates to try
-to guess which of two or more instruments was hit. Bonk is described
-theoretically in the 1998 ICMC proceedings \, reprinted on crca.ucsd.edu/~msp
-.;
-#N canvas 0 0 699 717 creation-arguments 1;
-#X text 228 14 creation arguments for bonk~;
-#X text 70 272 -npts 256;
-#X text 44 244 default value:;
-#X text 70 308 -hop 128;
-#X text 70 342 -nfilters 11;
-#X text 68 380 -halftones 6;
-#X text 76 514 -overlap 1;
-#X text 79 567 -firstbin 1;
-#X text 71 454 -minbandwidth 1.5;
-#X text 122 147 All frequency parameters are specified in 'bins'. One
-bin is the sample rate divided by the window size. The minimum possible
-bandwidth is 1.5 bins. Higher bandwidths give numerically more robust
-outputs.;
-#X text 43 229 Arguments and;
-#X text 212 270 window size in points;
-#X text 210 306 analysis period ("hop size") in points;
-#X text 212 340 number of filters to use;
-#X text 212 379 desired bandwidth of filters in halftones \, effective
-in the exponentially spaced region. (At lower center frequencies the
-bandwidth is supported by the "minbandwidth" parameter below).;
-#X text 212 511 overlap factor between filters. If 1 \, the filters
-are spaced to line up at their half-power points. Other values specify
-more or fewer filters proportionally.;
-#X text 121 49 bonk~ uses a filterbank whose center frequencies are
-spaced equally at low frequencies and proportionally at high ones -
-i.e. \, they increase linearly \, then exponentially. They are determined
-by the filters' bandwidths and overlap. The bandwidths are specified
-proportionally to frequency but bounded below by a specified minimum.
-;
-#X text 210 455 minimum bandwidth in bins. If the bandwidth specified
-by "halftones" is smaller than this \, this value is used. This must
-be at least 1.5.;
-#X text 212 567 center frequency \, in bins \, of the lowest filter.
-The others are computed from this.;
-#X restore 147 414 pd creation-arguments;
-#N canvas 660 173 579 589 templates 0;
-#X msg 76 197 learn 0;
-#X msg 76 227 forget;
-#X msg 76 257 write templates.txt;
-#X msg 76 287 read templates.txt;
-#X msg 76 107 debounce 0;
-#X msg 76 137 learn 10;
-#X obj 62 431 outlet;
-#X text 155 133 Forget all templates and start learning new ones. The
-argument gives the number of times you will hit each instrument (10
-recommended.) Turn on the output volume above for audible feedback
-as you train Bonk. "Learn 0" exits learn mode.;
-#X text 155 217 Forget the last template. In Learn mode \, use "forget"
-to erase and record over a template.;
-#X text 220 253 Write templates to a file in text-editable format.
-;
-#X text 221 283 Read templates from a file.;
-#X text 157 104 Minimum time (msec) between attacks in learn mode;
-#X connect 0 0 6 0;
-#X connect 1 0 6 0;
-#X connect 2 0 6 0;
-#X connect 3 0 6 0;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X restore 500 421 pd templates;
-#X msg 483 68 thresh 2.5 5;
-#X msg 483 173 attack-frames 1;
-#X text 608 174 number of frames over which to measure growth;
-#X text 605 422 more messages for managing templates;
-#X msg 483 201 minvel 7;
-#X msg 483 228 spew 0;
-#X text 550 230 Turn spew mode on/off;
-#X msg 483 255 useloudness 0;
-#X text 597 254 experimental: use alternative loudness units;
-#X text 212 9 BONK~ - attack detection and spectral envelope measurement
-;
-#X text 734 552 Updated for Pd version 0.42;
-#X text 5 344 By default bonk's analysis is carried out on a 256-point
-window (6 msec at 44.1 kHz) and the analysis period is 128 samples.
-These and other parameters may be overridden using creation arguments
-as shown in the subpatch below:;
-#X text 552 356 Print out settings and templates.;
-#X connect 0 0 23 0;
-#X connect 1 0 2 0;
-#X connect 2 0 6 0;
-#X connect 2 1 0 0;
-#X connect 2 1 27 0;
-#X connect 3 0 2 0;
-#X connect 4 0 2 0;
-#X connect 6 0 24 0;
-#X connect 8 0 7 0;
-#X connect 9 0 8 0;
-#X connect 10 0 8 0;
-#X connect 16 0 2 0;
-#X connect 19 0 2 0;
-#X connect 21 0 6 1;
-#X connect 22 0 0 1;
-#X connect 30 0 2 0;
-#X connect 34 0 2 0;
-#X connect 35 0 2 0;
-#X connect 36 0 2 0;
-#X connect 39 0 2 0;
-#X connect 40 0 2 0;
-#X connect 42 0 2 0;
diff --git a/externals/extra/0.43.3/0.43.2/bonk~/bonk~.c b/externals/extra/0.43.3/0.43.2/bonk~/bonk~.c
deleted file mode 100644
index c3516775..00000000
--- a/externals/extra/0.43.3/0.43.2/bonk~/bonk~.c
+++ /dev/null
@@ -1,1638 +0,0 @@
-/*
- ###########################################################################
- # bonk~ - a Max/MSP external
- # by miller puckette and ted apel
- # http://crca.ucsd.edu/~msp/
- # Max/MSP port by barry threw
- # http://www.barrythrew.com
- # me@barrythrew.com
- # San Francisco, CA
- # (c) 2008
- # for Kesumo - http://www.kesumo.com
- ###########################################################################
- // bonk~ detects attacks in an audio signal
- ###########################################################################
- This software is copyrighted by Miller Puckette and others. The following
- terms (the "Standard Improved BSD License") apply to all files associated with
- the software unless explicitly disclaimed in individual files:
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- 3. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior
- written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
-dolist:
-decay and other times in msec
-*/
-
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
-/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
-#ifdef _MSC_VER
-#pragma warning (disable: 4305 4244)
-#endif
-
-#ifdef MSP
-#include "ext.h"
-#include "z_dsp.h"
-#include "math.h"
-#include "ext_support.h"
-#include "ext_proto.h"
-#include "ext_obex.h"
-
-typedef double t_floatarg; /* from m_pd.h */
-#define flog log
-#define fexp exp
-#define fsqrt sqrt
-#define t_resizebytes(a, b, c) t_resizebytes((char *)(a), (b), (c))
-
-void *bonk_class;
-#define getbytes t_getbytes
-#define freebytes t_freebytes
-#endif /* MSP */
-
-#ifdef PD
-#include "m_pd.h"
-static t_class *bonk_class;
-#endif
-
-#ifdef _WIN32
-#include <malloc.h>
-#elif ! defined(_MSC_VER)
-#include <alloca.h>
-#endif
-
-/* ------------------------ bonk~ ----------------------------- */
-
-#define DEFNPOINTS 256
-#define MAXCHANNELS 8
-#define MINPOINTS 64
-#define DEFPERIOD 128
-#define DEFNFILTERS 11
-#define DEFHALFTONES 6
-#define DEFOVERLAP 1
-#define DEFFIRSTBIN 1
-#define DEFMINBANDWIDTH 1.5
-#define DEFHITHRESH 5
-#define DEFLOTHRESH 2.5
-#define DEFMASKTIME 4
-#define DEFMASKDECAY 0.7
-#define DEFDEBOUNCEDECAY 0
-#define DEFMINVEL 7
-#define DEFATTACKBINS 1
-#define MAXATTACKWAIT 4
-
-typedef struct _filterkernel
-{
- int k_filterpoints;
- int k_hoppoints;
- int k_skippoints;
- int k_nhops;
- t_float k_centerfreq; /* center frequency, bins */
- t_float k_bandwidth; /* bandwidth, bins */
- t_float *k_stuff;
-} t_filterkernel;
-
-typedef struct _filterbank
-{
- int b_nfilters; /* number of filters in bank */
- int b_npoints; /* input vector size */
- t_float b_halftones; /* filter bandwidth in halftones */
- t_float b_overlap; /* overlap; default 1 for 1/2-power pts */
- t_float b_firstbin; /* freq of first filter in bins, default 1 */
- t_float b_minbandwidth; /* minimum bandwidth, default 1.5 */
- t_filterkernel *b_vec; /* filter kernels */
- int b_refcount; /* number of bonk~ objects using this */
- struct _filterbank *b_next; /* next in linked list */
-} t_filterbank;
-
-#if 0 /* this is the design for 1.0: */
-static t_filterkernel bonk_filterkernels[] =
- {{256, 2, .01562}, {256, 4, .01562}, {256, 6, .01562}, {180, 6, .02222},
- {128, 6, .01803}, {90, 6, .02222}, {64, 6, .02362}, {46, 6, .02773},
- {32, 6, .03227}, {22, 6, .03932}, {16, 6, .04489}};
-#endif
-
-#if 0
- /* here's the 1.1 rev: */
-static t_filterkernel bonk_filterkernels[] =
- {{256, 1, .01562, 0}, {256, 3, .01562, 0}, {256, 5, .01562, 0},
- {212, 6, .01886, 0}, {150, 6, .01885, 0}, {106, 6, .02179, 0},
- {76, 6, .0236, 0}, {54, 6, .02634, 0}, {38, 6, .03047, 0},
- {26, 6, .03667, 0}, {18, 6, .04458, 0}};
-
-#define NFILTERS \
- ((int)(sizeof(bonk_filterkernels) / sizeof(bonk_filterkernels[0])))
-
-#endif
-
-#if 0
- /* and 1.2 */
-#define NFILTERS 11
-static t_filterkernel bonk_filterkernels[NFILTERS];
-#endif
-
- /* and 1.3 */
-#define MAXNFILTERS 50
-#define MASKHIST 8
-
-static t_filterbank *bonk_filterbanklist;
-
-typedef struct _hist
-{
- t_float h_power;
- t_float h_before;
- t_float h_outpower;
- int h_countup;
- t_float h_mask[MASKHIST];
-} t_hist;
-
-typedef struct template
-{
- t_float t_amp[MAXNFILTERS];
-} t_template;
-
-typedef struct _insig
-{
- t_hist g_hist[MAXNFILTERS]; /* history for each filter */
-#ifdef PD
- t_outlet *g_outlet; /* outlet for raw data */
-#endif
-#ifdef MSP
- void *g_outlet; /* outlet for raw data */
-#endif
- t_float *g_inbuf; /* buffered input samples */
- t_float *g_invec; /* new input samples */
-} t_insig;
-
-typedef struct _bonk
-{
-#ifdef PD
- t_object x_obj;
- t_outlet *x_cookedout;
- t_clock *x_clock;
- t_canvas *x_canvas; /* ptr to current canvas --fbar */
-#endif /* PD */
-#ifdef MSP
- t_pxobject x_obj;
- void *obex;
- void *x_cookedout;
- void *x_clock;
-#endif /* MSP */
- /* parameters */
- int x_npoints; /* number of points in input buffer */
- int x_period; /* number of input samples between analyses */
- int x_nfilters; /* number of filters requested */
- t_float x_halftones; /* nominal halftones between filters */
- t_float x_overlap;
- t_float x_firstbin;
- t_float x_minbandwidth;
- t_float x_hithresh; /* threshold for total growth to trigger */
- t_float x_lothresh; /* threshold for total growth to re-arm */
- t_float x_minvel; /* minimum velocity we output */
- t_float x_maskdecay;
- int x_masktime;
- int x_useloudness; /* use loudness spectra instead of power */
- t_float x_debouncedecay;
- t_float x_debouncevel;
- double x_learndebounce; /* debounce time (in "learn" mode only) */
- int x_attackbins; /* number of bins to wait for attack */
-
- t_filterbank *x_filterbank;
- t_hist x_hist[MAXNFILTERS];
- t_template *x_template;
- t_insig *x_insig;
- int x_ninsig;
- int x_ntemplate;
- int x_infill;
- int x_countdown;
- int x_willattack;
- int x_attacked;
- int x_debug;
- int x_learn;
- int x_learncount; /* countup for "learn" mode */
- int x_spew; /* if true, always generate output! */
- int x_maskphase; /* phase, 0 to MASKHIST-1, for mask history */
- t_float x_sr; /* current sample rate in Hz. */
- int x_hit; /* next "tick" called because of a hit, not a poll */
-} t_bonk;
-
-#ifdef MSP
-static void *bonk_new(t_symbol *s, long ac, t_atom *av);
-static void bonk_tick(t_bonk *x);
-static void bonk_doit(t_bonk *x);
-static t_int *bonk_perform(t_int *w);
-static void bonk_dsp(t_bonk *x, t_signal **sp);
-void bonk_assist(t_bonk *x, void *b, long m, long a, char *s);
-static void bonk_free(t_bonk *x);
-void bonk_setup(void);
-int main();
-
-static void bonk_thresh(t_bonk *x, t_floatarg f1, t_floatarg f2);
-static void bonk_print(t_bonk *x, t_floatarg f);
-static void bonk_bang(t_bonk *x);
-
-static void bonk_write(t_bonk *x, t_symbol *s);
-static void bonk_dowrite(t_bonk *x, t_symbol *s);
-static void bonk_writefile(t_bonk *x, char *filename, short path);
-
-static void bonk_read(t_bonk *x, t_symbol *s);
-static void bonk_doread(t_bonk *x, t_symbol *s);
-static void bonk_openfile(t_bonk *x, char *filename, short path);
-
-void bonk_minvel_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_lothresh_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_hithresh_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_masktime_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_maskdecay_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_debouncedecay_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_debug_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_spew_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_useloudness_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_attackbins_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_learn_set(t_bonk *x, void *attr, long ac, t_atom *av);
-
-t_float qrsqrt(t_float f);
-double clock_getsystime();
-double clock_gettimesince(double prevsystime);
-char *strcpy(char *s1, const char *s2);
-#endif
-
-static void bonk_tick(t_bonk *x);
-
-#define HALFWIDTH 0.75 /* half peak bandwidth at half power point in bins */
-#define SLIDE 0.25 /* relative slide between filter subwindows */
-
-static t_filterbank *bonk_newfilterbank(int npoints, int nfilters,
- t_float halftones, t_float overlap, t_float firstbin, t_float minbandwidth)
-{
- int i, j;
- t_float cf, bw, h, relspace;
- t_filterbank *b = (t_filterbank *)getbytes(sizeof(*b));
- b->b_npoints = npoints;
- b->b_nfilters = nfilters;
- b->b_halftones = halftones;
- b->b_overlap = overlap;
- b->b_firstbin = firstbin;
- b->b_minbandwidth = minbandwidth;
- b->b_refcount = 0;
- b->b_next = bonk_filterbanklist;
- bonk_filterbanklist = b;
- b->b_vec = (t_filterkernel *)getbytes(nfilters * sizeof(*b->b_vec));
-
- h = exp((log(2.)/12.)*halftones); /* specced interval between filters */
- relspace = (h - 1)/(h + 1); /* nominal spacing-per-f for fbank */
-
- if (minbandwidth < 2*HALFWIDTH)
- minbandwidth = 2*HALFWIDTH;
- if (firstbin < minbandwidth/(2*HALFWIDTH))
- firstbin = minbandwidth/(2*HALFWIDTH);
- cf = firstbin;
- bw = cf * relspace * overlap;
- if (bw < (0.5*minbandwidth))
- bw = (0.5*minbandwidth);
- for (i = 0; i < nfilters; i++)
- {
- t_float *fp, newcf, newbw;
- t_float normalizer = 0;
- int filterpoints, skippoints, hoppoints, nhops;
-
- filterpoints = npoints * HALFWIDTH/bw;
- if (cf > npoints/2)
- {
- post("bonk~: only using %d filters (ran past Nyquist)", i+1);
- break;
- }
- if (filterpoints < 4)
- {
- post("bonk~: only using %d filters (kernels got too short)", i+1);
- break;
- }
- else if (filterpoints > npoints)
- filterpoints = npoints;
-
- hoppoints = SLIDE * npoints * HALFWIDTH/bw;
-
- nhops = 1. + (npoints-filterpoints)/(t_float)hoppoints;
- skippoints = 0.5 * (npoints-filterpoints - (nhops-1) * hoppoints);
-
- b->b_vec[i].k_stuff =
- (t_float *)getbytes(2 * sizeof(t_float) * filterpoints);
- b->b_vec[i].k_filterpoints = filterpoints;
- b->b_vec[i].k_nhops = nhops;
- b->b_vec[i].k_hoppoints = hoppoints;
- b->b_vec[i].k_skippoints = skippoints;
- b->b_vec[i].k_centerfreq = cf;
- b->b_vec[i].k_bandwidth = bw;
-
- for (fp = b->b_vec[i].k_stuff, j = 0; j < filterpoints; j++, fp+= 2)
- {
- t_float phase = j * cf * (2*3.141592653589793 / npoints);
- t_float wphase = j * (2*3.141592653589793 / filterpoints);
- t_float window = sin(0.5*wphase);
- fp[0] = window * cos(phase);
- fp[1] = window * sin(phase);
- normalizer += window;
- }
- normalizer = 1/(normalizer * sqrt(nhops));
- for (fp = b->b_vec[i].k_stuff, j = 0;
- j < filterpoints; j++, fp+= 2)
- fp[0] *= normalizer, fp[1] *= normalizer;
-#if 0
- post("i %d cf %.2f bw %.2f nhops %d, hop %d, skip %d, npoints %d",
- i, cf, bw, nhops, hoppoints, skippoints, filterpoints);
-#endif
- newcf = (cf + bw/overlap)/(1 - relspace);
- newbw = newcf * overlap * relspace;
- if (newbw < 0.5*minbandwidth)
- {
- newbw = 0.5*minbandwidth;
- newcf = cf + minbandwidth / overlap;
- }
- cf = newcf;
- bw = newbw;
- }
- for (; i < nfilters; i++)
- b->b_vec[i].k_stuff = 0, b->b_vec[i].k_filterpoints = 0;
- return (b);
-}
-
-static void bonk_freefilterbank(t_filterbank *b)
-{
- t_filterbank *b2, *b3;
- int i;
- if (bonk_filterbanklist == b)
- bonk_filterbanklist = b->b_next;
- else for (b2 = bonk_filterbanklist; b3 = b2->b_next; b2 = b3)
- if (b3 == b)
- {
- b2->b_next = b3->b_next;
- break;
- }
- for (i = 0; i < b->b_nfilters; i++)
- if (b->b_vec[i].k_stuff)
- freebytes(b->b_vec[i].k_stuff,
- b->b_vec[i].k_filterpoints * sizeof(t_float));
- freebytes(b, sizeof(*b));
-}
-
-static void bonk_donew(t_bonk *x, int npoints, int period, int nsig,
- int nfilters, t_float halftones, t_float overlap, t_float firstbin,
- t_float minbandwidth, t_float samplerate)
-{
- int i, j;
- t_hist *h;
- t_float *fp;
- t_insig *g;
- t_filterbank *fb;
- for (j = 0, g = x->x_insig; j < nsig; j++, g++)
- {
- for (i = 0, h = g->g_hist; i--; h++)
- {
- h->h_power = h->h_before = 0, h->h_countup = 0;
- for (j = 0; j < MASKHIST; j++)
- h->h_mask[j] = 0;
- }
- /* we ought to check for failure to allocate memory here */
- g->g_inbuf = (t_float *)getbytes(npoints * sizeof(t_float));
- for (i = npoints, fp = g->g_inbuf; i--; fp++) *fp = 0;
- }
- if (!period) period = npoints/2;
- x->x_npoints = npoints;
- x->x_period = period;
- x->x_ninsig = nsig;
- x->x_nfilters = nfilters;
- x->x_halftones = halftones;
- x->x_template = (t_template *)getbytes(0);
- x->x_ntemplate = 0;
- x->x_infill = 0;
- x->x_countdown = 0;
- x->x_willattack = 0;
- x->x_attacked = 0;
- x->x_maskphase = 0;
- x->x_debug = 0;
- x->x_hithresh = DEFHITHRESH;
- x->x_lothresh = DEFLOTHRESH;
- x->x_masktime = DEFMASKTIME;
- x->x_maskdecay = DEFMASKDECAY;
- x->x_learn = 0;
- x->x_learndebounce = clock_getsystime();
- x->x_learncount = 0;
- x->x_debouncedecay = DEFDEBOUNCEDECAY;
- x->x_minvel = DEFMINVEL;
- x->x_useloudness = 0;
- x->x_debouncevel = 0;
- x->x_attackbins = DEFATTACKBINS;
- x->x_sr = samplerate;
- x->x_filterbank = 0;
- x->x_hit = 0;
- for (fb = bonk_filterbanklist; fb; fb = fb->b_next)
- if (fb->b_nfilters == x->x_nfilters &&
- fb->b_halftones == x->x_halftones &&
- fb->b_firstbin == firstbin &&
- fb->b_overlap == overlap &&
- fb->b_npoints == x->x_npoints &&
- fb->b_minbandwidth == minbandwidth)
- {
- fb->b_refcount++;
- x->x_filterbank = fb;
- break;
- }
- if (!x->x_filterbank)
- x->x_filterbank = bonk_newfilterbank(npoints, nfilters,
- halftones, overlap, firstbin, minbandwidth),
- x->x_filterbank->b_refcount++;
-}
-
-static void bonk_tick(t_bonk *x)
-{
- t_atom at[MAXNFILTERS], *ap, at2[3];
- int i, j, k, n;
- t_hist *h;
- t_float *pp, vel = 0., temperature = 0.;
- t_float *fp;
- t_template *tp;
- int nfit, ninsig = x->x_ninsig, ntemplate = x->x_ntemplate, nfilters = x->x_nfilters;
- t_insig *gp;
-#ifdef _MSC_VER
- t_float powerout[MAXNFILTERS*MAXCHANNELS];
-#else
- t_float *powerout = alloca(x->x_nfilters * x->x_ninsig * sizeof(*powerout));
-#endif
-
- for (i = ninsig, pp = powerout, gp = x->x_insig; i--; gp++)
- {
- for (j = 0, h = gp->g_hist; j < nfilters; j++, h++, pp++)
- {
- t_float power = h->h_outpower;
- t_float intensity = *pp = (power > 0. ? 100. * qrsqrt(qrsqrt(power)) : 0.);
- vel += intensity;
- temperature += intensity * (t_float)j;
- }
- }
- if (vel > 0) temperature /= vel;
- else temperature = 0;
- vel *= 0.5 / ninsig; /* fudge factor */
- if (x->x_hit)
- {
- /* if hit nonzero it's a clock callback. if in "learn" mode update the
- template list; in any event match the hit to known templates. */
-
- if (vel < x->x_debouncevel)
- {
- if (x->x_debug)
- post("bounce cancelled: vel %f debounce %f",
- vel, x->x_debouncevel);
- return;
- }
- if (vel < x->x_minvel)
- {
- if (x->x_debug)
- post("low velocity cancelled: vel %f, minvel %f",
- vel, x->x_minvel);
- return;
- }
- x->x_debouncevel = vel;
- if (x->x_learn)
- {
- double lasttime = x->x_learndebounce;
- double msec = clock_gettimesince(lasttime);
- if ((!ntemplate) || (msec > 200))
- {
- int countup = x->x_learncount;
- /* normalize to 100 */
- t_float norm;
- for (i = nfilters * ninsig, norm = 0, pp = powerout; i--; pp++)
- norm += *pp * *pp;
- if (norm < 1.0e-15) norm = 1.0e-15;
- norm = 100. * qrsqrt(norm);
- /* check if this is the first strike for a new template */
- if (!countup)
- {
- int oldn = ntemplate;
- x->x_ntemplate = ntemplate = oldn + ninsig;
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- oldn * sizeof(x->x_template[0]),
- ntemplate * sizeof(x->x_template[0]));
- for (i = ninsig, pp = powerout; i--; oldn++)
- for (j = nfilters, fp = x->x_template[oldn].t_amp; j--;
- pp++, fp++)
- *fp = *pp * norm;
- }
- else
- {
- int oldn = ntemplate - ninsig;
- if (oldn < 0) post("bonk_tick bug");
- for (i = ninsig, pp = powerout; i--; oldn++)
- {
- for (j = nfilters, fp = x->x_template[oldn].t_amp; j--;
- pp++, fp++)
- *fp = (countup * *fp + *pp * norm)
- /(countup + 1.0);
- }
- }
- countup++;
- if (countup == x->x_learn) countup = 0;
- x->x_learncount = countup;
- }
- else return;
- }
- x->x_learndebounce = clock_getsystime();
- if (ntemplate)
- {
- t_float bestfit = -1e30;
- int templatecount;
- nfit = -1;
- for (i = 0, templatecount = 0, tp = x->x_template;
- templatecount < ntemplate; i++)
- {
- t_float dotprod = 0;
- for (k = 0, pp = powerout;
- k < ninsig && templatecount < ntemplate;
- k++, tp++, templatecount++)
- {
- for (j = nfilters, fp = tp->t_amp;
- j--; fp++, pp++)
- {
- if (*fp < 0 || *pp < 0) post("bonk_tick bug 2");
- dotprod += *fp * *pp;
- }
- }
- if (dotprod > bestfit)
- {
- bestfit = dotprod;
- nfit = i;
- }
- }
- if (nfit < 0) post("bonk_tick bug");
- }
- else nfit = 0;
- }
- else nfit = -1; /* hit is zero; this is the "bang" method. */
-
- x->x_attacked = 1;
- if (x->x_debug)
- post("bonk out: number %d, vel %f, temperature %f",
- nfit, vel, temperature);
-
- SETFLOAT(at2, nfit);
- SETFLOAT(at2+1, vel);
- SETFLOAT(at2+2, temperature);
- outlet_list(x->x_cookedout, 0, 3, at2);
-
- for (n = 0, gp = x->x_insig + (ninsig-1),
- pp = powerout + nfilters * (ninsig-1); n < ninsig;
- n++, gp--, pp -= nfilters)
- {
- t_float *pp2;
- for (i = 0, ap = at, pp2 = pp; i < nfilters;
- i++, ap++, pp2++)
- {
- ap->a_type = A_FLOAT;
- ap->a_w.w_float = *pp2;
- }
- outlet_list(gp->g_outlet, 0, nfilters, at);
- }
-}
-
-static void bonk_doit(t_bonk *x)
-{
- int i, j, ch, n;
- t_filterkernel *k;
- t_hist *h;
- t_float growth = 0, *fp1, *fp3, *fp4, hithresh, lothresh;
- int ninsig = x->x_ninsig, nfilters = x->x_nfilters,
- maskphase = x->x_maskphase, nextphase, oldmaskphase;
- t_insig *gp;
- nextphase = maskphase + 1;
- if (nextphase >= MASKHIST)
- nextphase = 0;
- x->x_maskphase = nextphase;
- oldmaskphase = nextphase - x->x_attackbins;
- if (oldmaskphase < 0)
- oldmaskphase += MASKHIST;
- if (x->x_useloudness)
- hithresh = qrsqrt(qrsqrt(x->x_hithresh)),
- lothresh = qrsqrt(qrsqrt(x->x_lothresh));
- else hithresh = x->x_hithresh, lothresh = x->x_lothresh;
- for (ch = 0, gp = x->x_insig; ch < ninsig; ch++, gp++)
- {
- for (i = 0, k = x->x_filterbank->b_vec, h = gp->g_hist;
- i < nfilters; i++, k++, h++)
- {
- t_float power = 0, maskpow = h->h_mask[maskphase];
- t_float *inbuf= gp->g_inbuf + k->k_skippoints;
- int countup = h->h_countup;
- int filterpoints = k->k_filterpoints;
- /* if the user asked for more filters that fit under the
- Nyquist frequency, some filters won't actually be filled in
- so we skip running them. */
- if (!filterpoints)
- {
- h->h_countup = 0;
- h->h_mask[nextphase] = 0;
- h->h_power = 0;
- continue;
- }
- /* run the filter repeatedly, sliding it forward by hoppoints,
- for nhop times */
- for (fp1 = inbuf, n = 0;
- n < k->k_nhops; fp1 += k->k_hoppoints, n++)
- {
- t_float rsum = 0, isum = 0;
- for (fp3 = fp1, fp4 = k->k_stuff, j = filterpoints; j--;)
- {
- t_float g = *fp3++;
- rsum += g * *fp4++;
- isum += g * *fp4++;
- }
- power += rsum * rsum + isum * isum;
- }
- if (!x->x_willattack)
- h->h_before = maskpow;
-
- if (power > h->h_mask[oldmaskphase])
- {
- if (x->x_useloudness)
- growth += qrsqrt(qrsqrt(
- power/(h->h_mask[oldmaskphase] + 1.0e-15))) - 1.;
- else growth += power/(h->h_mask[oldmaskphase] + 1.0e-15) - 1.;
- }
- if (!x->x_willattack && countup >= x->x_masktime)
- maskpow *= x->x_maskdecay;
-
- if (power > maskpow)
- {
- maskpow = power;
- countup = 0;
- }
- countup++;
- h->h_countup = countup;
- h->h_mask[nextphase] = maskpow;
- h->h_power = power;
- }
- }
- if (x->x_willattack)
- {
- if (x->x_willattack > MAXATTACKWAIT || growth < x->x_lothresh)
- {
- /* if haven't yet, and if not in spew mode, report a hit */
- if (!x->x_spew && !x->x_attacked)
- {
- for (ch = 0, gp = x->x_insig; ch < ninsig; ch++, gp++)
- for (i = nfilters, h = gp->g_hist; i--; h++)
- h->h_outpower = h->h_mask[nextphase];
- x->x_hit = 1;
- clock_delay(x->x_clock, 0);
- }
- }
- if (growth < x->x_lothresh)
- x->x_willattack = 0;
- else x->x_willattack++;
- }
- else if (growth > x->x_hithresh)
- {
- if (x->x_debug) post("attack: growth = %f", growth);
- x->x_willattack = 1;
- x->x_attacked = 0;
- for (ch = 0, gp = x->x_insig; ch < ninsig; ch++, gp++)
- for (i = nfilters, h = gp->g_hist; i--; h++)
- h->h_mask[nextphase] = h->h_power, h->h_countup = 0;
- }
-
- /* if in "spew" mode just always output */
- if (x->x_spew)
- {
- for (ch = 0, gp = x->x_insig; ch < ninsig; ch++, gp++)
- for (i = nfilters, h = gp->g_hist; i--; h++)
- h->h_outpower = h->h_power;
- x->x_hit = 0;
- clock_delay(x->x_clock, 0);
- }
- x->x_debouncevel *= x->x_debouncedecay;
-}
-
-static t_int *bonk_perform(t_int *w)
-{
- t_bonk *x = (t_bonk *)(w[1]);
- int n = (int)(w[2]);
- int onset = 0;
- if (x->x_countdown >= n)
- x->x_countdown -= n;
- else
- {
- int i, j, ninsig = x->x_ninsig;
- t_insig *gp;
- if (x->x_countdown > 0)
- {
- n -= x->x_countdown;
- onset += x->x_countdown;
- x->x_countdown = 0;
- }
- while (n > 0)
- {
- int infill = x->x_infill;
- int m = (n < (x->x_npoints - infill) ?
- n : (x->x_npoints - infill));
- for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
- {
- t_float *fp = gp->g_inbuf + infill;
- t_float *in1 = gp->g_invec + onset;
- for (j = 0; j < m; j++)
- *fp++ = *in1++;
- }
- infill += m;
- x->x_infill = infill;
- if (infill == x->x_npoints)
- {
- bonk_doit(x);
-
- /* shift or clear the input buffer and update counters */
- if (x->x_period > x->x_npoints)
- x->x_countdown = x->x_period - x->x_npoints;
- else x->x_countdown = 0;
- if (x->x_period < x->x_npoints)
- {
- int overlap = x->x_npoints - x->x_period;
- t_float *fp1, *fp2;
- for (n = 0, gp = x->x_insig; n < ninsig; n++, gp++)
- for (i = overlap, fp1 = gp->g_inbuf,
- fp2 = fp1 + x->x_period; i--;)
- *fp1++ = *fp2++;
- x->x_infill = overlap;
- }
- else x->x_infill = 0;
- }
- n -= m;
- onset += m;
- }
- }
- return (w+3);
-}
-
-static void bonk_dsp(t_bonk *x, t_signal **sp)
-{
- int i, n = sp[0]->s_n, ninsig = x->x_ninsig;
- t_insig *gp;
-
- x->x_sr = sp[0]->s_sr;
-
- for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
- gp->g_invec = (*(sp++))->s_vec;
-
- dsp_add(bonk_perform, 2, x, n);
-}
-
-static void bonk_thresh(t_bonk *x, t_floatarg f1, t_floatarg f2)
-{
- if (f1 > f2)
- post("bonk: warning: low threshold greater than hi threshold");
- x->x_lothresh = (f1 <= 0 ? 0.0001 : f1);
- x->x_hithresh = (f2 <= 0 ? 0.0001 : f2);
-}
-
-#ifdef PD
-static void bonk_mask(t_bonk *x, t_floatarg f1, t_floatarg f2)
-{
- int ticks = f1;
- if (ticks < 0) ticks = 0;
- if (f2 < 0) f2 = 0;
- else if (f2 > 1) f2 = 1;
- x->x_masktime = ticks;
- x->x_maskdecay = f2;
-}
-
-static void bonk_debounce(t_bonk *x, t_floatarg f1)
-{
- if (f1 < 0) f1 = 0;
- else if (f1 > 1) f1 = 1;
- x->x_debouncedecay = f1;
-}
-
-static void bonk_minvel(t_bonk *x, t_floatarg f)
-{
- if (f < 0) f = 0;
- x->x_minvel = f;
-}
-
-static void bonk_debug(t_bonk *x, t_floatarg f)
-{
- x->x_debug = (f != 0);
-}
-
-static void bonk_spew(t_bonk *x, t_floatarg f)
-{
- x->x_spew = (f != 0);
-}
-
-static void bonk_useloudness(t_bonk *x, t_floatarg f)
-{
- x->x_useloudness = (f != 0);
-}
-
-static void bonk_attackbins(t_bonk *x, t_floatarg f)
-{
- if (f < 1)
- f = 1;
- else if (f > MASKHIST)
- f = MASKHIST;
- x->x_attackbins = f;
-}
-
-static void bonk_learn(t_bonk *x, t_floatarg f)
-{
- int n = f;
- if (n < 0) n = 0;
- if (n)
- {
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(x->x_template[0]), 0);
- x->x_ntemplate = 0;
- }
- x->x_learn = n;
- x->x_learncount = 0;
-}
-#endif
-
-static void bonk_print(t_bonk *x, t_floatarg f)
-{
- int i;
- post("thresh %f %f", x->x_lothresh, x->x_hithresh);
- post("mask %d %f", x->x_masktime, x->x_maskdecay);
- post("attack-frames %d", x->x_attackbins);
- post("debounce %f", x->x_debouncedecay);
- post("minvel %f", x->x_minvel);
- post("spew %d", x->x_spew);
- post("useloudness %d", x->x_useloudness);
-
-#if 0 /* LATER rewrite without hard-coded 11 filters */
- if (x->x_ntemplate)
- {
- post("templates:");
- for (i = 0; i < x->x_ntemplate; i++)
- post(
-"%2d %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f",
- i,
- x->x_template[i].t_amp[0],
- x->x_template[i].t_amp[1],
- x->x_template[i].t_amp[2],
- x->x_template[i].t_amp[3],
- x->x_template[i].t_amp[4],
- x->x_template[i].t_amp[5],
- x->x_template[i].t_amp[6],
- x->x_template[i].t_amp[7],
- x->x_template[i].t_amp[8],
- x->x_template[i].t_amp[9],
- x->x_template[i].t_amp[10]);
- }
- else post("no templates");
-#endif
- post("number of templates %d", x->x_ntemplate);
- if (x->x_learn) post("learn mode");
- if (f != 0)
- {
- int j, ninsig = x->x_ninsig;
- t_insig *gp;
- for (j = 0, gp = x->x_insig; j < ninsig; j++, gp++)
- {
- t_hist *h;
- if (ninsig > 1) post("input %d:", j+1);
- for (i = x->x_nfilters, h = gp->g_hist; i--; h++)
- post("pow %f mask %f before %f count %d",
- h->h_power, h->h_mask[x->x_maskphase],
- h->h_before, h->h_countup);
- }
- post("filter details (frequencies are in units of %.2f-Hz. bins):",
- x->x_sr/x->x_npoints);
- for (j = 0; j < x->x_nfilters; j++)
- post("%2d cf %.2f bw %.2f nhops %d hop %d skip %d npoints %d",
- j,
- x->x_filterbank->b_vec[j].k_centerfreq,
- x->x_filterbank->b_vec[j].k_bandwidth,
- x->x_filterbank->b_vec[j].k_nhops,
- x->x_filterbank->b_vec[j].k_hoppoints,
- x->x_filterbank->b_vec[j].k_skippoints,
- x->x_filterbank->b_vec[j].k_filterpoints);
- }
- if (x->x_debug) post("debug mode");
-}
-
-static void bonk_forget(t_bonk *x)
-{
- int ntemplate = x->x_ntemplate, newn = ntemplate - x->x_ninsig;
- if (newn < 0) newn = 0;
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(x->x_template[0]),
- newn * sizeof(x->x_template[0]));
- x->x_ntemplate = newn;
- x->x_learncount = 0;
-}
-
-static void bonk_bang(t_bonk *x)
-{
- int i, ch;
- t_insig *gp;
- x->x_hit = 0;
- for (ch = 0, gp = x->x_insig; ch < x->x_ninsig; ch++, gp++)
- {
- t_hist *h;
- for (i = 0, h = gp->g_hist; i < x->x_nfilters; i++, h++)
- h->h_outpower = h->h_power;
- }
- bonk_tick(x);
-}
-
-#ifdef PD
-static void bonk_read(t_bonk *x, t_symbol *s)
-{
- t_float vec[MAXNFILTERS];
- int i, ntemplate = 0, remaining;
- t_float *fp, *fp2;
-
- /* fbar: canvas_open code taken from g_array.c */
- FILE *fd;
- char buf[MAXPDSTRING], *bufptr;
- int filedesc;
-
- if ((filedesc = canvas_open(x->x_canvas,
- s->s_name, "", buf, &bufptr, MAXPDSTRING, 0)) < 0
- || !(fd = fdopen(filedesc, "r")))
- {
- post("%s: open failed", s->s_name);
- return;
- }
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(t_template), 0);
- while (1)
- {
- for (i = x->x_nfilters, fp = vec; i--; fp++)
- if (fscanf(fd, "%f", fp) < 1) goto nomore;
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate + 1) * sizeof(t_template));
- for (i = x->x_nfilters, fp = vec,
- fp2 = x->x_template[ntemplate].t_amp; i--;)
- *fp2++ = *fp++;
- ntemplate++;
- }
-nomore:
- if (remaining = (ntemplate % x->x_ninsig))
- {
- post("bonk_read: %d templates not a multiple of %d; dropping extras");
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate - remaining) * sizeof(t_template));
- ntemplate = ntemplate - remaining;
- }
- post("bonk: read %d templates\n", ntemplate);
- x->x_ntemplate = ntemplate;
- fclose(fd);
-}
-#endif
-
-#ifdef MSP
-static void bonk_read(t_bonk *x, t_symbol *s)
-{
- defer(x, (method)bonk_doread, s, 0, NULL);
-}
-
-static void bonk_doread(t_bonk *x, t_symbol *s)
-{
- long filetype = 'TEXT', outtype;
- char filename[512];
- short path;
-
- if (s == gensym("")) {
- if (open_dialog(filename, &path, &outtype, &filetype, 1))
- return;
- } else {
- strcpy(filename, s->s_name);
- if (locatefile_extended(filename, &path, &outtype, &filetype, 1)) {
- object_error((t_object *) x, "%s: not found", s->s_name);
- return;
- }
- }
- // we have a file
- bonk_openfile(x, filename, path);
-}
-
-static void bonk_openfile(t_bonk *x, char *filename, short path) {
- t_float vec[MAXNFILTERS];
- int i, ntemplate = 0, remaining;
- t_float *fp, *fp2;
-
- t_filehandle fh;
- char **texthandle;
- char *tokptr;
-
- if (path_opensysfile(filename, path, &fh, READ_PERM)) {
- object_error((t_object *) x, "error opening %s", filename);
- return;
- }
-
- texthandle = sysmem_newhandle(0);
- sysfile_readtextfile(fh, texthandle, 0, TEXT_LB_NATIVE);
- sysfile_close(fh);
-
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(t_template), 0);
-
- tokptr = strtok(*texthandle, " \n");
-
- while(tokptr != NULL)
- {
- for (i = x->x_nfilters, fp = vec; i--; fp++) {
- if (sscanf(tokptr, "%f", fp) < 1)
- goto nomore;
- tokptr = strtok(NULL, " \n");
- }
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate + 1) * sizeof(t_template));
- for (i = x->x_nfilters, fp = vec,
- fp2 = x->x_template[ntemplate].t_amp; i--;)
- *fp2++ = *fp++;
- ntemplate++;
- }
-nomore:
- if (remaining = (ntemplate % x->x_ninsig))
- {
- post("bonk_read: %d templates not a multiple of %d; dropping extras");
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate - remaining) * sizeof(t_template));
- ntemplate = ntemplate - remaining;
- }
-
- sysmem_freehandle(texthandle);
- post("bonk: read %d templates\n", ntemplate);
- x->x_ntemplate = ntemplate;
-}
-#endif
-
-#ifdef PD
-static void bonk_write(t_bonk *x, t_symbol *s)
-{
- FILE *fd;
- char buf[MAXPDSTRING]; /* fbar */
- int i, ntemplate = x->x_ntemplate;
- t_template *tp = x->x_template;
- t_float *fp;
-
- /* fbar: canvas-code as in g_array.c */
- canvas_makefilename(x->x_canvas, s->s_name,
- buf, MAXPDSTRING);
- sys_bashfilename(buf, buf);
-
- if (!(fd = fopen(buf, "w")))
- {
- post("%s: couldn't create", s->s_name);
- return;
- }
- for (; ntemplate--; tp++)
- {
- for (i = x->x_nfilters, fp = tp->t_amp; i--; fp++)
- fprintf(fd, "%6.2f ", *fp);
- fprintf(fd, "\n");
- }
- post("bonk: wrote %d templates\n", x->x_ntemplate);
- fclose(fd);
-}
-#endif
-
-#ifdef MSP
-static void bonk_write(t_bonk *x, t_symbol *s)
-{
- defer(x, (method)bonk_dowrite, s, 0, NULL);
-}
-
-static void bonk_dowrite(t_bonk *x, t_symbol *s)
-{
- long filetype = 'TEXT', outtype;
- char filename[MAX_FILENAME_CHARS];
- short path;
-
- if (s == gensym("")) {
- sprintf(filename, "bonk_template.txt");
- saveas_promptset("Save template as...");
- if (saveasdialog_extended(filename, &path, &outtype, &filetype, 0))
- return;
- } else {
- strcpy(filename, s->s_name);
- path = path_getdefault();
- }
- bonk_writefile(x, filename, path);
-}
-
-void bonk_writefile(t_bonk *x, char *filename, short path)
-{
- int i, ntemplate = x->x_ntemplate;
- t_template *tp = x->x_template;
- t_float *fp;
- long err;
- long buflen;
-
- t_filehandle fh;
-
- char buf[20];
-
- err = path_createsysfile(filename, path, 'TEXT', &fh);
-
- if (err)
- return;
-
- for (; ntemplate--; tp++)
- {
- for (i = x->x_nfilters, fp = tp->t_amp; i--; fp++) {
- snprintf(buf, 20, "%6.2f ", *fp);
- buflen = strlen(buf);
- sysfile_write(fh, &buflen, buf);
- }
- buflen = 1;
- sysfile_write(fh, &buflen, "\n");
- }
-
- sysfile_close(fh);
-}
-#endif
-
-static void bonk_free(t_bonk *x)
-{
-
- int i, ninsig = x->x_ninsig;
- t_insig *gp = x->x_insig;
-#ifdef MSP
- dsp_free((t_pxobject *)x);
-#endif
- for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
- freebytes(gp->g_inbuf, x->x_npoints * sizeof(t_float));
- clock_free(x->x_clock);
- if (!--(x->x_filterbank->b_refcount))
- bonk_freefilterbank(x->x_filterbank);
-
-}
-
-/* -------------------------- Pd glue ------------------------- */
-#ifdef PD
-
-static void *bonk_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_bonk *x = (t_bonk *)pd_new(bonk_class);
- int nsig = 1, period = DEFPERIOD, npts = DEFNPOINTS,
- nfilters = DEFNFILTERS, j;
- t_float halftones = DEFHALFTONES, overlap = DEFOVERLAP,
- firstbin = DEFFIRSTBIN, minbandwidth = DEFMINBANDWIDTH;
- t_insig *g;
-
- x->x_canvas = canvas_getcurrent(); /* fbar: bind current canvas to x */
- if (argc > 0 && argv[0].a_type == A_FLOAT)
- {
- /* old style args for compatibility */
- period = atom_getfloatarg(0, argc, argv);
- nsig = atom_getfloatarg(1, argc, argv);
- }
- else while (argc > 0)
- {
- t_symbol *firstarg = atom_getsymbolarg(0, argc, argv);
- if (!strcmp(firstarg->s_name, "-npts") && argc > 1)
- {
- npts = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-hop") && argc > 1)
- {
- period = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-nsigs") && argc > 1)
- {
- nsig = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-nfilters") && argc > 1)
- {
- nfilters = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-halftones") && argc > 1)
- {
- halftones = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-overlap") && argc > 1)
- {
- overlap = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-firstbin") && argc > 1)
- {
- firstbin = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-minbandwidth") && argc > 1)
- {
- minbandwidth = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-spew") && argc > 1)
- {
- x->x_spew = (atom_getfloatarg(1, argc, argv) != 0);
- argc -= 2; argv += 2;
- }
- else
- {
- pd_error(x,
-"usage is: bonk [-npts #] [-hop #] [-nsigs #] [-nfilters #] [-halftones #]");
- post(
-"... [-overlap #] [-firstbin #] [-spew #]");
- argc = 0;
- }
- }
-
- x->x_npoints = (npts >= MINPOINTS ? npts : DEFNPOINTS);
- x->x_period = (period >= 1 ? period : npts/2);
- x->x_nfilters = (nfilters >= 1 ? nfilters : DEFNFILTERS);
- if (halftones < 0.01)
- halftones = DEFHALFTONES;
- else if (halftones > 12)
- halftones = 12;
- if (nsig < 1)
- nsig = 1;
- else if (nsig > MAXCHANNELS)
- nsig = MAXCHANNELS;
- if (firstbin < 0.5)
- firstbin = 0.5;
- if (overlap < 1)
- overlap = 1;
-
- x->x_clock = clock_new(x, (t_method)bonk_tick);
- x->x_insig = (t_insig *)getbytes(nsig * sizeof(*x->x_insig));
- for (j = 0, g = x->x_insig; j < nsig; j++, g++)
- {
- g->g_outlet = outlet_new(&x->x_obj, gensym("list"));
- if (j)
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- }
- x->x_cookedout = outlet_new(&x->x_obj, gensym("list"));
- bonk_donew(x, npts, period, nsig, nfilters, halftones, overlap,
- firstbin, minbandwidth, sys_getsr());
- return (x);
-}
-
-void bonk_tilde_setup(void)
-{
- bonk_class = class_new(gensym("bonk~"), (t_newmethod)bonk_new,
- (t_method)bonk_free, sizeof(t_bonk), 0, A_GIMME, 0);
- class_addmethod(bonk_class, nullfn, gensym("signal"), 0);
- class_addmethod(bonk_class, (t_method)bonk_dsp, gensym("dsp"), 0);
- class_addbang(bonk_class, bonk_bang);
- class_addmethod(bonk_class, (t_method)bonk_learn,
- gensym("learn"), A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_forget, gensym("forget"), 0);
- class_addmethod(bonk_class, (t_method)bonk_thresh,
- gensym("thresh"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_mask,
- gensym("mask"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_debounce,
- gensym("debounce"), A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_minvel,
- gensym("minvel"), A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_print,
- gensym("print"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_debug,
- gensym("debug"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_spew,
- gensym("spew"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_useloudness,
- gensym("useloudness"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_attackbins,
- gensym("attack-bins"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_attackbins,
- gensym("attack-frames"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_read,
- gensym("read"), A_SYMBOL, 0);
- class_addmethod(bonk_class, (t_method)bonk_write,
- gensym("write"), A_SYMBOL, 0);
- post("bonk version 1.5");
-}
-#endif
-
-/* -------------------------- MSP glue ------------------------- */
-#ifdef MSP
-
-int main()
-{
- t_class *c;
- t_object *attr;
- long attrflags = 0;
- t_symbol *sym_long = gensym("long"), *sym_float32 = gensym("float32");
-
- c = class_new("bonk~", (method)bonk_new, (method)bonk_free, sizeof(t_bonk), (method)0L, A_GIMME, 0);
-
- class_obexoffset_set(c, calcoffset(t_bonk, obex));
-
- attr = attr_offset_new("npoints", sym_long, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_npoints));
- class_addattr(c, attr);
-
- attr = attr_offset_new("hop", sym_long, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_period));
- class_addattr(c, attr);
-
- attr = attr_offset_new("nfilters", sym_long, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_nfilters));
- class_addattr(c, attr);
-
- attr = attr_offset_new("halftones", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_halftones));
- class_addattr(c, attr);
-
- attr = attr_offset_new("overlap", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_overlap));
- class_addattr(c, attr);
-
- attr = attr_offset_new("firstbin", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_firstbin));
- class_addattr(c, attr);
-
- attr = attr_offset_new("minbandwidth", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_minbandwidth));
- class_addattr(c, attr);
-
- attr = attr_offset_new("minvel", sym_float32, attrflags, (method)0L, (method)bonk_minvel_set, calcoffset(t_bonk, x_minvel));
- class_addattr(c, attr);
-
- attr = attr_offset_new("lothresh", sym_float32, attrflags, (method)0L, (method)bonk_lothresh_set, calcoffset(t_bonk, x_lothresh));
- class_addattr(c, attr);
-
- attr = attr_offset_new("hithresh", sym_float32, attrflags, (method)0L, (method)bonk_hithresh_set, calcoffset(t_bonk, x_hithresh));
- class_addattr(c, attr);
-
- attr = attr_offset_new("masktime", sym_long, attrflags, (method)0L, (method)bonk_masktime_set, calcoffset(t_bonk, x_masktime));
- class_addattr(c, attr);
-
- attr = attr_offset_new("maskdecay", sym_float32, attrflags, (method)0L, (method)bonk_maskdecay_set, calcoffset(t_bonk, x_maskdecay));
- class_addattr(c, attr);
-
- attr = attr_offset_new("debouncedecay", sym_float32, attrflags, (method)0L, (method)bonk_debouncedecay_set, calcoffset(t_bonk, x_debouncedecay));
- class_addattr(c, attr);
-
- attr = attr_offset_new("debug", sym_long, attrflags, (method)0L, (method)bonk_debug_set, calcoffset(t_bonk, x_debug));
- class_addattr(c, attr);
-
- attr = attr_offset_new("spew", sym_long, attrflags, (method)0L, (method)bonk_spew_set, calcoffset(t_bonk, x_spew));
- class_addattr(c, attr);
-
- attr = attr_offset_new("useloudness", sym_long, attrflags, (method)0L, (method)bonk_useloudness_set, calcoffset(t_bonk, x_useloudness));
- class_addattr(c, attr);
-
- attr = attr_offset_new("attackframes", sym_long, attrflags, (method)0L, (method)bonk_attackbins_set, calcoffset(t_bonk, x_attackbins));
- class_addattr(c, attr);
-
- attr = attr_offset_new("learn", sym_long, attrflags, (method)0L, (method)bonk_learn_set, calcoffset(t_bonk, x_learn));
- class_addattr(c, attr);
-
- class_addmethod(c, (method)bonk_dsp, "dsp", A_CANT, 0);
- class_addmethod(c, (method)bonk_bang, "bang", A_CANT, 0);
- class_addmethod(c, (method)bonk_forget, "forget", 0);
- class_addmethod(c, (method)bonk_thresh, "thresh", A_FLOAT, A_FLOAT, 0);
- class_addmethod(c, (method)bonk_print, "print", A_DEFFLOAT, 0);
- class_addmethod(c, (method)bonk_read, "read", A_DEFSYM, 0);
- class_addmethod(c, (method)bonk_write, "write", A_DEFSYM, 0);
- class_addmethod(c, (method)bonk_assist, "assist", A_CANT, 0);
-
- class_addmethod(c, (method)object_obex_dumpout, "dumpout", A_CANT, 0);
- class_addmethod(c, (method)object_obex_quickref, "quickref", A_CANT, 0);
-
- class_dspinit(c);
-
- class_register(CLASS_BOX, c);
- bonk_class = c;
-
- post("bonk~ v1.5");
- return (0);
-}
-
-static void *bonk_new(t_symbol *s, long ac, t_atom *av)
-{
- short j;
- t_bonk *x;
-
- if (x = (t_bonk *)object_alloc(bonk_class)) {
-
- t_insig *g;
-
- x->x_npoints = DEFNPOINTS;
- x->x_period = DEFPERIOD;
- x->x_nfilters = DEFNFILTERS;
- x->x_halftones = DEFHALFTONES;
- x->x_firstbin = DEFFIRSTBIN;
- x->x_minbandwidth = DEFMINBANDWIDTH;
- x->x_overlap = DEFOVERLAP;
- x->x_ninsig = 1;
-
- x->x_hithresh = DEFHITHRESH;
- x->x_lothresh = DEFLOTHRESH;
- x->x_masktime = DEFMASKTIME;
- x->x_maskdecay = DEFMASKDECAY;
- x->x_debouncedecay = DEFDEBOUNCEDECAY;
- x->x_minvel = DEFMINVEL;
- x->x_attackbins = DEFATTACKBINS;
-
- if (!x->x_period) x->x_period = x->x_npoints/2;
- x->x_template = (t_template *)getbytes(0);
- x->x_ntemplate = 0;
- x->x_infill = 0;
- x->x_countdown = 0;
- x->x_willattack = 0;
- x->x_attacked = 0;
- x->x_maskphase = 0;
- x->x_debug = 0;
- x->x_learn = 0;
- x->x_learndebounce = clock_getsystime();
- x->x_learncount = 0;
- x->x_useloudness = 0;
- x->x_debouncevel = 0;
- x->x_sr = sys_getsr();
-
- if (ac) {
- switch (av[0].a_type) {
- case A_LONG:
- x->x_ninsig = av[0].a_w.w_long;
- break;
- }
- }
-
- if (x->x_ninsig < 1) x->x_ninsig = 1;
- if (x->x_ninsig > MAXCHANNELS) x->x_ninsig = MAXCHANNELS;
-
- attr_args_process(x, ac, av);
-
- x->x_insig = (t_insig *)getbytes(x->x_ninsig * sizeof(*x->x_insig));
-
- dsp_setup((t_pxobject *)x, x->x_ninsig);
-
- object_obex_store(x, gensym("dumpout"), outlet_new(x, NULL));
-
- x->x_cookedout = listout((t_object *)x);
-
- for (j = 0, g = x->x_insig + x->x_ninsig-1; j < x->x_ninsig; j++, g--) {
- g->g_outlet = listout((t_object *)x);
- }
-
- x->x_clock = clock_new(x, (method)bonk_tick);
-
- bonk_donew(x, x->x_npoints, x->x_period, x->x_ninsig, x->x_nfilters,
- x->x_halftones, x->x_overlap, x->x_firstbin, x->x_minbandwidth,
- sys_getsr());
- }
- return (x);
-}
-
-/* Attribute setters. */
-void bonk_minvel_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- if (f < 0) f = 0;
- x->x_minvel = f;
- }
-}
-
-void bonk_lothresh_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- if (f > x->x_hithresh)
- post("bonk: warning: low threshold greater than hi threshold");
- x->x_lothresh = (f <= 0 ? 0.0001 : f);
- }
-}
-
-void bonk_hithresh_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- if (f < x->x_lothresh)
- post("bonk: warning: low threshold greater than hi threshold");
- x->x_hithresh = (f <= 0 ? 0.0001 : f);
- }
-}
-
-void bonk_masktime_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- x->x_masktime = (n < 0) ? 0 : n;
- }
-}
-
-void bonk_maskdecay_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- f = (f < 0) ? 0 : f;
- f = (f > 1) ? 1 : f;
- x->x_maskdecay = f;
- }
-}
-
-void bonk_debouncedecay_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- f = (f < 0) ? 0 : f;
- f = (f > 1) ? 1 : f;
- x->x_debouncedecay = f;
- }
-}
-
-void bonk_debug_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- x->x_debug = (n != 0);
- }
-}
-
-void bonk_spew_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- x->x_spew = (n != 0);
- }
-}
-
-void bonk_useloudness_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- x->x_useloudness = (n != 0);
- }
-}
-
-void bonk_attackbins_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- n = (n < 1) ? 1 : n;
- n = (n > MASKHIST) ? MASKHIST : n;
- x->x_attackbins = n;
- }
-}
-
-void bonk_learn_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- if (n != 0) {
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(x->x_template[0]), 0);
- x->x_ntemplate = 0;
- }
- x->x_learn = n;
- x->x_learncount = 0;
- }
-}
-/* end attr setters */
-
-void bonk_assist(t_bonk *x, void *b, long m, long a, char *s)
-{
-}
-
- /* get current system time */
-double clock_getsystime()
-{
- return gettime();
-}
-
- /* elapsed time in milliseconds since the given system time */
-double clock_gettimesince(double prevsystime)
-{
- return ((gettime() - prevsystime));
-}
-
-t_float qrsqrt(t_float f)
-{
- return 1/sqrt(f);
-}
-#endif /* MSP */
diff --git a/externals/extra/0.43.3/0.43.2/bonk~/templates.txt b/externals/extra/0.43.3/0.43.2/bonk~/templates.txt
deleted file mode 100644
index f3528d78..00000000
--- a/externals/extra/0.43.3/0.43.2/bonk~/templates.txt
+++ /dev/null
@@ -1,4 +0,0 @@
- 10.47 9.65 14.95 23.77 28.32 38.84 53.21 41.20 31.25 21.70 16.48
- 6.52 13.93 27.82 58.05 24.11 35.26 35.98 37.78 22.54 13.56 10.75
- 30.45 28.86 29.42 21.94 29.92 35.70 38.49 32.01 28.19 27.38 22.10
- 66.77 46.27 28.82 25.95 22.84 20.61 20.33 14.18 6.86 8.92 7.37
diff --git a/externals/extra/0.43.3/0.43.2/choice/choice-help.pd b/externals/extra/0.43.3/0.43.2/choice/choice-help.pd
deleted file mode 100644
index 0677db87..00000000
--- a/externals/extra/0.43.3/0.43.2/choice/choice-help.pd
+++ /dev/null
@@ -1,58 +0,0 @@
-#N canvas 16 5 609 600 12;
-#X obj 8 195 choice;
-#X msg 41 86 print;
-#X msg 29 63 clear;
-#X msg 8 34 add 1 0 0 \, add 0 1 0 \, add 0 0 1 \, add 1 1 1 \, add
-1 1 0;
-#X obj 77 171 pack 0 0 0;
-#X floatatom 182 125 0 0 0 0 - - -;
-#X floatatom 148 125 0 0 0 0 - - -;
-#X floatatom 115 125 0 0 0 0 - - -;
-#X obj 77 147 f;
-#X msg 77 125 bang;
-#X floatatom 8 216 0 0 0 0 - - -;
-#X obj 71 196 choice 1;
-#X floatatom 71 217 0 0 0 0 - - -;
-#X obj 76 4 choice;
-#X text 135 3 - search for a best match to an incoming list;
-#X text 19 243 The choice object holds a list of vectors \, each having
-up to ten elements. When sent a list of numbers \, it outputs the index
-of the known vector that matches most closely. The quality of the match
-is the dot product of the two vectors after normalizing them \, i.e.
-\, the vector whose direction is closest to that of the input wins.
-;
-#X text 19 340 If given a nonzero creation argument \, choice tries
-to avoid repetitious outputs by weighting less recently output vectors
-preferentially.;
-#X text 20 389 You can use this to choose interactively between a number
-of behaviors depending on their attributes. For example \, you might
-have stored a number of melodies \, of which some are syncopated \,
-some chromatic \, some are more than 100 years old \, some are bugle
-calls \, and some are Christmas carols. You could then ask to find
-a syncopated bugle call (1 \, 0 \, 0 \, 1 \, 0) and you'll get the
-thing most closely matching the request.;
-#X text 19 514 You can use numbers other than 0 and 1 to indicate relative
-strengths of the attributes \, or even use negative numbers to indicate
-opposites \, either in the incoming lists or in the stored ones.;
-#X text 320 572 updated for Pd version-0.30;
-#X text 79 62 delete all stored vectors;
-#X text 498 34 add vectors;
-#X text 94 84 debugging printout;
-#X text 69 104 tweak the numbers and hit "bang" to input a list;
-#X text 151 197 creation argument to avoid repeated outout;
-#X text 108 219 output is the index of best match \, counting from
-zero;
-#X connect 0 0 10 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 0;
-#X connect 2 0 11 0;
-#X connect 3 0 0 0;
-#X connect 3 0 11 0;
-#X connect 4 0 0 0;
-#X connect 4 0 11 0;
-#X connect 5 0 4 2;
-#X connect 6 0 4 1;
-#X connect 7 0 8 1;
-#X connect 8 0 4 0;
-#X connect 9 0 8 0;
-#X connect 11 0 12 0;
diff --git a/externals/extra/0.43.3/0.43.2/choice/choice.c b/externals/extra/0.43.3/0.43.2/choice/choice.c
deleted file mode 100644
index 9b8bfb1c..00000000
--- a/externals/extra/0.43.3/0.43.2/choice/choice.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* choice -- match incoming list against a collection of stored templates. */
-
-/* Copyright 1999 Miller Puckette.
-Permission is granted to use this software for any purpose provided you
-keep this copyright notice intact.
-
-THE AUTHOR AND HIS EMPLOYERS MAKE NO WARRANTY, EXPRESS OR IMPLIED,
-IN CONNECTION WITH THIS SOFTWARE.
-
-This file is downloadable from http://www.crca.ucsd.edu/~msp .
-*/
-
-#include "m_pd.h"
-#include <math.h>
-static t_class *choice_class;
-#define DIMENSION 10
-
-typedef struct _elem
-{
- t_float e_age;
- t_float e_weight[DIMENSION];
-} t_elem;
-
-typedef struct _choice
-{
- t_object x_obj;
- t_elem *x_vec;
- int x_n;
- int x_nonrepeat;
-} t_choice;
-
-static void *choice_new(t_float fnonrepeat)
-{
- t_choice *x = (t_choice *)pd_new(choice_class);
- outlet_new(&x->x_obj, gensym("float"));
- x->x_vec = (t_elem *)getbytes(0);
- x->x_n = 0;
- x->x_nonrepeat = (fnonrepeat != 0);
- return (x);
-}
-
-static void choice_clear(t_choice *x)
-{
- x->x_vec = (t_elem *)resizebytes(x->x_vec, x->x_n * sizeof(t_elem), 0);
- x->x_n = 0;
-}
-
-static void choice_print(t_choice *x)
-{
- int j;
- for (j = 0; j < x->x_n; j++)
- {
- t_elem *e = x->x_vec + j;
- t_float *w = e->e_weight;
- post("%2d age %2d \
-w %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f",
- j, (int)(e->e_age), w[0], w[1], w[2], w[3], w[4], w[5],
- w[6], w[7], w[8], w[9]);
- }
-}
-
-static void choice_add(t_choice *x, t_symbol *s, int argc, t_atom *argv)
-{
- int oldn = x->x_n, newn = oldn + 1, i;
- t_elem *e;
- t_float sum, normal;
- x->x_vec = (t_elem *)resizebytes(x->x_vec, oldn * sizeof(t_elem),
- newn * sizeof(t_elem));
- x->x_n = newn;
- e = x->x_vec + oldn;
- e->e_age = 2;
-
- for (i = 0, sum = 0; i < DIMENSION; i++)
- {
- t_float f = atom_getfloatarg(i, argc, argv);
- e->e_weight[i] = f;
- sum += f*f;
- }
- normal = (t_float)(sum > 0 ? 1./sqrt(sum) : 1);
- for (i = 0; i < DIMENSION; i++)
- e->e_weight[i] *= normal;
-}
-
-static void choice_list(t_choice *x, t_symbol *s, int argc, t_atom *argv)
-{
- int i, j;
- t_float bestsum = 0;
- int bestindex = -1;
- t_float invec[DIMENSION];
- for (i = 0; i < DIMENSION; i++)
- invec[i] = atom_getfloatarg(i, argc, argv);
- for (j = 0; j < x->x_n; j++)
- {
- t_elem *e = x->x_vec + j;
- t_float sum;
- for (i = 0, sum = 0; i < DIMENSION; i++)
- sum += e->e_weight[i] * invec[i];
- if (x->x_nonrepeat) sum *= (t_float)(log(e->e_age));
- if (sum > bestsum)
- {
- bestsum = sum;
- sum = 1;
- bestindex = j;
- }
- }
- if (bestindex >= 0)
- {
- for (j = 0; j < x->x_n; j++)
- x->x_vec[j].e_age += 1.;
- x->x_vec[bestindex].e_age = 1;
- }
- outlet_float(x->x_obj.ob_outlet, (t_float)bestindex);
-}
-
-static void choice_free(t_choice *x)
-{
- freebytes(x->x_vec, x->x_n * sizeof(t_elem));
-}
-
-void choice_setup(void)
-{
- choice_class = class_new(gensym("choice"), (t_newmethod)choice_new,
- (t_method)choice_free, sizeof(t_choice), 0, A_DEFFLOAT, 0);
- class_addmethod(choice_class, (t_method)choice_add, gensym("add"), A_GIMME, 0);
- class_addmethod(choice_class, (t_method)choice_clear, gensym("clear"), 0);
- class_addmethod(choice_class, (t_method)choice_print, gensym("print"), 0);
- class_addlist(choice_class, choice_list);
-}
diff --git a/externals/extra/0.43.3/0.43.2/complex-mod~-help.pd b/externals/extra/0.43.3/0.43.2/complex-mod~-help.pd
deleted file mode 100644
index 9e14904d..00000000
--- a/externals/extra/0.43.3/0.43.2/complex-mod~-help.pd
+++ /dev/null
@@ -1,26 +0,0 @@
-#N canvas 136 85 600 480 12;
-#X graph graph1 0 -1 882 1 279 209 579 39;
-#X array mod-output 882 float;
-#X pop;
-#X msg 84 256 bang \; pd dsp 1;
-#X floatatom 67 56;
-#X obj 67 186 complex-mod~;
-#X obj 67 84 phasor~ 440;
-#X obj 67 115 cos~;
-#X obj 106 138 cos~;
-#X obj 106 114 -~ 0.25;
-#X floatatom 145 152;
-#X text 93 351 The complex modulator takes two signals in which it considers to be the real and imaginary part of a complex-valued signal. It then does a complex multiplication by a sinusoud to shift all frequencies up or down by any frequency shift in Hz. See also hilbert~.;
-#X obj 69 298 tabwrite~ mod-output;
-#X text 149 204 right outlet;
-#X text 151 220 gives the other;
-#X text 149 236 sideband;
-#X connect 1 0 10 0;
-#X connect 2 0 4 0;
-#X connect 3 0 10 0;
-#X connect 4 0 5 0;
-#X connect 4 0 7 0;
-#X connect 5 0 3 0;
-#X connect 6 0 3 1;
-#X connect 7 0 6 0;
-#X connect 8 0 3 2;
diff --git a/externals/extra/0.43.3/0.43.2/complex-mod~.pd b/externals/extra/0.43.3/0.43.2/complex-mod~.pd
deleted file mode 100644
index df78a3bf..00000000
--- a/externals/extra/0.43.3/0.43.2/complex-mod~.pd
+++ /dev/null
@@ -1,30 +0,0 @@
-#N canvas 206 108 428 341 12;
-#X obj 142 87 inlet~;
-#X obj 315 166 cos~;
-#X obj 351 144 +~ -0.25;
-#X obj 351 166 cos~;
-#X obj 225 87 inlet~;
-#X obj 142 215 *~;
-#X obj 225 216 *~;
-#X obj 142 251 -~;
-#X obj 142 284 outlet~;
-#X obj 212 285 outlet~;
-#X obj 212 252 +~;
-#X text 140 310 positive;
-#X text 213 311 negative;
-#X obj 315 114 phasor~;
-#X obj 315 88 inlet~;
-#X connect 0 0 5 0;
-#X connect 1 0 5 1;
-#X connect 2 0 3 0;
-#X connect 3 0 6 1;
-#X connect 4 0 6 0;
-#X connect 5 0 7 0;
-#X connect 5 0 10 0;
-#X connect 6 0 7 1;
-#X connect 6 0 10 1;
-#X connect 7 0 8 0;
-#X connect 10 0 9 0;
-#X connect 13 0 2 0;
-#X connect 13 0 1 0;
-#X connect 14 0 13 0;
diff --git a/externals/extra/0.43.3/0.43.2/debian/changelog b/externals/extra/0.43.3/0.43.2/debian/changelog
deleted file mode 100644
index 1aaa941b..00000000
--- a/externals/extra/0.43.3/0.43.2/debian/changelog
+++ /dev/null
@@ -1,5 +0,0 @@
-pd-extra (0.42.6-1) unstable; urgency=low
-
- * Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
-
- -- Hans-Christoph Steiner <hans@eds.org> Thu, 21 Jan 2010 23:27:04 -0500
diff --git a/externals/extra/0.43.3/0.43.2/debian/compat b/externals/extra/0.43.3/0.43.2/debian/compat
deleted file mode 100644
index 7f8f011e..00000000
--- a/externals/extra/0.43.3/0.43.2/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-7
diff --git a/externals/extra/0.43.3/0.43.2/debian/control b/externals/extra/0.43.3/0.43.2/debian/control
deleted file mode 100644
index f6000b5c..00000000
--- a/externals/extra/0.43.3/0.43.2/debian/control
+++ /dev/null
@@ -1,35 +0,0 @@
-Source: pd-extra
-Section: sound
-Priority: optional
-Maintainer: Debian Multimedia Maintainers <pkg-multimedia-maintainers@lists.alioth.debian.org>
-Uploaders: Hans-Christoph Steiner <hans@eds.org>
-Build-Depends: debhelper (>= 7.0.50~),
- puredata
-Standards-Version: 3.9.1
-Homepage: http://puredata.info
-
-Package: pd-extra
-Architecture: any
-Depends: ${shlibs:Depends},
- pd,
- pd-libdir,
- ${misc:Depends}
-Recommends: pd-import
-Description: Pd library of core extras distributed as part of Pure Data
- Pure Data ships with a separate collection of objects known as
- 'extra'. Included in this collection is a set of audio functions like audio
- analysis and reverb.
- .
- bonk~: attack detection and spectral envelope measurement
- choice: search for a best match to an incoming list
- complex-mod~: complex multiplication
- expr, expr~, fexpr~: objects for evalutaing mathematical expressions
- fiddle~: pitch estimator and sinusoidal peak finder
- hilbert~: a phase quadrature for signal sideband modulation
- loop~: phase generator for looping samplers
- lrshift~: shift signal vector elements left or right
- pd~: run pd as a subprocess of pd itself
- pique: find peaks in an FFT spectrum
- rev1~, rev2~, rev3~: different reverberation algorithms
- sigmund~: sinusoidal analysis and pitch tracking
- stdout: write messages to stdout
diff --git a/externals/extra/0.43.3/0.43.2/debian/copyright b/externals/extra/0.43.3/0.43.2/debian/copyright
deleted file mode 100644
index 231abfd2..00000000
--- a/externals/extra/0.43.3/0.43.2/debian/copyright
+++ /dev/null
@@ -1,63 +0,0 @@
-Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?rev=135
-Name: extra
-Maintainer: Miller Puckette and others
-Source: http://sourceforge.net/projects/pure-data/files/libraries/extra/
-
-Files: *
-Copyright: 1997-2010, Miller Puckette
- 1997-1999, Ted Apel
-License: BSD Pd License
-
-Files: expr~/*
-Copyright: 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
-License: GPL-2+
-
-License: BSD Pd License
-This software is copyrighted by Miller Puckette and others. The following
-terms (the "Standard Improved BSD License") apply to all files associated with
-the software unless explicitly disclaimed in individual files:
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-3. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior
- written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
-
-
-License: GPL-2+
- This package is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- .
- This package is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- .
- You should have received a copy of the GNU General Public License
- along with this package; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-X-Comment: On Debian systems, the complete text of the GNU General
- Public License can be found in `/usr/share/common-licenses/GPL-2'.
diff --git a/externals/extra/0.43.3/0.43.2/debian/gbp.conf b/externals/extra/0.43.3/0.43.2/debian/gbp.conf
deleted file mode 100644
index ae1dc367..00000000
--- a/externals/extra/0.43.3/0.43.2/debian/gbp.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-[DEFAULT]
-upstream-branch = upstream
-debian-branch = master
-upstream-tag = upstream/%(version)s
-debian-tag = debian/%(version)s
-pristine-tar = True
-sign-tags = True
diff --git a/externals/extra/0.43.3/0.43.2/debian/links b/externals/extra/0.43.3/0.43.2/debian/links
deleted file mode 100644
index d97ab7c9..00000000
--- a/externals/extra/0.43.3/0.43.2/debian/links
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib/pd/extra/extra/README.txt usr/share/doc/pd-extra/README
diff --git a/externals/extra/0.43.3/0.43.2/debian/rules b/externals/extra/0.43.3/0.43.2/debian/rules
deleted file mode 100755
index 67fca227..00000000
--- a/externals/extra/0.43.3/0.43.2/debian/rules
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/make -f
-
-LIBRARY_NAME = extra
-PACKAGE = pd-$(LIBRARY_NAME)
-pkglibdir = /usr/lib/pd/extra
-
-%:
- dh $@ --buildsystem=makefile
-
-override_dh_auto_install:
- dh_auto_install -- prefix=/usr pkglibdir=$(pkglibdir)
-
-override_dh_shlibdeps:
- dpkg-shlibdeps $(CURDIR)/debian/$(PACKAGE)$(pkglibdir)/$(LIBRARY_NAME)/*.pd_linux \
- -T$(CURDIR)/debian/$(PACKAGE).substvars
diff --git a/externals/extra/0.43.3/0.43.2/debian/source/format b/externals/extra/0.43.3/0.43.2/debian/source/format
deleted file mode 100644
index 163aaf8d..00000000
--- a/externals/extra/0.43.3/0.43.2/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/externals/extra/0.43.3/0.43.2/debian/watch b/externals/extra/0.43.3/0.43.2/debian/watch
deleted file mode 100644
index 06eccab4..00000000
--- a/externals/extra/0.43.3/0.43.2/debian/watch
+++ /dev/null
@@ -1,2 +0,0 @@
-version=3
-http://sf.net/pure-data/extra-(.*)\.tar\.gz
diff --git a/externals/extra/0.43.3/0.43.2/expr-help.pd b/externals/extra/0.43.3/0.43.2/expr-help.pd
deleted file mode 100644
index 8fafb35d..00000000
--- a/externals/extra/0.43.3/0.43.2/expr-help.pd
+++ /dev/null
@@ -1,497 +0,0 @@
-#N canvas 165 94 1012 579 12;
-#X text 66 10 expression evaluation family - expr \, expr~ \, fexpr~
-;
-#X text 63 239 Syntyax:;
-#X text 64 311 $f#: float input variable;
-#X text 65 326 $s#: symbol input variable;
-#X text 553 90 Used for expr~ only:;
-#X text 553 105 $v#: signal (vector) input (vector by vector evaluation)
-;
-#X text 550 164 Used for fexpr~ only:;
-#X text 550 220 $y[n]: the output value indexed by n where n has to
-satisfy 0 > n >= -vector size.;
-#X text 550 248 (the vector size can be changed by the "block~" object.)
-;
-#X text 550 179 $x#[n]: the sample from inlet # indexed by n where
-n has to satisfy 0 => n >= -vector size \, ($x# is a shorthand for
-$x#[0] \, specifying the current sample);
-#X text 63 151 expr~ is used for expression evaluaion of signal data
-on the vector by vector basis;
-#X text 63 136 expr is used for expression evaluaion of control data
-;
-#X text 67 39 For a more detailed documentaion refer to http://www.crca.ucsd.edu/~yadegari/expr.html
-;
-#X text 64 254 The syntax is very close to how expressions are written
-in C. Variables are specified as follows where the '#' stands for the
-inlet number:;
-#X text 65 297 $i#: integer input variable;
-#X text 63 179 fexpr~ is used for expression evaluaion on sample level
-data \; i.e. \, filter design. Warning: fexpr~ is very cpu intensive.
-;
-#X text 633 12 updated for Pd 0.35 test 26 and expr* 0.4;
-#X text 67 85 you can define multiple expressoins in the same object.
-semicolon is used to separates the expressions.;
-#X text 635 294 $y -> $y1[-1];
-#X text 550 263 Shorthands: $x -> $x1[0];
-#X text 635 279 $x1 -> $x1[0] $x2 -> $x2[0] .....;
-#X text 635 309 $y1 -> $y1[-1] $y2 -> $y2[-1] .....;
-#N canvas 0 0 828 385 Examples 0;
-#X obj 33 151 expr 1;
-#X floatatom 197 119 0 0 0 0 - - -;
-#X floatatom 33 181 0 0 0 0 - - -;
-#X msg 33 123 bang;
-#X obj 101 149 expr 2 + 3;
-#X msg 101 122 bang;
-#X floatatom 101 177 0 0 0 0 - - -;
-#X floatatom 196 177 0 0 0 0 - - -;
-#X obj 196 149 expr 2+$f1;
-#X floatatom 34 220 0 0 0 0 - - -;
-#X floatatom 34 277 0 0 0 0 - - -;
-#X obj 34 249 expr $f1 * $f2;
-#X floatatom 113 220 0 0 0 0 - - -;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array array1 10 float 0;
-#X coords 0 10 10 0 200 150 1;
-#X restore 584 180 graph;
-#X floatatom 35 315 0 0 0 0 - - -;
-#X floatatom 35 371 0 0 0 0 - - -;
-#X floatatom 194 219 0 0 0 0 - - -;
-#X floatatom 194 276 0 0 0 0 - - -;
-#X obj 194 248 expr $s2[$f1];
-#X msg 267 220 symbol array1;
-#X obj 35 343 expr sin(2 * 3.14159 * $f1 / 360);
-#X msg 330 281 \; array1 1 4 2 8 5 6 1 4 2 8 5 6;
-#X floatatom 310 184 5 0 0 0 - - -;
-#X floatatom 395 186 5 0 0 0 - - -;
-#X floatatom 480 184 5 0 0 0 - - -;
-#X floatatom 310 105 5 0 0 0 - - -;
-#X obj 310 132 expr $f1 \; if ($f1 > 0 \, $f1 * 2 \, 0) \; if ($f1
-<= 0 \, $f1 / 2 \, 0);
-#X text 34 56 Examples of expr object;
-#X text 304 88 an example of multiple expressions and the use of 'if'
-;
-#X connect 0 0 2 0;
-#X connect 1 0 8 0;
-#X connect 3 0 0 0;
-#X connect 4 0 6 0;
-#X connect 5 0 4 0;
-#X connect 8 0 7 0;
-#X connect 9 0 11 0;
-#X connect 11 0 10 0;
-#X connect 12 0 11 1;
-#X connect 14 0 20 0;
-#X connect 16 0 18 0;
-#X connect 18 0 17 0;
-#X connect 19 0 18 1;
-#X connect 20 0 15 0;
-#X connect 25 0 26 0;
-#X connect 26 0 22 0;
-#X connect 26 1 23 0;
-#X connect 26 2 24 0;
-#X restore 307 398 pd Examples of expr;
-#N canvas 23 24 882 676 Examples 0;
-#X text -88 101 expr~ examples:;
-#X obj -24 355 print~;
-#X msg 13 334 bang;
-#X obj -24 276 sig~ 440;
-#X floatatom 49 293 0 0 0 0 - - -;
-#X floatatom -24 253 0 0 0 0 - - -;
-#X obj -24 316 expr~ $v1*$f2;
-#X obj 85 356 print~;
-#X msg 101 335 bang;
-#X floatatom 85 268 0 0 0 0 - - -;
-#X floatatom 158 270 0 0 0 0 - - -;
-#X floatatom 357 291 0 0 0 0 - - -;
-#X floatatom 244 267 0 0 0 0 - - -;
-#X obj 244 294 osc~;
-#X msg 369 47 \; pd dsp 0;
-#X msg 291 49 \; pd dsp 1;
-#X text 294 26 audio on;
-#X text 377 25 audio off;
-#X text -45 236 vector times scalar;
-#X text 87 236 vector;
-#X obj 243 354 dac~;
-#X text 241 245 frequency;
-#X text 373 273 amplitude;
-#X obj 85 315 expr~ $v1*$v2;
-#X floatatom 207 471 5 0 0 0 - - -;
-#X obj -40 520 tabsend~ a1;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array a1 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore -39 542 graph;
-#X obj -40 497 expr~ max(min($v1 \, $f2/10) \, -$f2/10);
-#X text -38 123 NOTES: the first inlet of expr~ cannot be a $f1 or
-$i1 \, this may change in later releases;
-#X text -87 420 A simple limiter example;
-#X obj 356 158 vsl 15 128 0 127 0 0 empty empty empty 20 8 0 8 -262144
--1 -1 0 1;
-#X obj 243 315 expr~ $v1*$f2/128;
-#X text -82 28 make sure you turn on audio for the expr~ examples;
-#X obj -40 473 osc~ 2756.25;
-#X text 122 436 Move the value below between 0 and 10;
-#X text 126 451 to change the limiter threshold;
-#X obj 417 522 tabsend~ a2;
-#X obj 580 518 tabsend~ a3;
-#X obj 417 439 osc~ 2756.25;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array a2 64 float 1;
-#A 0 -0.797042 -0.728354 -0.551199 -0.29486 -5.74798e-08 0.28779 0.525076
-0.677165 0.723186 0.658973 0.49724 0.265198 -5.86755e-06 -0.257244
--0.467812 -0.601285 -0.639938 -0.581051 -0.436842 -0.232108 -4.49318e-08
-0.223344 0.404462 0.517604 0.548393 0.495593 0.370771 0.195993 -4.2964e-06
--0.186556 -0.335875 -0.427214 -0.449737 -0.4037 -0.299884 -0.157342
--3.00576e-08 0.14734 0.262927 0.331275 0.34523 0.306564 0.225106 0.116645
--2.503e-06 -0.106219 -0.186565 -0.231035 -0.236249 -0.205455 -0.147412
--0.0744387 -1.36289e-08 0.0637127 0.10778 0.127799 0.124205 0.101679
-0.0677997 0.0312617 -5.8003e-07 -0.0203835 -0.0275998 -0.0229047;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 347 554 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array a3 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 569 554 graph;
-#X obj 417 473 expr~ $v1 *$v2 \; if ($v2 > 0 \, 0 \, $v1*$v2);
-#X obj 580 439 osc~ 100;
-#X connect 2 0 1 0;
-#X connect 3 0 6 0;
-#X connect 4 0 6 1;
-#X connect 5 0 3 0;
-#X connect 6 0 1 0;
-#X connect 8 0 7 0;
-#X connect 9 0 23 0;
-#X connect 10 0 23 1;
-#X connect 11 0 31 1;
-#X connect 12 0 13 0;
-#X connect 13 0 31 0;
-#X connect 23 0 7 0;
-#X connect 24 0 27 1;
-#X connect 27 0 25 0;
-#X connect 30 0 11 0;
-#X connect 31 0 20 0;
-#X connect 31 0 20 1;
-#X connect 33 0 27 0;
-#X connect 38 0 41 0;
-#X connect 41 0 36 0;
-#X connect 41 1 37 0;
-#X connect 42 0 41 1;
-#X restore 307 433 pd Examples of expr~;
-#X text 40 399 For expr examples click here ->;
-#X text 41 433 For expr~ examples click here ->;
-#X text 40 471 For fexpr~ examples click here ->;
-#N canvas 0 0 1059 688 examples 0;
-#X msg 519 84 \; pd dsp 0;
-#X msg 428 84 \; pd dsp 1;
-#X text 426 64 audio on;
-#X text 518 65 audio off;
-#X floatatom 126 304 0 0 0 0 - - -;
-#X floatatom 259 323 0 0 0 0 - - -;
-#X msg 226 283 -10;
-#X text 53 103 fexpr~ examples:;
-#X obj 125 571 print~;
-#X msg 247 552 bang;
-#X floatatom 125 475 0 0 0 0 - - -;
-#X obj 126 347 fexpr~ ($x1[$f2]+$x1)/2;
-#X obj 125 532 fexpr~ $x1+$y[-1];
-#X floatatom 635 366 0 0 0 0 - - -;
-#X floatatom 795 387 0 0 0 0 - - -;
-#X obj 630 456 dac~;
-#X obj 632 407 fexpr~ ($x1[$f2/1000]+$x1)/2;
-#X msg 864 317 0 10000;
-#X obj 795 368 line 0;
-#X msg 798 318 -10000;
-#X obj 120 389 dac~;
-#X text 96 227 Simple FIR filter;
-#X text 557 134 Simple FIR filter using fractional offset;
-#X msg 704 318 -10000 10000;
-#X obj 635 387 osc~ 2205;
-#X msg 644 343 1102.5;
-#X msg 862 342 0 10000;
-#X msg 796 343 -20000;
-#X msg 702 343 -20000 10000;
-#X msg 635 318 2205;
-#X msg 548 312 start;
-#X msg 550 334 stop;
-#X msg 57 284 start;
-#X msg 56 309 stop;
-#X msg 75 469 start;
-#X msg 74 494 stop;
-#X obj 491 335 loadbang;
-#X obj 18 495 loadbang;
-#X obj 1 309 loadbang;
-#X text 617 291 frequency;
-#X text 707 300 of the simple filter;
-#X msg 293 282 -20;
-#X obj 126 325 osc~ 2205;
-#X msg 156 281 1102.5;
-#X msg 110 281 2205;
-#X msg 260 282 0;
-#X text 123 445 simple accumulator defined as and an IIR filter;
-#X text 52 148 NOTE: fexpr~ could use lots of CPU power \, by default
-fexpr~ is on when it is loaded. In this page we are turning them off
-with loadbang \, so to hear them you have to turn them on explicitly.
-You can use the "start" and "stop" messages to start and stop fexpr~
-and expr~;
-#X text 706 288 index defining the frequency;
-#X text 95 240 -10 offset will fully filter audio frequency of 2205
-\, and -20 offset will filter audio at frequency of 1102.5;
-#X text 559 215 Thus \, the offset -10000 will filter audio at frequency
-of 2205 and the offset value -20000 will filter the audio at frequency
-of 1102.5.;
-#X text 558 161 When fractional offset is used \, fexpr~ determines
-indexed by linear interpolation. In the following example the offset
-value is divided by 1000 \, thus we can continuously change the offset
-without an audible click in the output.;
-#X text 288 318 If you change this value you;
-#X text 290 330 hear a click;
-#X text 51 87 make sure you turn on audio for the fexpr~ examples;
-#X text 55 -323 Used for fexpr~ only:;
-#X text 55 -267 $y[n]: the output value indexed by n where n has to
-satisfy 0 > n >= -vector size.;
-#X text 55 -239 (the vector size can be changed by the "block~" object.)
-;
-#X text 55 -308 $x#[n]: the sample from inlet # indexed by n where
-n has to satisfy 0 => n >= -vector size \, ($x# is a shorthand for
-$x#[0] \, specifying the current sample);
-#X text 140 -193 $y -> $y1[-1];
-#X text 55 -224 Shorthands: $x -> $x1[0];
-#X text 140 -208 $x1 -> $x1[0] $x2 -> $x2[0] .....;
-#X text 140 -178 $y1 -> $y1[-1] $y2 -> $y2[-1] .....;
-#X text 64 -125 fexpr~ responds to the following methods;
-#X text 66 -106 clear - clears all the previous input and output buffers
-;
-#X text 65 -92 clear x# - clears the previous values of the #th input
-;
-#X text 66 -79 clear y# - clears the previous values of the #th output
-;
-#X text 66 -33 set x# val-1 val-2 ... - sets the as many supplied values
-of the #th input;
-#X text 513 -22 e.g. \, set x2 3.4 0.4 sets x2[-1]=3.4 and x2[-2]=0.4
-;
-#X text 66 -2 set y# val-1 val-2 ... - sets the as many supplied values
-of the #th input;
-#X text 514 4 e.g. \, set y3 1.1 3.3 4.5 sets y3[-1]=1.1 y3[-2]=3.3
-and y3[-3]=4.5;
-#X text 64 -54 set val val ... - sets the first past values of each
-output;
-#X text 513 -59 e.g. \, set 0.1 2.2 0.4 sets y1[-1]=0.1 y2[-1]=2.2
-\, and y3[-1]=0.4;
-#X msg 244 475 set 4000;
-#X obj 125 504 sig~ 0.001;
-#X msg 245 498 clear;
-#X text 22 442 comment;
-#X text 14 431 1 first click the start button;
-#X text 307 494 2 click the set or the clear button;
-#X text 304 547 3 then click bang to see how set and clear work;
-#X connect 4 0 42 0;
-#X connect 5 0 11 1;
-#X connect 6 0 5 0;
-#X connect 9 0 8 0;
-#X connect 10 0 74 0;
-#X connect 11 0 20 0;
-#X connect 11 0 20 1;
-#X connect 12 0 8 0;
-#X connect 13 0 24 0;
-#X connect 14 0 16 1;
-#X connect 16 0 15 0;
-#X connect 16 0 15 1;
-#X connect 17 0 18 0;
-#X connect 18 0 14 0;
-#X connect 19 0 18 0;
-#X connect 23 0 18 0;
-#X connect 24 0 16 0;
-#X connect 25 0 13 0;
-#X connect 26 0 18 0;
-#X connect 27 0 18 0;
-#X connect 28 0 18 0;
-#X connect 29 0 13 0;
-#X connect 30 0 16 0;
-#X connect 31 0 16 0;
-#X connect 32 0 11 0;
-#X connect 33 0 11 0;
-#X connect 34 0 12 0;
-#X connect 35 0 12 0;
-#X connect 36 0 31 0;
-#X connect 37 0 35 0;
-#X connect 38 0 33 0;
-#X connect 41 0 5 0;
-#X connect 42 0 11 0;
-#X connect 43 0 4 0;
-#X connect 44 0 4 0;
-#X connect 45 0 5 0;
-#X connect 73 0 12 0;
-#X connect 74 0 12 0;
-#X connect 75 0 12 0;
-#X restore 306 472 pd examples of fexpr~;
-#X text 42 504 For using fexpr~ for solving;
-#X text 43 520 differential equations click here ->;
-#N canvas 112 22 944 449 lorenz 0;
-#X obj 176 67 v pr;
-#X obj 307 68 v r;
-#X obj 233 69 v b;
-#X floatatom 176 38 5 0 0 0 - - -;
-#X floatatom 307 40 5 0 0 0 - - -;
-#X msg 177 13 10;
-#X obj 231 10 expr 8./3;
-#X msg 128 136 set 1.2 2.3 4.4;
-#X floatatom 233 39 7 0 0 0 - - -;
-#X msg 75 46 stop;
-#X msg 75 67 start;
-#X floatatom 399 40 5 0 0 0 - - -;
-#X obj 399 69 v dt;
-#X msg 310 12 18;
-#X msg 395 13 0.01;
-#X obj 68 296 dac~;
-#X obj 128 -41 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X text 201 -41 <- turn audio on and bang here;
-#X text 463 42 <- experiment with these numbers;
-#X text 472 72 if you hear a buzz \, you have probably gone unstable
-bang on the top again;
-#X obj 489 15 line;
-#X obj 128 241 /~ 20;
-#X obj 234 238 /~ 20;
-#X obj 340 237 /~ 20;
-#X msg 484 -11 0.01 \, 0.04 5000;
-#X obj 128 185 fexpr~ $y1+(pr*$y2-pr*$y1)*dt \; $y2 +(-$y1*$y3 + r*$y1-$y2)*dt
-\; $y3+($y1*$y2 - b*$y3)*dt;
-#X obj 14 65 loadbang;
-#X text 113 -100 This is an example of how fexpr~ could be used for
-solving differential equations \, in this case the lorenz equations
-which generate chotic signals;
-#X text 361 182 Note the following shorthands:;
-#X text 360 198 $y1 -> $y1[-1] \, $y2 -> $y2[-1] \, .....;
-#X text 248 136 the 'set' commands sets the initial previous values
-;
-#X obj 128 298 tabsend~ lorenz1a;
-#X obj 234 278 tabsend~ lorenz2a;
-#X obj 339 259 tabsend~ lorenz3a;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz1a 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 73 437 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz2a 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 331 435 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz3a 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 592 436 graph;
-#X text 301 315 You can see the graphs if you scroll down;
-#X text 301 328 but the redrawings may cause clicks in the audio;
-#X connect 3 0 0 0;
-#X connect 4 0 1 0;
-#X connect 5 0 3 0;
-#X connect 6 0 8 0;
-#X connect 7 0 25 0;
-#X connect 8 0 2 0;
-#X connect 9 0 25 0;
-#X connect 10 0 25 0;
-#X connect 11 0 12 0;
-#X connect 13 0 4 0;
-#X connect 14 0 11 0;
-#X connect 16 0 5 0;
-#X connect 16 0 6 0;
-#X connect 16 0 13 0;
-#X connect 16 0 14 0;
-#X connect 16 0 7 0;
-#X connect 16 0 10 0;
-#X connect 20 0 11 0;
-#X connect 21 0 31 0;
-#X connect 21 0 15 0;
-#X connect 21 0 15 1;
-#X connect 22 0 32 0;
-#X connect 23 0 33 0;
-#X connect 24 0 20 0;
-#X connect 25 0 21 0;
-#X connect 25 1 22 0;
-#X connect 25 2 23 0;
-#X connect 26 0 9 0;
-#X restore 308 518 pd lorenz equations for audition;
-#N canvas 97 36 978 656 lorenz 0;
-#X obj 176 67 v pr;
-#X obj 307 68 v r;
-#X obj 233 69 v b;
-#X floatatom 176 38 5 0 0 0 - - -;
-#X floatatom 307 40 5 0 0 0 - - -;
-#X msg 177 13 10;
-#X obj 231 10 expr 8./3;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz1 2048 float 0;
-#X coords 0 -1 2047 1 200 140 1;
-#X restore 82 357 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz2 2048 float 0;
-#X coords 0 -1 2047 1 200 140 1;
-#X restore 327 353 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz3 2048 float 0;
-#X coords 0 -1 2047 1 200 140 1;
-#X restore 570 347 graph;
-#X msg 128 136 set 1.2 2.3 4.4;
-#X floatatom 233 39 7 0 0 0 - - -;
-#X msg 75 46 stop;
-#X msg 75 67 start;
-#X floatatom 399 40 5 0 0 0 - - -;
-#X obj 399 69 v dt;
-#X msg 310 12 18;
-#X msg 395 13 0.01;
-#X obj 128 -41 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X text 201 -41 <- turn audio on and bang here;
-#X text 463 42 <- experiment with these numbers;
-#X text 472 72 if you hear a buzz \, you have probably gone unstable
-bang on the top again;
-#X obj 489 15 line;
-#X obj 128 241 /~ 20;
-#X obj 234 238 /~ 20;
-#X obj 340 237 /~ 20;
-#X msg 484 -11 0.01 \, 0.04 5000;
-#X obj 14 65 loadbang;
-#X text 113 -100 This is an example of how fexpr~ could be used for
-solving differential equations \, in this case the lorenz equations
-which generate chotic signals;
-#X text 361 182 Note the following shorthands:;
-#X text 360 198 $y1 -> $y1[-1] \, $y2 -> $y2[-1] \, .....;
-#X text 248 136 the 'set' commands sets the initial previous values
-;
-#X obj 128 298 tabsend~ lorenz1;
-#X obj 234 278 tabsend~ lorenz2;
-#X obj 339 259 tabsend~ lorenz3;
-#X obj 627 280 block~ 2048;
-#X text 669 133 Lorenz Equations;
-#X obj 128 185 fexpr~ $y1+pr * ($y2-$y1)*dt \; $y2 +(-$y1*$y3 + r*$y1-$y2)*dt
-\; $y3+($y1*$y2 - b*$y3)*dt;
-#X text 672 197 dZ/dt = -bZ;
-#X text 669 167 dX/dt = pr * (X - Y);
-#X text 668 147 written with 3 state variable X \, Y \, and Z;
-#X text 670 182 dY/dt = -XZ + rX - y;
-#X connect 3 0 0 0;
-#X connect 4 0 1 0;
-#X connect 5 0 3 0;
-#X connect 6 0 11 0;
-#X connect 10 0 37 0;
-#X connect 11 0 2 0;
-#X connect 12 0 37 0;
-#X connect 13 0 37 0;
-#X connect 14 0 15 0;
-#X connect 16 0 4 0;
-#X connect 17 0 14 0;
-#X connect 18 0 5 0;
-#X connect 18 0 6 0;
-#X connect 18 0 16 0;
-#X connect 18 0 17 0;
-#X connect 18 0 10 0;
-#X connect 18 0 13 0;
-#X connect 22 0 14 0;
-#X connect 23 0 32 0;
-#X connect 24 0 33 0;
-#X connect 25 0 34 0;
-#X connect 26 0 22 0;
-#X connect 27 0 12 0;
-#X connect 37 0 23 0;
-#X connect 37 1 24 0;
-#X connect 37 2 25 0;
-#X restore 308 541 pd lorenz equations for visualization;
-#X text 68 24 by Shahrokh Yadegari;
diff --git a/externals/extra/0.43.3/0.43.2/expr~/LICENSE.txt b/externals/extra/0.43.3/0.43.2/expr~/LICENSE.txt
deleted file mode 100644
index 01469ec7..00000000
--- a/externals/extra/0.43.3/0.43.2/expr~/LICENSE.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/externals/extra/0.43.3/0.43.2/expr~/README.txt b/externals/extra/0.43.3/0.43.2/expr~/README.txt
deleted file mode 100644
index bf84f2ae..00000000
--- a/externals/extra/0.43.3/0.43.2/expr~/README.txt
+++ /dev/null
@@ -1,97 +0,0 @@
-
-You can get more information on the expr object at
-http://www.crca.ucsd.edu/~yadegari/expr.html
-
------------
-
-New if Version 0.4
-
--access to variables (made by value object)
--multiple expression separated by ;
--added the following shorthands:
- $y or $y1 = $y1[-1] and $y2 = $y2[-1]
--new functions:
- if - conditional evaluation
- cbrt - cube root
- erf - error function
- erfc - complementary error function
- expm1 - exponential minus 1,
- log1p - logarithm of 1 plus
- isinf - is the value infinite,
- finite - is the value finite
- isnan -- is the resut a nan (Not a number)
- copysign - copy sign of a number
- ldexp - multiply floating-point number by integral power of 2
- imodf - get signed integral value from floating-point number
- modf - get signed fractional value from floating-point number
- drem - floating-point remainder function
-
- Thanks to Orm Finnendahl for adding the following functions:
- fmod - floating-point remainder function
- ceil - ceiling function: smallest integral value not less than argument
- floor - largest integral value not greater than argument
-
-------------
-
-New in Version 0.3
--Full function functionality
-
-------------
-
-The object "expr" is used for expression evaluaion of control data.
-
-Expr~ and fexpr~ are extentions to the expr object to work with vectors.
-The expr~ object is designed to efficiently combine signal and control
-stream processing by vector operations on the basis of the block size of
-the environment.
-
-fexpr~ object provides a flexible mechanism for building FIR and
-IIR filters by evaluating expressions on a sample by sample basis
-and providing access to prior samples of the input and output audio
-streams. When fractional offset is used, fexpr~ uses linear interpolation
-to determine the value of the indexed sample. fexpr~ evaluates the
-expression for every single sample and at every evaluation previous
-samples (limited by the audio vector size) can be accessed. $x is used to
-denote a singnal input whose samples we would like to access. The syntax
-is $x followed by the inlet number and indexed by brackets, for example
-$x1[-1] specifies the previous sample of the first inlet. Therefore,
-if we are to build a simple filter which replaces every sample by
-the average of that sample and its previous one, we would use "fexpr~
-($x1[0]+$x1[-1])/2 ". For ease of when the brackets are omitted, the
-current sample is implied, so we can right the previous filter expression
-as follows: " fexpr~ ($x1+$x1[-1])/2". To build IIR filters $y is used
-to access the previous samples of the output stream.
-
-The three objects expr, expr~, and fexpr~ are implemented in the same object
-so the files expr~.pd_linux and fexpr~.pd_linux are links to expr.pd_linux
-This release has been compiled and tested on Linux 6.0.
-
---------
-
-Here are some syntax information: (refer to help-expr.pd for examples)
-
-Syntyax:
-The syntax is very close to how expression are written in
-C. Variables are specified as follows where the '#' stands
-for the inlet number:
-$i#: integer input variable
-$f#: float input variable
-$s#: symbol input variable
-
-Used for expr~ only:
-$v#: signal (vector) input (vector by vector evaluation)
-
-Used for fexpr~ only:
-$x#[n]: the sample from inlet # indexed by n, where n has to
- satisfy 0 => n >= -vector size,
- ($x# is a shorthand for $x#[0], specifying the current sample)
-
-$y#[n]: the output value indexed by n, where n has to
- satisfy 0 > n >= -vector size,
- $y[n] is a shorthand for $y1[n]
-
-
-I'll appreciate hearing about bugs, comments, suggestions, ...
-
-Shahrokh Yadegari (sdy@ucsd.edu)
-7/10/02
diff --git a/externals/extra/0.43.3/0.43.2/expr~/fts_to_pd.h b/externals/extra/0.43.3/0.43.2/expr~/fts_to_pd.h
deleted file mode 100644
index 9ca2fc42..00000000
--- a/externals/extra/0.43.3/0.43.2/expr~/fts_to_pd.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* fts_to_pd.h -- alias some fts names to compile in Pd.
-
-copyright 1999 Miller Puckette;
-permission is granted to use this file for any purpose.
-*/
-
-
-#define fts_malloc malloc
-#define fts_calloc calloc
-#define fts_free free
-#define fts_realloc realloc
-#define fts_atom_t t_atom
-#define fts_object_t t_object
-typedef t_symbol *fts_symbol_t;
-
-#ifdef MSP
-#define t_atom Atom
-#define t_symbol Symbol
-#define pd_new(x) newobject(x);
-#define pd_free(x) freeobject(x);
-#define t_outlet void
-#define t_binbuf void
-typedef t_class *t_pd;
-typedef float t_floatarg;
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <errno.h>
-
-void pd_error(void *object, char *fmt, ...);
-
-#endif /* MSP */
-
-#define post_error pd_error
-#define fts_is_floatg(x) ((x)->a_type == A_FLOAT)
-
-#define fts_new_symbol_copy gensym
-
-#define fts_symbol_name(x) ((x)->s_name)
diff --git a/externals/extra/0.43.3/0.43.2/expr~/vexp.c b/externals/extra/0.43.3/0.43.2/expr~/vexp.c
deleted file mode 100644
index 8f8ff46c..00000000
--- a/externals/extra/0.43.3/0.43.2/expr~/vexp.c
+++ /dev/null
@@ -1,2142 +0,0 @@
-/*
- * jMax
- * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * See file LICENSE for further informations on licensing terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Based on Max/ISPW by Miller Puckette.
- *
- * Authors: Maurizio De Cecco, Francois Dechelle, Enzo Maggi, Norbert Schnell.
- *
- */
-
-/* "expr" was written by Shahrokh Yadegari c. 1989. -msp */
-/* "expr~" and "fexpr~" conversion by Shahrokh Yadegari c. 1999,2000 */
-
-/*
- * Feb 2002 - added access to variables
- * multiple expression support
- * new short hand forms for fexpr~
- * now $y or $y1 = $y1[-1] and $y2 = $y2[-1]
- * --sdy
- *
- * July 2002
- * fixed bugs introduced in last changes in store and ET_EQ
- * --sdy
- *
- */
-
-/*
- * vexp.c -- a variable expression evaluator
- *
- * This modules implements an expression evaluator using the
- * operator-precedence parsing. It transforms an infix expression
- * to a prefix stack ready to be evaluated. The expression sysntax
- * is close to that of C. There are a few operators that are not
- * supported and functions are also recognized. Strings can be
- * passed to functions when they are quoted in '"'s. "[]" are implememted
- * as an easy way of accessing the content of tables, and the syntax
- * table_name[index].
- * Variables (inlets) are specified with the following syntax: $x#,
- * where x is either i(integers), f(floats), and s(strings); and #
- * is a digit that coresponds to the inlet number. The string variables
- * can be used as strings when they are quoted and can also be used as
- * table names when they are followed by "[]".
- *
- * signal vectors have been added to this implementation:
- * $v# denotes a signal vector
- * $x#[index] is the value of a sample at the index of a the signal vector
- * $x# is the shorthand for $x#[0]
- * $y[index] is the value of the sample output at the index of a the
- * signal output
- * "index" for $x#[index] has to have this range (0 <= index < vectorsize)
- * "index" for $y[index] has to have this range (0 < index < vectorsize)
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "vexp.h"
-#ifdef MSP
-#undef isdigit
-#define isdigit(x) (x >= '0' && x <= '9')
-#endif
-
-char *atoif(char *s, long int *value, long int *type);
-
-static struct ex_ex *ex_lex(struct expr *expr, long int *n);
-struct ex_ex *ex_match(struct ex_ex *eptr, long int op);
-struct ex_ex *ex_parse(struct expr *expr, struct ex_ex *iptr,
- struct ex_ex *optr, long int *argc);
-struct ex_ex *ex_eval(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-
-int expr_donew(struct expr *exprr, int ac, t_atom *av);
-struct ex_ex *eval_func(struct expr *expr,struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-struct ex_ex *eval_tab(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-struct ex_ex *eval_var(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-struct ex_ex *eval_store(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-struct ex_ex *eval_sigidx(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-static int cal_sigidx(struct ex_ex *optr, /* The output value */
- int i, t_float rem_i, /* integer and fractinal part of index */
- int idx, /* index of current fexpr~ processing */
- int vsize, /* vector size */
- t_float *curvec, t_float *prevec); /* current and previous table */
-t_ex_func *find_func(char *s);
-void ex_dzdetect(struct expr *expr);
-
-#define MAX_ARGS 10
-extern t_ex_func ex_funcs[];
-
-struct ex_ex nullex;
-
-void set_tokens (char *s);
-int getoken (struct expr *expr, struct ex_ex *eptr);
-void ex_print (struct ex_ex *eptr);
-#ifdef MSP
-void atom_string(t_atom *a, char *buf, unsigned int bufsize);
-
-void atom_string(t_atom *a, char *buf, unsigned int bufsize)
-{
- char tbuf[30];
- switch(a->a_type)
- {
- case A_SEMI: strcpy(buf, ";"); break;
- case A_COMMA: strcpy(buf, ","); break;
-#ifdef PD
- case A_POINTER:
- strcpy(buf, "(pointer)");
- break;
-#endif
- case A_FLOAT:
- sprintf(tbuf, "%g", a->a_w.w_float);
- if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf);
- else if (a->a_w.w_float < 0) strcpy(buf, "-");
- else strcat(buf, "+");
- break;
- case A_LONG:
- sprintf(tbuf, "%d", a->a_w.w_long);
- if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf);
- else if (a->a_w.w_float < 0) strcpy(buf, "-");
- else strcat(buf, "+");
- break;
- case A_SYMBOL:
- {
- char *sp;
- unsigned int len;
- int quote;
- for (sp = a->a_w.w_symbol->s_name, len = 0, quote = 0; *sp; sp++, len++)
- if (*sp == ';' || *sp == ',' || *sp == '\\' ||
- (*sp == '$' && sp == a->a_w.w_symbol->s_name && sp[1] >= '0'
- && sp[1] <= '9'))
- quote = 1;
- if (quote)
- {
- char *bp = buf, *ep = buf + (bufsize-2);
- sp = a->a_w.w_symbol->s_name;
- while (bp < ep && *sp)
- {
- if (*sp == ';' || *sp == ',' || *sp == '\\' ||
- (*sp == '$' && bp == buf && sp[1] >= '0' && sp[1] <= '9'))
- *bp++ = '\\';
- *bp++ = *sp++;
- }
- if (*sp) *bp++ = '*';
- *bp = 0;
- /* post("quote %s -> %s", a->a_w.w_symbol->s_name, buf); */
- }
- else
- {
- if (len < bufsize-1) strcpy(buf, a->a_w.w_symbol->s_name);
- else
- {
- strncpy(buf, a->a_w.w_symbol->s_name, bufsize - 2);
- strcpy(buf + (bufsize - 2), "*");
- }
- }
- }
- break;
-#ifdef PD
- case A_DOLLAR:
- sprintf(buf, "$%d", a->a_w.w_index);
- break;
- case A_DOLLSYM:
- sprintf(buf, "$%s", a->a_w.w_symbol->s_name);
- break;
-#else /* MAX */
- case A_DOLLAR:
- sprintf(buf, "$%s", a->a_w.w_symbol->s_name);
- break;
-#endif
- default:
- post("atom_string bug");
- }
-}
-#endif /* MSP */
-/*
- * expr_donew -- create a new "expr" object.
- * returns 1 on failure, 0 on success.
- */
-int
-expr_donew(struct expr *expr, int ac, t_atom *av)
-{
- struct ex_ex *list;
- struct ex_ex *ret;
- long max_node = 0; /* maximum number of nodes needed */
- char *exp_string;
- int exp_strlen;
- t_binbuf *b;
- int i;
-
- memset(expr->exp_var, 0, MAX_VARS * sizeof (*expr->exp_var));
-#ifdef PD
- b = binbuf_new();
- binbuf_add(b, ac, av);
- binbuf_gettext(b, &exp_string, &exp_strlen);
-
-#else /* MSP */
- {
- char *buf = getbytes(0), *newbuf;
- int length = 0;
- char string[250];
- t_atom *ap;
- int indx;
-
- for (ap = av, indx = 0; indx < ac; indx++, ap = ++av) {
- int newlength;
- if ((ap->a_type == A_SEMI || ap->a_type == A_COMMA) &&
- length && buf[length-1] == ' ') length--;
- atom_string(ap, string, 250);
- newlength = length + strlen(string) + 1;
- if (!(newbuf = t_resizebytes(buf, length, newlength))) break;
- buf = newbuf;
- strcpy(buf + length, string);
- length = newlength;
- if (ap->a_type == A_SEMI) buf[length-1] = '\n';
- else buf[length-1] = ' ';
- }
-
- if (length && buf[length-1] == ' ') {
- if (newbuf = t_resizebytes(buf, length, length-1))
- {
- buf = newbuf;
- length--;
- }
- }
- exp_string = buf;
- exp_strlen = length;
- }
-#endif
- exp_string = (char *)t_resizebytes(exp_string, exp_strlen,exp_strlen+1);
- exp_string[exp_strlen] = 0;
- expr->exp_string = exp_string;
- expr->exp_str = exp_string;
- expr->exp_nexpr = 0;
- ret = (struct ex_ex *) 0;
- /*
- * if ret == 0 it means that we have no expression
- * so we let the pass go through to build a single null stack
- */
- while (*expr->exp_str || !ret) {
- list = ex_lex(expr, &max_node);
- if (!list) { /* syntax error */
- goto error;
- }
- expr->exp_stack[expr->exp_nexpr] =
- (struct ex_ex *)fts_malloc(max_node * sizeof (struct ex_ex));
- expr->exp_nexpr++;
- ret = ex_match(list, (long)0);
- if (!ret) /* syntax error */
- goto error;
- ret = ex_parse(expr,
- list, expr->exp_stack[expr->exp_nexpr - 1], (long *)0);
- if (!ret)
- goto error;
- }
- *ret = nullex;
- t_freebytes(exp_string, exp_strlen+1);
- return (0);
-error:
- for (i = 0; i < expr->exp_nexpr; i++) {
- fts_free(expr->exp_stack[i]);
- expr->exp_stack[i] = 0;
- }
- expr->exp_nexpr = 0;
- if (list)
- fts_free(list);
- t_freebytes(exp_string, exp_strlen+1);
- return (1);
-}
-
-/*
- * ex_lex -- This routine is a bit more than a lexical parser since it will
- * also do some syntax checking. It reads the string s and will
- * return a linked list of struct ex_ex.
- * It will also put the number of the nodes in *n.
- */
-struct ex_ex *
-ex_lex(struct expr *expr, long int *n)
-{
- struct ex_ex *list_arr;
- struct ex_ex *exptr;
- long non = 0; /* number of nodes */
- long maxnode = 0;
-
- list_arr = (struct ex_ex *)fts_malloc(sizeof (struct ex_ex) * MINODES);
- if (! list_arr) {
- post("ex_lex: no mem\n");
- return ((struct ex_ex *)0);
- }
- exptr = list_arr;
- maxnode = MINODES;
-
- while (8)
- {
- if (non >= maxnode) {
- maxnode += MINODES;
-
- list_arr = fts_realloc((void *)list_arr,
- sizeof (struct ex_ex) * maxnode);
- if (!list_arr) {
- post("ex_lex: no mem\n");
- return ((struct ex_ex *)0);
- }
- exptr = &(list_arr)[non];
- }
-
- if (getoken(expr, exptr)) {
- fts_free(list_arr);
- return ((struct ex_ex *)0);
- }
- non++;
-
- if (!exptr->ex_type)
- break;
-
- exptr++;
- }
- *n = non;
-
- return list_arr;
-}
-
-/*
- * ex_match -- this routine walks through the eptr and matches the
- * perentheses and brackets, it also converts the function
- * names to a pointer to the describing structure of the
- * specified function
- */
-/* operator to match */
-struct ex_ex *
-ex_match(struct ex_ex *eptr, long int op)
-{
- int firstone = 1;
- struct ex_ex *ret;
- t_ex_func *fun;
-
- for (; 8; eptr++, firstone = 0) {
- switch (eptr->ex_type) {
- case 0:
- if (!op)
- return (eptr);
- post("expr syntax error: an open %s not matched\n",
- op == OP_RP ? "parenthesis" : "bracket");
- return (exNULL);
- case ET_INT:
- case ET_FLT:
- case ET_II:
- case ET_FI:
- case ET_SI:
- case ET_VI:
- case ET_SYM:
- case ET_VSYM:
- continue;
- case ET_YO:
- if (eptr[1].ex_type != ET_OP || eptr[1].ex_op != OP_LB)
- eptr->ex_type = ET_YOM1;
- continue;
- case ET_XI:
- if (eptr[1].ex_type != ET_OP || eptr[1].ex_op != OP_LB)
- eptr->ex_type = ET_XI0;
- continue;
- case ET_TBL:
- case ET_FUNC:
- case ET_LP:
- /* CHANGE
- case ET_RP:
- */
- case ET_LB:
- /* CHANGE
- case ET_RB:
- */
- post("ex_match: unexpected type, %ld\n", eptr->ex_type);
- return (exNULL);
- case ET_OP:
- if (op == eptr->ex_op)
- return (eptr);
- /*
- * if we are looking for a right peranthesis
- * or a right bracket and find the other kind,
- * it has to be a syntax error
- */
- if ((eptr->ex_op == OP_RP && op == OP_RB) ||
- (eptr->ex_op == OP_RB && op == OP_RP)) {
- post("expr syntax error: prenthesis or brackets not matched\n");
- return (exNULL);
- }
- /*
- * Up to now we have marked the unary minuses as
- * subrtacts. Any minus that is the first one in
- * chain or is preceeded by anything except ')' and
- * ']' is a unary minus.
- */
- if (eptr->ex_op == OP_SUB) {
- ret = eptr - 1;
- if (firstone || (ret->ex_type == ET_OP &&
- ret->ex_op != OP_RB && ret->ex_op != OP_RP))
- eptr->ex_op = OP_UMINUS;
- } else if (eptr->ex_op == OP_LP) {
- ret = ex_match(eptr + 1, OP_RP);
- if (!ret)
- return (ret);
- eptr->ex_type = ET_LP;
- eptr->ex_ptr = (char *) ret;
- eptr = ret;
- } else if (eptr->ex_op == OP_LB) {
- ret = ex_match(eptr + 1, OP_RB);
- if (!ret)
- return (ret);
- eptr->ex_type = ET_LB;
- eptr->ex_ptr = (char *) ret;
- eptr = ret;
- }
- continue;
- case ET_STR:
- if (eptr[1].ex_op == OP_LB) {
- char *tmp;
-
- eptr->ex_type = ET_TBL;
- tmp = eptr->ex_ptr;
- if (ex_getsym(tmp, (t_symbol **)&(eptr->ex_ptr))) {
- post("expr: syntax error: problms with ex_getsym\n");
- return (exNULL);
- }
- fts_free((void *)tmp);
- } else if (eptr[1].ex_op == OP_LP) {
- fun = find_func(eptr->ex_ptr);
- if (!fun) {
- post(
- "expr: error: function %s not found\n",
- eptr->ex_ptr);
- return (exNULL);
- }
- eptr->ex_type = ET_FUNC;
- eptr->ex_ptr = (char *) fun;
- } else {
- char *tmp;
-
- if (eptr[1].ex_type && eptr[1].ex_type!=ET_OP){
- post("expr: syntax error: bad string '%s'\n", eptr->ex_ptr);
- return (exNULL);
- }
- /* it is a variable */
- eptr->ex_type = ET_VAR;
- tmp = eptr->ex_ptr;
- if (ex_getsym(tmp,
- (t_symbol **)&(eptr->ex_ptr))) {
- post("expr: variable '%s' not found",tmp);
- return (exNULL);
- }
- }
- continue;
- default:
- post("ex_match: bad type\n");
- return (exNULL);
- }
- }
- /* NOTREACHED */
-}
-
-/*
- * ex_parse -- This function if called when we have already done some
- * parsing on the expression, and we have already matched
- * our brackets and parenthesis. The main job of this
- * function is to convert the infix expression to the
- * prefix form.
- * First we find the operator with the lowest precedence and
- * put it on the stack ('optr', it is really just an array), then
- * we call ourself (ex_parse()), on its arguments (unary operators
- * only have one operator.)
- * When "argc" is set it means that we are parsing the arguments
- * of a function and we will increment *argc anytime we find
- * a a segment that can qualify as an argument (counting commas).
- *
- * returns 0 on syntax error
- */
-/* number of argument separated by comma */
-struct ex_ex *
-ex_parse(struct expr *x, struct ex_ex *iptr, struct ex_ex *optr, long int *argc)
-{
- struct ex_ex *eptr;
- struct ex_ex *lowpre = 0; /* pointer to the lowest precedence */
- struct ex_ex savex;
- long pre = HI_PRE;
- long count;
-
- if (!iptr) {
- post("ex_parse: input is null, iptr = 0x%lx\n", iptr);
- return (exNULL);
- }
- if (!iptr->ex_type)
- return (exNULL);
-
- /*
- * the following loop finds the lowest precedence operator in the
- * the input token list, comma is explicitly checked here since
- * that is a special operator and is only legal in functions
- */
- for (eptr = iptr, count = 0; eptr->ex_type; eptr++, count++)
- switch (eptr->ex_type) {
- case ET_SYM:
- case ET_VSYM:
- if (!argc) {
- post("expr: syntax error: symbols allowed for functions only\n");
- ex_print(eptr);
- return (exNULL);
- }
- case ET_INT:
- case ET_FLT:
- case ET_II:
- case ET_FI:
- case ET_XI0:
- case ET_YOM1:
- case ET_VI:
- case ET_VAR:
- if (!count && !eptr[1].ex_type) {
- *optr++ = *eptr;
- return (optr);
- }
- break;
- case ET_XI:
- case ET_YO:
- case ET_SI:
- case ET_TBL:
- if (eptr[1].ex_type != ET_LB) {
- post("expr: syntax error: brackets missing\n");
- ex_print(eptr);
- return (exNULL);
- }
- /* if this table is the only token, parse the table */
- if (!count &&
- !((struct ex_ex *) eptr[1].ex_ptr)[1].ex_type) {
- savex = *((struct ex_ex *) eptr[1].ex_ptr);
- *((struct ex_ex *) eptr[1].ex_ptr) = nullex;
- *optr++ = *eptr;
- lowpre = ex_parse(x, &eptr[2], optr, (long *)0);
- *((struct ex_ex *) eptr[1].ex_ptr) = savex;
- return(lowpre);
- }
- eptr = (struct ex_ex *) eptr[1].ex_ptr;
- break;
- case ET_OP:
- if (eptr->ex_op == OP_COMMA) {
- if (!argc || !count || !eptr[1].ex_type) {
- post("expr: syntax error: illegal comma\n");
- ex_print(eptr[1].ex_type ? eptr : iptr);
- return (exNULL);
- }
- }
- if (!eptr[1].ex_type) {
- post("expr: syntax error: missing operand\n");
- ex_print(iptr);
- return (exNULL);
- }
- if ((eptr->ex_op & PRE_MASK) <= pre) {
- pre = eptr->ex_op & PRE_MASK;
- lowpre = eptr;
- }
- break;
- case ET_FUNC:
- if (eptr[1].ex_type != ET_LP) {
- post("expr: ex_parse: no parenthesis\n");
- return (exNULL);
- }
- /* if this function is the only token, parse it */
- if (!count &&
- !((struct ex_ex *) eptr[1].ex_ptr)[1].ex_type) {
- long ac;
-
- if (eptr[1].ex_ptr == (char *) &eptr[2]) {
- post("expr: syntax error: missing argument\n");
- ex_print(eptr);
- return (exNULL);
- }
- ac = 0;
- savex = *((struct ex_ex *) eptr[1].ex_ptr);
- *((struct ex_ex *) eptr[1].ex_ptr) = nullex;
- *optr++ = *eptr;
- lowpre = ex_parse(x, &eptr[2], optr, &ac);
- if (!lowpre)
- return (exNULL);
- ac++;
- if (ac !=
- ((t_ex_func *)eptr->ex_ptr)->f_argc){
- post("expr: syntax error: function '%s' needs %ld arguments\n",
- ((t_ex_func *)eptr->ex_ptr)->f_name,
- ((t_ex_func *)eptr->ex_ptr)->f_argc);
- return (exNULL);
- }
- *((struct ex_ex *) eptr[1].ex_ptr) = savex;
- return (lowpre);
- }
- eptr = (struct ex_ex *) eptr[1].ex_ptr;
- break;
- case ET_LP:
- case ET_LB:
- if (!count &&
- !((struct ex_ex *) eptr->ex_ptr)[1].ex_type) {
- if (eptr->ex_ptr == (char *)(&eptr[1])) {
- post("expr: syntax error: empty '%s'\n",
- eptr->ex_type==ET_LP?"()":"[]");
- ex_print(eptr);
- return (exNULL);
- }
- savex = *((struct ex_ex *) eptr->ex_ptr);
- *((struct ex_ex *) eptr->ex_ptr) = nullex;
- lowpre = ex_parse(x, &eptr[1], optr, (long *)0);
- *((struct ex_ex *) eptr->ex_ptr) = savex;
- return (lowpre);
- }
- eptr = (struct ex_ex *)eptr->ex_ptr;
- break;
- case ET_STR:
- default:
- ex_print(eptr);
- post("expr: ex_parse: type = 0x%lx\n", eptr->ex_type);
- return (exNULL);
- }
-
- if (pre == HI_PRE) {
- post("expr: syntax error: missing operation\n");
- ex_print(iptr);
- return (exNULL);
- }
- if (count < 2) {
- post("expr: syntax error: mission operand\n");
- ex_print(iptr);
- return (exNULL);
- }
- if (count == 2) {
- if (lowpre != iptr) {
- post("expr: ex_parse: unary operator should be first\n");
- return (exNULL);
- }
- if (!unary_op(lowpre->ex_op)) {
- post("expr: syntax error: not a uniary operator\n");
- ex_print(iptr);
- return (exNULL);
- }
- *optr++ = *lowpre;
- eptr = ex_parse(x, &lowpre[1], optr, argc);
- return (eptr);
- }
- if (lowpre == iptr) {
- post("expr: syntax error: mission operand\n");
- ex_print(iptr);
- return (exNULL);
- }
- savex = *lowpre;
- *lowpre = nullex;
- if (savex.ex_op != OP_COMMA)
- *optr++ = savex;
- else
- (*argc)++;
- eptr = ex_parse(x, iptr, optr, argc);
- if (eptr) {
- eptr = ex_parse(x, &lowpre[1], eptr, argc);
- *lowpre = savex;
- }
- return (eptr);
-}
-
-/*
- * this is the devide zero check for a a non devide operator
- */
-#define DZC(ARG1,OPR,ARG2) (ARG1 OPR ARG2)
-
-#define EVAL(OPR); \
-eptr = ex_eval(expr, ex_eval(expr, eptr, &left, idx), &right, idx); \
-switch (left.ex_type) { \
-case ET_INT: \
- switch(right.ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)DZC(left.ex_int, OPR, right.ex_int); \
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_INT; \
- optr->ex_int = DZC(left.ex_int, OPR, right.ex_int); \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = DZC(((t_float)left.ex_int), OPR, right.ex_flt);\
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = DZC(((t_float)left.ex_int), OPR, \
- right.ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- scalar = left.ex_int; \
- rp = right.ex_vec; \
- op = optr->ex_vec; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC (scalar, OPR, *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad right type %ld\n", \
- __LINE__, right.ex_type); \
- nullret = 1; \
- } \
- break; \
-case ET_FLT: \
- switch(right.ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = DZC((t_float) left.ex_flt, OPR, right.ex_int); \
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = DZC(left.ex_flt, OPR, right.ex_int); \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = DZC(left.ex_flt, OPR, right.ex_flt); \
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt= DZC(left.ex_flt, OPR, right.ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- scalar = left.ex_flt; \
- rp = right.ex_vec; \
- op = optr->ex_vec; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC(scalar, OPR, *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad right type %ld\n", \
- __LINE__, right.ex_type); \
- nullret = 1; \
- } \
- break; \
-case ET_VEC: \
-case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left.ex_vec; \
- switch(right.ex_type) { \
- case ET_INT: \
- scalar = right.ex_int; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC(*lp, OPR, scalar); \
- lp++; \
- } \
- break; \
- case ET_FLT: \
- scalar = right.ex_flt; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC(*lp, OPR, scalar); \
- lp++; \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- rp = right.ex_vec; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- /* \
- * on a RISC processor one could copy \
- * 8 times in each round to get a considerable \
- * improvement \
- */ \
- *op++ = DZC(*lp, OPR, *rp); \
- rp++; lp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad right type %ld\n", \
- __LINE__, right.ex_type); \
- nullret = 1; \
- } \
- break; \
-case ET_SYM: \
-default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad left type %ld\n", \
- __LINE__, left.ex_type); \
-} \
-break;
-
-/*
- * evaluate a unary operator, TYPE is applied to float operands
- */
-#define EVAL_UNARY(OPR, TYPE) \
- eptr = ex_eval(expr, eptr, &left, idx); \
- switch(left.ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec,(t_float)(OPR left.ex_int),\
- expr->exp_vsize);\
- break; \
- } \
- optr->ex_type = ET_INT; \
- optr->ex_int = OPR left.ex_int; \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec, OPR (TYPE left.ex_flt),\
- expr->exp_vsize);\
- break; \
- } \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = OPR (TYPE left.ex_flt); \
- break; \
- case ET_VI: \
- case ET_VEC: \
- j = expr->exp_vsize; \
- if (optr->ex_type != ET_VEC) { \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left.ex_vec; \
- j = expr->exp_vsize; \
- for (i = 0; i < j; i++) \
- *op++ = OPR (TYPE *lp++); \
- break; \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad left type %ld\n", \
- __LINE__, left.ex_type); \
- nullret++; \
- } \
- break;
-
-void
-ex_mkvector(t_float *fp, t_float x, int size)
-{
- while (size--)
- *fp++ = x;
-}
-
-/*
- * ex_dzdetect -- divide by zero detected
- */
-void
-ex_dzdetect(struct expr *expr)
-{
- char *etype;
-
- if (!expr->exp_error & EE_DZ) {
- if (IS_EXPR(expr))
- etype = "expr";
- else if (IS_EXPR_TILDE(expr))
- etype = "expr~";
- else if (IS_FEXPR_TILDE(expr))
- etype = "fexpr~";
- else {
- post ("expr -- ex_dzdetect internal error");
- etype = "";
- }
- post ("%s divide by zero detected", etype);
- expr->exp_error |= EE_DZ;
- }
-}
-
-
-/*
- * ex_eval -- evaluate the array of prefix expression
- * ex_eval returns the pointer to the first unevaluated node
- * in the array. This is a recursive routine.
- */
-
-/* SDY
-all the returns in this function need to be changed so that the code
-ends up at the end to check for newly allocated right and left vectors which
-need to be freed
-
-look into the variable nullret
-*/
-struct ex_ex *
-ex_eval(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-/* the sample numnber processed for fexpr~ */
-{
- int i, j;
- t_float *lp, *rp, *op; /* left, right, and out pointer to vectors */
- t_float scalar;
- int nullret = 0; /* did we have an error */
- struct ex_ex left, right; /* left and right operands */
-
- left.ex_type = 0;
- left.ex_int = 0;
- right.ex_type = 0;
- right.ex_int = 0;
-
- if (!eptr)
- return (exNULL);
- switch (eptr->ex_type) {
- case ET_INT:
- if (optr->ex_type == ET_VEC)
- ex_mkvector(optr->ex_vec, (t_float) eptr->ex_int,
- expr->exp_vsize);
- else
- *optr = *eptr;
- return (++eptr);
-
- case ET_FLT:
-
- if (optr->ex_type == ET_VEC)
- ex_mkvector(optr->ex_vec, eptr->ex_flt, expr->exp_vsize);
- else
- *optr = *eptr;
- return (++eptr);
-
- case ET_SYM:
- if (optr->ex_type == ET_VEC) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: cannot turn string to vector\n");
- return (exNULL);
- }
- *optr = *eptr;
- return (++eptr);
- case ET_II:
- if (eptr->ex_int == -1) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: inlet number not set\n");
- return (exNULL);
- }
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec,
- (t_float)expr->exp_var[eptr->ex_int].ex_int,
- expr->exp_vsize);
- } else {
- optr->ex_type = ET_INT;
- optr->ex_int = expr->exp_var[eptr->ex_int].ex_int;
- }
- return (++eptr);
- case ET_FI:
- if (eptr->ex_int == -1) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: inlet number not set\n");
- return (exNULL);
- }
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec,
- expr->exp_var[eptr->ex_int].ex_flt, expr->exp_vsize);
- } else {
- optr->ex_type = ET_FLT;
- optr->ex_flt = expr->exp_var[eptr->ex_int].ex_flt;
- }
- return (++eptr);
-
- case ET_VSYM:
- if (optr->ex_type == ET_VEC) {
- post_error((fts_object_t *) expr,
- "expr: IntErr. vsym in for vec out\n");
- return (exNULL);
- }
- if (eptr->ex_int == -1) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: inlet number not set\n");
- return (exNULL);
- }
- optr->ex_type = ET_SYM;
- optr->ex_ptr = expr->exp_var[eptr->ex_int].ex_ptr;
- return(++eptr);
-
- case ET_VI:
- if (optr->ex_type != ET_VEC)
- *optr = expr->exp_var[eptr->ex_int];
- else if (optr->ex_vec != expr->exp_var[eptr->ex_int].ex_vec)
- memcpy(optr->ex_vec, expr->exp_var[eptr->ex_int].ex_vec,
- expr->exp_vsize * sizeof (t_float));
- return(++eptr);
- case ET_VEC:
- if (optr->ex_type != ET_VEC) {
- optr->ex_type = ET_VEC;
- optr->ex_vec = eptr->ex_vec;
- eptr->ex_type = ET_INT;
- eptr->ex_int = 0;
- } else if (optr->ex_vec != eptr->ex_vec) {
- memcpy(optr->ex_vec, eptr->ex_vec,
- expr->exp_vsize * sizeof (t_float));
-/* do we need to free here? or can we free higher up */
-/* SDY the next lines do not make sense */
-post("calling fts_free\n");
-abort();
- fts_free(optr->ex_vec);
- optr->ex_type = ET_INT;
- eptr->ex_int = 0;
- } else { /* this should not happen */
- post("expr int. error, optr->ex_vec = %d",optr->ex_vec);
- abort();
- }
- return(++eptr);
- case ET_XI0:
- /* short hand for $x?[0] */
-
- /* SDY delete the following check */
- if (!IS_FEXPR_TILDE(expr) || optr->ex_type==ET_VEC) {
- post("%d:exp->exp_flags = %d", __LINE__,expr->exp_flags);
- abort();
- }
- optr->ex_type = ET_FLT;
- optr->ex_flt = expr->exp_var[eptr->ex_int].ex_vec[idx];
- return(++eptr);
- case ET_YOM1:
- /*
- * short hand for $y?[-1]
- * if we are calculating the first sample of the vector
- * we need to look at the previous results buffer
- */
- optr->ex_type = ET_FLT;
- if (idx == 0)
- optr->ex_flt =
- expr->exp_p_res[eptr->ex_int][expr->exp_vsize - 1];
- else
- optr->ex_flt=expr->exp_tmpres[eptr->ex_int][idx-1];
- return(++eptr);
-
- case ET_YO:
- case ET_XI:
- /* SDY delete the following */
- if (!IS_FEXPR_TILDE(expr) || optr->ex_type==ET_VEC) {
- post("%d:expr->exp_flags = %d", __LINE__,expr->exp_flags);
- abort();
- }
- return (eval_sigidx(expr, eptr, optr, idx));
-
- case ET_TBL:
- case ET_SI:
- return (eval_tab(expr, eptr, optr, idx));
- case ET_FUNC:
- return (eval_func(expr, eptr, optr, idx));
- case ET_VAR:
- return (eval_var(expr, eptr, optr, idx));
- case ET_OP:
- break;
- case ET_STR:
- case ET_LP:
- case ET_LB:
- default:
- post_error((fts_object_t *) expr,
- "expr: ex_eval: unexpected type %d\n", eptr->ex_type);
- return (exNULL);
- }
- if (!eptr[1].ex_type) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: not enough nodes 1\n");
- return (exNULL);
- }
- if (!unary_op(eptr->ex_op) && !eptr[2].ex_type) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: not enough nodes 2\n");
- return (exNULL);
- }
-
- switch((eptr++)->ex_op) {
- case OP_STORE:
- return (eval_store(expr, eptr, optr, idx));
- case OP_NOT:
- EVAL_UNARY(!, +);
- case OP_NEG:
- EVAL_UNARY(~, (long));
- case OP_UMINUS:
- EVAL_UNARY(-, +);
- case OP_MUL:
- EVAL(*);
- case OP_ADD:
- EVAL(+);
- case OP_SUB:
- EVAL(-);
- case OP_LT:
- EVAL(<);
- case OP_LE:
- EVAL(<=);
- case OP_GT:
- EVAL(>);
- case OP_GE:
- EVAL(>=);
- case OP_EQ:
- EVAL(==);
- case OP_NE:
- EVAL(!=);
-/*
- * following operators convert their argument to integer
- */
-#undef DZC
-#define DZC(ARG1,OPR,ARG2) (((int)ARG1) OPR ((int)ARG2))
- case OP_SL:
- EVAL(<<);
- case OP_SR:
- EVAL(>>);
- case OP_AND:
- EVAL(&);
- case OP_XOR:
- EVAL(^);
- case OP_OR:
- EVAL(|);
- case OP_LAND:
- EVAL(&&);
- case OP_LOR:
- EVAL(||);
-/*
- * for modulo we need to convert to integer and check for divide by zero
- */
-#undef DZC
-#define DZC(ARG1,OPR,ARG2) (((ARG2)?(((int)ARG1) OPR ((int)ARG2)) \
- : (ex_dzdetect(expr),0)))
- case OP_MOD:
- EVAL(%);
-/*
- * define the divide by zero check for divide
- */
-#undef DZC
-#define DZC(ARG1,OPR,ARG2) (((ARG2)?(ARG1 OPR ARG2):(ex_dzdetect(expr),0)))
- case OP_DIV:
- EVAL(/);
- case OP_LP:
- case OP_RP:
- case OP_LB:
- case OP_RB:
- case OP_COMMA:
- case OP_SEMI:
- default:
- post_error((fts_object_t *) expr, "expr: ex_print: bad op 0x%x\n", eptr->ex_op);
- return (exNULL);
- }
-
-
- /*
- * the left and right nodes could have been transformed to vectors
- * down the chain
- */
- if (left.ex_type == ET_VEC)
- fts_free(left.ex_vec);
- if (right.ex_type == ET_VEC)
- fts_free(right.ex_vec);
- if (nullret)
- return (exNULL);
- else
- return (eptr);
-}
-
-/*
- * eval_func -- evaluate a function, call ex_eval() on all the arguments
- * so that all of them are terminal nodes. The call the
- * appropriate function
- */
-struct ex_ex *
-eval_func(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-{
- int i;
- struct ex_ex args[MAX_ARGS];
- t_ex_func *f;
-
- f = (t_ex_func *)(eptr++)->ex_ptr;
- if (!f || !f->f_name) {
- return (exNULL);
- }
- if (f->f_argc > MAX_ARGS) {
- post_error((fts_object_t *) expr, "expr: eval_func: asking too many arguments\n");
- return (exNULL);
- }
-
- for (i = 0; i < f->f_argc; i++) {
- args[i].ex_type = 0;
- args[i].ex_int = 0;
- eptr = ex_eval(expr, eptr, &args[i], idx);
- }
- (*f->f_func)(expr, f->f_argc, args, optr);
- for (i = 0; i < f->f_argc; i++) {
- if (args[i].ex_type == ET_VEC)
- fts_free(args[i].ex_vec);
- }
- return (eptr);
-}
-
-
-/*
- * eval_store -- evaluate the '=' operator,
- * make sure the first operator is a legal left operator
- * and call ex_eval on the right operator
- */
-struct ex_ex *
-eval_store(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-{
- struct ex_ex arg;
- int isvalue;
- char *tbl = (char *) 0;
- char *var = (char *) 0;
- int badleft = 0;
-
-post("store called\n");
-ex_print(eptr);
-eptr = ex_eval(expr, ++eptr, optr, idx);
-return (eptr);
-
-#ifdef notdef /* SDY */
- arg.ex_type = ET_INT;
- arg.ex_int = 0;
- if (eptr->ex_type == ET_VAR) {
- var = (char *) eptr->ex_ptr;
-
- eptr = ex_eval(expr, ++eptr, &arg, idx);
- (void)max_ex_var_store(expr, (t_symbol *)var, &arg, optr);
- if (arg.ex_type == ET_VEC)
- fts_free(arg.ex_vec);
- }
-
-
- if (eptr->ex_type == ET_SI) {
- eptr++;
- if (eptr->ex_type =
- }
-
- /* the left operator should either be a value or a array member */
- switch (eptr->ex_type) {
- case ET_SI:
- if ((eptr + 1)->ex_type == OP_LB) {
- }
- if (!expr->exp_var[eptr->ex_int].ex_ptr) {
- if (!(expr->exp_error & EE_NOTABLE)) {
- post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
- post("expr: No more table errors will be reported");
- post("expr: till the next reset");
- expr->exp_error |= EE_NOTABLE;
- }
- badleft++;
- } else
- tbl = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
- break;
- case ET_TBL:
- }
-#endif /* SDY */
-}
-
-/*
- * eval_tab -- evaluate a table operation
- */
-struct ex_ex *
-eval_tab(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-{
- struct ex_ex arg;
- char *tbl = (char *) 0;
- int notable = 0;
-
- if (eptr->ex_type == ET_SI) {
- if (!expr->exp_var[eptr->ex_int].ex_ptr) {
-/* SDY post_error() does not work in MAX/MSP yet
- post_error((fts_object_t *) expr,
- "expr: syntax error: no string for inlet %d\n", eptr->ex_int + 1);
-*/
- if (!(expr->exp_error & EE_NOTABLE)) {
- post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
- post("expr: No more table errors will be reported");
- post("expr: till the next reset");
- expr->exp_error |= EE_NOTABLE;
- }
- notable++;
- } else
- tbl = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
- } else if (eptr->ex_type == ET_TBL)
- tbl = (char *) eptr->ex_ptr;
- else {
- post_error((fts_object_t *) expr, "expr: eval_tbl: bad type %ld\n", eptr->ex_type);
- notable++;
-
- }
- arg.ex_type = 0;
- arg.ex_int = 0;
- eptr = ex_eval(expr, ++eptr, &arg, idx);
-
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- if (!notable)
- (void)max_ex_tab(expr, (t_symbol *)tbl, &arg, optr);
- if (arg.ex_type == ET_VEC)
- fts_free(arg.ex_vec);
- return (eptr);
-}
-
-/*
- * eval_var -- evaluate a variable
- */
-struct ex_ex *
-eval_var(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-{
- struct ex_ex arg;
- char *var = (char *) 0;
- int novar = 0;
-
- if (eptr->ex_type == ET_SI) {
- if (!expr->exp_var[eptr->ex_int].ex_ptr) {
-/* SDY post_error() does not work in MAX/MSP yet
-post_error((fts_object_t *) expr,
-"expr: syntax error: no string for inlet %d\n", eptr->ex_int + 1);
-*/
- if (!(expr->exp_error & EE_NOVAR)) {
- post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
- post("expr: No more table errors will be reported");
- post("expr: till the next reset");
- expr->exp_error |= EE_NOVAR;
- }
- novar++;
- } else
- var = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
- } else if (eptr->ex_type == ET_VAR)
- var = (char *) eptr->ex_ptr;
- else {
- post_error((fts_object_t *) expr, "expr: eval_tbl: bad type %ld\n", eptr->ex_type);
- novar++;
-
- }
-
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- if (!novar)
- (void)max_ex_var(expr, (t_symbol *)var, optr);
- return (++eptr);
-}
-
-/*
- * eval_sigidx -- evaluate the value of an indexed signal for fexpr~
- */
-struct ex_ex *
-eval_sigidx(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-/* the index */
-{
- struct ex_ex arg;
- struct ex_ex *reteptr;
- int i = 0, j = 0;
- t_float fi = 0, /* index in float */
- rem_i = 0; /* remains of the float */
- char *tbl;
-
- arg.ex_type = 0;
- arg.ex_int = 0;
- reteptr = ex_eval(expr, eptr + 1, &arg, idx);
- if (arg.ex_type == ET_FLT) {
- fi = arg.ex_flt; /* float index */
- i = (int) arg.ex_flt; /* integer index */
- rem_i = arg.ex_flt - i; /* remains of integer */
- } else if (arg.ex_type == ET_INT) {
- fi = arg.ex_int; /* float index */
- i = arg.ex_int;
- rem_i = 0;
- } else {
- post("eval_sigidx: bad res type (%d)", arg.ex_type);
- }
- optr->ex_type = ET_FLT;
- /*
- * indexing an input vector
- */
- if (eptr->ex_type == ET_XI) {
- if (fi > 0) {
- if (!(expr->exp_error & EE_BI_INPUT)) {
- expr->exp_error |= EE_BI_INPUT;
- post("expr: input vector index > 0, (vector x%d[%f])",
- eptr->ex_int + 1, i + rem_i);
- post("fexpr~: index assumed to be = 0");
- post("fexpr~: no error report till next reset");
- ex_print(eptr);
- }
- /* just replace it with zero */
- i = 0;
- rem_i = 0;
- }
- if (cal_sigidx(optr, i, rem_i, idx, expr->exp_vsize,
- expr->exp_var[eptr->ex_int].ex_vec,
- expr->exp_p_var[eptr->ex_int])) {
- if (!(expr->exp_error & EE_BI_INPUT)) {
- expr->exp_error |= EE_BI_INPUT;
- post("expr: input vector index < -VectorSize, (vector x%d[%f])", eptr->ex_int + 1, fi);
- ex_print(eptr);
- post("fexpr~: index assumed to be = -%d",
- expr->exp_vsize);
- post("fexpr~: no error report till next reset");
- }
- }
-
- /*
- * indexing an output vector
- */
- } else if (eptr->ex_type == ET_YO) {
- /* for output vectors index of zero is not legal */
- if (fi >= 0) {
- if (!(expr->exp_error & EE_BI_OUTPUT)) {
- expr->exp_error |= EE_BI_OUTPUT;
- post("fexpr~: bad output index, (%f)", fi);
- ex_print(eptr);
- post("fexpr~: no error report till next reset");
- post("fexpr~: index assumed to be = -1");
- }
- i = -1;
- }
- if (eptr->ex_int >= expr->exp_nexpr) {
- post("fexpr~: $y%d illegal: not that many exprs",
- eptr->ex_int);
- optr->ex_flt = 0;
- return (reteptr);
- }
- if (cal_sigidx(optr, i, rem_i, idx, expr->exp_vsize,
- expr->exp_tmpres[eptr->ex_int],
- expr->exp_p_res[eptr->ex_int])) {
- if (!(expr->exp_error & EE_BI_OUTPUT)) {
- expr->exp_error |= EE_BI_OUTPUT;
- post("fexpr~: bad output index, (%f)", fi);
- ex_print(eptr);
- post("fexpr~: index assumed to be = -%d",
- expr->exp_vsize);
- }
- }
- } else {
- optr->ex_flt = 0;
- post("fexpr~:eval_sigidx: internal error - unknown vector (%d)",
- eptr->ex_type);
- }
- return (reteptr);
-}
-
-/*
- * cal_sigidx -- given two tables (one current one previous) calculate an
- * evaluation of a float index into the vectors by linear
- * interpolation
- * return 0 on success, 1 on failure (index out of bound)
- */
-static int
-cal_sigidx(struct ex_ex *optr, /* The output value */
- int i, t_float rem_i,/* integer and fractinal part of index */
- int idx, /* index of current fexpr~ processing */
- int vsize, /* vector size */
- t_float *curvec, t_float *prevec) /* current and previous table */
-{
- int n;
-
- n = i + idx;
- if (n > 0) {
- /* from the curvec */
- if (rem_i)
- optr->ex_flt = curvec[n] +
- rem_i * (curvec[n] - curvec[n - 1]);
- else
- optr->ex_flt = curvec[n];
- return (0);
- }
- if (n == 0) {
- /*
- * this is the case that the remaining float
- * is between two tables
- */
- if (rem_i)
- optr->ex_flt = *curvec +
- rem_i * (*curvec - prevec[vsize - 1]);
- else
- optr->ex_flt = *curvec;
- return (0);
- }
- /* find the index in the saved buffer */
- n = vsize + n;
- if (n > 0) {
- if (rem_i)
- optr->ex_flt = prevec[n] +
- rem_i * (prevec[n] - prevec[n - 1]);
- else
- optr->ex_flt = prevec[n];
- return (0);
- }
- /* out of bound */
- optr->ex_flt = *prevec;
- return (1);
-}
-
-/*
- * getoken -- return 1 on syntax error otherwise 0
- */
-int
-getoken(struct expr *expr, struct ex_ex *eptr)
-{
- char *p;
- long i;
-
-
- if (!expr->exp_str) {
- post("expr: getoken: expression string not set\n");
- return (0);
- }
-retry:
- if (!*expr->exp_str) {
- eptr->ex_type = 0;
- eptr->ex_int = 0;
- return (0);
- }
- if (*expr->exp_str == ';') {
- expr->exp_str++;
- eptr->ex_type = 0;
- eptr->ex_int = 0;
- return (0);
- }
- eptr->ex_type = ET_OP;
- switch (*expr->exp_str++) {
- case '\\':
- case ' ':
- case '\t':
- goto retry;
- case ';':
- post("expr: syntax error: ';' not implemented\n");
- return (1);
- case ',':
- eptr->ex_op = OP_COMMA;
- break;
- case '(':
- eptr->ex_op = OP_LP;
- break;
- case ')':
- eptr->ex_op = OP_RP;
- break;
- case ']':
- eptr->ex_op = OP_RB;
- break;
- case '~':
- eptr->ex_op = OP_NEG;
- break;
- /* we will take care of unary minus later */
- case '*':
- eptr->ex_op = OP_MUL;
- break;
- case '/':
- eptr->ex_op = OP_DIV;
- break;
- case '%':
- eptr->ex_op = OP_MOD;
- break;
- case '+':
- eptr->ex_op = OP_ADD;
- break;
- case '-':
- eptr->ex_op = OP_SUB;
- break;
- case '^':
- eptr->ex_op = OP_XOR;
- break;
- case '[':
- eptr->ex_op = OP_LB;
- break;
- case '!':
- if (*expr->exp_str == '=') {
- eptr->ex_op = OP_NE;
- expr->exp_str++;
- } else
- eptr->ex_op = OP_NOT;
- break;
- case '<':
- switch (*expr->exp_str) {
- case '<':
- eptr->ex_op = OP_SL;
- expr->exp_str++;
- break;
- case '=':
- eptr->ex_op = OP_LE;
- expr->exp_str++;
- break;
- default:
- eptr->ex_op = OP_LT;
- break;
- }
- break;
- case '>':
- switch (*expr->exp_str) {
- case '>':
- eptr->ex_op = OP_SR;
- expr->exp_str++;
- break;
- case '=':
- eptr->ex_op = OP_GE;
- expr->exp_str++;
- break;
- default:
- eptr->ex_op = OP_GT;
- break;
- }
- break;
- case '=':
- if (*expr->exp_str++ != '=') {
- post("expr: syntax error: =\n");
- return (1);
- }
- eptr->ex_op = OP_EQ;
- break;
-/* do not allow the store till the function is fixed
- if (*expr->exp_str != '=')
- eptr->ex_op = OP_STORE;
- else {
- expr->exp_str++;
- eptr->ex_op = OP_EQ;
- }
- break;
-*/
-
- case '&':
- if (*expr->exp_str == '&') {
- expr->exp_str++;
- eptr->ex_op = OP_LAND;
- } else
- eptr->ex_op = OP_AND;
- break;
-
- case '|':
- if ((*expr->exp_str == '|')) {
- expr->exp_str++;
- eptr->ex_op = OP_LOR;
- } else
- eptr->ex_op = OP_OR;
- break;
- case '$':
- switch (*expr->exp_str++) {
- case 'I':
- case 'i':
- eptr->ex_type = ET_II;
- break;
- case 'F':
- case 'f':
- eptr->ex_type = ET_FI;
- break;
- case 'S':
- case 's':
- eptr->ex_type = ET_SI;
- break;
- case 'V':
- case 'v':
- if (IS_EXPR_TILDE(expr)) {
- eptr->ex_type = ET_VI;
- break;
- }
- post("$v? works only for expr~");
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- case 'X':
- case 'x':
- if (IS_FEXPR_TILDE(expr)) {
- eptr->ex_type = ET_XI;
- if (isdigit(*expr->exp_str))
- break;
- /* for $x[] is a shorhand for $x1[] */
- eptr->ex_int = 0;
- goto noinletnum;
- }
- post("$x? works only for fexpr~");
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- case 'y':
- case 'Y':
- if (IS_FEXPR_TILDE(expr)) {
- eptr->ex_type = ET_YO;
- /*$y takes no number */
- if (isdigit(*expr->exp_str))
- break;
- /* for $y[] is a shorhand for $y1[] */
- eptr->ex_int = 0;
- goto noinletnum;
- }
- post("$y works only for fexpr~");
- default:
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- }
- p = atoif(expr->exp_str, &eptr->ex_op, &i);
- if (!p) {
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- }
- if (i != ET_INT) {
- post("expr: syntax error: %s\n", expr->exp_str);
- return (1);
- }
- /*
- * make the user inlets one based rather than zero based
- * therefore we decrement the number that user has supplied
- */
- if (!eptr->ex_op || (eptr->ex_op)-- > MAX_VARS) {
- post("expr: syntax error: inlet or outlet out of range: %s\n",
- expr->exp_str);
- return (1);
- }
-
- /*
- * until we can change the input type of inlets on
- * the fly (at pd_new()
- * time) the first input to expr~ is always a vectore
- * and $f1 or $i1 is
- * illegal for fexr~
- */
- if (eptr->ex_op == 0 &&
- (IS_FEXPR_TILDE(expr) || IS_EXPR_TILDE(expr)) &&
- (eptr->ex_type==ET_II || eptr->ex_type==ET_FI ||
- eptr->ex_type==ET_SI)) {
- post("first inlet of expr~/fexpr~ can only be a vector");
- return (1);
- }
- /* record the inlet or outlet type and check for consistency */
- if (eptr->ex_type == ET_YO ) {
- /* it is an outlet for fexpr~*/
- /* no need to do anything */
- ;
- } else if (!expr->exp_var[eptr->ex_op].ex_type)
- expr->exp_var[eptr->ex_op].ex_type = eptr->ex_type;
- else if (expr->exp_var[eptr->ex_op].ex_type != eptr->ex_type) {
- post("expr: syntax error: inlets can only have one type: %s\n", expr->exp_str);
- return (1);
- }
- expr->exp_str = p;
-noinletnum:
- break;
- case '"':
- {
- struct ex_ex ex;
-
- p = expr->exp_str;
- if (!*expr->exp_str || *expr->exp_str == '"') {
- post("expr: syntax error: empty symbol: %s\n", --expr->exp_str);
- return (1);
- }
- if (getoken(expr, &ex))
- return (1);
- switch (ex.ex_type) {
- case ET_STR:
- if (ex_getsym(ex.ex_ptr, (t_symbol **)&(eptr->ex_ptr))) {
- post("expr: syntax error: getoken: problms with ex_getsym\n");
- return (1);
- }
- eptr->ex_type = ET_SYM;
- break;
- case ET_SI:
- *eptr = ex;
- eptr->ex_type = ET_VSYM;
- break;
- default:
- post("expr: syntax error: bad symbol name: %s\n", p);
- return (1);
- }
- if (*expr->exp_str++ != '"') {
- post("expr: syntax error: missing '\"'\n");
- return (1);
- }
- break;
- }
- case '.':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- p = atoif(--expr->exp_str, &eptr->ex_int, &eptr->ex_type);
- if (!p)
- return (1);
- expr->exp_str = p;
- break;
-
- default:
- /*
- * has to be a string, it should either be a
- * function or a table
- */
- p = --expr->exp_str;
- for (i = 0; name_ok(*p); i++)
- p++;
- if (!i) {
- post("expr: syntax error: %s\n", expr->exp_str);
- return (1);
- }
- eptr->ex_ptr = (char *)fts_malloc(i + 1);
- strncpy(eptr->ex_ptr, expr->exp_str, (int) i);
- (eptr->ex_ptr)[i] = 0;
- expr->exp_str = p;
- /*
- * we mark this as a string and later we will change this
- * to either a function or a table
- */
- eptr->ex_type = ET_STR;
- break;
- }
- return (0);
-}
-
-/*
- * atoif -- ascii to float or integer (understands hex numbers also)
- */
-char *
-atoif(char *s, long int *value, long int *type)
-{
- char *p;
- long int_val = 0;
- int flt = 0;
- t_float pos = 0;
- t_float flt_val = 0;
- int base = 10;
-
- p = s;
- if (*p == '0' && (p[1] == 'x' || p[1] == 'X')) {
- base = 16;
- p += 2;
- }
- while (8) {
- switch (*p) {
- case '.':
- if (flt || base != 10) {
- post("expr: syntax error: %s\n", s);
- return ((char *) 0);
- }
- flt++;
- pos = 10;
- flt_val = int_val;
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (flt) {
- flt_val += (*p - '0') / pos;
- pos *= 10;
- } else {
- int_val *= base;
- int_val += (*p - '0');
- }
- break;
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- if (base != 16 || flt) {
- post("expr: syntax error: %s\n", s);
- return ((char *) 0);
- }
- int_val *= base;
- int_val += (*p - 'a' + 10);
- break;
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- if (base != 16 || flt) {
- post("expr: syntax error: %s\n", s);
- return ((char *) 0);
- }
- int_val *= base;
- int_val += (*p - 'A' + 10);
- break;
- default:
- if (flt) {
- *type = ET_FLT;
- *((t_float *) value) = flt_val;
- } else {
- *type = ET_INT;
- *value = int_val;
- }
- return (p);
- }
- p++;
- }
-}
-
-/*
- * find_func -- returns a pointer to the found function structure
- * otherwise it returns 0
- */
-t_ex_func *
-find_func(char *s)
-{
- t_ex_func *f;
-
- for (f = ex_funcs; f->f_name; f++)
- if (!strcmp(f->f_name, s))
- return (f);
- return ((t_ex_func *) 0);
-}
-
-
-/*
- * ex_print -- print an expression array
- */
-
-void
-ex_print(struct ex_ex *eptr)
-{
-
- while (eptr->ex_type) {
- switch (eptr->ex_type) {
- case ET_INT:
- post("%ld ", eptr->ex_int);
- break;
- case ET_FLT:
- post("%f ", eptr->ex_flt);
- break;
- case ET_STR:
- post("%s ", eptr->ex_ptr);
- break;
- case ET_TBL:
- case ET_VAR:
- post("%s ", ex_symname((fts_symbol_t )eptr->ex_ptr));
- break;
- case ET_SYM:
- post("\"%s\" ", ex_symname((fts_symbol_t )eptr->ex_ptr));
- break;
- case ET_VSYM:
- post("\"$s%ld\" ", eptr->ex_int + 1);
- break;
- case ET_FUNC:
- post("%s ",
- ((t_ex_func *)eptr->ex_ptr)->f_name);
- break;
- case ET_LP:
- post("%c", '(');
- break;
- /* CHANGE
- case ET_RP:
- post("%c ", ')');
- break;
- */
- case ET_LB:
- post("%c", '[');
- break;
- /* CHANGE
- case ET_RB:
- post("%c ", ']');
- break;
- */
- case ET_II:
- post("$i%ld ", eptr->ex_int + 1);
- break;
- case ET_FI:
- post("$f%ld ", eptr->ex_int + 1);
- break;
- case ET_SI:
- post("$s%lx ", eptr->ex_ptr);
- break;
- case ET_VI:
- post("$v%lx ", eptr->ex_vec);
- break;
- case ET_VEC:
- post("vec = %ld ", eptr->ex_vec);
- break;
- case ET_YOM1:
- case ET_YO:
- post("$y%d", eptr->ex_int + 1);
- break;
- case ET_XI:
- case ET_XI0:
- post("$x%d", eptr->ex_int + 1);
- break;
- case ET_OP:
- switch (eptr->ex_op) {
- case OP_LP:
- post("%c", '(');
- break;
- case OP_RP:
- post("%c ", ')');
- break;
- case OP_LB:
- post("%c", '[');
- break;
- case OP_RB:
- post("%c ", ']');
- break;
- case OP_NOT:
- post("%c", '!');
- break;
- case OP_NEG:
- post("%c", '~');
- break;
- case OP_UMINUS:
- post("%c", '-');
- break;
- case OP_MUL:
- post("%c", '*');
- break;
- case OP_DIV:
- post("%c", '/');
- break;
- case OP_MOD:
- post("%c", '%');
- break;
- case OP_ADD:
- post("%c", '+');
- break;
- case OP_SUB:
- post("%c", '-');
- break;
- case OP_SL:
- post("%s", "<<");
- break;
- case OP_SR:
- post("%s", ">>");
- break;
- case OP_LT:
- post("%c", '<');
- break;
- case OP_LE:
- post("%s", "<=");
- break;
- case OP_GT:
- post("%c", '>');
- break;
- case OP_GE:
- post("%s", ">=");
- break;
- case OP_EQ:
- post("%s", "==");
- break;
- case OP_STORE:
- post("%s", "=");
- break;
- case OP_NE:
- post("%s", "!=");
- break;
- case OP_AND:
- post("%c", '&');
- break;
- case OP_XOR:
- post("%c", '^');
- break;
- case OP_OR:
- post("%c", '|');
- break;
- case OP_LAND:
- post("%s", "&&");
- break;
- case OP_LOR:
- post("%s", "||");
- break;
- case OP_COMMA:
- post("%c", ',');
- break;
- case OP_SEMI:
- post("%c", ';');
- break;
- default:
- post("expr: ex_print: bad op 0x%lx\n", eptr->ex_op);
- }
- break;
- default:
- post("expr: ex_print: bad type 0x%lx\n", eptr->ex_type);
- }
- eptr++;
- }
- post("\n");
-}
-
-#ifdef _WIN32
-void ABORT( void) {bug("expr");}
-#endif
diff --git a/externals/extra/0.43.3/0.43.2/expr~/vexp.h b/externals/extra/0.43.3/0.43.2/expr~/vexp.h
deleted file mode 100644
index df5547ea..00000000
--- a/externals/extra/0.43.3/0.43.2/expr~/vexp.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * jMax
- * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * See file LICENSE for further informations on licensing terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Based on Max/ISPW by Miller Puckette.
- *
- * Authors: Maurizio De Cecco, Francois Dechelle, Enzo Maggi, Norbert Schnell.
- *
- */
-
-/* "expr" was written by Shahrokh Yadegari c. 1989. -msp */
-/* "expr~" and "fexpr~" conversion by Shahrokh Yadegari c. 1999,2000 */
-
-#define MSP
-#ifdef PD
-#undef MSP
-#endif
-
-#ifdef PD
-#include "m_pd.h"
-#else /* MSP */
-#include "ext.h"
-#include "z_dsp.h"
-#endif
-
-#include "fts_to_pd.h"
-/* This is put in fts_to_pd.h
-
-#ifdef MSP
-#define t_atom Atom
-#define t_symbol Symbol
-#define pd_new(x) newobject(x);
-#define t_outlet void
-#endif
-*/
-
-/*
- * Currently the maximum number of variables (inlets) that are supported
- * is 10.
- */
-
-#define MAX_VARS 9
-#define MINODES 10 /* was 200 */
-
-/* terminal defines */
-
-/*
- * operations
- * (x<<16|y) x defines the level of precedence,
- * the lower the number the lower the precedence
- * separators are defines as operators just for convenience
- */
-
-#define OP_SEMI ((long)(1<<16|1)) /* ; */
-#define OP_COMMA ((long)(2<<16|2)) /* , */
-#define OP_LOR ((long)(3<<16|3)) /* || */
-#define OP_LAND ((long)(4<<16|4)) /* && */
-#define OP_OR ((long)(5<<16|5)) /* | */
-#define OP_XOR ((long)(6<<16|6)) /* ^ */
-#define OP_AND ((long)(7<<16|7)) /* & */
-#define OP_NE ((long)(8<<16|8)) /* != */
-#define OP_EQ ((long)(8<<16|9)) /* == */
-#define OP_GE ((long)(9<<16|10)) /* >= */
-#define OP_GT ((long)(9<<16|11)) /* > */
-#define OP_LE ((long)(9<<16|12)) /* <= */
-#define OP_LT ((long)(9<<16|13)) /* < */
-#define OP_SR ((long)(10<<16|14)) /* >> */
-#define OP_SL ((long)(10<<16|15)) /* << */
-#define OP_SUB ((long)(11<<16|16)) /* - */
-#define OP_ADD ((long)(11<<16|17)) /* + */
-#define OP_MOD ((long)(12<<16|18)) /* % */
-#define OP_DIV ((long)(12<<16|19)) /* / */
-#define OP_MUL ((long)(12<<16|20)) /* * */
-#define OP_UMINUS ((long)(13<<16|21)) /* - unary minus */
-#define OP_NEG ((long)(13<<16|22)) /* ~ one complement */
-#define OP_NOT ((long)(13<<16|23)) /* ! */
-#define OP_RB ((long)(14<<16|24)) /* ] */
-#define OP_LB ((long)(14<<16|25)) /* [ */
-#define OP_RP ((long)(14<<16|26)) /* ) */
-#define OP_LP ((long)(14<<16|27)) /* ( */
-#define OP_STORE ((long)(15<<16|28)) /* = */
-#define HI_PRE ((long)(100<<16)) /* infinite precedence */
-#define PRE_MASK ((long)0xffff0000) /* precedence level mask */
-
-struct ex_ex;
-
-#define name_ok(c) (((c)=='_') || ((c)>='a' && (c)<='z') || \
- ((c)>='A' && (c)<='Z') || ((c) >= '0' && (c) <= '9'))
-#define unary_op(x) ((x) == OP_NOT || (x) == OP_NEG || (x) == OP_UMINUS)
-
-struct ex_ex {
- union {
- long v_int;
- t_float v_flt;
- t_float *v_vec; /* this is an for allocated vector */
- long op;
- char *ptr;
- } ex_cont; /* content */
-#define ex_int ex_cont.v_int
-#define ex_flt ex_cont.v_flt
-#define ex_vec ex_cont.v_vec
-#define ex_op ex_cont.op
-#define ex_ptr ex_cont.ptr
- long ex_type; /* type of the node */
-};
-#define exNULL ((struct ex_ex *)0)
-
-/* defines for ex_type */
-#define ET_INT 1 /* an int */
-#define ET_FLT 2 /* a float */
-#define ET_OP 3 /* operator */
-#define ET_STR 4 /* string */
-#define ET_TBL 5 /* a table, the content is a pointer */
-#define ET_FUNC 6 /* a function */
-#define ET_SYM 7 /* symbol ("string") */
-#define ET_VSYM 8 /* variable symbol ("$s?") */
- /* we treat parenthesis and brackets */
- /* special to keep a pointer to their */
- /* match in the content */
-#define ET_LP 9 /* left parenthesis */
-#define ET_LB 10 /* left bracket */
-#define ET_II 11 /* and integer inlet */
-#define ET_FI 12 /* float inlet */
-#define ET_SI 13 /* string inlet */
-#define ET_VI 14 /* signal inlet */
-#define ET_VEC 15 /* allocated signal vector */
- /* special types for fexpr~ */
-#define ET_YO 16 /* vector output for fexpr~ */
-#define ET_YOM1 17 /* shorthand for $y?[-1] */
-#define ET_XI 18 /* vector input for fexpr~ */
-#define ET_XI0 20 /* shorthand for $x?[0] */
-#define ET_VAR 21 /* variable */
-
-/* defines for ex_flags */
-#define EF_TYPE_MASK 0x07 /* first three bits define the type of expr */
-#define EF_EXPR 0x01 /* expr - control in and out */
-#define EF_EXPR_TILDE 0x02 /* expr~ signal and control in, signal out */
-#define EF_FEXPR_TILDE 0x04 /* fexpr~ filter expression */
-
-#define EF_STOP 0x08 /* is it stopped used for expr~ and fexpr~ */
-#define EF_VERBOSE 0x10 /* verbose mode */
-
-#define IS_EXPR(x) ((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR) == EF_EXPR)
-#define IS_EXPR_TILDE(x) \
- ((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR_TILDE)==EF_EXPR_TILDE)
-#define IS_FEXPR_TILDE(x) \
- ((((x)->exp_flags&EF_TYPE_MASK)|EF_FEXPR_TILDE)==EF_FEXPR_TILDE)
-
-#define SET_EXPR(x) (x)->exp_flags |= EF_EXPR; \
- (x)->exp_flags &= ~EF_EXPR_TILDE; \
- (x)->exp_flags &= ~EF_FEXPR_TILDE;
-
-#define SET_EXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \
- (x)->exp_flags |= EF_EXPR_TILDE; \
- (x)->exp_flags &= ~EF_FEXPR_TILDE;
-
-#define SET_FEXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \
- (x)->exp_flags &= ~EF_EXPR_TILDE; \
- (x)->exp_flags |= EF_FEXPR_TILDE;
-
-/*
- * defines for expr_error
- */
-#define EE_DZ 0x01 /* divide by zero error */
-#define EE_BI_OUTPUT 0x02 /* Bad output index */
-#define EE_BI_INPUT 0x04 /* Bad input index */
-#define EE_NOTABLE 0x08 /* NO TABLE */
-#define EE_NOVAR 0x10 /* NO VARIABLE */
-
-typedef struct expr {
-#ifdef PD
- t_object exp_ob;
-#else /* MSP */
- t_pxobject exp_ob;
-#endif
- int exp_flags; /* are we expr~, fexpr~, or expr */
- int exp_error; /* reported errors */
- int exp_nexpr; /* number of expressions */
- char *exp_string; /* the full expression string */
- char *exp_str; /* current parsing position */
- t_outlet *exp_outlet[MAX_VARS];
-#ifdef PD
- struct _exprproxy *exp_proxy;
-#else /* MAX */
- void *exp_proxy[MAX_VARS];
- long exp_proxy_id;
-#endif
- struct ex_ex *exp_stack[MAX_VARS];
- struct ex_ex exp_var[MAX_VARS];
- struct ex_ex exp_res[MAX_VARS]; /* the evluation result */
- t_float *exp_p_var[MAX_VARS];
- t_float *exp_p_res[MAX_VARS]; /* the previous evaluation result */
- t_float *exp_tmpres[MAX_VARS]; /* temporty result for fexpr~ */
- int exp_vsize; /* the size of the signal vector */
- int exp_nivec; /* # of vector inlets */
- t_float exp_f; /* control value to be transformed to signal */
-} t_expr;
-
-typedef struct ex_funcs {
- char *f_name; /* function name */
- void (*f_func)(t_expr *, long, struct ex_ex *, struct ex_ex *);
- /* the real function performing the function (void, no return!!!) */
- long f_argc; /* number of arguments */
-} t_ex_func;
-
-/* function prototypes for pd-related functions called withing vexp.h */
-
-extern int max_ex_tab(struct expr *expr, t_symbol *s, struct ex_ex *arg, struct ex_ex *optr);
-extern int max_ex_var(struct expr *expr, t_symbol *s, struct ex_ex *optr);
-extern int ex_getsym(char *p, t_symbol **s);
-extern const char *ex_symname(t_symbol *s);
-void ex_mkvector(t_float *fp, t_float x, int size);
-extern void ex_size(t_expr *expr, long int argc, struct ex_ex *argv,
- struct ex_ex *optr);
-extern void ex_sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_Sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_Avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_store(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-
-int value_getonly(t_symbol *s, t_float *f);
-
-
-/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
-#ifdef _MSC_VER
-#pragma warning (disable: 4305 4244)
-#endif
-
-#ifdef _WIN32
-#define abort ABORT
-void ABORT(void);
-#endif
diff --git a/externals/extra/0.43.3/0.43.2/expr~/vexp_fun.c b/externals/extra/0.43.3/0.43.2/expr~/vexp_fun.c
deleted file mode 100644
index 73c0b5c6..00000000
--- a/externals/extra/0.43.3/0.43.2/expr~/vexp_fun.c
+++ /dev/null
@@ -1,1315 +0,0 @@
-/*
- * jMax
- * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * See file LICENSE for further informations on licensing terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Based on Max/ISPW by Miller Puckette.
- *
- * Authors: Maurizio De Cecco, Francois Dechelle, Enzo Maggi, Norbert Schnell.
- *
- */
-
-/* "expr" was written by Shahrokh Yadegari c. 1989. -msp
- *
- * Nov. 2001 --sdy
- * conversion for expr~
- *
- * Jan, 2002 --sdy
- * added fmod()
- *
- * May 2002
- * added floor and ceil for expr -- Orm Finnendahl
- *
- * July 2002 --sdy
- * added the following math funtions:
- * cbrt - cube root
- * erf - error function
- * erfc - complementary error function
- * expm1 - exponential minus 1,
- * log1p - logarithm of 1 plus
- * isinf - is the value infinite,
- * finite - is the value finite
- * isnan -- is the resut a nan (Not a number)
- * copysign - copy sign of a number
- * ldexp - multiply floating-point number by integral power of 2
- * imodf - get signed integral value from floating-point number
- * modf - get signed fractional value from floating-point number
- * drem - floating-point remainder function
- *
- * The following are done but not popular enough in math libss
- * to be included yet
- * hypoth - Euclidean distance function
- * trunc
- * round
- * nearbyint -
- */
-
-
-
-/*
- * vexp_func.c -- this file include all the functions for vexp.
- * the first two arguments to the function are the number
- * of argument and an array of arguments (argc, argv)
- * the last argument is a pointer to a struct ex_ex for
- * the result. Up do this point, the content of the
- * struct ex_ex that these functions receive are either
- * ET_INT (long), ET_FLT (t_float), or ET_SYM (char **, it is
- * char ** and not char * since NewHandle of Mac returns
- * a char ** for relocatability.) The common practice in
- * these functions is that they figure out the type of their
- * result according to the type of the arguments. In general
- * the ET_SYM is used an ET_INT when we expect a value.
- * It is the users responsibility not to pass strings to the
- * function.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#define __STRICT_BSD__
-#include <math.h>
-#undef __STRICT_BSD__
-
-
-#include "vexp.h"
-
-/* forward declarations */
-
-static void ex_min(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_max(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_toint(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_rint(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_tofloat(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_pow(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_exp(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_log(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_ln(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_sin(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_cos(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_asin(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_acos(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_tan(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_atan(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_sinh(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_cosh(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_asinh(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_acosh(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_tanh(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_atanh(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_atan2(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_sqrt(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_fact(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_random(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_abs(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_fmod(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_ceil(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_floor(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_if(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_ldexp(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_imodf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_modf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-#ifndef _WIN32
-static void ex_cbrt(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_erf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_erfc(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_expm1(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_log1p(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_isinf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_finite(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_isnan(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_copysign(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_drem(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-#endif
-#ifdef notdef
-/* the following will be added once they are more popular in math libraries */
-static void ex_round(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_trunc(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_nearbyint(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_hypoth(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-#endif
-
-
-t_ex_func ex_funcs[] = {
- {"min", ex_min, 2},
- {"max", ex_max, 2},
- {"int", ex_toint, 1},
- {"rint", ex_rint, 1},
- {"float", ex_tofloat, 1},
- {"fmod", ex_fmod, 2},
- {"floor", ex_floor, 2},
- {"ceil", ex_ceil, 2},
- {"pow", ex_pow, 2},
- {"sqrt", ex_sqrt, 1},
- {"exp", ex_exp, 1},
- {"log10", ex_log, 1},
- {"ln", ex_ln, 1},
- {"log", ex_ln, 1},
- {"sin", ex_sin, 1},
- {"cos", ex_cos, 1},
- {"tan", ex_tan, 1},
- {"asin", ex_asin, 1},
- {"acos", ex_acos, 1},
- {"atan", ex_atan, 1},
- {"atan2", ex_atan2, 2},
- {"sinh", ex_sinh, 1},
- {"cosh", ex_cosh, 1},
- {"tanh", ex_tanh, 1},
- {"fact", ex_fact, 1},
- {"random", ex_random, 2}, /* random number */
- {"abs", ex_abs, 1},
- {"if", ex_if, 3},
- {"ldexp ", ex_ldexp, 1},
- {"imodf ", ex_imodf, 1},
- {"modf", ex_modf, 1},
-#ifndef _WIN32
- {"cbrt", ex_cbrt, 1},
- {"erf", ex_erf, 1},
- {"erfc", ex_erfc, 1},
- {"expm1", ex_expm1, 1},
- {"log1p", ex_log1p, 1},
- {"isinf", ex_isinf, 1},
- {"finite", ex_finite, 1},
- {"isnan", ex_isnan, 1},
- {"copysig", ex_copysign, 1},
- {"drem", ex_drem, 1},
- {"asinh", ex_asinh, 1},
- {"acosh", ex_acosh, 1},
- {"atanh", ex_atanh, 1}, /* hyperbolic atan */
-#endif
-#ifdef PD
- {"size", ex_size, 1},
- {"sum", ex_sum, 1},
- {"Sum", ex_Sum, 3},
- {"avg", ex_avg, 1},
- {"Avg", ex_Avg, 3},
- {"store", ex_store, 3},
-#endif
-#ifdef notdef
-/* the following will be added once they are more popular in math libraries */
- {"round", ex_round, 1},
- {"trunc", ex_trunc, 1},
- {"nearbyint", ex_nearbyint, 1},
- {"hypoth", ex_hypoth, 1},
-#endif
- {0, 0, 0}
-};
-
-/*
- * FUN_EVAL -- do type checking, evaluate a function,
- * if fltret is set return float
- * otherwise return value based on regular typechecking,
- */
-#define FUNC_EVAL(left, right, func, leftfuncast, rightfuncast, optr, fltret) \
-switch (left->ex_type) { \
-case ET_INT: \
- switch(right->ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)func(leftfuncast left->ex_int, \
- rightfuncast right->ex_int); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- if (fltret) { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float)func(leftfuncast \
- left->ex_int, rightfuncast right->ex_int); \
- } else { \
- optr->ex_type = ET_INT; \
- optr->ex_int = (int)func(leftfuncast \
- left->ex_int, rightfuncast right->ex_int); \
- } \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)func(leftfuncast left->ex_int, \
- rightfuncast right->ex_flt); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float)func(leftfuncast left->ex_int, \
- rightfuncast right->ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*e->exp_vsize); \
- } \
- scalar = left->ex_int; \
- rp = right->ex_vec; \
- op = optr->ex_vec; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (t_float)func(leftfuncast scalar, \
- rightfuncast *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad right type %ld\n", \
- __LINE__, right->ex_type);\
- } \
- break; \
-case ET_FLT: \
- switch(right->ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_int); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_int); \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_flt); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float) * e->exp_vsize);\
- } \
- scalar = left->ex_flt; \
- rp = right->ex_vec; \
- op = optr->ex_vec; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (t_float)func(leftfuncast scalar, \
- rightfuncast *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad right type %ld\n", \
- __LINE__, right->ex_type);\
- } \
- break; \
-case ET_VEC: \
-case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float) * e->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left->ex_vec; \
- switch(right->ex_type) { \
- case ET_INT: \
- scalar = right->ex_int; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (t_float)func(leftfuncast *lp, \
- rightfuncast scalar); \
- lp++; \
- } \
- break; \
- case ET_FLT: \
- scalar = right->ex_flt; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (t_float)func(leftfuncast *lp, \
- rightfuncast scalar); \
- lp++; \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- rp = right->ex_vec; \
- j = e->exp_vsize; \
- while (j--) { \
- /* \
- * on a RISC processor one could copy \
- * 8 times in each round to get a considerable \
- * improvement \
- */ \
- *op++ = (t_float)func(leftfuncast *lp, \
- rightfuncast *rp); \
- rp++; lp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad right type %ld\n", \
- __LINE__, right->ex_type);\
- } \
- break; \
-case ET_SYM: \
-default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad left type %ld\n", \
- __LINE__, left->ex_type); \
-}
-
-/*
- * FUNC_EVAL_UNARY - evaluate a unary function,
- * if fltret is set return t_float
- * otherwise return value based on regular typechecking,
- */
-#define FUNC_EVAL_UNARY(left, func, leftcast, optr, fltret) \
-switch(left->ex_type) { \
-case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec, \
- (t_float)(func (leftcast left->ex_int)), e->exp_vsize);\
- break; \
- } \
- if (fltret) { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float) func(leftcast left->ex_int); \
- break; \
- } \
- optr->ex_type = ET_INT; \
- optr->ex_int = (int) func(leftcast left->ex_int); \
- break; \
-case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec, \
- (t_float)(func (leftcast left->ex_flt)), e->exp_vsize);\
- break; \
- } \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float) func(leftcast left->ex_flt); \
- break; \
-case ET_VI: \
-case ET_VEC: \
- if (optr->ex_type != ET_VEC) { \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*e->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left->ex_vec; \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = (t_float)(func (leftcast *lp++)); \
- break; \
-default: \
- post_error((fts_object_t *) e, \
- "expr: FUNV_EVAL_UNARY(%d): bad left type %ld\n",\
- __LINE__, left->ex_type); \
-}
-
-#undef min
-#undef max
-#define min(x,y) (x > y ? y : x)
-#define max(x,y) (x > y ? x : y)
-
-#define FUNC_DEF(ex_func, func, castleft, castright, fltret); \
-static void \
-ex_func(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)\
-{ \
- struct ex_ex *left, *right; \
- t_float *op; /* output pointer */ \
- t_float *lp, *rp; /* left and right vector pointers */ \
- t_float scalar; \
- int j; \
- \
- left = argv++; \
- right = argv; \
- FUNC_EVAL(left, right, func, castleft, castright, optr, fltret); \
-}
-
-
-#define FUNC_DEF_UNARY(ex_func, func, cast, fltret); \
-static void \
-ex_func(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)\
-{ \
- struct ex_ex *left; \
- t_float *op; /* output pointer */ \
- t_float *lp, *rp; /* left and right vector pointers */ \
- t_float scalar; \
- int j; \
- \
- left = argv++; \
- \
- FUNC_EVAL_UNARY(left, func, cast, optr, fltret); \
-}
-
-/*
- * ex_min -- if any of the arguments are or the output are vectors, a vector
- * of floats is generated otherwise the type of the result is the
- * type of the smaller value
- */
-static void
-ex_min(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
-
- FUNC_EVAL(left, right, min, (double), (double), optr, 0);
-}
-
-/*
- * ex_max -- if any of the arguments are or the output are vectors, a vector
- * of floats is generated otherwise the type of the result is the
- * type of the larger value
- */
-static void
-ex_max(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
-
- FUNC_EVAL(left, right, max, (double), (double), optr, 0);
-}
-
-/*
- * ex_toint -- convert to integer
- */
-static void
-ex_toint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
-#define toint(x) ((int)(x))
- FUNC_EVAL_UNARY(left, toint, (int), optr, 0);
- }
-
-#ifdef _WIN32
-/* No rint in NT land ??? */
-double rint(double x);
-
-double
-rint(double x)
-{
- return (floor(x + 0.5));
-}
-#endif
-
-/*
- * ex_rint -- rint() round to the nearest int according to the common
- * rounding mechanism
- */
-static void
-ex_rint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
-
- FUNC_EVAL_UNARY(left, rint, (double), optr, 1);
-}
-
-/*
- * ex_tofloat -- convert to t_float
- */
-static void
-ex_tofloat(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
-#define tofloat(x) ((t_float)(x))
- FUNC_EVAL_UNARY(left, tofloat, (int), optr, 1);
-}
-
-
-/*
- * ex_pow -- the power of
- */
-static void
-ex_pow(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, pow, (double), (double), optr, 1);
-}
-
-/*
- * ex_sqrt -- square root
- */
-static void
-ex_sqrt(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, sqrt, (double), optr, 1);
-}
-
-/*
- * ex_exp -- e to the power of
- */
-static void
-ex_exp(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, exp, (double), optr, 1);
-}
-
-/*
- * ex_log -- 10 based logarithm
- */
-static void
-ex_log(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, log10, (double), optr, 1);
-}
-
-/*
- * ex_ln -- natural log
- */
-static void
-ex_ln(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, log, (double), optr, 1);
-}
-
-static void
-ex_sin(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, sin, (double), optr, 1);
-}
-
-static void
-ex_cos(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, cos, (double), optr, 1);
-}
-
-
-static void
-ex_tan(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, tan, (double), optr, 1);
-}
-
-static void
-ex_asin(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, asin, (double), optr, 1);
-}
-
-static void
-ex_acos(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, acos, (double), optr, 1);
-}
-
-
-static void
-ex_atan(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, atan, (double), optr, 1);
-}
-
-/*
- *ex_atan2 --
- */
-static void
-ex_atan2(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, atan2, (double), (double), optr, 1);
-}
-
-/*
- * ex_fmod -- floating point modulo
- */
-static void
-ex_fmod(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, fmod, (double), (double), optr, 1);
-}
-
-
-/*
- * ex_floor -- floor
- */
-static void
-ex_floor(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- FUNC_EVAL_UNARY(left, floor, (double), optr, 1);
-}
-
-
-/*
- * ex_ceil -- ceil
- */
-static void
-ex_ceil(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- FUNC_EVAL_UNARY(left, ceil, (double), optr, 1);
-}
-
-static void
-ex_sinh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, sinh, (double), optr, 1);
-}
-
-static void
-ex_cosh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, cosh, (double), optr, 1);
-}
-
-
-static void
-ex_tanh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, tanh, (double), optr, 1);
-}
-
-
-#ifndef _WIN32
-static void
-ex_asinh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, asinh, (double), optr, 1);
-}
-
-static void
-ex_acosh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, acosh, (double), optr, 1);
-}
-
-static void
-ex_atanh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, atanh, (double), optr, 1);
-}
-#endif
-
-static int
-ex_dofact(int i)
-{
- int ret = 0;
-
- if (i)
- ret = 1;
- else
- return (0);
-
- do {
- ret *= i;
- } while (--i);
-
- return(ret);
-}
-
-static void
-ex_fact(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, ex_dofact, (int), optr, 0);
-}
-
-static int
-ex_dorandom(int i1, int i2)
-{
- return(i1 + (((i2 - i1) * (rand() & 0x7fffL)) >> 15));
-}
-/*
- * ex_random -- return a random number
- */
-static void
-ex_random(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, ex_dorandom, (int), (int), optr, 0);
-}
-
-
-static void
-ex_abs(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, fabs, (double), optr, 0);
-}
-
-/*
- *ex_if -- floating point modulo
- */
-static void
-ex_if(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right, *cond, *res;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float *cp; /* condition pointer */
- t_float leftvalue, rightvalue;
- int j;
-
- cond = argv++;
- left = argv++;
- right = argv;
-
- switch (cond->ex_type) {
- case ET_VEC:
- case ET_VI:
- if (optr->ex_type != ET_VEC) {
- if (optr->ex_type == ET_VI) {
- /* SDY remove this test */
- post("expr~: Int. error %d", __LINE__);
- return;
- }
- optr->ex_type = ET_VEC;
- optr->ex_vec = (t_float *)
- fts_malloc(sizeof (t_float) * e->exp_vsize);
- }
- op = optr->ex_vec;
- j = e->exp_vsize;
- cp = cond->ex_vec;
- switch (left->ex_type) {
- case ET_INT:
- leftvalue = left->ex_int;
- switch (right->ex_type) {
- case ET_INT:
- rightvalue = right->ex_int;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_FLT:
- rightvalue = right->ex_flt;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_VEC:
- case ET_VI:
- rp = right->ex_vec;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = *rp;
- rp++;
- }
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad right type %ld\n",
- __LINE__, right->ex_type);
- return;
- }
- case ET_FLT:
- leftvalue = left->ex_flt;
- switch (right->ex_type) {
- case ET_INT:
- rightvalue = right->ex_int;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_FLT:
- rightvalue = right->ex_flt;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_VEC:
- case ET_VI:
- rp = right->ex_vec;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = *rp;
- rp++;
- }
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad right type %ld\n",
- __LINE__, right->ex_type);
- return;
- }
- case ET_VEC:
- case ET_VI:
- lp = left->ex_vec;
- switch (right->ex_type) {
- case ET_INT:
- rightvalue = right->ex_int;
- while (j--) {
- if (*cp++)
- *op++ = *lp;
- else
- *op++ = rightvalue;
- lp++;
- }
- return;
- case ET_FLT:
- rightvalue = right->ex_flt;
- while (j--) {
- if (*cp++)
- *op++ = *lp;
- else
- *op++ = rightvalue;
- lp++;
- }
- return;
- case ET_VEC:
- case ET_VI:
- rp = right->ex_vec;
- while (j--) {
- if (*cp++)
- *op++ = *lp;
- else
- *op++ = *rp;
- lp++; rp++;
- }
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad right type %ld\n",
- __LINE__, right->ex_type);
- return;
- }
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad left type %ld\n",
- __LINE__, left->ex_type);
- return;
- }
- case ET_INT:
- if (cond->ex_int)
- res = left;
- else
- res = right;
- break;
- case ET_FLT:
- if (cond->ex_flt)
- res = left;
- else
- res = right;
- break;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad condition type %ld\n",
- __LINE__, cond->ex_type);
- return;
- }
- switch(res->ex_type) {
- case ET_INT:
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec, (t_float)res->ex_int,
- e->exp_vsize);
- return;
- }
- *optr = *res;
- return;
- case ET_FLT:
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec, (t_float)res->ex_flt,
- e->exp_vsize);
- return;
- }
- *optr = *res;
- return;
- case ET_VEC:
- case ET_VI:
- if (optr->ex_type != ET_VEC) {
- if (optr->ex_type == ET_VI) {
- /* SDY remove this test */
- post("expr~: Int. error %d", __LINE__);
- return;
- }
- optr->ex_type = ET_VEC;
- optr->ex_vec = (t_float *)
- fts_malloc(sizeof (t_float) * e->exp_vsize);
- }
- memcpy(optr->ex_vec, res->ex_vec, e->exp_vsize*sizeof(t_float));
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad res type %ld\n",
- __LINE__, res->ex_type);
- return;
- }
-
-}
-
-/*
- * ex_imodf - extract signed integral value from floating-point number
- */
-static double
-imodf(double x)
-{
- double xx;
-
- modf(x, &xx);
- return (xx);
-}
-FUNC_DEF_UNARY(ex_imodf, imodf, (double), 1);
-
-/*
- * ex_modf - extract signed fractional value from floating-point number
- *
- * using fracmodf because fmodf() is alrady defined in a .h file
- */
-static double
-fracmodf(double x)
-{
- double xx;
-
- return(modf(x, &xx));
-}
-FUNC_DEF_UNARY(ex_modf, fracmodf, (double), 1);
-
-/*
- * ex_ldexp - multiply floating-point number by integral power of 2
- */
-FUNC_DEF(ex_ldexp, ldexp, (double), (int), 1);
-
-#ifndef _WIN32
-/*
- * ex_cbrt - cube root
- */
-FUNC_DEF_UNARY(ex_cbrt, cbrt, (double), 1);
-
-/*
- * ex_erf - error function
- */
-FUNC_DEF_UNARY(ex_erf, erf, (double), 1);
-
-/*
- * ex_erfc - complementary error function
- */
-FUNC_DEF_UNARY(ex_erfc, erfc, (double), 1);
-
-/*
- * ex_expm1 - exponential minus 1,
- */
-FUNC_DEF_UNARY(ex_expm1, expm1, (double), 1);
-
-/*
- * ex_log1p - logarithm of 1 plus
- */
-FUNC_DEF_UNARY(ex_log1p, log1p, (double), 1);
-
-/*
- * ex_isinf - is the value infinite,
- */
-FUNC_DEF_UNARY(ex_isinf, isinf, (double), 0);
-
-/*
- * ex_finite - is the value finite
- */
-FUNC_DEF_UNARY(ex_finite, finite, (double), 0);
-
-/*
- * ex_isnan -- is the resut a nan (Not a number)
- */
-FUNC_DEF_UNARY(ex_isnan, isnan, (double), 0);
-
-/*
- * ex_copysign - copy sign of a number
- */
-FUNC_DEF(ex_copysign, copysign, (double), (double), 1);
-
-/*
- * ex_drem - floating-point remainder function
- */
-FUNC_DEF(ex_drem, drem, (double), (double), 1);
-#endif
-
-#ifdef notdef
-/* the following will be added once they are more popular in math libraries */
-/*
- * ex_hypoth - Euclidean distance function
- */
-FUNC_DEF(ex_hypoth, hypoth, (double), (double), 1);
-
-/*
- * ex_round - round to nearest integer, away from zero
- */
-FUNC_DEF_UNARY(ex_round, round, (double), 1);
-
-/*
- * ex_trunc - round to interger, towards zero
- */
-FUNC_DEF_UNARY(ex_trunc, trunc, (double), 1);
-
-/*
- * ex_nearbyint - round to nearest integer
- */
-FUNC_DEF_UNARY(ex_nearbyint, nearbyint, (double), 1);
-#endif
diff --git a/externals/extra/0.43.3/0.43.2/expr~/vexp_if.c b/externals/extra/0.43.3/0.43.2/expr~/vexp_if.c
deleted file mode 100644
index 3028ff82..00000000
--- a/externals/extra/0.43.3/0.43.2/expr~/vexp_if.c
+++ /dev/null
@@ -1,1225 +0,0 @@
-/*
- * jMax
- * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * See file LICENSE for further informations on licensing terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Based on Max/ISPW by Miller Puckette.
- *
- * Authors: Maurizio De Cecco, Francois Dechelle, Enzo Maggi, Norbert Schnell.
- *
- */
-
-/* "expr" was written by Shahrokh Yadegari c. 1989. -msp */
-/* "expr~" and "fexpr~" conversion by Shahrokh Yadegari c. 1999,2000 */
-
-/*
- * Feb 2002 - added access to variables
- * multiple expression support
- * new short hand forms for fexpr~
- * now $y or $y1 = $y1[-1] and $y2 = $y2[-1]
- * --sdy
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "vexp.h"
-
-static char *exp_version = "0.4";
-
-extern struct ex_ex *ex_eval(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int n);
-
-#ifdef PD
-static t_class *expr_class;
-static t_class *expr_tilde_class;
-static t_class *fexpr_tilde_class;
-#else /* MSP */
-void *expr_tilde_class;
-#endif
-
-
-/*------------------------- expr class -------------------------------------*/
-
-extern int expr_donew(struct expr *expr, int ac, t_atom *av);
-
-/*#define EXPR_DEBUG*/
-
-static void expr_bang(t_expr *x);
-t_int *expr_perform(t_int *w);
-
-
-static void
-expr_list(t_expr *x, t_symbol *s, int argc, const fts_atom_t *argv)
-{
- int i;
-
- if (argc > MAX_VARS) argc = MAX_VARS;
-
- for (i = 0; i < argc; i++)
- {
- if (argv[i].a_type == A_FLOAT)
- {
- if (x->exp_var[i].ex_type == ET_FI)
- x->exp_var[i].ex_flt = argv[i].a_w.w_float;
- else if (x->exp_var[i].ex_type == ET_II)
- x->exp_var[i].ex_int = argv[i].a_w.w_float;
- else if (x->exp_var[i].ex_type)
- pd_error(x, "expr: type mismatch");
- }
- else if (argv[i].a_type == A_SYMBOL)
- {
- if (x->exp_var[i].ex_type == ET_SI)
- x->exp_var[i].ex_ptr = (char *)argv[i].a_w.w_symbol;
- else if (x->exp_var[i].ex_type)
- pd_error(x, "expr: type mismatch");
- }
- }
- expr_bang(x);
-}
-
-static void
-expr_flt(t_expr *x, t_float f, int in)
-{
- if (in > MAX_VARS)
- return;
-
- if (x->exp_var[in].ex_type == ET_FI)
- x->exp_var[in].ex_flt = f;
- else if (x->exp_var[in].ex_type == ET_II)
- x->exp_var[in].ex_int = f;
-}
-
-static t_class *exprproxy_class;
-
-typedef struct _exprproxy {
- t_pd p_pd;
- int p_index;
- t_expr *p_owner;
- struct _exprproxy *p_next;
-} t_exprproxy;
-
-t_exprproxy *exprproxy_new(t_expr *owner, int indx);
-void exprproxy_float(t_exprproxy *p, t_floatarg f);
-
-t_exprproxy *
-exprproxy_new(t_expr *owner, int indx)
-{
- t_exprproxy *x = (t_exprproxy *)pd_new(exprproxy_class);
- x->p_owner = owner;
- x->p_index = indx;
- x->p_next = owner->exp_proxy;
- owner->exp_proxy = x;
- return (x);
-}
-
-void
-exprproxy_float(t_exprproxy *p, t_floatarg f)
-{
- t_expr *x = p->p_owner;
- int in = p->p_index;
-
- if (in > MAX_VARS)
- return;
-
- if (x->exp_var[in].ex_type == ET_FI)
- x->exp_var[in].ex_flt = f;
- else if (x->exp_var[in].ex_type == ET_II)
- x->exp_var[in].ex_int = f;
-}
-
-/* method definitions */
-static void
-expr_ff(t_expr *x)
-{
- t_exprproxy *y;
- int i;
-
- y = x->exp_proxy;
- while (y)
- {
- x->exp_proxy = y->p_next;
-#ifdef PD
- pd_free(&y->p_pd);
-#else /*MSP */
- /* SDY find out what needs to be called for MSP */
-
-#endif
- y = x->exp_proxy;
- }
- for (i = 0 ; i < x->exp_nexpr; i++);
- if (x->exp_stack[i])
- fts_free(x->exp_stack[i]);
-/*
- * SDY free all the allocated buffers here for expr~ and fexpr~
- * check to see if there are others
- */
- for (i = 0; i < MAX_VARS; i++) {
- if (x->exp_p_var[i])
- fts_free(x->exp_p_var[i]);
- if (x->exp_p_res[i])
- fts_free(x->exp_p_res[i]);
- if (x->exp_tmpres[i])
- fts_free(x->exp_tmpres[i]);
- }
-
-
-}
-
-static void
-expr_bang(t_expr *x)
-{
- int i;
-
-#ifdef EXPR_DEBUG
- {
- struct ex_ex *eptr;
-
- for (i = 0, eptr = x->exp_var; ; eptr++, i++)
- {
- if (!eptr->ex_type)
- break;
- switch (eptr->ex_type)
- {
- case ET_II:
- fprintf(stderr,"ET_II: %d \n", eptr->ex_int);
- break;
-
- case ET_FI:
- fprintf(stderr,"ET_FT: %f \n", eptr->ex_flt);
- break;
-
- default:
- fprintf(stderr,"oups\n");
- }
- }
- }
-#endif
- /* banging a signal or filter object means nothing */
- if (!IS_EXPR(x))
- return;
-
- for (i = x->exp_nexpr - 1; i > -1 ; i--) {
- if (!ex_eval(x, x->exp_stack[i], &x->exp_res[i], 0)) {
- /*fprintf(stderr,"expr_bang(error evaluation)\n"); */
- /* SDY now that we have mutiple ones, on error we should
- * continue
- return;
- */
- }
- switch(x->exp_res[i].ex_type) {
- case ET_INT:
- outlet_float(x->exp_outlet[i],
- (t_float) x->exp_res[i].ex_int);
- break;
-
- case ET_FLT:
- outlet_float(x->exp_outlet[i], x->exp_res[i].ex_flt);
- break;
-
- case ET_SYM:
- /* CHANGE this will have to be taken care of */
-
- default:
- post("expr: bang: unrecognized result %ld\n", x->exp_res[i].ex_type);
- }
- }
-}
-
-static t_expr *
-#ifdef PD
-expr_new(t_symbol *s, int ac, t_atom *av)
-#else /* MSP */
-Nexpr_new(t_symbol *s, int ac, t_atom *av)
-#endif
-{
- struct expr *x;
- int i, ninlet;
- struct ex_ex *eptr;
- t_atom fakearg;
- int dsp_index; /* keeping track of the dsp inlets */
-
-
-/*
- * SDY - we may need to call dsp_setup() in this function
- */
-
- if (!ac)
- {
- ac = 1;
- av = &fakearg;
- SETFLOAT(&fakearg, 0);
- }
-
-#ifdef PD
- /*
- * figure out if we are expr, expr~, or fexpr~
- */
- if (!strcmp("expr", s->s_name)) {
- x = (t_expr *)pd_new(expr_class);
- SET_EXPR(x);
- } else if (!strcmp("expr~", s->s_name)) {
- x = (t_expr *)pd_new(expr_tilde_class);
- SET_EXPR_TILDE(x);
- } else if (!strcmp("fexpr~", s->s_name)) {
- x = (t_expr *)pd_new(fexpr_tilde_class);
- SET_FEXPR_TILDE(x);
- } else {
- post("expr_new: bad object name '%s'");
- /* assume expr */
- x = (t_expr *)pd_new(expr_class);
- SET_EXPR(x);
- }
-#else /* MSP */
- /* for now assume an expr~ */
- x = (t_expr *)pd_new(expr_tilde_class);
- SET_EXPR_TILDE(x);
-#endif
-
- /*
- * initialize the newly allocated object
- */
- x->exp_proxy = 0;
- x->exp_nivec = 0;
- x->exp_nexpr = 0;
- x->exp_error = 0;
- for (i = 0; i < MAX_VARS; i++) {
- x->exp_stack[i] = (struct ex_ex *)0;
- x->exp_outlet[i] = (t_outlet *)0;
- x->exp_res[i].ex_type = 0;
- x->exp_res[i].ex_int = 0;
- x->exp_p_res[i] = (t_float *)0;
- x->exp_var[i].ex_type = 0;
- x->exp_var[i].ex_int = 0;
- x->exp_p_var[i] = (t_float *)0;
- x->exp_tmpres[i] = (t_float *)0;
- x->exp_vsize = 0;
- }
- x->exp_f = 0; /* save the control value to be transformed to signal */
-
-
- if (expr_donew(x, ac, av))
- {
- pd_error(x, "expr: syntax error");
-/*
-SDY the following coredumps why?
- pd_free(&x->exp_ob.ob_pd);
-*/
- return (0);
- }
-
- ninlet = 1;
- for (i = 0, eptr = x->exp_var; i < MAX_VARS ; i++, eptr++)
- if (eptr->ex_type) {
- ninlet = i + 1;
- }
-
- /*
- * create the new inlets
- */
- for (i = 1, eptr = x->exp_var + 1, dsp_index=1; i<ninlet ; i++, eptr++)
- {
- t_exprproxy *p;
- switch (eptr->ex_type)
- {
- case 0:
- /* nothing is using this inlet */
- if (i < ninlet)
-#ifdef PD
- floatinlet_new(&x->exp_ob, &eptr->ex_flt);
-#else /* MSP */
- inlet_new(&x->exp_ob, "float");
-#endif
- break;
-
- case ET_II:
- case ET_FI:
- p = exprproxy_new(x, i);
-#ifdef PD
- inlet_new(&x->exp_ob, &p->p_pd, &s_float, &s_float);
-#else /* MSP */
- inlet_new(&x->exp_ob, "float");
-#endif
- break;
-
- case ET_SI:
-#ifdef PD
- symbolinlet_new(&x->exp_ob, (t_symbol **)&eptr->ex_ptr);
-#else /* MSP */
- inlet_new(&x->exp_ob, "symbol");
-#endif
- break;
-
- case ET_XI:
- case ET_VI:
- if (!IS_EXPR(x)) {
- dsp_index++;
-#ifdef PD
- inlet_new(&x->exp_ob, &x->exp_ob.ob_pd,
- &s_signal, &s_signal);
-#else /* MSP */
- inlet_new(&x->exp_ob, "signal");
-#endif
- break;
- } else
- post("expr: internal error expr_new");
- default:
- pd_error(x, "expr: bad type (%lx) inlet = %d\n",
- eptr->ex_type, i + 1);
- break;
- }
- }
- if (IS_EXPR(x)) {
- for (i = 0; i < x->exp_nexpr; i++)
- x->exp_outlet[i] = outlet_new(&x->exp_ob, 0);
- } else {
- for (i = 0; i < x->exp_nexpr; i++)
- x->exp_outlet[i] = outlet_new(&x->exp_ob,
- gensym("signal"));
- x->exp_nivec = dsp_index;
- }
- /*
- * for now assume a 64 sample size block but this may change once
- * expr_dsp is called
- */
- x->exp_vsize = 64;
- for (i = 0; i < x->exp_nexpr; i++) {
- x->exp_p_res[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- x->exp_tmpres[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- }
- for (i = 0; i < MAX_VARS; i++)
- x->exp_p_var[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
-
- return (x);
-}
-
-t_int *
-expr_perform(t_int *w)
-{
- int i, j;
- t_expr *x = (t_expr *)w[1];
- struct ex_ex res;
- int n;
-
- /* sanity check */
- if (IS_EXPR(x)) {
- post("expr_perform: bad x->exp_flags = %d", x->exp_flags);
- abort();
- }
-
- if (x->exp_flags & EF_STOP) {
- for (i = 0; i < x->exp_nexpr; i++)
- memset(x->exp_res[i].ex_vec, 0,
- x->exp_vsize * sizeof (t_float));
- return (w + 2);
- }
-
- if (IS_EXPR_TILDE(x)) {
- /*
- * if we have only one expression, we can right on
- * on the output directly, otherwise we have to copy
- * the data because, outputs could be the same buffer as
- * inputs
- */
- if ( x->exp_nexpr == 1)
- ex_eval(x, x->exp_stack[0], &x->exp_res[0], 0);
- else {
- res.ex_type = ET_VEC;
- for (i = 0; i < x->exp_nexpr; i++) {
- res.ex_vec = x->exp_tmpres[i];
- ex_eval(x, x->exp_stack[i], &res, 0);
- }
- n = x->exp_vsize * sizeof(t_float);
- for (i = 0; i < x->exp_nexpr; i++)
- memcpy(x->exp_res[i].ex_vec, x->exp_tmpres[i],
- n);
- }
- return (w + 2);
- }
-
- if (!IS_FEXPR_TILDE(x)) {
- post("expr_perform: bad x->exp_flags = %d - expecting fexpr",
- x->exp_flags);
- return (w + 2);
- }
- /*
- * since the output buffer could be the same as one of the inputs
- * we need to keep the output in a different buffer
- */
- for (i = 0; i < x->exp_vsize; i++) for (j = 0; j < x->exp_nexpr; j++) {
- res.ex_type = 0;
- res.ex_int = 0;
- ex_eval(x, x->exp_stack[j], &res, i);
- switch (res.ex_type) {
- case ET_INT:
- x->exp_tmpres[j][i] = (t_float) res.ex_int;
- break;
- case ET_FLT:
- x->exp_tmpres[j][i] = res.ex_flt;
- break;
- default:
- post("expr_perform: bad result type %d", res.ex_type);
- }
- }
- /*
- * copy inputs and results to the save buffers
- * inputs need to be copied first as the output buffer can be
- * same as an input buffer
- */
- n = x->exp_vsize * sizeof(t_float);
- for (i = 0; i < MAX_VARS; i++)
- if (x->exp_var[i].ex_type == ET_XI)
- memcpy(x->exp_p_var[i], x->exp_var[i].ex_vec, n);
- for (i = 0; i < x->exp_nexpr; i++) {
- memcpy(x->exp_p_res[i], x->exp_tmpres[i], n);
- memcpy(x->exp_res[i].ex_vec, x->exp_tmpres[i], n);
- }
- return (w + 2);
-}
-
-static void
-expr_dsp(t_expr *x, t_signal **sp)
-{
- int i, nv;
- int newsize;
-
- x->exp_error = 0; /* reset all errors */
- newsize = (x->exp_vsize != sp[0]->s_n);
- x->exp_vsize = sp[0]->s_n; /* record the vector size */
- for (i = 0; i < x->exp_nexpr; i++) {
- x->exp_res[i].ex_type = ET_VEC;
- x->exp_res[i].ex_vec = sp[x->exp_nivec + i]->s_vec;
- }
- for (i = 0, nv = 0; i < MAX_VARS; i++)
- /*
- * the first inlet is always a signal
- *
- * SDY We are warning the user till this limitation
- * is taken away from pd
- */
- if (!i || x->exp_var[i].ex_type == ET_VI ||
- x->exp_var[i].ex_type == ET_XI) {
- if (nv >= x->exp_nivec) {
- post("expr_dsp int. err nv = %d, x->exp_nive = %d",
- nv, x->exp_nivec);
- abort();
- }
- x->exp_var[i].ex_vec = sp[nv]->s_vec;
- nv++;
- }
- /* we always have one inlet but we may not use it */
- if (nv != x->exp_nivec && (nv != 0 || x->exp_nivec != 1)) {
- post("expr_dsp internal error 2 nv = %d, x->exp_nive = %d",
- nv, x->exp_nivec);
- abort();
- }
-
- dsp_add(expr_perform, 1, (t_int *) x);
-
- /*
- * The buffer are now being allocated for expr~ and fexpr~
- * because if we have more than one expression we need the
- * temporary buffers, The save buffers are not really needed
- if (!IS_FEXPR_TILDE(x))
- return;
- */
- /*
- * if we have already allocated the buffers and we have a
- * new size free all the buffers
- */
- if (x->exp_p_res[0]) {
- if (!newsize)
- return;
- /*
- * if new size, reallocate all the previous buffers for fexpr~
- */
- for (i = 0; i < x->exp_nexpr; i++) {
- fts_free(x->exp_p_res[i]);
- fts_free(x->exp_tmpres[i]);
- }
- for (i = 0; i < MAX_VARS; i++)
- fts_free(x->exp_p_var[i]);
-
- }
- for (i = 0; i < x->exp_nexpr; i++) {
- x->exp_p_res[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- x->exp_tmpres[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- }
- for (i = 0; i < MAX_VARS; i++)
- x->exp_p_var[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
-}
-
-/*
- * expr_verbose -- toggle the verbose switch
- */
-static void
-expr_verbose(t_expr *x)
-{
- if (x->exp_flags & EF_VERBOSE) {
- x->exp_flags &= ~EF_VERBOSE;
- post ("verbose off");
- } else {
- x->exp_flags |= EF_VERBOSE;
- post ("verbose on");
- }
-}
-
-/*
- * expr_start -- turn on expr processing for now only used for fexpr~
- */
-static void
-expr_start(t_expr *x)
-{
- x->exp_flags &= ~EF_STOP;
-}
-
-/*
- * expr_stop -- turn on expr processing for now only used for fexpr~
- */
-static void
-expr_stop(t_expr *x)
-{
- x->exp_flags |= EF_STOP;
-}
-static void
-fexpr_set_usage(void)
-{
- post("fexpr~: set val ...");
- post("fexpr~: set {xy}[#] val ...");
-}
-
-/*
- * fexpr_tilde_set -- set previous values of the buffers
- * set val val ... - sets the first elements of output buffers
- * set x val ... - sets the elements of the first input buffer
- * set x# val ... - sets the elements of the #th input buffers
- * set y val ... - sets the elements of the first output buffer
- * set y# val ... - sets the elements of the #th output buffers
- */
-static void
-fexpr_tilde_set(t_expr *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_symbol *sx;
- int vecno;
- int i, nargs;
-
- if (!argc)
- return;
- sx = atom_getsymbolarg(0, argc, argv);
- switch(sx->s_name[0]) {
- case 'x':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.set: bad set x vector number");
- fexpr_set_usage();
- return;
- }
- if (vecno >= MAX_VARS) {
- post("fexpr~.set: no more than %d inlets",
- MAX_VARS);
- return;
- }
- vecno--;
- }
- if (x->exp_var[vecno].ex_type != ET_XI) {
- post("fexpr~-set: no signal at inlet %d", vecno + 1);
- return;
- }
- nargs = argc - 1;
- if (!nargs) {
- post("fexpr~-set: no argument to set");
- return;
- }
- if (nargs > x->exp_vsize) {
- post("fexpr~.set: %d set values larger than vector size(%d)",
- nargs, x->exp_vsize);
- post("fexpr~.set: only the first %d values will be set",
- x->exp_vsize);
- nargs = x->exp_vsize;
- }
- for (i = 0; i < nargs; i++) {
- x->exp_p_var[vecno][x->exp_vsize - i - 1] =
- atom_getfloatarg(i + 1, argc, argv);
- }
- return;
- case 'y':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.set: bad set y vector number");
- fexpr_set_usage();
- return;
- }
- vecno--;
- }
- if (vecno >= x->exp_nexpr) {
- post("fexpr~.set: only %d outlets", x->exp_nexpr);
- return;
- }
- nargs = argc - 1;
- if (!nargs) {
- post("fexpr~-set: no argument to set");
- return;
- }
- if (nargs > x->exp_vsize) {
- post("fexpr~-set: %d set values larger than vector size(%d)",
- nargs, x->exp_vsize);
- post("fexpr~.set: only the first %d values will be set",
- x->exp_vsize);
- nargs = x->exp_vsize;
- }
- for (i = 0; i < nargs; i++) {
- x->exp_p_res[vecno][x->exp_vsize - i - 1] =
- atom_getfloatarg(i + 1, argc, argv);
- }
- return;
- case 0:
- if (argc > x->exp_nexpr) {
- post("fexpr~.set: only %d outlets available",
- x->exp_nexpr);
- post("fexpr~.set: the extra set values are ignored");
- }
- for (i = 0; i < x->exp_nexpr && i < argc; i++)
- x->exp_p_res[i][x->exp_vsize - 1] =
- atom_getfloatarg(i, argc, argv);
- return;
- default:
- fexpr_set_usage();
- return;
- }
- return;
-}
-
-/*
- * fexpr_tilde_clear - clear the past buffers
- */
-static void
-fexpr_tilde_clear(t_expr *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_symbol *sx;
- int vecno;
- int i, nargs;
-
- /*
- * if no arguement clear all input and output buffers
- */
- if (!argc) {
- for (i = 0; i < x->exp_nexpr; i++)
- memset(x->exp_p_res[i], 0, x->exp_vsize*sizeof(t_float));
- for (i = 0; i < MAX_VARS; i++)
- if (x->exp_var[i].ex_type == ET_XI)
- memset(x->exp_p_var[i], 0,
- x->exp_vsize*sizeof(t_float));
- return;
- }
- if (argc > 1) {
- post("fexpr~ usage: 'clear' or 'clear {xy}[#]'");
- return;
- }
-
- sx = atom_getsymbolarg(0, argc, argv);
- switch(sx->s_name[0]) {
- case 'x':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.clear: bad clear x vector number");
- return;
- }
- if (vecno >= MAX_VARS) {
- post("fexpr~.clear: no more than %d inlets",
- MAX_VARS);
- return;
- }
- vecno--;
- }
- if (x->exp_var[vecno].ex_type != ET_XI) {
- post("fexpr~-clear: no signal at inlet %d", vecno + 1);
- return;
- }
- memset(x->exp_p_var[vecno], 0, x->exp_vsize*sizeof(t_float));
- return;
- case 'y':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.clear: bad clear y vector number");
- return;
- }
- vecno--;
- }
- if (vecno >= x->exp_nexpr) {
- post("fexpr~.clear: only %d outlets", x->exp_nexpr);
- return;
- }
- memset(x->exp_p_res[vecno], 0, x->exp_vsize*sizeof(t_float));
- return;
- return;
- default:
- post("fexpr~ usage: 'clear' or 'clear {xy}[#]'");
- return;
- }
- return;
-}
-
-#ifdef PD
-
-void
-expr_setup(void)
-{
- /*
- * expr initialization
- */
- expr_class = class_new(gensym("expr"), (t_newmethod)expr_new,
- (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
- class_addlist(expr_class, expr_list);
- exprproxy_class = class_new(gensym("exprproxy"), 0,
- 0, sizeof(t_exprproxy), CLASS_PD, 0);
- class_addfloat(exprproxy_class, exprproxy_float);
-
- /*
- * expr~ initialization
- */
- expr_tilde_class = class_new(gensym("expr~"), (t_newmethod)expr_new,
- (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
- class_addmethod(expr_tilde_class, nullfn, gensym("signal"), 0);
- CLASS_MAINSIGNALIN(expr_tilde_class, t_expr, exp_f);
- class_addmethod(expr_tilde_class,(t_method)expr_dsp, gensym("dsp"), 0);
- class_sethelpsymbol(expr_tilde_class, gensym("expr"));
- /*
- * fexpr~ initialization
- */
- fexpr_tilde_class = class_new(gensym("fexpr~"), (t_newmethod)expr_new,
- (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
- class_addmethod(fexpr_tilde_class, nullfn, gensym("signal"), 0);
- class_addmethod(fexpr_tilde_class,(t_method)expr_start,
- gensym("start"), 0);
- class_addmethod(fexpr_tilde_class,(t_method)expr_stop,
- gensym("stop"), 0);
-
- class_addmethod(fexpr_tilde_class,(t_method)expr_dsp,gensym("dsp"), 0);
- class_addmethod(fexpr_tilde_class, (t_method)fexpr_tilde_set,
- gensym("set"), A_GIMME, 0);
- class_addmethod(fexpr_tilde_class, (t_method)fexpr_tilde_clear,
- gensym("clear"), A_GIMME, 0);
- class_addmethod(fexpr_tilde_class,(t_method)expr_verbose,
- gensym("verbose"), 0);
- class_sethelpsymbol(fexpr_tilde_class, gensym("expr"));
-
-
-
- post("expr, expr~, fexpr~ version %s under GNU General Public License ", exp_version);
-
-}
-
-void
-expr_tilde_setup(void)
-{
- expr_setup();
-}
-
-void
-fexpr_tilde_setup(void)
-{
- expr_setup();
-}
-#else /* MSP */
-void
-main(void)
-{
- setup((t_messlist **)&expr_tilde_class, (method)Nexpr_new,
- (method)expr_ff, (short)sizeof(t_expr), 0L, A_GIMME, 0);
- addmess((method)expr_dsp, "dsp", A_CANT, 0); // dsp method
- dsp_initclass();
-}
-#endif
-
-
-/* -- the following functions use Pd internals and so are in the "if" file. */
-
-
-int
-ex_getsym(char *p, fts_symbol_t *s)
-{
- *s = gensym(p);
- return (0);
-}
-
-const char *
-ex_symname(fts_symbol_t s)
-{
- return (fts_symbol_name(s));
-}
-
-/*
- * max_ex_tab -- evaluate this table access
- * eptr is the name of the table and arg is the index we
- * have to put the result in optr
- * return 1 on error and 0 otherwise
- *
- * Arguments:
- * the expr object
- * table
- * the argument
- * the result pointer
- */
-int
-max_ex_tab(struct expr *expr, fts_symbol_t s, struct ex_ex *arg,
- struct ex_ex *optr)
-{
-#ifdef PD
- t_garray *garray;
- int size, indx;
- t_word *wvec;
-
- if (!s || !(garray = (t_garray *)pd_findbyclass(s, garray_class)) ||
- !garray_getfloatwords(garray, &size, &wvec))
- {
- optr->ex_type = ET_FLT;
- optr->ex_flt = 0;
- pd_error(expr, "no such table '%s'", s->s_name);
- return (1);
- }
- optr->ex_type = ET_FLT;
-
- switch (arg->ex_type) {
- case ET_INT:
- indx = arg->ex_int;
- break;
- case ET_FLT:
- /* strange interpolation code deleted here -msp */
- indx = arg->ex_flt;
- break;
-
- default: /* do something with strings */
- pd_error(expr, "expr: bad argument for table '%s'\n", fts_symbol_name(s));
- indx = 0;
- }
- if (indx < 0) indx = 0;
- else if (indx >= size) indx = size - 1;
- optr->ex_flt = wvec[indx].w_float;
-#else /* MSP */
- /*
- * table lookup not done for MSP yet
- */
- post("max_ex_tab: not complete for MSP yet!");
- optr->ex_type = ET_FLT;
- optr->ex_flt = 0;
-#endif
- return (0);
-}
-
-int
-max_ex_var(struct expr *expr, fts_symbol_t var, struct ex_ex *optr)
-{
- optr->ex_type = ET_FLT;
- if (value_getfloat(var, &(optr->ex_flt))) {
- optr->ex_type = ET_FLT;
- optr->ex_flt = 0;
- pd_error(expr, "no such var '%s'", var->s_name);
- return (1);
- }
- return (0);
-}
-
-#ifdef PD /* this goes to the end of this file as the following functions
- * should be defined in the expr object in MSP
- */
-#define ISTABLE(sym, garray, size, vec) \
-if (!sym || !(garray = (t_garray *)pd_findbyclass(sym, garray_class)) || \
- !garray_getfloatwords(garray, &size, &vec)) { \
- optr->ex_type = ET_FLT; \
- optr->ex_int = 0; \
- error("no such table '%s'", sym?(sym->s_name):"(null)"); \
- return; \
-}
-
-/*
- * ex_size -- find the size of a table
- */
-void
-ex_size(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- t_symbol *s;
- t_garray *garray;
- int size;
- t_word *wvec;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: size: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- ISTABLE(s, garray, size, wvec);
-
- optr->ex_type = ET_INT;
- optr->ex_int = size;
-}
-
-/*
- * ex_sum -- calculate the sum of all elements of a table
- */
-
-void
-ex_sum(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- t_symbol *s;
- t_garray *garray;
- int size;
- t_word *wvec;
- t_float sum;
- int indx;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: sum: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- ISTABLE(s, garray, size, wvec);
-
- for (indx = 0, sum = 0; indx < size; indx++)
- sum += wvec[indx].w_float;
-
- optr->ex_type = ET_FLT;
- optr->ex_flt = sum;
-}
-
-
-/*
- * ex_Sum -- calculate the sum of table with the given boundries
- */
-
-void
-ex_Sum(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- t_symbol *s;
- t_garray *garray;
- int size;
- t_word *wvec;
- t_float sum;
- int indx, n1, n2;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: sum: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- ISTABLE(s, garray, size, wvec);
-
- if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
- {
- post("expr: Sum: boundries have to be fix values\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
- n1 = argv->ex_int;
- n2 = argv[1].ex_int;
-
- for (indx = n1, sum = 0; indx < n2; indx++)
- if (indx >= 0 && indx < size)
- sum += wvec[indx].w_float;
-
- optr->ex_type = ET_FLT;
- optr->ex_flt = sum;
-}
-
-/*
- * ex_avg -- calculate the avarage of a table
- */
-
-void
-ex_avg(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
-/* SDY - look into this function */
-#if 0
- fts_symbol_t s;
- fts_integer_vector_t *tw = 0;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: avg: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- tw = table_integer_vector_get_by_name(s);
-
- if (tw)
- {
- optr->ex_type = ET_INT;
-
- if (! fts_integer_vector_get_size(tw))
- optr->ex_int = 0;
- else
- optr->ex_int = fts_integer_vector_get_sum(tw) / fts_integer_vector_get_size(tw);
- }
- else
- {
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- post("expr: avg: no such table %s\n", fts_symbol_name(s));
- }
-#endif
-}
-
-
-/*
- * ex_Avg -- calculate the avarage of table with the given boundries
- */
-
-void
-ex_Avg(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
-/* SDY - look into this function */
-#if 0
- fts_symbol_t s;
- fts_integer_vector_t *tw = 0;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: Avg: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- }
-
- s = (fts_symbol_t ) (argv++)->ex_ptr;
-
- tw = table_integer_vector_get_by_name(s);
-
- if (! tw)
- {
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- post("expr: Avg: no such table %s\n", fts_symbol_name(s));
- return;
- }
-
- if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
- {
- post("expr: Avg: boundries have to be fix values\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- optr->ex_type = ET_INT;
-
- if (argv[1].ex_int - argv->ex_int <= 0)
- optr->ex_int = 0;
- else
- optr->ex_int = (fts_integer_vector_get_sub_sum(tw, argv->ex_int, argv[1].ex_int) /
- (argv[1].ex_int - argv->ex_int));
-#endif
-}
-
-/*
- * ex_store -- store a value in a table
- * if the index is greater the size of the table,
- * we will make a modulo the size of the table
- */
-
-void
-ex_store(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
-/* SDY - look into this function */
-#if 0
- fts_symbol_t s;
- fts_integer_vector_t *tw = 0;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: store: need a table name\n");
- }
-
- s = (fts_symbol_t ) (argv++)->ex_ptr;
-
- tw = table_integer_vector_get_by_name(s);
-
- if (! tw)
- {
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- post("expr: store: no such table %s\n", fts_symbol_name(s));
- return;
- }
-
- if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
- {
- post("expr: store: arguments have to be integer\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- }
-
- fts_integer_vector_set_element(tw, argv->ex_int < 0 ? 0 : argv->ex_int % fts_integer_vector_get_size(tw), argv[1].ex_int);
- *optr = argv[1];
-#endif
-}
-
-#else /* MSP */
-
-void
-pd_error(void *object, char *fmt, ...)
-{
- va_list ap;
- t_int arg[8];
- int i;
- static int saidit = 0;
- va_start(ap, fmt);
-/* SDY
- vsprintf(error_string, fmt, ap);
- */ post(fmt, ap);
- va_end(ap);
-/* SDY
- fprintf(stderr, "error: %s\n", error_string);
- error_object = object;
-*/
- if (!saidit)
- {
- post("... you might be able to track this down from the Find menu.");
- saidit = 1;
- }
-}
-#endif
diff --git a/externals/extra/0.43.3/0.43.2/extra-meta.pd b/externals/extra/0.43.3/0.43.2/extra-meta.pd
deleted file mode 100644
index 2ddfe712..00000000
--- a/externals/extra/0.43.3/0.43.2/extra-meta.pd
+++ /dev/null
@@ -1,7 +0,0 @@
-#N canvas 15 49 200 200 10;
-#N canvas 25 49 420 300 META 1;
-#X text 13 10 NAME extra;
-#X text 10 30 VERSION 0.43.2;
-#X text 10 50 AUTHOR Miller Puckette and others;
-#X text 10 50 LICENSE GPLv2 for expr and BSD for the rest;
-#X restore 10 10 pd META;
diff --git a/externals/extra/0.43.3/0.43.2/fiddle~/fiddle~-help.pd b/externals/extra/0.43.3/0.43.2/fiddle~/fiddle~-help.pd
deleted file mode 100644
index f396725a..00000000
--- a/externals/extra/0.43.3/0.43.2/fiddle~/fiddle~-help.pd
+++ /dev/null
@@ -1,142 +0,0 @@
-#N canvas 93 26 980 745 10;
-#X obj 262 522 phasor~;
-#X obj 531 616 unpack;
-#X floatatom 531 666 0 0 0 0 - - -;
-#X msg 437 449 print;
-#X obj 262 500 sig~;
-#X floatatom 262 478 0 0 0 0 - - -;
-#X obj 262 456 mtof;
-#X floatatom 262 434 0 0 0 0 - - -;
-#X floatatom 545 643 0 0 0 0 - - -;
-#X obj 531 576 route 1 2 3 4;
-#X obj 614 616 unpack;
-#X floatatom 614 666 0 0 0 0 - - -;
-#X floatatom 628 643 0 0 0 0 - - -;
-#X obj 698 616 unpack;
-#X floatatom 698 666 0 0 0 0 - - -;
-#X floatatom 712 643 0 0 0 0 - - -;
-#X obj 389 616 unpack;
-#X floatatom 389 666 0 0 0 0 - - -;
-#X floatatom 403 643 0 0 0 0 - - -;
-#X obj 334 545 *~;
-#X obj 322 394 loadbang;
-#X obj 353 522 sig~;
-#X floatatom 353 500 0 0 0 0 - - -;
-#X msg 322 478 1;
-#X msg 353 478 0;
-#X floatatom 466 666 0 0 0 0 - - -;
-#X obj 281 666 print attack;
-#X obj 190 666 print pitch;
-#X msg 555 45 \; pd dsp 1;
-#X text 460 39 click here;
-#X text 460 61 to start DSP;
-#X text 226 4 FIDDLE - pitch estimator and sinusoidal peak finder;
-#X text 8 70 The Fiddle object estimates the pitch and amplitude of
-an incoming sound \, both continuously and as a stream of discrete
-"note" events. Fiddle optionally outputs a list of detected sinusoidal
-peaks used to make the pitch determination. Fiddle is described theoretically
-in the 1998 ICMC proceedings \, reprinted on http://man104nfs.ucsd.edu/~mpuckett.
-;
-#X text 8 170 Fiddle's creation arguments specify an analysis window
-size \, the maximum polyphony (i.e. \, the number of simultaneous "pitches"
-to try to find) \, the number of peaks in the spectrum to consider
-\, and the number of peaks \, if any \, to output "raw." The outlets
-give discrete pitch (a number) \, detected attacks in the amplitude
-envelope (a bang) \, one or more voices of continuous pitch and amplitude
-\, overall amplitude \, and optionally a sequence of messages with
-the peaks.;
-#X text 8 296 The analysis hop size is half the window size so in the
-example shown here \, one analysis is done every 512 samples (11.6
-msec at 44K1) \, and the analysis uses the most recent 1024 samples
-(23.2 msec at 44K1). The minimum frequency that Fiddle will report
-is 2-1/2 cycles per analysis windows \, or about 108 Hz. (just below
-MIDI 45.);
-#X text 669 535 number of pitch outlets (1-3 \, default 1);
-#X text 669 557 number of peaks to find (1-100 \, default 20);
-#X text 669 579 number of peaks to output (default 0.);
-#X msg 441 107 amp-range 40 50;
-#X msg 439 227 reattack 100 10;
-#X msg 438 282 npartial 7;
-#X msg 438 170 vibrato 50 0.5;
-#X text 560 91 a low and high amplitude threshold: if signal amplitude
-is below the low threshold \, no pitches or peaks are output. The high
-threshold is a minimum at which "cooked" outputs may appear.;
-#X text 560 152 A period in milliseconds (50) over which the raw pitch
-may not deviate more than an interval in half-tones (0.5) from the
-average pitch to report it as a note to the "cooked" pitch outlet.
-;
-#X text 560 213 A period in milliseconds (100) over which a re-attack
-is reported if the amplitude rises more than (1) dB. The re-attack
-will result in a "bang" in the attack outlet and may give rise to repeated
-notes in the cooked pitch output.;
-#X text 142 432 test input pitch;
-#X text 330 444 test input;
-#X text 330 457 amplitude;
-#X obj 410 545 fiddle~ 1024 1 20 3;
-#X text 538 690 individual sinusoidal components;
-#X text 466 688 amplitude;
-#X text 476 703 (dB);
-#X text 389 688 raw pitch;
-#X text 376 712 and amplitude;
-#X text 364 729 (up to 3 outputs);
-#X text 287 686 bang on;
-#X text 287 708 attack;
-#X text 185 686 cooked pitch;
-#X text 202 703 output;
-#X text 545 545 ------ arguments:;
-#X msg 262 412 57;
-#X msg 440 331 auto 1;
-#X msg 440 353 auto 0;
-#X msg 439 418 bang;
-#X text 561 416 poll current values --- useful if not in auto mode
-\,;
-#X text 560 274 Higher partials are weighed less strongly than lower
-ones in determining the pitch. This specifies the number of the partial
-(7) which will be weighted half as strongly as the fundamental.;
-#X text 560 335 start and stop "auto" mode (on by default.) If off
-\, output only appears on "bang" (poll mode).;
-#X text 561 448 print out all settings;
-#X text 669 513 window size (128-2048 \, default 1024);
-#X msg 440 375 npoints 2048;
-#X text 562 384 number of points in analysis window (power of 2 \,
-128-2048);
-#X msg 439 396 npoints 1024;
-#X connect 0 0 19 0;
-#X connect 1 0 2 0;
-#X connect 1 1 8 0;
-#X connect 3 0 48 0;
-#X connect 4 0 0 0;
-#X connect 5 0 4 0;
-#X connect 6 0 5 0;
-#X connect 7 0 6 0;
-#X connect 9 0 1 0;
-#X connect 9 1 10 0;
-#X connect 9 2 13 0;
-#X connect 10 0 11 0;
-#X connect 10 1 12 0;
-#X connect 13 0 14 0;
-#X connect 13 1 15 0;
-#X connect 16 0 17 0;
-#X connect 16 1 18 0;
-#X connect 19 0 48 0;
-#X connect 20 0 60 0;
-#X connect 20 0 23 0;
-#X connect 21 0 19 1;
-#X connect 22 0 21 0;
-#X connect 23 0 22 0;
-#X connect 24 0 22 0;
-#X connect 38 0 48 0;
-#X connect 39 0 48 0;
-#X connect 40 0 48 0;
-#X connect 41 0 48 0;
-#X connect 48 0 27 0;
-#X connect 48 1 26 0;
-#X connect 48 2 16 0;
-#X connect 48 3 25 0;
-#X connect 48 4 9 0;
-#X connect 60 0 7 0;
-#X connect 61 0 48 0;
-#X connect 62 0 48 0;
-#X connect 63 0 48 0;
-#X connect 69 0 48 0;
-#X connect 71 0 48 0;
diff --git a/externals/extra/0.43.3/0.43.2/fiddle~/fiddle~.c b/externals/extra/0.43.3/0.43.2/fiddle~/fiddle~.c
deleted file mode 100644
index ea676784..00000000
--- a/externals/extra/0.43.3/0.43.2/fiddle~/fiddle~.c
+++ /dev/null
@@ -1,1851 +0,0 @@
-/* Copyright (c) 1997-1999 Miller Puckette and Ted Apel.
-* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-
-/*
- * Fiddle is a pitch tracker hardwired to have hop size ("H") equal to
- * half its window size ("N").
- *
- * This version should compile for Max "0.26," JMAX, Pd, or Max/MSP.
- *
- * The "lastanalysis" field holds the shifted FT of the previous H
- * samples. The buffer contains in effect points 1/2, 3/2, ..., (N-1)/2
- * of the DTFT of a real vector of length N, half of whose points are zero,
- * i.e., only the first H points are used. Put another way, we get the
- * the odd-numbered points of the FFT of the H points, zero padded to 4*H in
- * length. The integer points 0, 1, ..., H-1
- * are found by interpolating these others, using the fact that the
- * half-integer points are band-limited (they only have positive frequencies.)
- * To facilitate the interpolation the "lastanalysis" buffer contains
- * FILTSIZE extra points (1/2-FILTSIZE, ..., -1/2) at the beginning and
- * FILTSIZE again at the end ((N+1)/2, ..., FILTSIZE+(N-1)/2). The buffer
- * therefore has N+4*FILTSIZE floating-point numbers in it.
- *
- * after doing this I found out that you can just do a real FFT
- * of the H new points, zero-padded to contain N points, and using a similar
- * but simpler interpolation scheme you can still get 2N points of the DTFT
- * of the N points. Jean Laroche is a big fat hen.
- *
- */
-
-
-/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
-#ifdef _MSC_VER
-#pragma warning (disable: 4305 4244)
-#endif
-
-/* this #ifdef does nothing, but its there... */
-#ifdef _WIN32
-#define flog log
-#define fexp exp
-#define fsqrt sqrt
-#else
-#define flog log
-#define fexp exp
-#define fsqrt sqrt
-#endif
-
-char fiddle_version[] = "fiddle version 1.1 TEST4";
-
-#ifdef JMAX
-#include "fts.h"
-#include <stdio.h>
-#include <stdlib.h>
-typedef float t_float;
-typedef float t_floatarg;
-typedef fts_symbol_t t_symbol;
-
-static void *getbytes(size_t nbytes)
-{
- void *ret;
- if (nbytes < 1) nbytes = 1;
- ret = (void *)malloc(nbytes);
- return (ret);
-}
-
-static void *resizebytes(void *old, size_t oldsize, size_t newsize)
-{
- void *ret;
- if (newsize < 1) newsize = 1;
- ret = (void *)realloc((char *)old, newsize);
- return (ret);
-}
-
-static void freebytes(void *fatso, size_t nbytes)
-{
- free(fatso);
-}
-
-#define CLASSNAME "fiddle"
-
-#define OUTLETpower 5
-#define OUTLETmicropitch1 4
-#define OUTLETmicropitch2 3
-#define OUTLETmicropitch3 2
-#define OUTLETattack 1
-#define OUTLETpitch 0
-
-static fts_symbol_t *dsp_symbol = 0;
-#define error post
-
-#endif /* FTS */
-
-#ifdef MAX26
-#define t_floatarg double
-#include "m_extern.h"
-#include "d_graph.h"
-#include "d_ugen.h"
-#endif /* MAX26 */
-
-#ifdef PD
-#include "m_pd.h"
-#endif /* PD */
-
-#ifdef MSP
-#define flog log
-#define fexp exp
-#define fsqrt sqrt
-#endif /* MSP */
-
-#ifdef MSP
-#define t_floatarg double
-#include "ext.h"
-#include "z_dsp.h"
-#include "fft_mayer.proto.h"
-
-#endif /* MSP */
-
-#include <math.h>
-
-
-#define MINBIN 3
-#define DEFAMPLO 40
-#define DEFAMPHI 50
-#define DEFATTACKTIME 100
-#define DEFATTACKTHRESH 10
-#define DEFVIBTIME 50
-#define DEFVIBDEPTH 0.5
-#define GLISS 0.7f
-#define DBFUDGE 30.8f
-#define MINFREQINBINS 5 /* minimum frequency in bins for reliable output */
-
-#define MAXNPITCH 3
-#define MAXHIST 3 /* find N hottest peaks in histogram */
-
-#define MAXPOINTS 8192
-#define MINPOINTS 128
-#define DEFAULTPOINTS 1024
-
-#define HISTORY 20
-#define MAXPEAK 100 /* maximum number of peaks */
-#define DEFNPEAK 20 /* default number of peaks */
-
-#define MAXNPEAK (MAXLOWPEAK + MAXSTRONGPEAK)
-#define MINBW (0.03f) /* consider BW >= 0.03 FFT bins */
-
-#define BINPEROCT 48 /* bins per octave */
-#define BPERO_OVER_LOG2 69.24936196f /* BINSPEROCT/log(2) */
-#define FACTORTOBINS (t_float)(4/0.0145453) /* 4 / (pow(2.,1/48.) - 1) */
-#define BINGUARD 10 /* extra bins to throw in front */
-#define PARTIALDEVIANCE 0.023f /* acceptable partial detuning in % */
-#define LOGTODB 4.34294481903f /* 20/log(10) */
-
-#define KNOCKTHRESH 10.f /* don't know how to describe this */
-
-
-static t_float sigfiddle_partialonset[] =
-{
-0,
-48,
-76.0782000346154967102,
-96,
-111.45254855459339269887,
-124.07820003461549671089,
-134.75303625876499715823,
-144,
-152.15640006923099342109,
-159.45254855459339269887,
-166.05271769459026829915,
-172.07820003461549671088,
-177.62110647077242370064,
-182.75303625876499715892,
-187.53074858920888940907,
-192,
-};
-
-#define NPARTIALONSET ((int)(sizeof(sigfiddle_partialonset)/sizeof(t_float)))
-
-static int sigfiddle_intpartialonset[] =
-{
-0,
-48,
-76,
-96,
-111,
-124,
-135,
-144,
-152,
-159,
-166,
-172,
-178,
-183,
-188,
-192,
-};
-
-/* these coefficients, which come from the "upsamp" subdirectory,
-are a filter kernel for upsampling by a factor of two, assuming
-the sound to be upsampled has no energy above half the Nyquist, i.e.,
-that it's already 2x oversampled compared to the theoretically possible
-sample rate. I got these by trial and error. */
-
-#define FILT1 ((t_float)(.5 * 1.227054))
-#define FILT2 ((t_float)(.5 * -0.302385))
-#define FILT3 ((t_float)(.5 * 0.095326))
-#define FILT4 ((t_float)(.5 * -0.022748))
-#define FILT5 ((t_float)(.5 * 0.002533))
-#define FILTSIZE 5
-
-typedef struct peakout /* a peak for output */
-{
- t_float po_freq; /* frequency in hz */
- t_float po_amp; /* amplitude */
-} t_peakout;
-
-typedef struct peak /* a peak for analysis */
-{
- t_float p_freq; /* frequency in bins */
- t_float p_width; /* peak width in bins */
- t_float p_pow; /* peak power */
- t_float p_loudness; /* 4th root of power */
- t_float *p_fp; /* pointer back to spectrum */
-} t_peak;
-
-typedef struct histopeak
-{
- t_float h_pitch; /* estimated pitch */
- t_float h_value; /* value of peak */
- t_float h_loud; /* combined strength of found partials */
- int h_index; /* index of bin holding peak */
- int h_used; /* true if an x_hist entry points here */
-} t_histopeak;
-
-typedef struct pitchhist /* struct for keeping history by pitch */
-{
- t_float h_pitch; /* pitch to output */
- t_float h_amps[HISTORY]; /* past amplitudes */
- t_float h_pitches[HISTORY]; /* past pitches */
- t_float h_noted; /* last pitch output */
- int h_age; /* number of frames pitch has been there */
- t_histopeak *h_wherefrom; /* new histogram peak to incorporate */
- void *h_outlet;
-} t_pitchhist;
-
-typedef struct sigfiddle /* instance struct */
-{
-#ifdef JMAX
- fts_object_t x_h; /* object header */
- fts_alarm_t x_clock; /* callback for timeouts */
-#endif
-#ifdef MAX26
- t_head x_h; /* header for tilde objects */
- t_sig *x_io[IN1+OUT0]; /* number of signal inputs and outputs */
- void *x_clock; /* a "clock" object */
-#endif
-#ifdef PD
- t_object x_ob; /* object header */
- t_clock *x_clock; /* callback for timeouts */
-#endif
-#ifdef MSP
- t_pxobject x_obj;
- void *x_clock;
- long x_downsample; /* downsample feature because of
- MSP's large sig vector sizes */
-#endif
- t_float *x_inbuf; /* buffer to analyze, npoints/2 elems */
- t_float *x_lastanalysis; /* FT of last buffer (see main comment) */
- t_float *x_spiral; /* 1/4-wave complex exponential */
- t_peakout *x_peakbuf; /* spectral peaks for output */
- int x_npeakout; /* number of spectral peaks to output */
- int x_npeakanal; /* number of spectral peaks to analyze */
- int x_phase; /* number of points since last output */
- int x_histphase; /* phase into amplitude history vector */
- int x_hop; /* period of output, npoints/2 */
- t_float x_sr; /* sample rate */
- t_pitchhist x_hist[MAXNPITCH]; /* history of current pitches */
- int x_nprint; /* how many periods to print */
- int x_npitch; /* number of simultaneous pitches */
- t_float x_dbs[HISTORY]; /* DB history, indexed by "histphase" */
- t_float x_peaked; /* peak since last attack */
- int x_dbage; /* number of bins DB has met threshold */
- int x_auto; /* true if generating continuous output */
-/* parameters */
- t_float x_amplo;
- t_float x_amphi;
- int x_attacktime;
- int x_attackbins;
- t_float x_attackthresh;
- int x_vibtime;
- int x_vibbins;
- t_float x_vibdepth;
- t_float x_npartial;
-/* outlets & clock */
- void *x_envout;
- int x_attackvalue;
- void *x_attackout;
- void *x_noteout;
- void *x_peakout;
-} t_sigfiddle;
-
-#if CHECKER
-t_float fiddle_checker[1024];
-#endif
-
-#ifdef MSP
-/* Mac compiler requires prototypes for everything */
-
-int sigfiddle_ilog2(int n);
-t_float fiddle_mtof(t_float f);
-t_float fiddle_ftom(t_float f);
-void sigfiddle_doit(t_sigfiddle *x);
-void sigfiddle_debug(t_sigfiddle *x);
-void sigfiddle_print(t_sigfiddle *x);
-void sigfiddle_assist(t_sigfiddle *x, void *b, long m, long a, char *s);
-void sigfiddle_amprange(t_sigfiddle *x, double amplo, double amphi);
-void sigfiddle_reattack(t_sigfiddle *x, t_floatarg attacktime, t_floatarg
-attackthresh);
-void sigfiddle_vibrato(t_sigfiddle *x, t_floatarg vibtime, t_floatarg
-vibdepth);
-void sigfiddle_npartial(t_sigfiddle *x, double npartial);
-void sigfiddle_auto(t_sigfiddle *x, t_floatarg f);
-void sigfiddle_setnpoints(t_sigfiddle *x, t_floatarg f);
-int sigfiddle_doinit(t_sigfiddle *x, long npoints, long npitch, long
-npeakanal, long npeakout);
-static t_int *fiddle_perform(t_int *w);
-void sigfiddle_dsp(t_sigfiddle *x, t_signal **sp);
-void sigfiddle_tick(t_sigfiddle *x);
-void sigfiddle_bang(t_sigfiddle *x);
-void sigfiddle_ff(t_sigfiddle *x);
-void *sigfiddle_new(long npoints, long npitch,
- long npeakanal, long npeakout);
-void msp_fft(t_float *buf, long np, long inv);
-t_float msp_ffttemp[MAXPOINTS*2];
-int errno;
-#endif
-
-int sigfiddle_ilog2(int n)
-{
- int ret = -1;
- while (n)
- {
- n >>= 1;
- ret++;
- }
- return (ret);
-}
-
-t_float fiddle_mtof(t_float f)
-{
- return (8.17579891564 * exp(.0577622650 * f));
-}
-
-t_float fiddle_ftom(t_float f)
-{
- return (17.3123405046 * log(.12231220585 * f));
-}
-#define ftom fiddle_ftom
-#define mtof fiddle_mtof
-
-void sigfiddle_doit(t_sigfiddle *x)
-{
-#ifdef MSP
- /* prevents interrupt-level stack overflow crash with Netscape. */
- static t_float spect1[4*MAXPOINTS];
- static t_float spect2[MAXPOINTS + 4*FILTSIZE];
-#else
- t_float spect1[4*MAXPOINTS];
- t_float spect2[MAXPOINTS + 4*FILTSIZE];
-#endif
-#if CHECKER
- t_float checker3[4*MAXPOINTS];
-#endif
-
- t_peak peaklist[MAXPEAK + 1], *pk1;
- t_peakout *pk2;
- t_histopeak histvec[MAXHIST], *hp1;
- int i, j, k, hop = x->x_hop, n = 2*hop, npeak, npitch,
- logn = sigfiddle_ilog2(n), newphase, oldphase;
- t_float *fp, *fp1, *fp2, *fp3, total_power, total_loudness, total_db;
- t_float maxbin = BINPEROCT * (logn-2), *histogram = spect2 + BINGUARD;
- t_pitchhist *phist;
- t_float hzperbin = x->x_sr / (2.0f * n);
- int npeakout = x->x_npeakout, npeakanal = x->x_npeakanal;
- int npeaktot = (npeakout > npeakanal ? npeakout : npeakanal);
-
- oldphase = x->x_histphase;
- newphase = x->x_histphase + 1;
- if (newphase == HISTORY) newphase = 0;
- x->x_histphase = newphase;
-
- /*
- * multiply the H points by a 1/4-wave complex exponential,
- * and take FFT of the result.
- */
- for (i = 0, fp1 = x->x_inbuf, fp2 = x->x_spiral, fp3 = spect1;
- i < hop; i++, fp1++, fp2 += 2, fp3 += 2)
- fp3[0] = fp1[0] * fp2[0], fp3[1] = fp1[0] * fp2[1];
-
-#ifdef MAX26
- fft(spect1, hop, 0);
-#endif
-#ifdef PD
- pd_fft(spect1, hop, 0);
-#endif
-#ifdef JMAX
- fts_cfft_inplc((complex *)spect1, hop);
-#endif
-#ifdef MSP
- msp_fft(spect1,hop,0);
-#endif
- /*
- * now redistribute the points to get in effect the odd-numbered
- * points of the FFT of the H points, zero padded to 4*H in length.
- */
- for (i = 0, fp1 = spect1, fp2 = spect2 + (2*FILTSIZE);
- i < (hop>>1); i++, fp1 += 2, fp2 += 4)
- fp2[0] = fp1[0], fp2[1] = fp1[1];
- for (i = 0, fp1 = spect1 + n - 2, fp2 = spect2 + (2*FILTSIZE+2);
- i < (hop>>1); i++, fp1 -= 2, fp2 += 4)
- fp2[0] = fp1[0], fp2[1] = -fp1[1];
- for (i = 0, fp1 = spect2 + (2*FILTSIZE), fp2 = spect2 + (2*FILTSIZE-2);
- i<FILTSIZE; i++, fp1+=2, fp2-=2)
- fp2[0] = fp1[0], fp2[1] = -fp1[1];
- for (i = 0, fp1 = spect2 + (2*FILTSIZE+n-2), fp2 = spect2 + (2*FILTSIZE+n);
- i<FILTSIZE; i++, fp1-=2, fp2+=2)
- fp2[0] = fp1[0], fp2[1] = -fp1[1];
-#if 0
- {
- fp = spect2 + 2*FILTSIZE;
- post("x1 re %12.4f %12.4f %12.4f %12.4f %12.4f",
- fp[0], fp[2], fp[4], fp[6], fp[8]);
- post("x1 im %12.4f %12.4f %12.4f %12.4f %12.4f",
- fp[1], fp[3], fp[5], fp[7], fp[9]);
- }
-#endif
- /* spect2 is now prepared; now combine spect2 and lastanalysis into
- * spect1. Odd-numbered points of spect1 are the points of "last"
- * plus (-i, i, -i, ...) times spect1. Even-numbered points are
- * the interpolated points of "last" plus (1, -1, 1, ...) times the
- * interpolated points of spect1.
- *
- * To interpolate, take FILT1 exp(-pi/4) times
- * the previous point, FILT2*exp(-3*pi/4) times 3 bins before,
- * etc, and FILT1 exp(pi/4), FILT2 exp(3pi/4), etc., to weight
- * the +1, +3, etc., points.
- *
- * In this calculation, we take (1, i, -1, -i, 1) times the
- * -9, -7, ..., -1 points, and (i, -1, -i, 1, i) times the 1, 3,..., 9
- * points of the OLD spectrum, alternately adding and subtracting
- * the new spectrum to the old; then we multiply the whole thing
- * by exp(-i pi/4).
- */
- for (i = 0, fp1 = spect1, fp2 = x->x_lastanalysis + 2*FILTSIZE,
- fp3 = spect2 + 2*FILTSIZE;
- i < (hop>>1); i++)
- {
- t_float re, im;
-
- re= FILT1 * ( fp2[ -2] -fp2[ 1] +fp3[ -2] -fp3[ 1]) +
- FILT2 * ( fp2[ -3] -fp2[ 2] +fp3[ -3] -fp3[ 2]) +
- FILT3 * (-fp2[ -6] +fp2[ 5] -fp3[ -6] +fp3[ 5]) +
- FILT4 * (-fp2[ -7] +fp2[ 6] -fp3[ -7] +fp3[ 6]) +
- FILT5 * ( fp2[-10] -fp2[ 9] +fp3[-10] -fp3[ 9]);
-
- im= FILT1 * ( fp2[ -1] +fp2[ 0] +fp3[ -1] +fp3[ 0]) +
- FILT2 * (-fp2[ -4] -fp2[ 3] -fp3[ -4] -fp3[ 3]) +
- FILT3 * (-fp2[ -5] -fp2[ 4] -fp3[ -5] -fp3[ 4]) +
- FILT4 * ( fp2[ -8] +fp2[ 7] +fp3[ -8] +fp3[ 7]) +
- FILT5 * ( fp2[ -9] +fp2[ 8] +fp3[ -9] +fp3[ 8]);
-
- fp1[0] = 0.7071f * (re + im);
- fp1[1] = 0.7071f * (im - re);
- fp1[4] = fp2[0] + fp3[1];
- fp1[5] = fp2[1] - fp3[0];
-
- fp1 += 8, fp2 += 2, fp3 += 2;
- re= FILT1 * ( fp2[ -2] -fp2[ 1] -fp3[ -2] +fp3[ 1]) +
- FILT2 * ( fp2[ -3] -fp2[ 2] -fp3[ -3] +fp3[ 2]) +
- FILT3 * (-fp2[ -6] +fp2[ 5] +fp3[ -6] -fp3[ 5]) +
- FILT4 * (-fp2[ -7] +fp2[ 6] +fp3[ -7] -fp3[ 6]) +
- FILT5 * ( fp2[-10] -fp2[ 9] -fp3[-10] +fp3[ 9]);
-
- im= FILT1 * ( fp2[ -1] +fp2[ 0] -fp3[ -1] -fp3[ 0]) +
- FILT2 * (-fp2[ -4] -fp2[ 3] +fp3[ -4] +fp3[ 3]) +
- FILT3 * (-fp2[ -5] -fp2[ 4] +fp3[ -5] +fp3[ 4]) +
- FILT4 * ( fp2[ -8] +fp2[ 7] -fp3[ -8] -fp3[ 7]) +
- FILT5 * ( fp2[ -9] +fp2[ 8] -fp3[ -9] -fp3[ 8]);
-
- fp1[0] = 0.7071f * (re + im);
- fp1[1] = 0.7071f * (im - re);
- fp1[4] = fp2[0] - fp3[1];
- fp1[5] = fp2[1] + fp3[0];
-
- fp1 += 8, fp2 += 2, fp3 += 2;
- }
-#if 0
- if (x->x_nprint)
- {
- for (i = 0, fp = spect1; i < 16; i++, fp+= 4)
- post("spect %d %f %f --> %f", i, fp[0], fp[1],
- sqrt(fp[0] * fp[0] + fp[1] * fp[1]));
- }
-#endif
- /* copy new spectrum out */
- for (i = 0, fp1 = spect2, fp2 = x->x_lastanalysis;
- i < n + 4*FILTSIZE; i++) *fp2++ = *fp1++;
-
- for (i = 0; i < MINBIN; i++) spect1[4*i + 2] = spect1[4*i + 3] = 0;
- /* starting at bin MINBIN, compute hanning windowed power spectrum */
- for (i = MINBIN, fp1 = spect1+4*MINBIN, total_power = 0;
- i < n-2; i++, fp1 += 4)
- {
- t_float re = fp1[0] - 0.5 * (fp1[-8] + fp1[8]);
- t_float im = fp1[1] - 0.5 * (fp1[-7] + fp1[9]);
- fp1[3] = (total_power += (fp1[2] = re * re + im * im));
- }
-
- if (total_power > 1e-9f)
- {
- total_db = (100.f - DBFUDGE) + LOGTODB * log(total_power/n);
- total_loudness = fsqrt(fsqrt(total_power));
- if (total_db < 0) total_db = 0;
- }
- else total_db = total_loudness = 0;
- /* store new db in history vector */
- x->x_dbs[newphase] = total_db;
- if (total_db < x->x_amplo) goto nopow;
-#if 1
- if (x->x_nprint) post("power %f", total_power);
-#endif
-
-#if CHECKER
- /* verify that our FFT resampling thing is putting out good results */
- for (i = 0; i < hop; i++)
- {
- checker3[2*i] = fiddle_checker[i];
- checker3[2*i + 1] = 0;
- checker3[n + 2*i] = fiddle_checker[i] = x->x_inbuf[i];
- checker3[n + 2*i + 1] = 0;
- }
- for (i = 2*n; i < 4*n; i++) checker3[i] = 0;
- fft(checker3, 2*n, 0);
- if (x->x_nprint)
- {
- for (i = 0, fp = checker3; i < 16; i++, fp += 2)
- post("spect %d %f %f --> %f", i, fp[0], fp[1],
- sqrt(fp[0] * fp[0] + fp[1] * fp[1]));
- }
-
-#endif
- npeak = 0;
-
- /* search for peaks */
- for (i = MINBIN, fp = spect1+4*MINBIN, pk1 = peaklist;
- i < n-2 && npeak < npeaktot; i++, fp += 4)
- {
- t_float height = fp[2], h1 = fp[-2], h2 = fp[6];
- t_float totalfreq, pfreq, f1, f2, m, var, stdev;
-
- if (height < h1 || height < h2 ||
- h1 < 0.00001f*total_power || h2 < 0.00001f*total_power)
- continue;
-
- /* use an informal phase vocoder to estimate the frequency.
- Do this for the two adjacent bins too. */
- pfreq= ((fp[-8] - fp[8]) * (2.0f * fp[0] - fp[8] - fp[-8]) +
- (fp[-7] - fp[9]) * (2.0f * fp[1] - fp[9] - fp[-7])) /
- (2.0f * height);
- f1= ((fp[-12] - fp[4]) * (2.0f * fp[-4] - fp[4] - fp[-12]) +
- (fp[-11] - fp[5]) * (2.0f * fp[-3] - fp[5] - fp[-11])) /
- (2.0f * h1) - 1;
- f2= ((fp[-4] - fp[12]) * (2.0f * fp[4] - fp[12] - fp[-4]) +
- (fp[-3] - fp[13]) * (2.0f * fp[5] - fp[13] - fp[-3])) /
- (2.0f * h2) + 1;
-
- /* get sample mean and variance of the three */
- m = 0.333333f * (pfreq + f1 + f2);
- var = 0.5f * ((pfreq-m)*(pfreq-m) + (f1-m)*(f1-m) + (f2-m)*(f2-m));
-
- totalfreq = i + m;
- if (var * total_power > KNOCKTHRESH * height || var < 1e-30)
- {
-#if 0
- if (x->x_nprint)
- post("cancel: %.2f hz, index %.1f, power %.5f, stdev=%.2f",
- totalfreq * hzperbin, BPERO_OVER_LOG2 * log(totalfreq) - 96,
- height, sqrt(var));
-#endif
- continue;
- }
- stdev = fsqrt(var);
- if (totalfreq < 4)
- {
- if (x->x_nprint) post("oops: was %d, freq %f, m %f, stdev %f h %f",
- i, totalfreq, m, stdev, height);
- totalfreq = 4;
- }
- pk1->p_width = stdev;
-
- pk1->p_pow = height;
- pk1->p_loudness = fsqrt(fsqrt(height));
- pk1->p_fp = fp;
- pk1->p_freq = totalfreq;
- npeak++;
-#if 1
- if (x->x_nprint)
- {
- post("peak: %.2f hz. index %.1f, power %.5f, stdev=%.2f",
- pk1->p_freq * hzperbin,
- BPERO_OVER_LOG2 * log(pk1->p_freq) - 96,
- height, stdev);
- }
-#endif
- pk1++;
- }
-
- /* prepare the raw peaks for output */
- for (i = 0, pk1 = peaklist, pk2 = x->x_peakbuf; i < npeak;
- i++, pk1++, pk2++)
- {
- t_float loudness = pk1->p_loudness;
- if (i >= npeakout) break;
- pk2->po_freq = hzperbin * pk1->p_freq;
- pk2->po_amp = (2. / (t_float)n) * (loudness * loudness);
- }
- for (; i < npeakout; i++, pk2++) pk2->po_amp = pk2->po_freq = 0;
-
- /* now, working back into spect2, make a sort of "liklihood"
- * spectrum. Proceeding in 48ths of an octave, from 2 to
- * n/2 (in bins), the likelihood of each pitch range is contributed
- * to by every peak in peaklist that's an integer multiple of it
- * in frequency.
- */
-
- if (npeak > npeakanal) npeak = npeakanal; /* max # peaks to analyze */
- for (i = 0, fp1 = histogram; i < maxbin; i++) *fp1++ = 0;
- for (i = 0, pk1 = peaklist; i < npeak; i++, pk1++)
- {
- t_float pit = BPERO_OVER_LOG2 * flog(pk1->p_freq) - 96.0;
- t_float binbandwidth = FACTORTOBINS * pk1->p_width/pk1->p_freq;
- t_float putbandwidth = (binbandwidth < 2 ? 2 : binbandwidth);
- t_float weightbandwidth = (binbandwidth < 1.0 ? 1.0 : binbandwidth);
- /* t_float weightamp = 1.0f + 3.0f * pk1->p_pow / pow; */
- t_float weightamp = 4. * pk1->p_loudness / total_loudness;
- for (j = 0, fp2 = sigfiddle_partialonset; j < NPARTIALONSET; j++, fp2++)
- {
- t_float bin = pit - *fp2;
- if (bin < maxbin)
- {
- t_float para, pphase, score = 30.0 * weightamp /
- ((j+x->x_npartial) * weightbandwidth);
- int firstbin = bin + 0.5f - 0.5f * putbandwidth;
- int lastbin = bin + 0.5f + 0.5f * putbandwidth;
- int ibw = lastbin - firstbin;
- if (firstbin < -BINGUARD) break;
- para = 1.0f / (putbandwidth * putbandwidth);
- for (k = 0, fp3 = histogram + firstbin,
- pphase = firstbin-bin; k <= ibw;
- k++, fp3++, pphase += 1.0f)
- {
- *fp3 += score * (1.0f - para * pphase * pphase);
- }
- }
- }
- }
-#if 1
- if (x->x_nprint)
- {
- for (i = 0; i < 6*5; i++)
- {
- t_float fhz = hzperbin * exp ((8*i + 96) * (1./BPERO_OVER_LOG2));
- if (!(i % 6)) post("-- bin %d pitch %f freq %f----", 8*i,
- ftom(fhz), fhz);;
- post("%3d %3d %3d %3d %3d %3d %3d %3d",
- (int)(histogram[8*i]),
- (int)(histogram[8*i+1]),
- (int)(histogram[8*i+2]),
- (int)(histogram[8*i+3]),
- (int)(histogram[8*i+4]),
- (int)(histogram[8*i+5]),
- (int)(histogram[8*i+6]),
- (int)(histogram[8*i+7]));
- }
- }
-
-#endif
-
- /*
- * Next we find up to NPITCH strongest peaks in the histogram.
- * if a peak is related to a stronger one via an interval in
- * the sigfiddle_partialonset array, we suppress it.
- */
-
- for (npitch = 0; npitch < x->x_npitch; npitch++)
- {
- int indx;
- t_float best;
- if (npitch)
- {
- for (best = 0, indx = -1, j=1; j < maxbin-1; j++)
- {
- if (histogram[j] > best && histogram[j] > histogram[j-1] &&
- histogram[j] > histogram[j+1])
- {
- for (k = 0; k < npitch; k++)
- if (histvec[k].h_index == j)
- goto peaknogood;
- for (k = 0; k < NPARTIALONSET; k++)
- {
- if (j - sigfiddle_intpartialonset[k] < 0) break;
- if (histogram[j - sigfiddle_intpartialonset[k]]
- > histogram[j]) goto peaknogood;
- }
- for (k = 0; k < NPARTIALONSET; k++)
- {
- if (j + sigfiddle_intpartialonset[k] >= maxbin) break;
- if (histogram[j + sigfiddle_intpartialonset[k]]
- > histogram[j]) goto peaknogood;
- }
- indx = j;
- best = histogram[j];
- }
- peaknogood: ;
- }
- }
- else
- {
- for (best = 0, indx = -1, j=0; j < maxbin; j++)
- if (histogram[j] > best)
- indx = j, best = histogram[j];
- }
- if (indx < 0) break;
- histvec[npitch].h_value = best;
- histvec[npitch].h_index = indx;
- }
-#if 1
- if (x->x_nprint)
- {
- for (i = 0; i < npitch; i++)
- {
- post("index %d freq %f --> value %f", histvec[i].h_index,
- exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 96)),
- histvec[i].h_value);
- post("next %f , prev %f",
- exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 97)),
- exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 95)) );
- }
- }
-#endif
-
- /* for each histogram peak, we now search back through the
- * FFT peaks. A peak is a pitch if either there are several
- * harmonics that match it, or else if (a) the fundamental is
- * present, and (b) the sum of the powers of the contributing peaks
- * is at least 1/100 of the total power.
- *
- * A peak is a contributor if its frequency is within 25 cents of
- * a partial from 1 to 16.
- *
- * Finally, we have to be at least 5 bins in frequency, which
- * corresponds to 2-1/5 periods fitting in the analysis window.
- */
-
- for (i = 0; i < npitch; i++)
- {
- t_float cumpow = 0, cumstrength = 0, freqnum = 0, freqden = 0;
- int npartials = 0, nbelow8 = 0;
- /* guessed-at frequency in bins */
- t_float putfreq = fexp((1.0 / BPERO_OVER_LOG2) *
- (histvec[i].h_index + 96.0f));
- for (j = 0; j < npeak; j++)
- {
- t_float fpnum = peaklist[j].p_freq/putfreq;
- int pnum = fpnum + 0.5f;
- t_float fipnum = pnum;
- t_float deviation;
- if (pnum > 16 || pnum < 1) continue;
- deviation = 1.0f - fpnum/fipnum;
- if (deviation > -PARTIALDEVIANCE && deviation < PARTIALDEVIANCE)
- {
- /*
- * we figure this is a partial since it's within 1/4 of
- * a halftone of a multiple of the putative frequency.
- */
-
- t_float stdev, weight;
- npartials++;
- if (pnum < 8) nbelow8++;
- cumpow += peaklist[j].p_pow;
- cumstrength += fsqrt(fsqrt(peaklist[j].p_pow));
- stdev = (peaklist[j].p_width > MINBW ?
- peaklist[j].p_width : MINBW);
- weight = 1.0f / ((stdev*fipnum) * (stdev*fipnum));
- freqden += weight;
- freqnum += weight * peaklist[j].p_freq/fipnum;
-#if 1
- if (x->x_nprint)
- {
- post("peak %d partial %d f=%f w=%f",
- j, pnum, peaklist[j].p_freq/fipnum, weight);
- }
-#endif
- }
-#if 1
- else if (x->x_nprint) post("peak %d partial %d dev %f",
- j, pnum, deviation);
-#endif
- }
- if ((nbelow8 < 4 || npartials < 7) && cumpow < 0.01f * total_power)
- histvec[i].h_value = 0;
- else
- {
- t_float pitchpow = (cumstrength * cumstrength) *
- (cumstrength * cumstrength);
- t_float freqinbins = freqnum/freqden;
- /* check for minimum output frequency */
-
- if (freqinbins < MINFREQINBINS)
- histvec[i].h_value = 0;
- else
- {
- /* we passed all tests... save the values we got */
- histvec[i].h_pitch = ftom(hzperbin * freqnum/freqden);
- histvec[i].h_loud = (100.0f -DBFUDGE) +
- (LOGTODB) * log(pitchpow/n);
- }
- }
- }
-#if 1
- if (x->x_nprint)
- {
- for (i = 0; i < npitch; i++)
- {
- if (histvec[i].h_value > 0)
- post("index %d pit %f loud %f", histvec[i].h_index,
- histvec[i].h_pitch, histvec[i].h_loud);
- else post("-- cancelled --");
- }
- }
-#endif
-
- /* now try to find continuous pitch tracks that match the new
- * pitches. First mark each peak unmatched.
- */
- for (i = 0, hp1 = histvec; i < npitch; i++, hp1++)
- hp1->h_used = 0;
-
- /* for each old pitch, try to match a new one to it. */
- for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
- {
- t_float thispitch = phist->h_pitches[oldphase];
- phist->h_pitch = 0; /* no output, thanks */
- phist->h_wherefrom = 0;
- if (thispitch == 0.0f) continue;
- for (j = 0, hp1 = histvec; j < npitch; j++, hp1++)
- if ((hp1->h_value > 0) && hp1->h_pitch > thispitch - GLISS
- && hp1->h_pitch < thispitch + GLISS)
- {
- phist->h_wherefrom = hp1;
- hp1->h_used = 1;
- }
- }
- for (i = 0, hp1 = histvec; i < npitch; i++, hp1++)
- if ((hp1->h_value > 0) && !hp1->h_used)
- {
- for (j = 0, phist = x->x_hist; j < x->x_npitch; j++, phist++)
- if (!phist->h_wherefrom)
- {
- phist->h_wherefrom = hp1;
- phist->h_age = 0;
- phist->h_noted = 0;
- hp1->h_used = 1;
- goto happy;
- }
- break;
- happy: ;
- }
- /* copy the pitch info into the history vector */
- for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
- {
- if (phist->h_wherefrom)
- {
- phist->h_amps[newphase] = phist->h_wherefrom->h_loud;
- phist->h_pitches[newphase] =
- phist->h_wherefrom->h_pitch;
- (phist->h_age)++;
- }
- else
- {
- phist->h_age = 0;
- phist->h_amps[newphase] = phist->h_pitches[newphase] = 0;
- }
- }
-#if 1
- if (x->x_nprint)
- {
- post("vibrato %d %f", x->x_vibbins, x->x_vibdepth);
- for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
- {
- post("noted %f, age %d", phist->h_noted, phist->h_age);
-#ifndef I860
- post("values %f %f %f %f %f",
- phist->h_pitches[newphase],
- phist->h_pitches[(newphase + HISTORY-1)%HISTORY],
- phist->h_pitches[(newphase + HISTORY-2)%HISTORY],
- phist->h_pitches[(newphase + HISTORY-3)%HISTORY],
- phist->h_pitches[(newphase + HISTORY-4)%HISTORY]);
-#endif
- }
- }
-#endif
- /* look for envelope attacks */
-
- x->x_attackvalue = 0;
-
- if (x->x_peaked)
- {
- if (total_db > x->x_amphi)
- {
- int binlook = newphase - x->x_attackbins;
- if (binlook < 0) binlook += HISTORY;
- if (total_db > x->x_dbs[binlook] + x->x_attackthresh)
- {
- x->x_attackvalue = 1;
- x->x_peaked = 0;
- }
- }
- }
- else
- {
- int binlook = newphase - x->x_attackbins;
- if (binlook < 0) binlook += HISTORY;
- if (x->x_dbs[binlook] > x->x_amphi && x->x_dbs[binlook] > total_db)
- x->x_peaked = 1;
- }
-
- /* for each current frequency track, test for a new note using a
- * stability criterion. Later perhaps we should also do as in
- * pitch~ and check for unstable notes a posteriori when
- * there's a new attack with no note found since the last onset;
- * but what's an attack &/or onset when we're polyphonic?
- */
-
- for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
- {
- /*
- * if we've found a pitch but we've now strayed from it turn
- * it off.
- */
- if (phist->h_noted)
- {
- if (phist->h_pitches[newphase] > phist->h_noted + x->x_vibdepth
- || phist->h_pitches[newphase] < phist->h_noted - x->x_vibdepth)
- phist->h_noted = 0;
- }
- else
- {
- if (phist->h_wherefrom && phist->h_age >= x->x_vibbins)
- {
- t_float centroid = 0;
- int not = 0;
- for (j = 0, k = newphase; j < x->x_vibbins; j++)
- {
- centroid += phist->h_pitches[k];
- k--;
- if (k < 0) k = HISTORY-1;
- }
- centroid /= x->x_vibbins;
- for (j = 0, k = newphase; j < x->x_vibbins; j++)
- {
- /* calculate deviation from norm */
- t_float dev = centroid - phist->h_pitches[k];
- k--;
- if (k < 0) k = HISTORY-1;
- if (dev > x->x_vibdepth ||
- -dev > x->x_vibdepth) not = 1;
- }
- if (!not)
- {
- phist->h_pitch = phist->h_noted = centroid;
- }
- }
- }
- }
- return;
-
-nopow:
- for (i = 0; i < x->x_npitch; i++)
- {
- x->x_hist[i].h_pitch = x->x_hist[i].h_noted =
- x->x_hist[i].h_pitches[newphase] =
- x->x_hist[i].h_amps[newphase] = 0;
- x->x_hist[i].h_age = 0;
- }
- x->x_peaked = 1;
- x->x_dbage = 0;
-}
-
-void sigfiddle_debug(t_sigfiddle *x)
-{
- x->x_nprint = 1;
-}
-
-void sigfiddle_print(t_sigfiddle *x)
-{
- post("npoints %d,", 2 * x->x_hop);
- post("amp-range %f %f,", x->x_amplo, x->x_amphi);
- post("reattack %d %f,", x->x_attacktime, x->x_attackthresh);
- post("vibrato %d %f", x->x_vibtime, x->x_vibdepth);
- post("npartial %f", x->x_npartial);
- post("auto %d", x->x_auto);
-}
-
-void sigfiddle_amprange(t_sigfiddle *x, t_floatarg amplo, t_floatarg amphi)
-{
- if (amplo < 0) amplo = 0;
- if (amphi < amplo) amphi = amplo + 1;
- x->x_amplo = amplo;
- x->x_amphi = amphi;
-}
-
-void sigfiddle_reattack(t_sigfiddle *x,
- t_floatarg attacktime, t_floatarg attackthresh)
-{
- if (attacktime < 0) attacktime = 0;
- if (attackthresh <= 0) attackthresh = 1000;
- x->x_attacktime = attacktime;
- x->x_attackthresh = attackthresh;
- x->x_attackbins = (x->x_sr * 0.001 * attacktime) / x->x_hop;
- if (x->x_attackbins >= HISTORY) x->x_attackbins = HISTORY - 1;
-}
-
-void sigfiddle_vibrato(t_sigfiddle *x, t_floatarg vibtime, t_floatarg vibdepth)
-{
- if (vibtime < 0) vibtime = 0;
- if (vibdepth <= 0) vibdepth = 1000;
- x->x_vibtime = vibtime;
- x->x_vibdepth = vibdepth;
- x->x_vibbins = (x->x_sr * 0.001 * vibtime) / x->x_hop;
- if (x->x_vibbins >= HISTORY) x->x_vibbins = HISTORY - 1;
- if (x->x_vibbins < 1) x->x_vibbins = 1;
-}
-
-void sigfiddle_npartial(t_sigfiddle *x, t_floatarg npartial)
-{
- if (npartial < 0.1) npartial = 0.1;
- x->x_npartial = npartial;
-}
-
-void sigfiddle_auto(t_sigfiddle *x, t_floatarg f)
-{
- x->x_auto = (f != 0);
-}
-
-static void sigfiddle_freebird(t_sigfiddle *x)
-{
- if (x->x_inbuf)
- {
- freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
- x->x_inbuf = 0;
- }
- if (x->x_lastanalysis)
- {
- freebytes(x->x_lastanalysis,
- sizeof(t_float) * (2 * x->x_hop + 4 * FILTSIZE));
- x->x_lastanalysis = 0;
- }
- if (x->x_spiral)
- {
- freebytes(x->x_spiral, sizeof(t_float) * 2 * x->x_hop);
- x->x_spiral = 0;
- }
- x->x_hop = 0;
-}
-
-int sigfiddle_setnpoints(t_sigfiddle *x, t_floatarg fnpoints)
-{
- int i, npoints = fnpoints;
- sigfiddle_freebird(x);
- if (npoints < MINPOINTS || npoints > MAXPOINTS)
- {
- error("fiddle~: npoints out of range; using %d",
- npoints = DEFAULTPOINTS);
- }
- if (npoints != (1 << sigfiddle_ilog2(npoints)))
- {
- error("fiddle~: npoints not a power of 2; using %d",
- npoints = (1 << sigfiddle_ilog2(npoints)));
- }
- x->x_hop = npoints >> 1;
- if (!(x->x_inbuf = (t_float *)getbytes(sizeof(t_float) * x->x_hop)))
- goto fail;
- if (!(x->x_lastanalysis = (t_float *)getbytes(
- sizeof(t_float) * (2 * x->x_hop + 4 * FILTSIZE))))
- goto fail;
- if (!(x->x_spiral = (t_float *)getbytes(sizeof(t_float) * 2 * x->x_hop)))
- goto fail;
- for (i = 0; i < x->x_hop; i++)
- x->x_inbuf[i] = 0;
- for (i = 0; i < npoints + 4 * FILTSIZE; i++)
- x->x_lastanalysis[i] = 0;
- for (i = 0; i < x->x_hop; i++)
- x->x_spiral[2*i] = cos((3.14159*i)/(npoints)),
- x->x_spiral[2*i+1] = -sin((3.14159*i)/(npoints));
- x->x_phase = 0;
- return (1);
-fail:
- sigfiddle_freebird(x);
- return (0);
-}
-
-int sigfiddle_doinit(t_sigfiddle *x, long npoints, long npitch,
- long npeakanal, long npeakout)
-{
- t_float *buf1, *buf2, *buf3;
- t_peakout *buf4;
- int i;
-
- if (!npeakanal && !npeakout) npeakanal = DEFNPEAK, npeakout = 0;
- if (!npeakanal < 0) npeakanal = 0;
- else if (npeakanal > MAXPEAK) npeakanal = MAXPEAK;
- if (!npeakout < 0) npeakout = 0;
- else if (npeakout > MAXPEAK) npeakout = MAXPEAK;
- if (npitch <= 0) npitch = 0;
- else if (npitch > MAXNPITCH) npitch = MAXNPITCH;
- if (npeakanal && !npitch) npitch = 1;
- if (!npoints)
- npoints = DEFAULTPOINTS;
- if (!sigfiddle_setnpoints(x, npoints))
- {
- error("fiddle~: out of memory");
- return (0);
- }
- if (!(buf4 = (t_peakout *)getbytes(sizeof(*buf4) * npeakout)))
- {
- sigfiddle_freebird(x);
- error("fiddle~: out of memory");
- return (0);
- }
- for (i = 0; i < npeakout; i++)
- buf4[i].po_freq = buf4[i].po_amp = 0;
- x->x_peakbuf = buf4;
-
- x->x_npeakout = npeakout;
- x->x_npeakanal = npeakanal;
- x->x_phase = 0;
- x->x_histphase = 0;
- x->x_sr = 44100; /* this and the next are filled in later */
- for (i = 0; i < MAXNPITCH; i++)
- {
- int j;
- x->x_hist[i].h_pitch = x->x_hist[i].h_noted = 0;
- x->x_hist[i].h_age = 0;
- x->x_hist[i].h_wherefrom = 0;
- x->x_hist[i].h_outlet = 0;
- for (j = 0; j < HISTORY; j++)
- x->x_hist[i].h_amps[j] = x->x_hist[i].h_pitches[j] = 0;
- }
- x->x_nprint = 0;
- x->x_npitch = npitch;
- for (i = 0; i < HISTORY; i++) x->x_dbs[i] = 0;
- x->x_dbage = 0;
- x->x_peaked = 0;
- x->x_auto = 1;
- x->x_amplo = DEFAMPLO;
- x->x_amphi = DEFAMPHI;
- x->x_attacktime = DEFATTACKTIME;
- x->x_attackbins = 1; /* real value calculated afterward */
- x->x_attackthresh = DEFATTACKTHRESH;
- x->x_vibtime = DEFVIBTIME;
- x->x_vibbins = 1; /* real value calculated afterward */
- x->x_vibdepth = DEFVIBDEPTH;
- x->x_npartial = 7;
- x->x_attackvalue = 0;
- return (1);
-}
-
- /* formalities for JMAX */
-
-#ifdef JMAX
-
-void sigfiddle_debug13(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- sigfiddle_debug(x);
-}
-
-void sigfiddle_print13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- sigfiddle_print(x);
-}
-
-void sigfiddle_amprange13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- t_float lo = (t_float) fts_get_float_arg(ac, at, 0, 0);
- t_float hi = (t_float) fts_get_float_arg(ac, at, 1, 0);
- sigfiddle_amprange(x, lo, hi);
-}
-
-void sigfiddle_reattack13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- long msec = fts_get_float_arg(ac, at, 0, 0);
- t_float db = (t_float) fts_get_float_arg(ac, at, 1, 0);
- sigfiddle_reattack(x, msec, db);
-}
-
-void sigfiddle_vibrato13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- long msec = fts_get_float_arg(ac, at, 0, 0);
- t_float halftones = (t_float) fts_get_float_arg(ac, at, 1, 0);
- sigfiddle_vibrato(x, msec, halftones);
-}
-
-void sigfiddle_npartial13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- t_float npartial = (t_float) fts_get_float_arg(ac, at, 0, 0);
- sigfiddle_npartial(x, npartial);
-}
-
-
-void ftl_sigfiddle(fts_word_t *a)
-{
- t_sigfiddle *x = (t_sigfiddle *)fts_word_get_long(a);
- t_float *in = (t_float *)fts_word_get_long(a + 1);
- long n_tick = fts_word_get_long(a + 2);
-
- int count;
- t_float *fp, *fp2;
- for (count = 0, fp = x->x_inbuf + x->x_phase;
- count < n_tick; count++) *fp++ = *in++;
- if (fp == x->x_inbuf + x->x_hop)
- {
- sigfiddle_doit(x);
- x->x_phase = 0;
- fts_alarm_set_delay(&x->x_clock, 0L); /* output bang */
- fts_alarm_arm(&x->x_clock);
-
- if (x->x_nprint) x->x_nprint--;
- }
- else x->x_phase += n_tick;
-}
-
-void sigfiddle_put(fts_object_t *o, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- fts_dsp_descr_t *dsp = (fts_dsp_descr_t *)fts_get_long_arg(ac, at, 0, 0);
- fts_atom_t a[3];
-
- x->x_sr = fts_dsp_get_input_srate(dsp, 0);
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
- sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
-
- fts_set_long(a, (long)x);
- fts_set_symbol(a+1, fts_dsp_get_input_name(dsp, 0));
- fts_set_long(a+2, fts_dsp_get_input_size(dsp, 0));
- dsp_add_funcall(dsp_symbol, 3, a);
-}
-
-void sigfiddle_tick(fts_alarm_t *alarm, void *p)
-{
- fts_object_t *o = (fts_object_t *)p;
- t_sigfiddle *x = (t_sigfiddle *)p;
-
- int i;
- t_pitchhist *ph;
- fts_outlet_float(o, OUTLETpower, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- fts_atom_t at[2];
- fts_set_float(at, ph->h_pitches[x->x_histphase]);
- fts_set_float(at+1, ph->h_amps[x->x_histphase]);
- fts_outlet_list(o, OUTLETmicropitch3 - i, 2, at);
- }
- if (x->x_attackvalue) fts_outlet_bang(o, OUTLETattack);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) fts_outlet_float(o, OUTLETpitch, ph->h_pitch);
-}
-
-static void sigfiddle_delete(fts_object_t *o, int winlet, fts_symbol_t *s, int ac,
- const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
-
- fts_free(x->x_inbuf);
- fts_free(x->x_lastanalysis);
- fts_free(x->x_spiral);
- dsp_list_remove(o);
-}
-
-static void sigfiddle_init(fts_object_t *o, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- t_float *buf1, *buf2, *buf3;
- int i, hop;
- long npoints = fts_get_long_arg(ac, at, 1, 0);
- long npitch = fts_get_long_arg(ac, at, 2, 0);
- long npeakanal = fts_get_long_arg(ac, at, 3, 0);
- long npeakout = fts_get_long_arg(ac, at, 4, 0);
-
- if (!sigfiddle_doinit(x, npoints, npitch, npeakanal, npeakout))
- {
- post("fiddle~: initialization failed");
- return;
- }
- hop = npoints>>1;
- if (fts_fft_declaresize(hop) != fts_Success)
- post("fiddle~: bad FFT size");
-
- fts_alarm_init(&(x->x_clock), 0, sigfiddle_tick, x);
- dsp_list_insert(o);
-}
-
-static fts_status_t sigfiddle_instantiate(fts_class_t *cl, int ac,
- const fts_atom_t *at)
-{
- int i;
- fts_type_t a[5];
-
- fts_class_init(cl, sizeof(t_sigfiddle), 1, 6, 0); /* 1 inlet + 6 outlets */
-
- /* the system methods */
-
- a[0] = fts_Symbol;
- a[1] = fts_Long | fts_OptArg;
- a[2] = fts_Long | fts_OptArg;
- fts_method_define(cl, fts_SystemInlet, fts_s_init, sigfiddle_init, 3, a);
-
- fts_method_define(cl, fts_SystemInlet, fts_s_delete, sigfiddle_delete, 0, a);
- a[0] = fts_Object;
- fts_method_define(cl, fts_SystemInlet, fts_s_put, sigfiddle_put, 1, a);
-
- /* class' own methods */
- fts_method_define(cl, 0, fts_new_symbol("print"), sigfiddle_print13, 0, a);
- fts_method_define(cl, 0, fts_new_symbol("debug"), sigfiddle_debug13, 0, a);
- fts_method_define(cl, 0, fts_new_symbol("amp-range"), sigfiddle_amprange13,
- 0, a);
- fts_method_define(cl, 0, fts_new_symbol("reattack"), sigfiddle_reattack13,
- 0, a);
- fts_method_define(cl, 0, fts_new_symbol("vibrato"), sigfiddle_vibrato13,
- 0, a);
- fts_method_define(cl, 0, fts_new_symbol("npartial"), sigfiddle_npartial13,
- 0, a);
-
- /* classes signal inlets */
- dsp_sig_inlet(cl, 0); /* declare signal input #0 */
-
- /* classes outlets */
- a[0] = fts_Float;
- fts_outlet_type_define(cl, OUTLETpitch, fts_s_float, 1, a); /* declare outlet #0 */
- fts_outlet_type_define(cl, OUTLETattack, fts_s_bang, 0, a); /* declare outlet #1 */
- a[0] = fts_VarArgs;
- fts_outlet_type_define(cl, OUTLETmicropitch1, fts_s_list, 1, a); /* declare outlet #2 */
- fts_outlet_type_define(cl, OUTLETmicropitch2, fts_s_list, 1, a); /* declare outlet #3 */
- fts_outlet_type_define(cl, OUTLETmicropitch3, fts_s_list, 1, a); /* declare outlet #4 */
- a[0] = fts_Float;
- fts_outlet_type_define(cl, OUTLETpower, fts_s_float, 1, a); /* declare outlet #5 */
-
- dsp_symbol = fts_new_symbol("fiddle");
- dsp_declare_function(dsp_symbol, ftl_sigfiddle);
-
- /* DSP properties */
-
- fts_class_put_prop(cl, fts_s_dsp_is_sink, fts_true);
-
- return(fts_Success);
-}
-
-void fiddle_config(void)
-{
- sys_log(fiddle_version);
- fts_metaclass_create(fts_new_symbol(CLASSNAME), sigfiddle_instantiate, fts_always_equiv);
-}
-
-fts_module_t fiddle_module =
- {"fiddle", "sonic meat fiddle", fiddle_config, 0};
-
-#endif /* JMAX */
-
-#ifdef PD
-
-static t_int *fiddle_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_sigfiddle *x = (t_sigfiddle *)(w[2]);
- int n = (int)(w[3]);
- int count;
- t_float *fp;
- if (!x->x_hop)
- goto nono;
- for (count = 0, fp = x->x_inbuf + x->x_phase; count < n; count++)
- *fp++ = *in++;
- if (fp == x->x_inbuf + x->x_hop)
- {
- sigfiddle_doit(x);
- x->x_phase = 0;
- if (x->x_auto) clock_delay(x->x_clock, 0L);
- if (x->x_nprint) x->x_nprint--;
- }
- else x->x_phase += n;
-nono:
- return (w+4);
-}
-
-void sigfiddle_dsp(t_sigfiddle *x, t_signal **sp)
-{
- x->x_sr = sp[0]->s_sr;
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
- sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
- dsp_add(fiddle_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
-}
-
- /* This is the callback function for the clock, but also acts as
- the "bang" method; you can leave "auto" on to get this called
- automatically (the default) or turn auto off and bang it yourself. */
-
-void sigfiddle_bang(t_sigfiddle *x)
-{
- int i;
- t_pitchhist *ph;
- if (x->x_npeakout)
- {
- int npeakout = x->x_npeakout;
- t_peakout *po;
- for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
- {
- t_atom at[3];
- SETFLOAT(at, i+1);
- SETFLOAT(at+1, po->po_freq);
- SETFLOAT(at+2, po->po_amp);
- outlet_list(x->x_peakout, 0, 3, at);
- }
- }
- outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, 0, 2, at);
- }
- if (x->x_attackvalue) outlet_bang(x->x_attackout);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
-}
-
-void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free */
-{
- if (x->x_inbuf)
- {
- freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
- freebytes(x->x_lastanalysis, sizeof(t_float) * (2*x->x_hop + 4 * FILTSIZE));
- freebytes(x->x_spiral, sizeof(t_float) * 2*x->x_hop);
- freebytes(x->x_peakbuf, sizeof(*x->x_peakbuf) * x->x_npeakout);
- clock_free(x->x_clock);
- }
-}
-
-static t_class *sigfiddle_class;
-
-void *sigfiddle_new(t_floatarg npoints, t_floatarg npitch,
- t_floatarg fnpeakanal, t_floatarg fnpeakout)
-{
- t_sigfiddle *x = (t_sigfiddle *)pd_new(sigfiddle_class);
- int i;
- int npeakanal = fnpeakanal, npeakout = fnpeakout;
-
-
- if (!sigfiddle_doinit(x, npoints, npitch,
- npeakanal, npeakout))
- {
- x->x_inbuf = 0; /* prevent the free routine from cleaning up */
- pd_free(&x->x_ob.ob_pd);
- return (0);
- }
- x->x_noteout = outlet_new(&x->x_ob, gensym("float"));
- x->x_attackout = outlet_new(&x->x_ob, gensym("bang"));
- for (i = 0; i < x->x_npitch; i++)
- x->x_hist[i].h_outlet = outlet_new(&x->x_ob, gensym("list"));
- x->x_envout = outlet_new(&x->x_ob, gensym("float"));
- if (x->x_npeakout)
- x->x_peakout = outlet_new(&x->x_ob, gensym("list"));
- else x->x_peakout = 0;
- x->x_clock = clock_new(&x->x_ob.ob_pd, (t_method)sigfiddle_bang);
- return (x);
-}
-
-void fiddle_tilde_setup(void)
-{
- sigfiddle_class = class_new(gensym("fiddle~"), (t_newmethod)sigfiddle_new,
- (t_method)sigfiddle_ff, sizeof(t_sigfiddle), 0,
- A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_dsp,
- gensym("dsp"), 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_debug,
- gensym("debug"), 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_setnpoints,
- gensym("npoints"), A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_amprange,
- gensym("amp-range"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_reattack,
- gensym("reattack"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_vibrato,
- gensym("vibrato"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_npartial,
- gensym("npartial"), A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_auto,
- gensym("auto"), A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_print,
- gensym("print"), 0);
- class_addmethod(sigfiddle_class, nullfn, gensym("signal"), 0);
- class_addbang(sigfiddle_class, sigfiddle_bang);
- class_addcreator((t_newmethod)sigfiddle_new, gensym("fiddle"),
- A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- post(fiddle_version);
-}
-
-void fiddle_setup(void)
-{
- fiddle_tilde_setup();
-}
-#endif /* PD */
-
-#ifdef MAX26
-
-void cu_fiddle(t_float *in1, t_sigfiddle *x, int n)
-{
- int count;
- t_float *fp, *fp2;
- for (count = 0, fp = x->x_inbuf + x->x_phase;
- count < n; count++) *fp++ = *in1++;
- if (fp == x->x_inbuf + x->x_hop)
- {
- sigfiddle_doit(x);
- x->x_phase = 0;
- if (x->x_auto) clock_delay(x->x_clock, 0L);
- if (x->x_nprint) x->x_nprint--;
- }
- else x->x_phase += n;
-}
-
-void sigfiddle_put(t_sigfiddle *x, long whether)
-{
- if (whether)
- {
- u_stdout(x);
- x->x_sr = x->x_io[0]->s_sr;
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
- sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
- dspchain_addc(cu_fiddle, 3,
- x->x_io[0]->s_shit, x, x->x_io[0]->s_n);
- }
-}
-
-void sigfiddle_tick(t_sigfiddle *x) /* callback function for the clock */
-{
- int i;
- t_pitchhist *ph;
- outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, NIL, 2, at);
- }
- if (x->x_attackvalue) outlet_bang(x->x_attackout);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
-}
-
-void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free */
-{
- if (x->x_inbuf)
- {
- freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
- freebytes(x->x_lastanalysis, sizeof(t_float) * (2*x->x_hop + 4 * FILTSIZE));
- freebytes(x->x_spiral, sizeof(t_float) * 2*x->x_hop);
- clock_free(x->x_clock);
- u_clean(x);
- }
-}
-
-t_externclass *sigfiddle_class;
-
-void *sigfiddle_new(long npoints, long npitch,
- long npeakanal, long npeakout)
-{
- t_sigfiddle *x = (t_sigfiddle *)obj_new(&sigfiddle_class, 0);
- int i;
-
- if (!sigfiddle_doinit(x, npoints, npitch, npeakanal, npeakout))
- {
- x->x_inbuf = 0; /* prevent the free routine from cleaning up */
- obj_free(x);
- return (0);
- }
- u_setup(x, IN1, OUT0);
- x->x_envout = outlet_new(x, gensym("float"));
- for (i = 0; i < x->x_npitch; i++)
- x->x_hist[i].h_outlet = outlet_new(x, gensym("list"));
- x->x_attackout = outlet_new(x, gensym("bang"));
- x->x_noteout = outlet_new(x, gensym("float"));
- x->x_clock = clock_new(x, sigfiddle_tick);
- return (x);
-}
-
-void fiddle_setup()
-{
- c_extern(&sigfiddle_class, sigfiddle_new, sigfiddle_ff,
- gensym("fiddle"), sizeof(t_sigfiddle), 0, A_DEFLONG, A_DEFLONG,
- A_DEFLONG, A_DEFLONG, 0);
- c_addmess(sigfiddle_put, gensym("put"), A_CANT, 0);
- c_addmess(sigfiddle_debug, gensym("debug"), 0);
- c_addmess(sigfiddle_amprange, gensym("amp-range"), A_FLOAT, A_FLOAT, 0);
- c_addmess(sigfiddle_reattack, gensym("reattack"), A_FLOAT, A_FLOAT, 0);
- c_addmess(sigfiddle_vibrato, gensym("vibrato"), A_LONG, A_FLOAT, 0);
- c_addmess(sigfiddle_npartial, gensym("npartial"), A_FLOAT, 0);
- c_addmess(sigfiddle_print, gensym("print"), 0);
- u_inletmethod(0); /* one signal input */
-#ifdef MAX
- post(fiddle_version);
-#endif
-}
-
-#endif /* MAX26 */
-
-/************* Beginning of MSP Code ******************************/
-
-#ifdef MSP
-
-static t_int *fiddle_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_sigfiddle *x = (t_sigfiddle *)(w[2]);
- int n = (int)(w[3]);
- int count,inc = x->x_downsample;
- t_float *fp;
-
- if (x->x_obj.z_disabled)
- goto skip;
- for (count = 0, fp = x->x_inbuf + x->x_phase; count < n; count+=inc) {
- *fp++ = *in;
- in += inc;
- }
- if (fp == x->x_inbuf + x->x_hop)
- {
- sigfiddle_doit(x);
- x->x_phase = 0;
- if (x->x_auto) clock_delay(x->x_clock, 0L);
- if (x->x_nprint) x->x_nprint--;
- }
- else x->x_phase += n;
-skip:
- return (w+4);
-}
-
-void sigfiddle_dsp(t_sigfiddle *x, t_signal **sp)
-{
- if (sp[0]->s_n > x->x_hop) {
- x->x_downsample = sp[0]->s_n / x->x_hop;
- post("* warning: fiddle~: will downsample input by %ld",x->x_downsample);
- x->x_sr = sp[0]->s_sr / x->x_downsample;
- } else {
- x->x_downsample = 1;
- x->x_sr = sp[0]->s_sr;
- }
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
- sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
- dsp_add(fiddle_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
-}
-
-void sigfiddle_tick(t_sigfiddle *x) /* callback function for the clock MSP*/
-{
- int i;
- t_pitchhist *ph;
- if (x->x_npeakout)
- {
- int npeakout = x->x_npeakout;
- t_peakout *po;
- for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
- {
- t_atom at[3];
- SETINT(at, i+1);
- SETFLOAT(at+1, po->po_freq);
- SETFLOAT(at+2, po->po_amp);
- outlet_list(x->x_peakout, 0, 3, at);
- }
- }
- outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, 0, 2, at);
- }
- if (x->x_attackvalue) outlet_bang(x->x_attackout);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
-}
-
-void sigfiddle_bang(t_sigfiddle *x)
-{
- int i;
- t_pitchhist *ph;
- if (x->x_npeakout)
- {
- int npeakout = x->x_npeakout;
- t_peakout *po;
- for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
- {
- t_atom at[3];
- SETLONG(at, i+1);
- SETFLOAT(at+1, po->po_freq);
- SETFLOAT(at+2, po->po_amp);
- outlet_list(x->x_peakout, 0, 3, at);
- }
- }
- outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, 0, 2, at);
- }
- if (x->x_attackvalue) outlet_bang(x->x_attackout);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
-}
-
-
-void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free MSP */
-{
-
- if (x->x_inbuf)
- {
- t_freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
- t_freebytes(x->x_lastanalysis, sizeof(t_float) * (2*x->x_hop + 4 *
-FILTSIZE));
- t_freebytes(x->x_spiral, sizeof(t_float) * 2*x->x_hop);
- t_freebytes(x->x_peakbuf, sizeof(*x->x_peakbuf) * x->x_npeakout);
- }
- dsp_free((t_pxobject *)x);
-}
-
-void *sigfiddle_class;
-
-void *sigfiddle_new(long npoints, long npitch,
- long npeakanal, long npeakout)
-{
- t_sigfiddle *x = (t_sigfiddle *)newobject(sigfiddle_class);
- int i;
-
- if (!sigfiddle_doinit(x, npoints, npitch, npeakanal, npeakout))
- {
- x->x_inbuf = 0; /* prevent the free routine from cleaning up */
- return (0);
- }
- dsp_setup((t_pxobject *)x,1);
-
- x->x_clock = clock_new(x, (method)sigfiddle_tick);
- if (x->x_npeakout)
- x->x_peakout = listout((t_object *)x);
- else x->x_peakout = 0;
- x->x_envout = floatout((t_object *)x);
- for (i = 0; i < x->x_npitch; i++)
- x->x_hist[i].h_outlet = listout((t_object *)x);
- x->x_attackout = bangout((t_object *)x);
- x->x_noteout = floatout((t_object *)x);
- return (x);
-
-
-}
-
-void main()
-{
- setup(&sigfiddle_class, sigfiddle_new, (method)sigfiddle_ff,
- (short)sizeof(t_sigfiddle), 0L, A_DEFLONG, A_DEFLONG,
-A_DEFLONG, A_DEFLONG, 0);
- addmess((method)sigfiddle_dsp, "dsp",
- A_CANT, 0);
- addmess((method)sigfiddle_debug, "debug", 0);
- addmess((method)sigfiddle_setnpoints, "npoints", A_FLOAT, 0);
- addmess((method)sigfiddle_amprange, "amp-range", A_FLOAT, A_FLOAT, 0);
- addmess((method)sigfiddle_reattack, "reattack", A_FLOAT, A_FLOAT, 0);
- addmess((method)sigfiddle_vibrato, "vibrato", A_FLOAT,
-A_FLOAT, 0);
- addmess((method)sigfiddle_npartial, "npartial", A_FLOAT, 0);
- addmess((method)sigfiddle_auto, "auto",
- A_FLOAT, 0);
- addmess((method)sigfiddle_print, "print", 0);
- addmess((method)sigfiddle_assist, "assist",
- A_CANT, 0);
- addbang((method)sigfiddle_bang);
- dsp_initclass();
- rescopy('STR#',3748);
- post(fiddle_version);
-}
-
-void sigfiddle_assist(t_sigfiddle *x, void *b, long m, long a, char *s)
-{
- assist_string(3748,m,a,1,2,s);
-}
-
-void msp_fft(t_float *buf, long np, long inv)
-{
- t_float *src,*real,*rp,*imag,*ip;
- long i;
-
- /*
- // because this fft algorithm uses separate real and imaginary
- // buffers
- // we must split the real and imaginary parts into two buffers,
- // then do the opposite on output
- // a more ambitious person would either do an in-place conversion
- // or rewrite the fft algorithm
- */
-
- real = rp = msp_ffttemp;
- imag = ip = real + MAXPOINTS;
- src = buf;
- for (i = 0; i < np; i++) {
- *rp++ = *src++;
- *ip++ = *src++;
- }
- if (inv)
- ifft(np,real,imag);
- else
- fft(np,real,imag);
- rp = real;
- ip = imag;
- src = buf;
- for (i = 0; i < np; i++) {
- *src++ = *rp++;
- *src++ = *ip++;
- }
-}
-
-#endif /* MSP */
diff --git a/externals/extra/0.43.3/0.43.2/hilbert~-help.pd b/externals/extra/0.43.3/0.43.2/hilbert~-help.pd
deleted file mode 100644
index 130ec750..00000000
--- a/externals/extra/0.43.3/0.43.2/hilbert~-help.pd
+++ /dev/null
@@ -1,18 +0,0 @@
-#N canvas 156 234 600 488 12;
-#X obj 67 124 hilbert~;
-#X obj 66 85 osc~ 440;
-#X graph graph1 0 -1 882 1 279 209 579 39;
-#X array out-left 882 float;
-#X array out-right 882 float;
-#X pop;
-#X obj 67 274 tabwrite~ out-left;
-#X obj 118 248 tabwrite~ out-right;
-#X msg 137 188 bang \; pd dsp 1;
-#X floatatom 66 57;
-#X text 71 319 The Hilbert transform (the name is abused here according to computer music tradition) puts out a phase quadrature version of the input signal suitable for signal sideband modulation via complex-mod~.;
-#X connect 0 0 3 0;
-#X connect 0 1 4 0;
-#X connect 1 0 0 0;
-#X connect 5 0 3 0;
-#X connect 5 0 4 0;
-#X connect 6 0 1 0;
diff --git a/externals/extra/0.43.3/0.43.2/hilbert~.pd b/externals/extra/0.43.3/0.43.2/hilbert~.pd
deleted file mode 100644
index 152c2082..00000000
--- a/externals/extra/0.43.3/0.43.2/hilbert~.pd
+++ /dev/null
@@ -1,27 +0,0 @@
-#N canvas 269 0 593 306 12;
-#X obj 105 92 biquad~ 0.83774 -0.06338 0.06338 -0.83774 1;
-#X obj 105 66 biquad~ 1.94632 -0.94657 0.94657 -1.94632 1;
-#X obj 86 149 biquad~ -0.02569 0.260502 -0.260502 0.02569 1;
-#X obj 86 175 biquad~ 1.8685 -0.870686 0.870686 -1.8685 1;
-#X obj 86 39 inlet~;
-#X obj 105 121 outlet~;
-#X obj 86 202 outlet~;
-#X text 34 232 This is a pair of 4th-order all-pass filters whose outputs
-somehow manage to be about 90 degrees out of phase from each other.
-Both have different phases from the original. Adapted from a 4X patch
-by Emmanuel Favreau \, circa 1982;
-#X obj 502 39 inlet;
-#X text 461 13 bang to clear;
-#X text 80 16 signal in;
-#X msg 502 112 clear;
-#X connect 0 0 5 0;
-#X connect 1 0 0 0;
-#X connect 2 0 3 0;
-#X connect 3 0 6 0;
-#X connect 4 0 1 0;
-#X connect 4 0 2 0;
-#X connect 8 0 11 0;
-#X connect 11 0 1 0;
-#X connect 11 0 0 0;
-#X connect 11 0 2 0;
-#X connect 11 0 3 0;
diff --git a/externals/extra/0.43.3/0.43.2/loop~/loop~-help.pd b/externals/extra/0.43.3/0.43.2/loop~/loop~-help.pd
deleted file mode 100644
index ff3d3a63..00000000
--- a/externals/extra/0.43.3/0.43.2/loop~/loop~-help.pd
+++ /dev/null
@@ -1,74 +0,0 @@
-#N canvas 234 90 647 662 12;
-#X floatatom 41 204 0 0 0 0 - - -;
-#X obj 254 382 print~;
-#X msg 254 347 bang;
-#X obj 41 338 loop~;
-#X floatatom 66 279 0 0 0 0 - - -;
-#X msg 55 252 bang;
-#X obj 183 382 print~;
-#X msg 183 347 bang;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array array2 150000 float 0;
-#X coords 0 1 150000 -1 200 150 1;
-#X restore 393 464 graph;
-#X msg 393 622 \; array2 resize 150000;
-#X obj 25 613 soundfiler;
-#X obj 16 453 tabread4~ array2;
-#X obj 16 407 *~;
-#X obj 16 522 dac~;
-#X obj 16 499 hip~ 5;
-#X obj 62 411 samphold~;
-#X obj 16 430 +~;
-#X floatatom 96 303 0 0 0 0 - - -;
-#X obj 96 326 *~ 1000;
-#X msg 43 568 read ../doc/sound/bell.aiff array2;
-#X msg 47 229 set 0.5;
-#X text 95 196 left signal input is transposition (1 is normal \, 2
-is up an octave \, etc);
-#X text 82 4 loop~ - phase generator for looping samplers;
-#X text 116 228 set phase (0 to 1);
-#X text 104 253 reset phase to 0;
-#X text 104 278 right signal input is window size in samples;
-#X text 134 302 here's how to handle onsets;
-#X obj 16 476 *~;
-#X floatatom 167 432 0 0 0 0 - - -;
-#X obj 167 501 line~;
-#X obj 167 455 dbtorms;
-#X obj 167 478 pack 0 50;
-#X text 201 431 output level 0-100;
-#X text 187 326 print outputs;
-#X text 33 32 loop~ takes input signals to set a window size and transposition
-\, and outputs a phase and a sampled window size. The window size only
-changes at phase zero crossings and the phase output is adjusted so
-that changing window size doesn't change the transposition.;
-#X text 33 112 You can send "bang" or "set" message to force the phase
-to zero--you should mute the output before doing so. This may be desirable
-if you've set a large window size but then want to decrease it without
-waiting for the next phase crossing.;
-#X msg 43 591 read ../doc/sound/voice.wav array2;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 6 0;
-#X connect 3 0 12 0;
-#X connect 3 0 15 1;
-#X connect 3 1 1 0;
-#X connect 3 1 12 1;
-#X connect 4 0 3 1;
-#X connect 5 0 3 0;
-#X connect 7 0 6 0;
-#X connect 11 0 27 0;
-#X connect 12 0 16 0;
-#X connect 14 0 13 0;
-#X connect 14 0 13 1;
-#X connect 15 0 16 1;
-#X connect 16 0 11 0;
-#X connect 17 0 18 0;
-#X connect 18 0 15 0;
-#X connect 19 0 10 0;
-#X connect 20 0 3 0;
-#X connect 27 0 14 0;
-#X connect 28 0 30 0;
-#X connect 29 0 27 1;
-#X connect 30 0 31 0;
-#X connect 31 0 29 0;
-#X connect 36 0 10 0;
diff --git a/externals/extra/0.43.3/0.43.2/loop~/loop~.c b/externals/extra/0.43.3/0.43.2/loop~/loop~.c
deleted file mode 100644
index ebe3d9d5..00000000
--- a/externals/extra/0.43.3/0.43.2/loop~/loop~.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* loop~ -- loop generator for sampling */
-
-/* Copyright 1997-1999 Miller Puckette.
-Permission is granted to use this software for any purpose provided you
-keep this copyright notice intact.
-
-THE AUTHOR AND HIS EMPLOYERS MAKE NO WARRANTY, EXPRESS OR IMPLIED,
-IN CONNECTION WITH THIS SOFTWARE.
-
-This file is downloadable from http://www.crca.ucsd.edu/~msp .
-
-*/
-
-#ifdef PD
-#include "m_pd.h"
-#else
-#define t_sample float
-#define t_float float
-#endif
-
-
-
-typedef struct _loopctl
-{
- double l_phase;
- t_sample l_invwindow;
- t_sample l_window;
- int l_resync;
-} t_loopctl;
-
-static void loopctl_run(t_loopctl *x, t_sample *transposein,
- t_sample *windowin, t_sample *rawout, t_sample *windowout, int n)
-{
- t_sample window, invwindow;
- double phase = x->l_phase;
- if (x->l_resync)
- {
- window = *windowin;
- if (window < 0)
- {
- if (window > -1)
- window = -1;
- invwindow = -1/window;
- }
- else
- {
- if (window < 1)
- window = 1;
- invwindow = 1/window;
- }
- x->l_resync = 0;
- }
- else
- {
- window = x->l_window;
- phase = x->l_phase;
- invwindow = x->l_invwindow;
- }
- while (n--)
- {
- double phaseinc = invwindow * *transposein++;
- double newphase;
- t_sample nwind = *windowin++;
- if (phaseinc >= 1 || phaseinc < 0)
- phaseinc = 0;
- newphase = phase + phaseinc;
- if (newphase >= 1)
- {
- window = nwind;
- if (window < 0)
- {
- if (window > -1)
- window = -1;
- invwindow = -1/window;
- }
- else
- {
- if (window < 1)
- window = 1;
- invwindow = 1/window;
- }
- newphase -= 1.;
- }
- phase = newphase;
- *rawout++ = (t_sample)phase;
- *windowout++ = window;
- }
- x->l_invwindow = invwindow;
- x->l_window = window;
- x->l_phase = phase;
-}
-
-static void loopctl_init(t_loopctl *x)
-{
- x->l_window = 1;
- x->l_invwindow = 1;
- x->l_phase = 0;
-}
-
-static void loopctl_set(t_loopctl *x, t_float val)
-{
- if (val < 0 || val > 1)
- val = 0;
- x->l_phase = val;
- x->l_resync = 1;
-}
-
-#ifdef PD
-
-typedef struct _loop
-{
- t_object x_obj;
- t_float x_f;
- t_loopctl x_loopctl;
-} t_loop;
-
-static t_class *loop_class;
-
-static void *loop_new(void)
-{
- t_loop *x = (t_loop *)pd_new(loop_class);
- loopctl_init(&x->x_loopctl);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- outlet_new(&x->x_obj, gensym("signal"));
- outlet_new(&x->x_obj, gensym("signal"));
- return (x);
-}
-
-static t_int *loop_perform(t_int *w)
-{
- t_loopctl *ctl = (t_loopctl *)(w[1]);
- t_sample *in1 = (t_sample *)(w[2]);
- t_sample *in2 = (t_sample *)(w[3]);
- t_sample *out1 = (t_sample *)(w[4]);
- t_sample *out2 = (t_sample *)(w[5]);
- int n = (int)(w[6]);
- loopctl_run(ctl, in1, in2, out1, out2, n);
- return (w+7);
-}
-
-static void loop_dsp(t_loop *x, t_signal **sp)
-{
- dsp_add(loop_perform, 6,
- &x->x_loopctl, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,
- sp[0]->s_n);
-}
-
-static void loop_set(t_loop *x, t_floatarg val)
-{
- loopctl_set(&x->x_loopctl, val);
-}
-
-static void loop_bang(t_loop *x)
-{
- loopctl_set(&x->x_loopctl, 0);
-}
-
-void loop_tilde_setup(void)
-{
- loop_class = class_new(gensym("loop~"), (t_newmethod)loop_new, 0,
- sizeof(t_loop), 0, 0);
- class_addmethod(loop_class, (t_method)loop_dsp, gensym("dsp"), A_CANT, 0);
- CLASS_MAINSIGNALIN(loop_class, t_loop, x_f);
- class_addmethod(loop_class, (t_method)loop_set, gensym("set"),
- A_DEFFLOAT, 0);
- class_addbang(loop_class, loop_bang);
-}
-
-#endif /* PD */
diff --git a/externals/extra/0.43.3/0.43.2/loop~/test-loop~.pd b/externals/extra/0.43.3/0.43.2/loop~/test-loop~.pd
deleted file mode 100644
index 9966483d..00000000
--- a/externals/extra/0.43.3/0.43.2/loop~/test-loop~.pd
+++ /dev/null
@@ -1,58 +0,0 @@
-#N canvas 33 0 680 609 12;
-#X floatatom 52 262 0 0 0 0 - - -;
-#X obj 261 346 print~;
-#X msg 47 373 bang;
-#X msg 274 313 bang;
-#X obj 52 306 loop~;
-#X floatatom 102 245 0 0 0 0 - - -;
-#N canvas 0 0 450 300 graph1 0;
-#X array array1 44100 float 0;
-#X coords 0 10 44100 0 200 150 1;
-#X restore 65 17 graph;
-#X msg 43 204 \; array1 resize 44100;
-#X obj 25 401 tabwrite~ array1;
-#X msg 208 371 bang;
-#X obj 176 402 tabwrite~ array1;
-#X msg 194 261 bang;
-#X obj 204 347 print~;
-#X msg 217 314 bang;
-#N canvas 0 0 450 300 graph1 0;
-#X array array2 150000 float 0;
-#X coords 0 1 150000 -1 200 150 1;
-#X restore 332 398 graph;
-#X msg 326 274 \; array2 resize 150000;
-#X obj 103 529 tabread4~ array2;
-#X obj 64 481 *~;
-#X obj 107 581 dac~;
-#X obj 105 552 hip~ 5;
-#X obj 123 482 samphold~;
-#X obj 102 506 +~;
-#X floatatom 106 430 0 0 0 0 - - -;
-#X obj 108 453 *~ 1000;
-#X obj 312 215 soundfiler;
-#X msg 330 170 read ../doc/sound/bell.aiff array2;
-#X msg 330 193 read ../doc/sound/vocal.aiff array2;
-#X connect 0 0 4 0;
-#X connect 2 0 8 0;
-#X connect 3 0 1 0;
-#X connect 4 0 12 0;
-#X connect 4 0 17 0;
-#X connect 4 0 8 0;
-#X connect 4 0 20 1;
-#X connect 4 1 10 0;
-#X connect 4 1 1 0;
-#X connect 4 1 17 1;
-#X connect 5 0 4 1;
-#X connect 9 0 10 0;
-#X connect 11 0 4 0;
-#X connect 13 0 12 0;
-#X connect 16 0 19 0;
-#X connect 17 0 21 0;
-#X connect 19 0 18 0;
-#X connect 19 0 18 1;
-#X connect 20 0 21 1;
-#X connect 21 0 16 0;
-#X connect 22 0 23 0;
-#X connect 23 0 20 0;
-#X connect 25 0 24 0;
-#X connect 26 0 24 0;
diff --git a/externals/extra/0.43.3/0.43.2/lrshift~/lrshift~-help.pd b/externals/extra/0.43.3/0.43.2/lrshift~/lrshift~-help.pd
deleted file mode 100644
index fdf7b0c5..00000000
--- a/externals/extra/0.43.3/0.43.2/lrshift~/lrshift~-help.pd
+++ /dev/null
@@ -1,33 +0,0 @@
-#N canvas 143 0 673 325 12;
-#X msg 268 277 bang;
-#X obj 244 303 print~;
-#X msg 185 278 bang;
-#X obj 161 304 print~;
-#X text 53 117 click here first;
-#X msg 72 270 bang;
-#X obj 48 296 print~;
-#X text 162 222 shift left;
-#X text 243 224 shift right;
-#X obj 161 252 lrshift~ 1;
-#X obj 244 251 lrshift~ -1;
-#X text 39 37 Acting at whatever vector size the window is running
-at \, lrshift~ shifts samples to the left (toward the beginning sample)
-or to the right. The argument gives the direction and the amount of
-the shift. The rightmost (or leftmost) samples are set to zero.;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array shiftin 64 float 0;
-#X coords 0 1 63 0 200 140 1;
-#X restore 448 118 graph;
-#X text 115 11 -- shift signal vector elements left or right;
-#X msg 54 138 \; pd dsp 1 \; shiftin 1 1;
-#X obj 48 204 tabreceive~ shiftin;
-#X text 525 308 Updated for Pd 0.31.;
-#X obj 47 11 lrshift~;
-#X connect 0 0 1 0;
-#X connect 2 0 3 0;
-#X connect 5 0 6 0;
-#X connect 9 0 3 0;
-#X connect 10 0 1 0;
-#X connect 15 0 6 0;
-#X connect 15 0 9 0;
-#X connect 15 0 10 0;
diff --git a/externals/extra/0.43.3/0.43.2/lrshift~/lrshift~.c b/externals/extra/0.43.3/0.43.2/lrshift~/lrshift~.c
deleted file mode 100644
index 19dcb93d..00000000
--- a/externals/extra/0.43.3/0.43.2/lrshift~/lrshift~.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "m_pd.h"
-
-/* ------------------------ lrshift~ ----------------------------- */
-
-static t_class *lrshift_tilde_class;
-
-typedef struct _lrshift_tilde
-{
- t_object x_obj;
- int x_n;
- t_float x_f;
-} t_lrshift_tilde;
-
-static t_int *leftshift_perform(t_int *w)
-{
- t_sample *in = (t_sample *)(w[1]);
- t_sample *out= (t_sample *)(w[2]);
- int n = (int)(w[3]);
- int shift = (int)(w[4]);
- in += shift;
- n -= shift;
- while (n--)
- *out++ = *in++;
- while (shift--)
- *out++ = 0;
- return (w+5);
-}
-
-static t_int *rightshift_perform(t_int *w)
-{
- t_sample *in = (t_sample *)(w[1]);
- t_sample *out= (t_sample *)(w[2]);
- int n = (int)(w[3]);
- int shift = (int)(w[4]);
- n -= shift;
- in -= shift;
- while (n--)
- *--out = *--in;
- while (shift--)
- *--out = 0;
- return (w+5);
-}
-
-static void lrshift_tilde_dsp(t_lrshift_tilde *x, t_signal **sp)
-{
- int n = sp[0]->s_n;
- int shift = x->x_n;
- if (shift > n)
- shift = n;
- if (shift < -n)
- shift = -n;
- if (shift < 0)
- dsp_add(rightshift_perform, 4,
- sp[0]->s_vec + n, sp[1]->s_vec + n, n, -shift);
- else dsp_add(leftshift_perform, 4,
- sp[0]->s_vec, sp[1]->s_vec, n, shift);
-}
-
-static void *lrshift_tilde_new(t_floatarg f)
-{
- t_lrshift_tilde *x = (t_lrshift_tilde *)pd_new(lrshift_tilde_class);
- x->x_n = f;
- x->x_f = 0;
- outlet_new(&x->x_obj, gensym("signal"));
- return (x);
-}
-
-void lrshift_tilde_setup(void)
-{
- lrshift_tilde_class = class_new(gensym("lrshift~"),
- (t_newmethod)lrshift_tilde_new, 0, sizeof(t_lrshift_tilde), 0,
- A_DEFFLOAT, 0);
- CLASS_MAINSIGNALIN(lrshift_tilde_class, t_lrshift_tilde, x_f);
- class_addmethod(lrshift_tilde_class, (t_method)lrshift_tilde_dsp,
- gensym("dsp"), 0);
-}
diff --git a/externals/extra/0.43.3/0.43.2/pd~/notes.txt b/externals/extra/0.43.3/0.43.2/pd~/notes.txt
deleted file mode 100644
index 59129d5a..00000000
--- a/externals/extra/0.43.3/0.43.2/pd~/notes.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-pd -schedlib `pwd`/pdsched
-
-dolist:
-pd~ to delay starting subproc until asked
-figure out about setting nchannels from command line
-fix maximum nchannels in and out
-
-
diff --git a/externals/extra/0.43.3/0.43.2/pd~/pdsched.c b/externals/extra/0.43.3/0.43.2/pd~/pdsched.c
deleted file mode 100644
index 43a5ccf1..00000000
--- a/externals/extra/0.43.3/0.43.2/pd~/pdsched.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright 2008 Miller Puckette. Berkeley license; see the
-file LICENSE.txt in this distribution. */
-
-/* A plug-in scheduler that turns Pd into a filter that inputs and
-outputs audio and messages. */
-
-/* todo:
- fix schedlib code to use extent2
- figure out about if (sys_externalschedlib) { return; } in s_audio.c
- make buffer size ynamically growable
-
-*/
-#include "m_pd.h"
-#include "s_stuff.h"
-#include <stdio.h>
-
-#define BUFSIZE 65536
-static char inbuf[BUFSIZE];
-
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
-void glob_watchdog(t_pd *dummy);
-
-static void pollwatchdog( void)
-{
- static int sched_diddsp, sched_nextpingtime;
- sched_diddsp++;
- if (sys_nogui && sys_hipriority && (sched_diddsp - sched_nextpingtime > 0))
- {
- glob_watchdog(0);
- /* ping every 2 seconds */
- sched_nextpingtime = sched_diddsp +
- 2 * (int)(sys_dacsr /(double)sys_schedblocksize);
- }
-}
-#endif
-
-int pd_extern_sched(char *flags)
-{
- int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV];
- int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV];
- int i, j, rate, advance, callback, chin, chout, fill = 0, c, blocksize;
- t_binbuf *b = binbuf_new();
-
- sys_get_audio_params(&naudioindev, audioindev, chindev,
- &naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback,
- &blocksize);
-
- chin = (naudioindev < 1 ? 0 : chindev[0]);
- chout = (naudiooutdev < 1 ? 0 : choutdev[0]);
-
- /* fprintf(stderr, "Pd plug-in scheduler called, chans %d %d, sr %d\n",
- chin, chout, (int)rate); */
- sys_setchsr(chin, chout, rate);
- sys_audioapi = API_NONE;
- while ((c = getchar()) != EOF)
- {
- if (c == ';')
- {
- int n;
- t_atom *ap;
- binbuf_text(b, inbuf, fill);
- n = binbuf_getnatom(b);
- ap = binbuf_getvec(b);
- fill = 0;
- if (n > 0 && ap[0].a_type == A_FLOAT)
- {
- /* a list -- take it as incoming signals. */
- int chan, nchan = n/DEFDACBLKSIZE;
- t_sample *fp;
- for (i = chan = 0, fp = sys_soundin; chan < nchan; chan++)
- for (j = 0; j < DEFDACBLKSIZE; j++)
- *fp++ = atom_getfloat(ap++);
- for (; chan < chin; chan++)
- for (j = 0; j < DEFDACBLKSIZE; j++)
- *fp++ = 0;
- sched_tick(sys_time+sys_time_per_dsp_tick);
- sys_pollgui();
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
- pollwatchdog();
-#endif
- printf(";\n");
- for (i = chout*DEFDACBLKSIZE, fp = sys_soundout; i--; fp++)
- {
- printf("%g\n", *fp);
- *fp = 0;
- }
- printf(";\n");
- fflush(stdout);
- }
- else if (n > 1 && ap[0].a_type == A_SYMBOL)
- {
- t_pd *whom = ap[0].a_w.w_symbol->s_thing;
- if (!whom)
- error("%s: no such object", ap[0].a_w.w_symbol->s_name);
- else if (ap[1].a_type == A_SYMBOL)
- typedmess(whom, ap[1].a_w.w_symbol, n-2, ap+2);
- else pd_list(whom, 0, n-1, ap+1);
- }
- }
- else if (fill < BUFSIZE)
- inbuf[fill++] = c;
- else if (fill == BUFSIZE)
- fprintf(stderr, "pd-extern: input buffer overflow\n");
- }
- return (0);
-}
diff --git a/externals/extra/0.43.3/0.43.2/pd~/pd~-help.pd b/externals/extra/0.43.3/0.43.2/pd~/pd~-help.pd
deleted file mode 100644
index 8bc357e0..00000000
--- a/externals/extra/0.43.3/0.43.2/pd~/pd~-help.pd
+++ /dev/null
@@ -1,75 +0,0 @@
-#N canvas 12 0 566 872 12;
-#X msg 31 406 foo bar baz;
-#X obj 189 466 osc~ 440;
-#X obj 127 645 env~ 8192;
-#X floatatom 127 694 5 0 0 0 - - -;
-#X msg 434 807 \; pd dsp 1;
-#X msg 24 332 pd~ stop;
-#X obj 127 670 i;
-#X obj 241 643 env~ 8192;
-#X floatatom 241 693 5 0 0 0 - - -;
-#X obj 241 669 i;
-#X obj 123 489 *~;
-#X obj 158 490 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X obj 189 490 *~;
-#X obj 224 491 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X obj 434 781 loadbang;
-#X obj 14 691 print x;
-#X msg 15 309 pd~ start pd~-subprocess.pd;
-#X obj 14 532 pd~ -ninsig 2 -noutsig 2 -fifo 20;
-#X obj 37 20 pd~;
-#X text 69 22 - run a pd sub-process;
-#X text 27 57 The pd~ object starts and manages a Pd sub-process that
-can communicate with the super-process (this one) via audio channels
-and/or Pd messages. In this way you can take advantage of multi-core
-CPUs \, and/or use Pd features from within Max (if you're using the
-Max version of pd~).;
-#X text 24 251 Sending a new "start" message will stop the sub-process
-and start a new one. If you just want to stop the sub-process \, send
-"stop".;
-#X text 33 353 Any message besides "pd~" is sent to the sub-process.
-For instance \, the message below sends "bar baz" to any object in
-the sub-process named "foo" \, such as a "receive" object.;
-#X text 43 430 Audio signals appear in adc~ objects in the sub-process.
-The sub-process doesn't open real audio devices.;
-#X text 281 473 Creation args:;
-#X text 265 490 -insig <n> sets input audio channels;
-#X text 266 508 -outsig <n> sets output channels;
-#X text 269 542 -fifo <n> sets round-trip delay in blocks;
-#X text 272 559 -pddir <s> sets Pd directory \, e.g. \,;
-#X text 299 574 .../Pd-0.42.app/Contents/Resources;
-#X text 272 590 -scheddir <s> sets scheduler dir \, e.g. \,;
-#X text 297 607 .../.../Resources/extra/pd~;
-#X text 267 524 -sr <n> sets sample rate;
-#X text 20 716 The first outlet reports messages the sub-process sends
-us via "stdout" objects. Any other outlets are signals corresponding
-to "dac~" objects in the sub-process.;
-#X text 10 784 ATTENTION: DSP must be running in this process for the
-sub-process to run. This is because its clock is slaved to audio I/O
-it gets from us!;
-#X text 359 849 Updated for Pd version 0.42.;
-#X text 24 138 Messages with "pd~" selector control the sub-process.
-"pd~ start" takes as arguments any startup arguments you wish to send
-the sub-process. For example \, specify "-nogui" to stop the sub-process's
-GUI from appearing. You don't have to specify the number of channels
-in and out \, since that's set by creation arguments below. Audio config
-arguments arguments (-audiobuf \, -audiodev \, etc.) are ignored.;
-#X connect 0 0 17 0;
-#X connect 1 0 10 0;
-#X connect 1 0 12 0;
-#X connect 2 0 6 0;
-#X connect 5 0 17 0;
-#X connect 6 0 3 0;
-#X connect 7 0 9 0;
-#X connect 9 0 8 0;
-#X connect 10 0 17 0;
-#X connect 11 0 10 1;
-#X connect 12 0 17 1;
-#X connect 13 0 12 1;
-#X connect 14 0 4 0;
-#X connect 16 0 17 0;
-#X connect 17 0 15 0;
-#X connect 17 1 2 0;
-#X connect 17 2 7 0;
diff --git a/externals/extra/0.43.3/0.43.2/pd~/pd~-subprocess.pd b/externals/extra/0.43.3/0.43.2/pd~/pd~-subprocess.pd
deleted file mode 100644
index 1d883ab1..00000000
--- a/externals/extra/0.43.3/0.43.2/pd~/pd~-subprocess.pd
+++ /dev/null
@@ -1,60 +0,0 @@
-#N canvas 577 21 563 559 12;
-#X obj 202 395 r foo;
-#X obj 202 423 print foo;
-#X obj 87 174 adc~;
-#X obj 72 442 stdout;
-#X msg 72 364 a b c;
-#X msg 455 441 \; pd dsp 1;
-#X obj 87 201 env~ 8192;
-#X floatatom 87 250 5 0 0 0 - - -;
-#X obj 87 226 i;
-#X obj 263 253 dac~;
-#X obj 262 185 osc~ 440;
-#X obj 262 219 *~;
-#X obj 297 220 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X obj 332 186 osc~ 440;
-#X obj 332 220 *~;
-#X obj 367 221 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X msg 86 411 bang;
-#X obj 455 417 loadbang;
-#X obj 160 201 env~ 8192;
-#X floatatom 160 250 5 0 0 0 - - -;
-#X obj 160 226 i;
-#X msg 86 388 4;
-#X text 62 8 This is a test patch to demonstrate the Pd~ object. It's
-intended as the patch to run in the sub-process. The sub-process (which
-is a separate instance of Pd) can be called from a Max or Pd super-process.
-;
-#X text 63 73 Audio inlets and outlets on the Pd~ object (in the super-process)
-talk to adc~ and dac~ objects here - so \, for instance \, the first
-adc~ here is the first inlet of the pd~ object \, and the first chanel
-of dac~ goes to the second outlet of pd~ (because the first one is
-for messages \, as shown further below.);
-#X text 58 283 Any message sent to a stdout object in this sub-process
-(below) appears on the first \, message outlet of the pd~ object in
-the super-process. The super-process can send messages to any "receive"
-object in this sub-process.;
-#X text 137 478 We turn DSP on at load for convenience - control objects
-in this patch will still work without it (unlike in the super-process
-\, where DSP must be on for time to move forward in the sub-process.)
-;
-#X text 351 538 Updated for Pd version 0.42.;
-#X connect 0 0 1 0;
-#X connect 2 0 6 0;
-#X connect 2 1 18 0;
-#X connect 4 0 3 0;
-#X connect 6 0 8 0;
-#X connect 8 0 7 0;
-#X connect 10 0 11 0;
-#X connect 11 0 9 0;
-#X connect 12 0 11 1;
-#X connect 13 0 14 0;
-#X connect 14 0 9 1;
-#X connect 15 0 14 1;
-#X connect 16 0 3 0;
-#X connect 17 0 5 0;
-#X connect 18 0 20 0;
-#X connect 20 0 19 0;
-#X connect 21 0 3 0;
diff --git a/externals/extra/0.43.3/0.43.2/pd~/pd~.c b/externals/extra/0.43.3/0.43.2/pd~/pd~.c
deleted file mode 100644
index 9c9d335e..00000000
--- a/externals/extra/0.43.3/0.43.2/pd~/pd~.c
+++ /dev/null
@@ -1,771 +0,0 @@
-/*
- pd~.c - embed a Pd process within Pd or Max.
-
- Copyright 2008 Miller Puckette
- BSD license; see README.txt in this distribution for details.
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-
-#ifdef _MSC_VER
-#pragma warning (disable: 4305 4244)
-#endif
-
-#ifdef MSP
-#include "ext.h"
-#include "z_dsp.h"
-#include "math.h"
-#include "ext_support.h"
-#include "ext_proto.h"
-#include "ext_obex.h"
-
-typedef double t_floatarg;
-#define w_symbol w_sym
-#define A_SYMBOL A_SYM
-#define getbytes t_getbytes
-#define freebytes t_freebytes
-#define ERROR error(
-void *pd_tilde_class;
-#define MAXPDSTRING 4096
-#define DEFDACBLKSIZE 64
-#endif /* MSP */
-
-#ifdef PD
-#include "m_pd.h"
-#include "s_stuff.h"
-static t_class *pd_tilde_class;
-char *class_gethelpdir(t_class *c);
-#define ERROR pd_error(x,
-
-#endif
-
-#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
-#ifdef __x86_64__
-static char pd_tilde_dllextent[] = ".l_ia64",
- pd_tilde_dllextent2[] = ".pd_linux";
-#else
-static char pd_tilde_dllextent[] = ".l_i386",
- pd_tilde_dllextent2[] = ".pd_linux";
-#endif
-#endif
-#ifdef __APPLE__
-static char pd_tilde_dllextent[] = ".d_fat",
- pd_tilde_dllextent2[] = ".pd_darwin";
-#endif
-#if defined(_WIN32) || defined(__CYGWIN__)
-static char pd_tilde_dllextent[] = ".m_i386", pd_tilde_dllextent2[] = ".dll";
-#endif
-
-/* ------------------------ pd_tilde~ ----------------------------- */
-
-#define MSGBUFSIZE 65536
-
-typedef struct _pd_tilde
-{
-#ifdef PD
- t_object x_obj;
- t_clock *x_clock;
- t_outlet *x_outlet1; /* for messages back from subproc */
- t_canvas *x_canvas;
-#endif /* PD */
-#ifdef MSP
- t_pxobject x_obj;
- void *x_outlet1;
- void *x_clock;
-#endif /* MSP */
- FILE *x_infd;
- FILE *x_outfd;
- char *x_msgbuf;
- int x_msgbufsize;
- int x_infill;
- int x_childpid;
- int x_ninsig;
- int x_noutsig;
- int x_fifo;
- t_float x_sr;
- t_symbol *x_pddir;
- t_symbol *x_schedlibdir;
- t_sample **x_insig;
- t_sample **x_outsig;
-} t_pd_tilde;
-
-#ifdef MSP
-static void *pd_tilde_new(t_symbol *s, long ac, t_atom *av);
-static void pd_tilde_tick(t_pd_tilde *x);
-static t_int *pd_tilde_perform(t_int *w);
-static void pd_tilde_dsp(t_pd_tilde *x, t_signal **sp);
-void pd_tilde_assist(t_pd_tilde *x, void *b, long m, long a, char *s);
-static void pd_tilde_free(t_pd_tilde *x);
-void pd_tilde_setup(void);
-int main();
-void pd_tilde_minvel_set(t_pd_tilde *x, void *attr, long ac, t_atom *av);
-char *strcpy(char *s1, const char *s2);
-#endif
-
-static void pd_tilde_tick(t_pd_tilde *x);
-static void pd_tilde_close(t_pd_tilde *x)
-{
- if (x->x_outfd)
- fclose(x->x_outfd);
- if (x->x_infd)
- fclose(x->x_infd);
- if (x->x_childpid > 0)
- waitpid(x->x_childpid, 0, 0);
- if (x->x_msgbuf)
- free(x->x_msgbuf);
- x->x_infd = x->x_outfd = 0;
- x->x_childpid = -1;
- x->x_msgbuf = 0;
- x->x_msgbufsize = 0;
-}
-
-static void pd_tilde_readmessages(t_pd_tilde *x)
-{
- int gotsomething = 0, setclock = 0, wasempty = (x->x_infill == 0);
- FILE *infd = x->x_infd;
- while (1)
- {
- int c = getc(infd);
- if (c == EOF)
- {
- ERROR "pd~: %s", strerror(errno));
- pd_tilde_close(x);
- break;
- }
- if (x->x_infill >= x->x_msgbufsize)
- {
- char *z = realloc(x->x_msgbuf, x->x_msgbufsize+MSGBUFSIZE);
- if (!z)
- {
- ERROR "pd~: failed to grow input buffer");
- pd_tilde_close(x);
- break;
- }
- x->x_msgbuf = z;
- x->x_msgbufsize += MSGBUFSIZE;
- }
- x->x_msgbuf[x->x_infill++] = c;
- if (c == ';')
- {
- if (!gotsomething)
- break;
- gotsomething = 0;
- }
- else if (!isspace(c))
- gotsomething = setclock = 1;
- }
- if (setclock)
- clock_delay(x->x_clock, 0);
- else if (wasempty)
- x->x_infill = 0;
-}
-
-static void pd_tilde_donew(t_pd_tilde *x, char *pddir, char *schedlibdir,
- char *patchdir, char *pdargs, int ninsig, int noutsig, int fifo,
- t_float samplerate)
-{
- int i, pid, pipe1[2], pipe2[2];
- char cmdbuf[MAXPDSTRING], pdexecbuf[MAXPDSTRING], schedbuf[MAXPDSTRING];
- struct stat statbuf;
- x->x_infd = x->x_outfd = 0;
- x->x_childpid = -1;
- snprintf(pdexecbuf, MAXPDSTRING, "%s/bin/pd", pddir);
- if (stat(pdexecbuf, &statbuf) < 0)
- {
- snprintf(pdexecbuf, MAXPDSTRING, "%s/../../../bin/pd", pddir);
- if (stat(pdexecbuf, &statbuf) < 0)
- {
- snprintf(pdexecbuf, MAXPDSTRING, "%s/pd", pddir);
- if (stat(pdexecbuf, &statbuf) < 0)
- {
- ERROR "pd~: can't stat %s", pdexecbuf);
- goto fail1;
- }
- }
- }
- snprintf(schedbuf, MAXPDSTRING, "%s/pdsched%s", schedlibdir,
- pd_tilde_dllextent);
- if (stat(schedbuf, &statbuf) < 0)
- {
- snprintf(schedbuf, MAXPDSTRING, "%s/pdsched%s", schedlibdir,
- pd_tilde_dllextent2);
- if (stat(schedbuf, &statbuf) < 0)
- {
- ERROR "pd~: can't stat %s", schedbuf);
- goto fail1;
- }
- }
- snprintf(cmdbuf, MAXPDSTRING,
-"'%s' -schedlib '%s'/pdsched -path '%s' -inchannels %d -outchannels %d -r %g %s\n",
- pdexecbuf, schedlibdir, patchdir, ninsig, noutsig, samplerate, pdargs);
-#if 0
-#ifdef PD
- fprintf(stderr, "%s", cmdbuf);
-#endif
- post("cmd: %s", cmdbuf);
-#endif
- if (pipe(pipe1) < 0)
- {
- ERROR "pd~: can't create pipe");
- goto fail1;
- }
- if (pipe(pipe2) < 0)
- {
- ERROR "pd~: can't create pipe");
- goto fail2;
- }
- if ((pid = fork()) < 0)
- {
- ERROR "pd~: can't fork");
- goto fail3;
- }
- else if (pid == 0)
- {
- /* child process */
- if (pipe2[1] == 0)
- {
- dup2(pipe2[1], 20);
- close(pipe2[1]);
- pipe2[1] = 20;
- }
- dup2(pipe1[0], 0);
- dup2(pipe2[1], 1);
- if (pipe1[0] >= 2)
- close(pipe1[0]);
- if (pipe1[1] >= 2)
- close(pipe1[1]);
- if (pipe2[0] >= 2)
- close(pipe2[0]);
- if (pipe2[1] >= 2)
- close(pipe2[1]);
- execl("/bin/sh", "sh", "-c", cmdbuf, (char*)0);
- _exit(1);
- }
- /* OK, we're parent */
- close(pipe1[0]);
- close(pipe2[1]);
- fcntl(pipe1[1], F_SETFD, FD_CLOEXEC);
- fcntl(pipe2[0], F_SETFD, FD_CLOEXEC);
- x->x_outfd = fdopen(pipe1[1], "w");
- x->x_infd = fdopen(pipe2[0], "r");
- x->x_childpid = pid;
- for (i = 0; i < fifo; i++)
- fprintf(x->x_outfd, "%s", ";\n0;\n");
- fflush(x->x_outfd);
- if (!(x->x_msgbuf = calloc(MSGBUFSIZE, 1)))
- {
- ERROR "pd~: can't allocate message buffer");
- goto fail3;
- }
- x->x_msgbufsize = MSGBUFSIZE;
- x->x_infill = 0;
- /* fprintf(stderr, "read...\n"); */
- pd_tilde_readmessages(x);
- /* fprintf(stderr, "... done.\n"); */
- return;
-fail3:
- close(pipe2[0]);
- close(pipe2[1]);
- if (x->x_childpid > 0)
- waitpid(x->x_childpid, 0, 0);
-fail2:
- close(pipe1[0]);
- close(pipe1[1]);
-fail1:
- x->x_infd = x->x_outfd = 0;
- x->x_childpid = -1;
- return;
-}
-
-static t_int *pd_tilde_perform(t_int *w)
-{
- t_pd_tilde *x = (t_pd_tilde *)(w[1]);
- int n = (int)(w[2]), i, j, numbuffill = 0, c;
- char numbuf[80];
- FILE *infd = x->x_infd;
- if (!infd)
- goto zeroit;
- fprintf(x->x_outfd, ";\n");
- if (!x->x_ninsig)
- fprintf(x->x_outfd, "0\n");
- else for (i = 0; i < x->x_ninsig; i++)
- {
- t_sample *fp = x->x_insig[i];
- for (j = 0; j < n; j++)
- fprintf(x->x_outfd, "%g\n", *fp++);
- for (; j < DEFDACBLKSIZE; j++)
- fprintf(x->x_outfd, "0\n");
- }
- fprintf(x->x_outfd, ";\n");
- fflush(x->x_outfd);
- i = j = 0;
- while (1)
- {
- while (1)
- {
- c = getc(infd);
- if (c == EOF)
- {
- if (errno)
- ERROR "pd~: %s", strerror(errno));
- else ERROR "pd~: subprocess exited");
- pd_tilde_close(x);
- goto zeroit;
- }
- else if (!isspace(c) && c != ';')
- {
- if (numbuffill < (80-1))
- numbuf[numbuffill++] = c;
- }
- else
- {
- t_sample z;
- if (numbuffill)
- {
- numbuf[numbuffill] = 0;
- if (sscanf(numbuf, "%f", &z) < 1)
- continue;
- if (i < x->x_noutsig)
- x->x_outsig[i][j] = z;
- if (++j >= DEFDACBLKSIZE)
- j = 0, i++;
- }
- numbuffill = 0;
- break;
- }
- }
- /* message terminated */
- if (c == ';')
- break;
- }
- for (; i < x->x_noutsig; i++, j = 0)
- {
- for (; j < DEFDACBLKSIZE; j++)
- x->x_outsig[i][j] = 0;
- }
- pd_tilde_readmessages(x);
- return (w+3);
-zeroit:
- for (i = 0; i < x->x_noutsig; i++)
- {
- for (j = 0; j < DEFDACBLKSIZE; j++)
- x->x_outsig[i][j] = 0;
- }
- return (w+3);
-}
-
-static void pd_tilde_dsp(t_pd_tilde *x, t_signal **sp)
-{
- int i, n = (x->x_ninsig || x->x_noutsig ? sp[0]->s_n : 1);
- t_sample **g;
-
- for (i = 0, g = x->x_insig; i < x->x_ninsig; i++, g++)
- *g = (*(sp++))->s_vec;
-
- for (i = 0, g = x->x_outsig; i < x->x_noutsig; i++, g++)
- *g = (*(sp++))->s_vec;
-
- dsp_add(pd_tilde_perform, 2, x, n);
-}
-
-static void pd_tilde_pdtilde(t_pd_tilde *x, t_symbol *s,
- int argc, t_atom *argv)
-{
- t_symbol *sel = ((argc > 0 && argv->a_type == A_SYMBOL) ?
- argv->a_w.w_symbol : gensym("?")), *schedlibdir;
- char *patchdir;
- if (sel == gensym("start"))
- {
- char pdargstring[MAXPDSTRING];
- if (x->x_infd)
- pd_tilde_close(x);
- pdargstring[0] = 0;
- argc--; argv++;
-#ifdef PD
- while (argc--)
- {
- atom_string(argv++, pdargstring + strlen(pdargstring),
- MAXPDSTRING - strlen(pdargstring));
- if (strlen(pdargstring) < MAXPDSTRING-1)
- strcat(pdargstring, " ");
- }
- patchdir = canvas_getdir(x->x_canvas)->s_name;
-#endif
-#ifdef MSP
- while (argc--)
- {
- /* because Mac pathnames sometimes have an evil preceeding
- colon character, we test for and silently eat them */
- if (argv->a_type == A_SYM)
- strncat(pdargstring, (*argv->a_w.w_sym->s_name == ':'?
- argv->a_w.w_sym->s_name+1 : argv->a_w.w_sym->s_name),
- MAXPDSTRING - strlen(pdargstring)-3);
- else if (argv->a_type == A_LONG)
- snprintf(pdargstring+strlen(pdargstring),
- MAXPDSTRING - strlen(pdargstring)-3, "%ld",
- argv->a_w.w_long);
- else if (argv->a_type == A_FLOAT)
- snprintf(pdargstring+strlen(pdargstring),
- MAXPDSTRING - strlen(pdargstring)-3, "%f",
- argv->a_w.w_float);
- strcat(pdargstring, " ");
- argv++;
- }
- patchdir = ".";
-#endif
- schedlibdir = x->x_schedlibdir;
- if (schedlibdir == gensym(".") && x->x_pddir != gensym("."))
- {
- char *pds = x->x_pddir->s_name, scheddirstring[MAXPDSTRING];
- int l = strlen(pds);
- if (l >= 4 && (!strcmp(pds+l-3, "bin") || !strcmp(pds+l-4, "bin/")))
- snprintf(scheddirstring, MAXPDSTRING, "%s/../extra/pd~", pds);
- else snprintf(scheddirstring, MAXPDSTRING, "%s/extra/pd~", pds);
- schedlibdir = gensym(scheddirstring);
- }
- pd_tilde_donew(x, x->x_pddir->s_name, schedlibdir->s_name,
- patchdir, pdargstring, x->x_ninsig, x->x_noutsig, x->x_fifo,
- x->x_sr);
- }
- else if (sel == gensym("stop"))
- {
- if (x->x_infd)
- pd_tilde_close(x);
- }
- else if (sel == gensym("pddir"))
- {
- if ((argc > 1) && argv[1].a_type == A_SYMBOL)
- {
- t_symbol *sym = argv[1].a_w.w_symbol;
-#ifdef MSP
- if (sym->s_name[0] == ':')
- sym = gensym(s->s_name+1);
-#endif
- x->x_pddir = sym;
- }
- else ERROR "pd~ pddir: needs symbol argument");
- }
- else ERROR "pd~: unknown control message: %s", sel->s_name);
-}
-
-static void pd_tilde_free(t_pd_tilde *x)
-{
-#ifdef MSP
- dsp_free((t_pxobject *)x);
-#endif
- pd_tilde_close(x);
- clock_free(x->x_clock);
-}
-
-/* -------------------------- Pd glue ------------------------- */
-#ifdef PD
-
-static void pd_tilde_tick(t_pd_tilde *x)
-{
- int messstart = 0, i, n;
- t_atom *vec;
- t_binbuf *b;
- if (!x->x_msgbuf)
- return;
- b = binbuf_new();
- binbuf_text(b, x->x_msgbuf, x->x_infill);
- /* binbuf_print(b); */
- n = binbuf_getnatom(b);
- vec = binbuf_getvec(b);
- for (i = 0; i < n; i++)
- {
- if (vec[i].a_type == A_SEMI)
- {
- if (i > messstart && vec[messstart].a_type == A_SYMBOL)
- outlet_anything(x->x_outlet1, vec[messstart].a_w.w_symbol,
- i-(messstart+1), vec+(messstart+1));
- else if (i > messstart)
- outlet_list(x->x_outlet1, 0, i-messstart, vec+messstart);
- messstart = i+1;
- }
- }
- binbuf_free(b);
- x->x_infill = 0;
-}
-
-static void pd_tilde_anything(t_pd_tilde *x, t_symbol *s,
- int argc, t_atom *argv)
-{
- char msgbuf[MAXPDSTRING];
- if (!x->x_outfd)
- return;
- fprintf(x->x_outfd, "%s ", s->s_name);
- while (argc--)
- {
- atom_string(argv++, msgbuf, MAXPDSTRING);
- fprintf(x->x_outfd, "%s ", msgbuf);
- }
- fprintf(x->x_outfd, ";\n");
-}
-
-static void *pd_tilde_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_pd_tilde *x = (t_pd_tilde *)pd_new(pd_tilde_class);
- int ninsig = 2, noutsig = 2, j, fifo = 5;
- t_float sr = sys_getsr();
- t_sample **g;
- t_symbol *pddir = sys_libdir,
- *scheddir = gensym(class_gethelpdir(pd_tilde_class));
- /* fprintf(stderr, "pd %s, sched %s\n", pddir->s_name, scheddir->s_name); */
- while (argc > 0)
- {
- t_symbol *firstarg = atom_getsymbolarg(0, argc, argv);
- if (!strcmp(firstarg->s_name, "-sr") && argc > 1)
- {
- sr = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-ninsig") && argc > 1)
- {
- ninsig = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-noutsig") && argc > 1)
- {
- noutsig = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-fifo") && argc > 1)
- {
- fifo = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-pddir") && argc > 1)
- {
- pddir = atom_getsymbolarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-scheddir") && argc > 1)
- {
- scheddir = atom_getsymbolarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else break;
- }
-
- if (argc)
- {
- pd_error(x,
-"usage: pd~ [-sr #] [-ninsig #] [-noutsig #] [-fifo #] [-pddir <>]");
- post(
-"... [-scheddir <>]");
- }
-
- x->x_clock = clock_new(x, (t_method)pd_tilde_tick);
- x->x_insig = (t_sample **)getbytes(ninsig * sizeof(*x->x_insig));
- x->x_outsig = (t_sample **)getbytes(noutsig * sizeof(*x->x_outsig));
- x->x_ninsig = ninsig;
- x->x_noutsig = noutsig;
- x->x_fifo = fifo;
- x->x_sr = sr;
- x->x_pddir = pddir;
- x->x_schedlibdir = scheddir;
- x->x_infd = 0;
- x->x_outfd = 0;
- x->x_outfd = 0;
- x->x_childpid = -1;
- x->x_msgbuf = 0;
- x->x_canvas = canvas_getcurrent();
- for (j = 1, g = x->x_insig; j < ninsig; j++, g++)
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- x->x_outlet1 = outlet_new(&x->x_obj, 0);
- for (j = 0, g = x->x_outsig; j < noutsig; j++, g++)
- outlet_new(&x->x_obj, &s_signal);
- signal(SIGPIPE, SIG_IGN);
-
- return (x);
-}
-
-void pd_tilde_setup(void)
-{
- pd_tilde_class = class_new(gensym("pd~"), (t_newmethod)pd_tilde_new,
- (t_method)pd_tilde_free, sizeof(t_pd_tilde), 0, A_GIMME, 0);
- class_addmethod(pd_tilde_class, nullfn, gensym("signal"), 0);
- class_addmethod(pd_tilde_class, (t_method)pd_tilde_dsp, gensym("dsp"), 0);
- class_addmethod(pd_tilde_class, (t_method)pd_tilde_pdtilde, gensym("pd~"), A_GIMME, 0);
- class_addanything(pd_tilde_class, pd_tilde_anything);
- post("pd~ version 0.2");
-}
-#endif
-
-/* -------------------------- MSP glue ------------------------- */
-#ifdef MSP
-
-#define LOTS 10000
-
-static void pd_tilde_tick(t_pd_tilde *x)
-{
- int messstart = 0, i, n = 0;
- t_atom vec[LOTS];
- long z1 = 0, z2 = 0;
- void *b;
- if (!x->x_msgbuf)
- return;
- b = binbuf_new();
- binbuf_text(b, &x->x_msgbuf, x->x_infill);
- /* binbuf_print(b); */
- while (!binbuf_getatom(b, &z1, &z2, vec+n))
- if (++n >= LOTS)
- break;
- for (i = 0; i < n; i++)
- {
- if (vec[i].a_type == A_SEMI)
- {
- if (i > messstart + 1)
- {
- void *whom;
- if (vec[messstart].a_type == A_SYM)
- outlet_anything(x->x_outlet1, vec[messstart].a_w.w_sym,
- i-messstart-1, vec+(messstart+1));
- else if (vec[messstart].a_type == A_FLOAT && i == messstart+1)
- outlet_float(x->x_outlet1, vec[messstart].a_w.w_float);
- else if (vec[messstart].a_type == A_LONG && i == messstart+1)
- outlet_int(x->x_outlet1, vec[messstart].a_w.w_long);
- else outlet_list(x->x_outlet1, gensym("list"),
- i-messstart, vec+(messstart));
- }
- messstart = i+1;
- }
- }
- binbuf_free(b);
- x->x_infill = 0;
-}
-
-static void pd_tilde_anything(t_pd_tilde *x, t_symbol *s,
- long ac, t_atom *av)
-{
- char msgbuf[MAXPDSTRING], *sp, *ep = msgbuf+MAXPDSTRING;
- if (!x->x_outfd)
- return;
- msgbuf[0] = 0;
- strncpy(msgbuf, s->s_name, MAXPDSTRING);
- msgbuf[MAXPDSTRING-1] = 0;
- sp = msgbuf + strlen(msgbuf);
- while (ac--)
- {
- if (sp < ep-1)
- sp[0] = ' ', sp[1] = 0, sp++;
- if (sp < ep - 80)
- {
- if (av->a_type == A_SYM && strlen(av->a_w.w_sym->s_name) < ep - sp-20)
- strcpy(sp, av->a_w.w_sym->s_name);
- else if (av->a_type == A_LONG)
- sprintf(sp, "%ld" ,av->a_w.w_long);
- else if (av->a_type == A_FLOAT)
- sprintf(sp, "%g" ,av->a_w.w_float);
- }
- sp += strlen(sp);
- av++;
- }
- fprintf(x->x_outfd, "%s;\n", msgbuf);
-}
-
-int main()
-{
- t_class *c;
-
- c = class_new("pd_tilde~", (method)pd_tilde_new, (method)pd_tilde_free, sizeof(t_pd_tilde), (method)0L, A_GIMME, 0);
-
- class_addmethod(c, (method)pd_tilde_dsp, "dsp", A_CANT, 0);
- class_addmethod(c, (method)pd_tilde_assist, "assist", A_CANT, 0);
- class_addmethod(c, (method)pd_tilde_pdtilde, "pd~", A_GIMME, 0);
- class_addmethod(c, (method)pd_tilde_anything, "anything", A_GIMME, 0);
- class_dspinit(c);
-
- class_register(CLASS_BOX, c);
- pd_tilde_class = c;
- post("pd~ version 0.2");
- return (0);
-}
-
-static void *pd_tilde_new(t_symbol *s, long ac, t_atom *av)
-{
- int ninsig = 2, noutsig = 2, fifo = 5, j;
- t_float sr = sys_getsr();
- t_symbol *pddir = gensym("."), *scheddir = gensym(".");
- t_pd_tilde *x;
-
- if (x = (t_pd_tilde *)object_alloc(pd_tilde_class))
- {
- while (ac > 0 && av[0].a_type == A_SYM)
- {
- char *flag = av[0].a_w.w_sym->s_name;
- if (!strcmp(flag, "-sr") && ac > 1)
- {
- sr = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float :
- (av[1].a_type == A_LONG ? av[1].a_w.w_long : 0));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-ninsig") && ac > 1)
- {
- ninsig = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float :
- (av[1].a_type == A_LONG ? av[1].a_w.w_long : 0));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-noutsig") && ac > 1)
- {
- noutsig = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float :
- (av[1].a_type == A_LONG ? av[1].a_w.w_long : 0));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-fifo") && ac > 1)
- {
- fifo = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float :
- (av[1].a_type == A_LONG ? av[1].a_w.w_long : 0));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-pddir") && ac > 1)
- {
- pddir = (av[1].a_type == A_SYM ? av[1].a_w.w_sym : gensym("."));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-scheddir") && ac > 1)
- {
- scheddir = (av[1].a_type == A_SYM ? av[1].a_w.w_sym : gensym("."));
- ac -= 2; av += 2;
- }
- else break;
- }
- if (ac)
- post("pd~: warning: ignoring extra arguments");
- dsp_setup((t_pxobject *)x, ninsig);
- x->x_outlet1 = outlet_new(&x->x_obj, 0);
- for (j = 0; j < noutsig; j++)
- outlet_new((t_pxobject *)x, "signal");
- x->x_clock = clock_new(x, (method)pd_tilde_tick);
- x->x_insig = (t_sample **)getbytes(ninsig * sizeof(*x->x_insig));
- x->x_outsig = (t_sample **)getbytes(noutsig * sizeof(*x->x_outsig));
- x->x_ninsig = ninsig;
- x->x_noutsig = noutsig;
- x->x_fifo = fifo;
- x->x_sr = sr;
- x->x_pddir = pddir;
- x->x_schedlibdir = scheddir;
- x->x_infd = 0;
- x->x_outfd = 0;
- x->x_outfd = 0;
- x->x_childpid = -1;
- x->x_msgbuf = 0;
- }
- return (x);
-}
-
-void pd_tilde_assist(t_pd_tilde *x, void *b, long m, long a, char *s)
-{
-}
-
-#endif /* MSP */
diff --git a/externals/extra/0.43.3/0.43.2/pd~/z.pd b/externals/extra/0.43.3/0.43.2/pd~/z.pd
deleted file mode 100644
index 373201da..00000000
--- a/externals/extra/0.43.3/0.43.2/pd~/z.pd
+++ /dev/null
@@ -1,15 +0,0 @@
-#N canvas 686 241 450 300 10;
-#X obj 65 58 r foo;
-#X obj 62 100 print foo;
-#X obj 244 59 adc~;
-#X obj 238 102 env~ 8192;
-#X floatatom 236 140 5 0 0 0 - - -;
-#X obj 155 234 dac~;
-#X obj 155 191 osc~ 440;
-#X obj 287 204 stdout;
-#X msg 307 153 a b c;
-#X connect 0 0 1 0;
-#X connect 2 0 3 0;
-#X connect 3 0 4 0;
-#X connect 6 0 5 0;
-#X connect 8 0 7 0;
diff --git a/externals/extra/0.43.3/0.43.2/pique/pique-help.pd b/externals/extra/0.43.3/0.43.2/pique/pique-help.pd
deleted file mode 100644
index 1689c95b..00000000
--- a/externals/extra/0.43.3/0.43.2/pique/pique-help.pd
+++ /dev/null
@@ -1,33 +0,0 @@
-#N canvas 143 0 729 407 12;
-#X obj 47 11 pique;
-#X text 105 12 -- find peaks in an FFT spectrum;
-#X obj 214 174 rfft~;
-#X obj 131 129 osc~ 2000;
-#X graph graph2 0 -64 63 64 519 179 719 39;
-#X array fft-real 64 float;
-#X pop;
-#X graph graph3 0 -64 63 64 519 327 719 187;
-#X array fft-imag 64 float;
-#X pop;
-#X obj 214 215 tabwrite~ fft-real;
-#X obj 245 240 tabwrite~ fft-imag;
-#X obj 315 158 metro 1000;
-#X obj 315 116 loadbang;
-#X msg 315 138 1;
-#X obj 91 349 pique;
-#X msg 91 322 64 fft-real fft-imag 10;
-#X obj 91 376 print;
-#X obj 205 132 osc~ 5000;
-#X text 25 37 pique takes unwindowed FFT analyses as input (they should be stored in arrays) and outputs a list of peaks \, giving their peak number \, frequency \, amplitude \, and phase (as a cosine/sine pair.);
-#X text 13 289 message argumnets: number of FFT points \, fft real part \, fft imaginary part \, maximum number of peaks to report.;
-#X text 578 387 updated for Pd 0.31.;
-#X connect 2 0 6 0;
-#X connect 2 1 7 0;
-#X connect 3 0 2 0;
-#X connect 8 0 6 0;
-#X connect 8 0 7 0;
-#X connect 9 0 10 0;
-#X connect 10 0 8 0;
-#X connect 11 0 13 0;
-#X connect 12 0 11 0;
-#X connect 14 0 2 0;
diff --git a/externals/extra/0.43.3/0.43.2/pique/pique.c b/externals/extra/0.43.3/0.43.2/pique/pique.c
deleted file mode 100644
index 7c8b899b..00000000
--- a/externals/extra/0.43.3/0.43.2/pique/pique.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/* Copyright (c) 1999 Miller Puckette. The
-contents of this file are free for any use, but BOTH THE AUTHOR AND UCSD
-DISCLAIM ALL WARRANTIES related to it. Although not written in Java, this
-still should not be used to control any machinery containing a sharp blade or
-combustible materiel, or as part of any life support system or weapon. */
-
-#include "m_pd.h"
-#include <math.h>
-#include <stdio.h>
-/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
-#ifdef _MSC_VER
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-static t_class *pique_class;
-
-typedef struct _pique
-{
- t_object x_obj;
- int x_n;
- t_float x_errthresh;
- t_float *x_freq;
- t_float *x_amp;
- t_float *x_ampre;
- t_float *x_ampim;
-} t_pique;
-
-static void *pique_new(t_floatarg f)
-{
- int n = f;
- t_pique *x = (t_pique *)pd_new(pique_class);
- if (n < 1) n = 100;
- x->x_n = n;
- x->x_errthresh = 0;
- x->x_freq = t_getbytes(n * sizeof(*x->x_freq));
- x->x_amp = t_getbytes(n * sizeof(*x->x_amp));
- x->x_ampre = t_getbytes(n * sizeof(*x->x_ampre));
- x->x_ampim = t_getbytes(n * sizeof(*x->x_ampim));
- outlet_new(&x->x_obj, &s_list);
- return (x);
-}
-
-static t_float hanning(t_float pidetune, t_float sinpidetune)
-{
- t_float pi = 3.141592653589793;
- if (pidetune < 0.01 && pidetune > -0.01) return (1);
- else if (pidetune > 3.14 && pidetune < 3.143) return (0.5);
- else if (pidetune < -3.14 && pidetune > -3.143) return (0.5);
- else return (sinpidetune/pidetune - 0.5 *
- (sinpidetune/(pidetune+pi) + sinpidetune/(pidetune-pi)));
-}
-
-static t_float peakerror(t_word *fpreal, t_word *fpimag, t_float pidetune,
- t_float norm, t_float peakreal, t_float peakimag)
-{
- t_float sinpidetune = sin(pidetune);
- t_float cospidetune = cos(pidetune);
- t_float windowshould = hanning(pidetune, sinpidetune);
- t_float realshould = windowshould * (
- peakreal * cospidetune + peakimag * sinpidetune);
- t_float imagshould = windowshould * (
- peakimag * cospidetune - peakreal * sinpidetune);
- t_float realgot = norm * (fpreal[0].w_float -
- 0.5 * (fpreal[1].w_float + fpreal[-1].w_float));
- t_float imaggot = norm * (fpimag[0].w_float -
- 0.5 * (fpimag[1].w_float + fpimag[-1].w_float));
- t_float realdev = realshould - realgot, imagdev = imagshould - imaggot;
-
- /* post("real %f->%f; imag %f->%f", realshould, realgot,
- imagshould, imaggot); */
- return (realdev * realdev + imagdev * imagdev);
-}
-
-static void pique_doit(int npts, t_word *fpreal, t_word *fpimag,
- int npeak, int *nfound, t_float *fpfreq, t_float *fpamp,
- t_float *fpampre, t_float *fpampim, t_float errthresh)
-{
- t_float srate = sys_getsr(); /* not sure how to get this correctly */
- t_float oneovern = 1.0/ (t_float)npts;
- t_float fperbin = srate * oneovern;
- t_float pow1, pow2 = 0, pow3 = 0, pow4 = 0, pow5 = 0;
- t_float re1, re2 = 0, re3 = fpreal->w_float;
- t_float im1, im2 = 0, im3 = 0, powthresh, relativeerror;
- int count, peakcount = 0, n2 = (npts >> 1);
- t_float *fp1, *fp2;
- t_word *wp1, *wp2;
- for (count = n2, wp1 = fpreal, wp2 = fpimag, powthresh = 0;
- count--; wp1++, wp2++)
- powthresh += (wp1->w_float) * (wp1->w_float) +
- (wp2->w_float) * (wp2->w_float) ;
- powthresh *= 0.00001;
- for (count = 1; count < n2; count++)
- {
- t_float windreal, windimag, pi = 3.141592653589793;
- t_float detune, pidetune, sinpidetune, cospidetune,
- ampcorrect, freqout, ampout, ampoutreal, ampoutimag;
- t_float rpeak, rpeaknext, rpeakprev;
- t_float ipeak, ipeaknext, ipeakprev;
- t_float errleft, errright;
- fpreal++;
- fpimag++;
- re1 = re2;
- re2 = re3;
- re3 = fpreal->w_float;
- im1 = im2;
- im2 = im3;
- im3 = fpimag->w_float;
- if (count < 2) continue;
- pow1 = pow2;
- pow2 = pow3;
- pow3 = pow4;
- pow4 = pow5;
- /* get Hanning-windowed spectrum by convolution */
- windreal = re2 - 0.5 * (re1 + re3);
- windimag = im2 - 0.5 * (im1 + im3);
- pow5 = windreal * windreal + windimag * windimag;
- /* if (count < 30) post("power %f", pow5); */
- if (count < 5) continue;
- /* check for a peak. The actual bin is count-3. */
- if (pow3 <= pow2 || pow3 <= pow4 || pow3 <= pow1 || pow3 <= pow5
- || pow3 < powthresh)
- continue;
- /* go back for the raw FFT values around the peak. */
- rpeak = fpreal[-3].w_float;
- rpeaknext = fpreal[-2].w_float;
- rpeakprev = fpreal[-4].w_float;
- ipeak = fpimag[-3].w_float;
- ipeaknext = fpimag[-2].w_float;
- ipeakprev = fpimag[-4].w_float;
- /* recalculate Hanning-windowed spectrum by convolution */
- windreal = rpeak - 0.5 * (rpeaknext + rpeakprev);
- windimag = ipeak - 0.5 * (ipeaknext + ipeakprev);
-
- detune = ((rpeakprev - rpeaknext) *
- (2.0 * rpeak - rpeakprev - rpeaknext) +
- (ipeakprev - ipeaknext) *
- (2.0 * ipeak - ipeakprev - ipeaknext)) /
- (4.0 * pow3);
- /* if (count < 30) post("detune %f", detune); */
- if (detune > 0.7 || detune < -0.7) continue;
- /* the frequency is the sum of the bin frequency and detuning */
- freqout = fperbin * ((t_float)(count-3) + detune);
- pidetune = pi * detune;
- sinpidetune = sin(pidetune);
- cospidetune = cos(pidetune);
- ampcorrect = 1.0 / hanning(pidetune, sinpidetune);
- /* Multiply by 2 to get real-sinusoid peak amplitude
- and divide by N to normalize FFT */
- ampcorrect *= 2. * oneovern;
- /* amplitude is peak height, corrected for Hanning window shape */
-
- ampout = ampcorrect * sqrt(pow3);
- ampoutreal = ampcorrect *
- (windreal * cospidetune - windimag * sinpidetune);
- ampoutimag = ampcorrect *
- (windreal * sinpidetune + windimag * cospidetune);
- if (errthresh > 0)
- {
- /* post("peak %f %f", freqout, ampout); */
- errleft = peakerror(fpreal-4, fpimag-4, pidetune+pi,
- 2. * oneovern, ampoutreal, ampoutimag);
- errright = peakerror(fpreal-2, fpimag-2, pidetune-pi,
- 2. * oneovern, ampoutreal, ampoutimag);
- relativeerror = (errleft + errright)/(ampout * ampout);
- if (relativeerror > errthresh) continue;
- }
- /* post("power %f, error %f, relative %f",
- pow3, errleft + errright, relativeerror); */
- *fpfreq++ = freqout;
- *fpamp++ = ampout;
- *fpampre++ = ampoutreal;
- *fpampim++ = ampoutimag;
- if (++peakcount == npeak) break;
- }
- *nfound = peakcount;
-}
-
-static void pique_list(t_pique *x, t_symbol *s, int argc, t_atom *argv)
-{
- int npts = atom_getintarg(0, argc, argv);
- t_symbol *symreal = atom_getsymbolarg(1, argc, argv);
- t_symbol *symimag = atom_getsymbolarg(2, argc, argv);
- int npeak = atom_getintarg(3, argc, argv);
- int n;
- t_garray *a;
- t_word *fpreal, *fpimag;
- if (npts < 8 || npeak < 1) error("pique: bad npoints or npeak");
- if (npeak > x->x_n) npeak = x->x_n;
- if (!(a = (t_garray *)pd_findbyclass(symreal, garray_class)) ||
- !garray_getfloatwords(a, &n, &fpreal) ||
- n < npts)
- error("%s: missing or bad array", symreal->s_name);
- else if (!(a = (t_garray *)pd_findbyclass(symimag, garray_class)) ||
- !garray_getfloatwords(a, &n, &fpimag) ||
- n < npts)
- error("%s: missing or bad array", symimag->s_name);
- else
- {
- int nfound, i;
- t_float *fpfreq = x->x_freq;
- t_float *fpamp = x->x_amp;
- t_float *fpampre = x->x_ampre;
- t_float *fpampim = x->x_ampim;
- pique_doit(npts, fpreal, fpimag, npeak,
- &nfound, fpfreq, fpamp, fpampre, fpampim, x->x_errthresh);
- for (i = 0; i < nfound; i++, fpamp++, fpfreq++, fpampre++, fpampim++)
- {
- t_atom at[5];
- SETFLOAT(at, (t_float)i);
- SETFLOAT(at+1, *fpfreq);
- SETFLOAT(at+2, *fpamp);
- SETFLOAT(at+3, *fpampre);
- SETFLOAT(at+4, *fpampim);
- outlet_list(x->x_obj.ob_outlet, &s_list, 5, at);
- }
- }
-}
-
-static void pique_errthresh(t_pique *x, t_floatarg f)
-{
- x->x_errthresh = f;
-}
-
-static void pique_free(t_pique *x)
-{
- int n = x->x_n;
- t_freebytes(x->x_freq, n * sizeof(*x->x_freq));
- t_freebytes(x->x_amp, n * sizeof(*x->x_amp));
- t_freebytes(x->x_ampre, n * sizeof(*x->x_ampre));
- t_freebytes(x->x_ampim, n * sizeof(*x->x_ampim));
-}
-
-void pique_setup(void)
-{
- pique_class = class_new(gensym("pique"), (t_newmethod)pique_new,
- (t_method)pique_free, sizeof(t_pique),0, A_DEFFLOAT, 0);
- class_addlist(pique_class, pique_list);
- class_addmethod(pique_class, (t_method)pique_errthresh,
- gensym("errthresh"), A_FLOAT, 0);
- post("pique 0.1 for PD version 23");
-}
-
diff --git a/externals/extra/0.43.3/0.43.2/rev1-final.pd b/externals/extra/0.43.3/0.43.2/rev1-final.pd
deleted file mode 100644
index 0ed091c4..00000000
--- a/externals/extra/0.43.3/0.43.2/rev1-final.pd
+++ /dev/null
@@ -1,106 +0,0 @@
-#N canvas 133 53 729 468 10;
-#X obj 72 240 inlet~;
-#X obj 347 28 loadbang;
-#X obj 90 376 +~;
-#X obj 52 408 +~;
-#X obj 52 437 outlet~;
-#X obj 409 96 pow;
-#X obj 372 118 *;
-#X floatatom 372 159;
-#X obj 82 264 *~ 0;
-#X obj 177 175 pow;
-#X text 386 140 delay \, msec;
-#X floatatom 201 237;
-#X obj 190 150 * 0.001;
-#X text 206 220 gain for this stage;
-#X obj 103 327 *~ 0;
-#X obj 201 202 *;
-#X text 25 13 Allpass filter for mono reverberator. Arg 1 = delay name \, arg2 = stage number \, arg 3 = delay time;
-#X obj 373 76 8;
-#X obj 409 75 1.79;
-#X obj 114 175 0.7;
-#X obj 363 50 t b b b b;
-#X obj 177 108 0;
-#X obj 372 207 abs;
-#X obj 372 229 moses 0.01;
-#X obj 443 229 print wrong-delay-time;
-#X obj 233 391 inlet~;
-#X obj 219 419 +~;
-#X obj 219 443 outlet~;
-#X text 74 83 decay after;
-#X text 85 98 1 second;
-#X obj 83 119 r \$1-decay;
-#X obj 327 262 r \$1-clear;
-#X obj 240 298 0;
-#X obj 327 281 t b;
-#X obj 327 344 delay;
-#X obj 327 322 + 5;
-#X obj 158 279 delread~ \$2 \$4;
-#X obj 90 397 delwrite~ \$2 \$4;
-#X obj 327 302 f \$4;
-#X obj 371 184 - \$4;
-#X obj 446 75 float \$3;
-#X obj 241 318 1;
-#X obj 158 300 *~ 1;
-#X obj 52 298 *~ 0;
-#X obj 10 209 t b f f;
-#X obj 28 233 *;
-#X obj 10 256 -;
-#X obj 41 258 * -1;
-#X obj 11 297 *~ 0;
-#X obj 214 181 sqrt;
-#X connect 0 0 8 0;
-#X connect 1 0 20 0;
-#X connect 2 0 37 0;
-#X connect 3 0 4 0;
-#X connect 3 0 26 0;
-#X connect 5 0 6 1;
-#X connect 6 0 7 0;
-#X connect 6 0 12 0;
-#X connect 7 0 39 0;
-#X connect 8 0 43 0;
-#X connect 8 0 48 0;
-#X connect 9 0 15 0;
-#X connect 9 0 14 1;
-#X connect 12 0 9 1;
-#X connect 14 0 2 1;
-#X connect 14 0 3 1;
-#X connect 15 0 11 0;
-#X connect 15 0 8 1;
-#X connect 17 0 6 0;
-#X connect 18 0 5 0;
-#X connect 18 0 49 0;
-#X connect 19 0 44 0;
-#X connect 19 0 47 0;
-#X connect 20 0 21 0;
-#X connect 20 0 19 0;
-#X connect 20 1 17 0;
-#X connect 20 2 18 0;
-#X connect 20 3 40 0;
-#X connect 21 0 9 0;
-#X connect 22 0 23 0;
-#X connect 23 1 24 0;
-#X connect 25 0 26 1;
-#X connect 26 0 27 0;
-#X connect 30 0 9 0;
-#X connect 31 0 33 0;
-#X connect 32 0 42 1;
-#X connect 33 0 32 0;
-#X connect 33 0 38 0;
-#X connect 34 0 41 0;
-#X connect 35 0 34 0;
-#X connect 36 0 42 0;
-#X connect 38 0 35 0;
-#X connect 39 0 22 0;
-#X connect 40 0 5 1;
-#X connect 41 0 42 1;
-#X connect 42 0 14 0;
-#X connect 43 0 3 0;
-#X connect 44 0 46 0;
-#X connect 44 1 45 0;
-#X connect 44 2 45 1;
-#X connect 45 0 46 1;
-#X connect 46 0 48 1;
-#X connect 47 0 43 1;
-#X connect 48 0 2 0;
-#X connect 49 0 15 1;
diff --git a/externals/extra/0.43.3/0.43.2/rev1-stage.pd b/externals/extra/0.43.3/0.43.2/rev1-stage.pd
deleted file mode 100644
index c1ee6574..00000000
--- a/externals/extra/0.43.3/0.43.2/rev1-stage.pd
+++ /dev/null
@@ -1,99 +0,0 @@
-#N canvas 86 133 729 452 10;
-#X obj 27 238 inlet~;
-#X obj 347 28 loadbang;
-#X obj 171 281 * -1;
-#X obj 36 353 +~;
-#X obj 69 395 +~;
-#X obj 69 424 outlet~;
-#X obj 409 96 pow;
-#X obj 372 118 *;
-#X floatatom 372 159;
-#X obj 37 262 *~ 0;
-#X obj 177 175 pow;
-#X text 408 162 delay \, msec;
-#X floatatom 177 238;
-#X obj 190 150 * 0.001;
-#X text 182 221 gain for this stage;
-#X obj 49 332 *~ 0;
-#X obj 47 375 *~ 0;
-#X obj 177 203 *;
-#X floatatom 409 119;
-#X text 25 13 Allpass filter for mono reverberator. Arg 1 = delay name \, arg2 = stage number \, arg 3 = delay time;
-#X obj 373 76 8;
-#X obj 409 75 1.79;
-#X obj 68 185 0.7;
-#X obj 363 50 t b b b b;
-#X obj 177 108 0;
-#X obj 372 207 abs;
-#X obj 372 229 moses 0.01;
-#X obj 443 229 print wrong-delay-time;
-#X obj 233 391 inlet~;
-#X obj 219 419 +~;
-#X obj 219 443 outlet~;
-#X text 74 83 decay after;
-#X text 85 98 1 second;
-#X obj 83 119 r \$1-decay;
-#X obj 259 256 r \$1-clear;
-#X obj 206 301 0;
-#X obj 259 275 t b;
-#X obj 259 338 delay;
-#X obj 259 316 + 5;
-#X obj 79 280 delread~ \$2 \$4;
-#X obj 36 447 delwrite~ \$2 \$4;
-#X obj 259 296 f \$4;
-#X obj 371 184 - \$4;
-#X obj 446 75 float \$3;
-#X obj 207 321 1;
-#X obj 79 301 *~ 1;
-#X obj 207 188 sqrt;
-#X floatatom 35 148;
-#X connect 0 0 9 0;
-#X connect 1 0 23 0;
-#X connect 2 0 16 1;
-#X connect 3 0 16 0;
-#X connect 3 0 40 0;
-#X connect 4 0 5 0;
-#X connect 4 0 29 0;
-#X connect 6 0 7 1;
-#X connect 6 0 18 0;
-#X connect 7 0 8 0;
-#X connect 7 0 13 0;
-#X connect 8 0 42 0;
-#X connect 9 0 3 0;
-#X connect 10 0 17 0;
-#X connect 13 0 10 1;
-#X connect 15 0 3 1;
-#X connect 16 0 4 0;
-#X connect 17 0 12 0;
-#X connect 17 0 9 1;
-#X connect 20 0 7 0;
-#X connect 21 0 6 0;
-#X connect 21 0 46 0;
-#X connect 22 0 2 0;
-#X connect 22 0 15 1;
-#X connect 23 0 24 0;
-#X connect 23 0 22 0;
-#X connect 23 1 20 0;
-#X connect 23 2 21 0;
-#X connect 23 3 43 0;
-#X connect 24 0 10 0;
-#X connect 25 0 26 0;
-#X connect 26 1 27 0;
-#X connect 28 0 29 1;
-#X connect 29 0 30 0;
-#X connect 33 0 10 0;
-#X connect 33 0 47 0;
-#X connect 34 0 36 0;
-#X connect 35 0 45 1;
-#X connect 36 0 35 0;
-#X connect 36 0 41 0;
-#X connect 37 0 44 0;
-#X connect 38 0 37 0;
-#X connect 39 0 45 0;
-#X connect 41 0 38 0;
-#X connect 42 0 25 0;
-#X connect 43 0 6 1;
-#X connect 44 0 45 1;
-#X connect 45 0 15 0;
-#X connect 45 0 4 1;
-#X connect 46 0 17 1;
diff --git a/externals/extra/0.43.3/0.43.2/rev1~-help.pd b/externals/extra/0.43.3/0.43.2/rev1~-help.pd
deleted file mode 100644
index 55580bd5..00000000
--- a/externals/extra/0.43.3/0.43.2/rev1~-help.pd
+++ /dev/null
@@ -1,119 +0,0 @@
-#N canvas 55 21 1008 526 12;
-#X obj 148 439 dac~;
-#X obj 58 72 line~;
-#X msg 58 49 0 \, 10000 5;
-#X obj 58 118 cos~;
-#X msg 146 70 1;
-#X obj 146 47 loadbang;
-#X obj 58 95 clip~ 0 0.25;
-#X floatatom 173 264 0 0 0;
-#X obj 251 134 line~;
-#X obj 251 157 cos~;
-#X msg 324 54 -0.25 \, 0.25 100;
-#X obj 251 8 loadbang;
-#X msg 251 31 -0.25;
-#X obj 251 203 *~;
-#X obj 58 140 hip~ 5;
-#X floatatom 162 328 0 0 0;
-#X obj 162 373 pack 0 100;
-#X obj 162 396 line~;
-#X obj 148 416 *~;
-#X obj 162 350 dbtorms;
-#X msg 324 77 -0.25 \, 0.25 400;
-#X floatatom 324 145 0 0 0;
-#X obj 324 191 osc~ 440;
-#X obj 324 168 mtof;
-#X msg 324 31 -0.25 \, 0.25 20;
-#X obj 251 180 *~ 0.1;
-#X msg 324 100 -0.25 \, 0.25 1000;
-#X msg 324 122 -0.25 \, 0.25 2000;
-#X obj 324 226 *~;
-#X obj 342 252 *~;
-#X obj 58 439 dac~;
-#X floatatom 68 323 0 0 0;
-#X obj 68 368 pack 0 100;
-#X obj 68 391 line~;
-#X obj 58 416 *~;
-#X obj 68 346 dbtorms;
-#X msg 324 8 0;
-#X obj 308 257 *~;
-#X obj 58 26 metro 2000;
-#X floatatom 58 4 0 0 0;
-#X msg 220 265 bang;
-#X obj 284 322 env~ 32768;
-#X floatatom 284 344 0 0 0;
-#X text 166 244 1 sec;
-#X text 143 226 dB after;
-#X text 220 245 clear;
-#X text 1 51 impulse;
-#X text 362 7 tone;
-#X text 484 31 beeps;
-#X text 428 167 This is an experimental reverberator design composed
-of a series of allpass filters with exponentially growing delay times.
-Each allpass filter has a gain of 0.7. The reverb time is adjusted
-by adjusting the input gains of the allpass filters. The last unit
-is modified so that its first two "echos" mimic those of an allpass
-but its loop gain depends on reverb time.;
-#X text 430 299 Reverb time is controlled by specifying the dB gain
-(100 normal) after one second \, so that 100 corresponds to infinite
-reverb time \, 70 to two seconds \, 40 to one second \, and 0 to 0
-;
-#X text 671 499 modified for Pd version 0.30.;
-#X msg 560 34 \; pd dsp 1;
-#X text 427 475 The rev1~ module eats about 18% of my 300mHz P2 machine.
-;
-#X obj 148 289 rev1~;
-#X text 428 381 The "clear" button impolitely clears out all the delay
-lines \, You may immediately resume pumping the reverberator \, but
-the input signal should be cleanly enveloped. The output \, too \,
-must be enveloped and may not be opened until 5 msec after the "clear"
-message is sent.;
-#X connect 1 0 6 0;
-#X connect 2 0 1 0;
-#X connect 3 0 14 0;
-#X connect 4 0 1 0;
-#X connect 5 0 4 0;
-#X connect 6 0 3 0;
-#X connect 7 0 54 1;
-#X connect 8 0 9 0;
-#X connect 9 0 25 0;
-#X connect 10 0 8 0;
-#X connect 11 0 12 0;
-#X connect 12 0 8 0;
-#X connect 13 0 14 0;
-#X connect 14 0 34 0;
-#X connect 14 0 54 0;
-#X connect 15 0 19 0;
-#X connect 16 0 17 0;
-#X connect 17 0 18 1;
-#X connect 18 0 0 0;
-#X connect 19 0 16 0;
-#X connect 20 0 8 0;
-#X connect 21 0 23 0;
-#X connect 22 0 13 1;
-#X connect 22 0 28 0;
-#X connect 22 0 28 1;
-#X connect 22 0 29 0;
-#X connect 23 0 22 0;
-#X connect 24 0 8 0;
-#X connect 25 0 13 0;
-#X connect 26 0 8 0;
-#X connect 27 0 8 0;
-#X connect 28 0 29 1;
-#X connect 28 0 13 1;
-#X connect 28 0 37 0;
-#X connect 28 0 37 1;
-#X connect 29 0 13 1;
-#X connect 31 0 35 0;
-#X connect 32 0 33 0;
-#X connect 33 0 34 1;
-#X connect 34 0 30 0;
-#X connect 35 0 32 0;
-#X connect 36 0 8 0;
-#X connect 37 0 13 1;
-#X connect 38 0 2 0;
-#X connect 39 0 38 0;
-#X connect 40 0 54 2;
-#X connect 41 0 42 0;
-#X connect 54 0 18 0;
-#X connect 54 0 41 0;
diff --git a/externals/extra/0.43.3/0.43.2/rev1~.pd b/externals/extra/0.43.3/0.43.2/rev1~.pd
deleted file mode 100644
index 83fd6d20..00000000
--- a/externals/extra/0.43.3/0.43.2/rev1~.pd
+++ /dev/null
@@ -1,64 +0,0 @@
-#N canvas 66 116 512 312 10;
-#X obj 345 154 dbtorms;
-#X obj 316 120 min 100;
-#X obj 316 100 inlet;
-#X obj 45 16 inlet~;
-#X obj 254 298 outlet~;
-#X obj 432 106 inlet;
-#X obj 432 130 t b;
-#X obj 269 145 t b f;
-#X obj 281 185 -;
-#X obj 282 254 line~;
-#X obj 282 233 pack 0 100;
-#X obj 269 166 105;
-#X obj 256 276 *~;
-#X obj 282 210 * 0.01;
-#X text 282 65 reverb decay speed;
-#X text 278 79 (dB left after 1 sec);
-#X text 425 84 bang to clear;
-#X obj 44 41 rev1-stage \$0 \$0-del1 0 8;
-#X obj 44 64 rev1-stage \$0 \$0-del2 1 14.32;
-#X obj 44 87 rev1-stage \$0 \$0-del3 2 25.6328;
-#X obj 44 110 rev1-stage \$0 \$0-del4 3 45.8827;
-#X obj 44 133 rev1-stage \$0 \$0-del5 4 82.1301;
-#X obj 44 156 rev1-stage \$0 \$0-del6 5 147.013;
-#X obj 44 179 rev1-stage \$0 \$0-del7 6 263.153;
-#X obj 44 202 rev1-stage \$0 \$0-del8 7 471.044;
-#X obj 44 225 rev1-stage \$0 \$0-del9 8 843.168;
-#X obj 44 248 rev1-final \$0 \$0-del10 9 1509.27;
-#X obj 346 177 s \$0-decay;
-#X obj 432 153 s \$0-clear;
-#X connect 0 0 27 0;
-#X connect 1 0 0 0;
-#X connect 1 0 7 0;
-#X connect 2 0 1 0;
-#X connect 3 0 17 0;
-#X connect 5 0 6 0;
-#X connect 6 0 28 0;
-#X connect 7 0 11 0;
-#X connect 7 1 8 1;
-#X connect 8 0 13 0;
-#X connect 9 0 12 1;
-#X connect 10 0 9 0;
-#X connect 11 0 8 0;
-#X connect 12 0 4 0;
-#X connect 13 0 10 0;
-#X connect 17 0 18 0;
-#X connect 17 1 18 1;
-#X connect 18 0 19 0;
-#X connect 18 1 19 1;
-#X connect 19 0 20 0;
-#X connect 19 1 20 1;
-#X connect 20 0 21 0;
-#X connect 20 1 21 1;
-#X connect 21 0 22 0;
-#X connect 21 1 22 1;
-#X connect 22 0 23 0;
-#X connect 22 1 23 1;
-#X connect 23 0 24 0;
-#X connect 23 1 24 1;
-#X connect 24 0 25 0;
-#X connect 24 1 25 1;
-#X connect 25 0 26 0;
-#X connect 25 1 26 1;
-#X connect 26 1 12 0;
diff --git a/externals/extra/0.43.3/0.43.2/rev2~-help.pd b/externals/extra/0.43.3/0.43.2/rev2~-help.pd
deleted file mode 100644
index 8f9fbaaf..00000000
--- a/externals/extra/0.43.3/0.43.2/rev2~-help.pd
+++ /dev/null
@@ -1,134 +0,0 @@
-#N canvas 167 160 766 354 12;
-#X floatatom 73 185 0 0 120 0 - - -;
-#X floatatom 106 323 0 0 120 0 - - -;
-#N canvas 0 0 539 448 tests 0;
-#X obj 67 33 inlet;
-#X obj 309 189 inlet;
-#X obj 235 207 line~;
-#X obj 235 230 cos~;
-#X obj 235 68 loadbang;
-#X msg 235 91 -0.25;
-#X obj 235 276 *~;
-#X obj 186 309 hip~ 5;
-#X floatatom 308 218 0 0 0 0 - - -;
-#X obj 308 264 osc~ 440;
-#X obj 308 241 mtof;
-#X obj 235 253 *~ 0.1;
-#X obj 308 299 *~;
-#X obj 326 325 *~;
-#X obj 292 330 *~;
-#X msg 279 150 -0.25 \, 0.25 \$1;
-#X obj 41 148 biquad~ 0 0 1 -1 0;
-#X obj 63 70 t b;
-#X obj 104 72 del 3;
-#X obj 57 101 1;
-#X obj 96 101 0;
-#X obj 41 355 outlet~;
-#X obj 279 126 inlet;
-#X obj 40 175 *~;
-#X connect 0 0 17 0;
-#X connect 1 0 8 0;
-#X connect 2 0 3 0;
-#X connect 3 0 11 0;
-#X connect 4 0 5 0;
-#X connect 5 0 2 0;
-#X connect 6 0 7 0;
-#X connect 7 0 21 0;
-#X connect 8 0 10 0;
-#X connect 9 0 6 1;
-#X connect 9 0 12 0;
-#X connect 9 0 12 1;
-#X connect 9 0 13 0;
-#X connect 10 0 9 0;
-#X connect 11 0 6 0;
-#X connect 12 0 13 1;
-#X connect 12 0 6 1;
-#X connect 12 0 14 0;
-#X connect 12 0 14 1;
-#X connect 13 0 6 1;
-#X connect 14 0 6 1;
-#X connect 15 0 2 0;
-#X connect 16 0 23 0;
-#X connect 17 0 18 0;
-#X connect 17 0 19 0;
-#X connect 18 0 20 0;
-#X connect 19 0 16 0;
-#X connect 19 0 23 1;
-#X connect 20 0 16 0;
-#X connect 20 0 23 1;
-#X connect 22 0 15 0;
-#X connect 23 0 21 0;
-#X restore 17 154 pd tests;
-#X msg 56 35 10;
-#X msg 54 62 20;
-#X msg 53 90 100;
-#X msg 52 115 500;
-#X obj 17 15 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X text 37 9 impulse;
-#N canvas 0 0 450 300 output 0;
-#X obj 54 202 dac~;
-#X obj 132 119 pack 0 100;
-#X obj 132 142 line~;
-#X obj 54 165 *~;
-#X obj 132 97 dbtorms;
-#X obj 33 42 inlet~;
-#X obj 177 42 inlet;
-#X obj 177 74 clip 0 120;
-#X msg 257 133 \; pd dsp 1;
-#X obj 98 42 inlet~;
-#X obj 94 168 *~;
-#X connect 1 0 2 0;
-#X connect 2 0 3 1;
-#X connect 2 0 10 1;
-#X connect 3 0 0 0;
-#X connect 4 0 1 0;
-#X connect 5 0 3 0;
-#X connect 6 0 7 0;
-#X connect 6 0 8 0;
-#X connect 7 0 4 0;
-#X connect 9 0 10 0;
-#X connect 10 0 0 1;
-#X restore 18 324 pd output;
-#X floatatom 97 127 0 0 0 0 - - -;
-#X text 136 96 tone;
-#X text 135 112 pitch;
-#X text 114 185 level \, dB;
-#X floatatom 117 209 0 0 100 0 - - -;
-#X text 158 209 liveness \, 0-100;
-#X text 505 330 modified for Pd version 0.37;
-#X floatatom 161 235 0 0 120 0 - - -;
-#X floatatom 205 259 0 0 120 0 - - -;
-#X text 192 235 crossover frequency \, Hz.;
-#X text 238 260 HF damping \, percent;
-#X obj 30 290 rev2~ 100 90 3000 20;
-#X text 141 324 output level \, dB;
-#X text 281 8 REV2~ - a simple 1-in \, 4-out reverberator;
-#X text 95 35 tone;
-#X text 96 52 bursts;
-#X text 231 37 The creation arguments (level \, liveness \, crossover
-frequency \, HF damping) may also be supplied in four inlets as shown.
-The "liveness" (actually the internal feedback percentage) should be
-100 for infinite reverb \, 90 for longish \, and 80 for short. The
-crossover frequency and HF damping work together: at frequencies above
-crossover \, the feedback is diminished by the "damping" as a percentage.
-So zero HF damping means equal reverb time at all frequencies \, and
-100% damping means almost nothing above the crossover frequency gets
-through.;
-#X text 132 130 (60 for;
-#X text 115 150 middle C);
-#X connect 0 0 21 1;
-#X connect 1 0 9 2;
-#X connect 2 0 9 0;
-#X connect 2 0 21 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 1;
-#X connect 6 0 2 1;
-#X connect 7 0 2 0;
-#X connect 10 0 2 2;
-#X connect 14 0 21 2;
-#X connect 17 0 21 3;
-#X connect 18 0 21 4;
-#X connect 21 0 9 0;
-#X connect 21 1 9 1;
diff --git a/externals/extra/0.43.3/0.43.2/rev2~.pd b/externals/extra/0.43.3/0.43.2/rev2~.pd
deleted file mode 100644
index 5b87faa7..00000000
--- a/externals/extra/0.43.3/0.43.2/rev2~.pd
+++ /dev/null
@@ -1,237 +0,0 @@
-#N canvas 333 147 832 664 12;
-#X obj 161 497 +~;
-#X obj 520 105 inlet;
-#X obj 184 407 *~;
-#X obj 486 412 *~;
-#X obj 285 412 *~;
-#X obj 387 412 *~;
-#X obj 443 546 -~;
-#X obj 364 545 -~;
-#X obj 239 537 +~;
-#X obj 161 534 +~;
-#X obj 162 444 +~;
-#X obj 262 440 +~;
-#X obj 464 501 -~;
-#X obj 387 499 +~;
-#X obj 239 500 -~;
-#X obj 452 105 inlet;
-#X obj 609 429 line~;
-#X obj 509 374 line~;
-#X obj 16 121 delread~ \$0-del1 58.6435;
-#X obj 94 143 delread~ \$0-del2 69.4325;
-#X obj 176 165 delread~ \$0-del3 74.5234;
-#X obj 258 189 delread~ \$0-del4 86.1244;
-#X obj 530 500 *~;
-#X obj 599 501 *~;
-#X obj 161 641 delwrite~ \$0-del1 58.6435;
-#X obj 240 617 delwrite~ \$0-del2 69.4325;
-#X obj 365 595 delwrite~ \$0-del3 74.5234;
-#X obj 444 573 delwrite~ \$0-del4 86.1244;
-#X obj 609 357 dbtorms;
-#X obj 609 403 pack 0 30;
-#X obj 520 211 pack 0 50;
-#X obj 9 390 inlet~;
-#X obj 530 525 outlet~;
-#X obj 599 525 outlet~;
-#X obj 520 187 / 200;
-#X obj 520 162 clip 0 100;
-#X obj 52 236 lop~;
-#X obj 452 137 f \$1;
-#X obj 520 138 f \$2;
-#X obj 625 143 f \$3;
-#X obj 696 143 f \$4;
-#X obj 367 106 loadbang;
-#X obj 667 500 *~;
-#X obj 735 501 *~;
-#X obj 667 525 outlet~;
-#X obj 735 525 outlet~;
-#X obj 625 167 moses 1;
-#X msg 631 193 3000;
-#X obj 705 193 clip 0 100;
-#N canvas 345 88 355 597 early-reflect 0;
-#X obj 119 477 delread~ \$0-ref6 13.645;
-#X obj 119 453 delwrite~ \$0-ref6 13.645;
-#X obj 106 400 delread~ \$0-ref5 16.364;
-#X obj 106 376 delwrite~ \$0-ref5 16.364;
-#X obj 102 324 delread~ \$0-ref4 19.392;
-#X obj 102 300 delwrite~ \$0-ref4 19.392;
-#X obj 106 247 delread~ \$0-ref3 25.796;
-#X obj 106 223 delwrite~ \$0-ref3 25.796;
-#X obj 107 169 delread~ \$0-ref2 43.5337;
-#X obj 107 145 delwrite~ \$0-ref2 43.5337;
-#X obj 110 90 delread~ \$0-ref1 75.2546;
-#X obj 84 119 -~;
-#X obj 49 119 +~;
-#X obj 50 195 +~;
-#X obj 85 196 -~;
-#X obj 84 275 -~;
-#X obj 49 274 +~;
-#X obj 82 349 -~;
-#X obj 48 350 +~;
-#X obj 83 428 -~;
-#X obj 49 428 +~;
-#X obj 65 7 inlet~;
-#X obj 110 66 delwrite~ \$0-ref1 75.2546;
-#X obj 49 508 outlet~;
-#X obj 119 507 outlet~;
-#X connect 0 0 24 0;
-#X connect 2 0 20 1;
-#X connect 2 0 19 1;
-#X connect 4 0 18 1;
-#X connect 4 0 17 1;
-#X connect 6 0 16 1;
-#X connect 6 0 15 1;
-#X connect 8 0 13 1;
-#X connect 8 0 14 1;
-#X connect 10 0 12 1;
-#X connect 10 0 11 1;
-#X connect 11 0 9 0;
-#X connect 12 0 14 0;
-#X connect 12 0 13 0;
-#X connect 13 0 16 0;
-#X connect 13 0 15 0;
-#X connect 14 0 7 0;
-#X connect 15 0 5 0;
-#X connect 16 0 18 0;
-#X connect 16 0 17 0;
-#X connect 17 0 3 0;
-#X connect 18 0 20 0;
-#X connect 18 0 19 0;
-#X connect 19 0 1 0;
-#X connect 20 0 23 0;
-#X connect 21 0 12 0;
-#X connect 21 0 11 0;
-#X connect 21 0 22 0;
-#X restore 9 416 pd early-reflect;
-#X obj 618 216 f;
-#X obj 618 105 inlet;
-#X obj 696 109 inlet;
-#X obj 705 216 f;
-#X obj 705 239 * 0.01;
-#X obj 705 263 pack 0 50;
-#X obj 705 287 line~;
-#X obj 29 269 -~;
-#X obj 28 300 *~;
-#X obj 16 331 +~;
-#X obj 132 240 lop~;
-#X obj 106 274 -~;
-#X obj 105 309 *~;
-#X obj 95 333 +~;
-#X obj 214 245 lop~;
-#X obj 188 273 -~;
-#X obj 187 314 *~;
-#X obj 176 339 +~;
-#X obj 308 249 lop~;
-#X obj 281 274 -~;
-#X obj 281 318 *~;
-#X obj 258 342 +~;
-#X obj 609 379 * 0.125;
-#X text 403 10 control inlets:;
-#X text 9 9 rev2 - simple \, cheap reverberator with;
-#X text 400 29 1: output level \, dB \, 0-100;
-#X text 8 30 one signal inlet and four signal outlets.;
-#X text 399 79 4: high frequency damping \, 0-100;
-#X text 400 62 3: crossover frequency in Hz. (3000 default);
-#X text 400 45 2: liveness \, 0-100 \, usually between 85 and 100;
-#X connect 0 0 9 0;
-#X connect 0 0 7 0;
-#X connect 1 0 38 0;
-#X connect 2 0 10 1;
-#X connect 3 0 12 1;
-#X connect 3 0 13 1;
-#X connect 3 0 43 0;
-#X connect 4 0 11 1;
-#X connect 5 0 13 0;
-#X connect 5 0 12 0;
-#X connect 5 0 42 0;
-#X connect 6 0 27 0;
-#X connect 7 0 26 0;
-#X connect 8 0 25 0;
-#X connect 9 0 24 0;
-#X connect 10 0 14 0;
-#X connect 10 0 0 0;
-#X connect 10 0 22 0;
-#X connect 11 0 0 1;
-#X connect 11 0 14 1;
-#X connect 11 0 23 0;
-#X connect 12 0 8 1;
-#X connect 12 0 6 1;
-#X connect 13 0 9 1;
-#X connect 13 0 7 1;
-#X connect 14 0 8 0;
-#X connect 14 0 6 0;
-#X connect 15 0 37 0;
-#X connect 16 0 22 1;
-#X connect 16 0 23 1;
-#X connect 16 0 42 1;
-#X connect 16 0 43 1;
-#X connect 17 0 4 1;
-#X connect 17 0 2 1;
-#X connect 17 0 5 1;
-#X connect 17 0 3 1;
-#X connect 18 0 36 0;
-#X connect 18 0 57 1;
-#X connect 18 0 59 0;
-#X connect 19 0 60 0;
-#X connect 19 0 61 1;
-#X connect 19 0 63 0;
-#X connect 20 0 67 0;
-#X connect 20 0 64 0;
-#X connect 20 0 65 1;
-#X connect 21 0 71 0;
-#X connect 21 0 69 1;
-#X connect 21 0 68 0;
-#X connect 22 0 32 0;
-#X connect 23 0 33 0;
-#X connect 28 0 72 0;
-#X connect 29 0 16 0;
-#X connect 30 0 17 0;
-#X connect 31 0 49 0;
-#X connect 34 0 30 0;
-#X connect 35 0 34 0;
-#X connect 36 0 57 0;
-#X connect 37 0 28 0;
-#X connect 38 0 35 0;
-#X connect 39 0 46 0;
-#X connect 40 0 48 0;
-#X connect 41 0 37 0;
-#X connect 41 0 38 0;
-#X connect 41 0 39 0;
-#X connect 41 0 40 0;
-#X connect 42 0 44 0;
-#X connect 43 0 45 0;
-#X connect 46 0 47 0;
-#X connect 46 1 50 0;
-#X connect 47 0 50 0;
-#X connect 48 0 53 0;
-#X connect 49 0 10 0;
-#X connect 49 1 11 0;
-#X connect 50 0 36 1;
-#X connect 50 0 60 1;
-#X connect 50 0 64 1;
-#X connect 50 0 68 1;
-#X connect 51 0 50 0;
-#X connect 52 0 40 0;
-#X connect 53 0 54 0;
-#X connect 54 0 55 0;
-#X connect 55 0 56 0;
-#X connect 56 0 58 1;
-#X connect 56 0 62 1;
-#X connect 56 0 66 1;
-#X connect 56 0 70 1;
-#X connect 57 0 58 0;
-#X connect 58 0 59 1;
-#X connect 59 0 2 0;
-#X connect 60 0 61 0;
-#X connect 61 0 62 0;
-#X connect 62 0 63 1;
-#X connect 63 0 4 0;
-#X connect 64 0 65 0;
-#X connect 65 0 66 0;
-#X connect 66 0 67 1;
-#X connect 67 0 5 0;
-#X connect 68 0 69 0;
-#X connect 69 0 70 0;
-#X connect 70 0 71 1;
-#X connect 71 0 3 0;
-#X connect 72 0 29 0;
diff --git a/externals/extra/0.43.3/0.43.2/rev3~-help.pd b/externals/extra/0.43.3/0.43.2/rev3~-help.pd
deleted file mode 100644
index 78ef15f5..00000000
--- a/externals/extra/0.43.3/0.43.2/rev3~-help.pd
+++ /dev/null
@@ -1,136 +0,0 @@
-#N canvas 70 263 765 380 12;
-#X floatatom 99 212 0 0 120 0 - - -;
-#X floatatom 105 340 0 0 120 0 - - -;
-#N canvas 0 0 539 448 tests 0;
-#X obj 67 33 inlet;
-#X obj 309 189 inlet;
-#X obj 235 207 line~;
-#X obj 235 230 cos~;
-#X obj 235 68 loadbang;
-#X msg 235 91 -0.25;
-#X obj 235 276 *~;
-#X obj 186 309 hip~ 5;
-#X floatatom 308 218 0 0 0 0 - - -;
-#X obj 308 264 osc~ 440;
-#X obj 308 241 mtof;
-#X obj 235 253 *~ 0.1;
-#X obj 308 299 *~;
-#X obj 326 325 *~;
-#X obj 292 330 *~;
-#X msg 279 150 -0.25 \, 0.25 \$1;
-#X obj 41 148 biquad~ 0 0 1 -1 0;
-#X obj 63 70 t b;
-#X obj 104 72 del 3;
-#X obj 57 101 1;
-#X obj 96 101 0;
-#X obj 41 355 outlet~;
-#X obj 279 126 inlet;
-#X obj 51 192 *~;
-#X connect 0 0 17 0;
-#X connect 1 0 8 0;
-#X connect 2 0 3 0;
-#X connect 3 0 11 0;
-#X connect 4 0 5 0;
-#X connect 5 0 2 0;
-#X connect 6 0 7 0;
-#X connect 7 0 21 0;
-#X connect 8 0 10 0;
-#X connect 9 0 6 1;
-#X connect 9 0 12 0;
-#X connect 9 0 12 1;
-#X connect 9 0 13 0;
-#X connect 10 0 9 0;
-#X connect 11 0 6 0;
-#X connect 12 0 13 1;
-#X connect 12 0 6 1;
-#X connect 12 0 14 0;
-#X connect 12 0 14 1;
-#X connect 13 0 6 1;
-#X connect 14 0 6 1;
-#X connect 15 0 2 0;
-#X connect 16 0 23 0;
-#X connect 17 0 18 0;
-#X connect 17 0 19 0;
-#X connect 18 0 20 0;
-#X connect 19 0 16 0;
-#X connect 19 0 23 1;
-#X connect 20 0 16 0;
-#X connect 20 0 23 1;
-#X connect 22 0 15 0;
-#X connect 23 0 21 0;
-#X restore 16 171 pd tests;
-#X msg 55 52 10;
-#X msg 53 79 20;
-#X msg 52 107 100;
-#X msg 51 132 500;
-#X obj 16 32 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X text 36 26 impulse;
-#N canvas 0 0 450 300 output 0;
-#X obj 54 202 dac~;
-#X obj 132 119 pack 0 100;
-#X obj 132 142 line~;
-#X obj 54 165 *~;
-#X obj 132 97 dbtorms;
-#X obj 33 42 inlet~;
-#X obj 177 42 inlet;
-#X obj 177 74 clip 0 120;
-#X msg 257 133 \; pd dsp 1;
-#X obj 98 42 inlet~;
-#X obj 94 168 *~;
-#X connect 1 0 2 0;
-#X connect 2 0 3 1;
-#X connect 2 0 10 1;
-#X connect 3 0 0 0;
-#X connect 4 0 1 0;
-#X connect 5 0 3 0;
-#X connect 6 0 7 0;
-#X connect 6 0 8 0;
-#X connect 7 0 4 0;
-#X connect 9 0 10 0;
-#X connect 10 0 0 1;
-#X restore 17 340 pd output;
-#X floatatom 96 144 0 0 0 0 - - -;
-#X text 135 113 tone;
-#X text 134 129 pitch;
-#X text 140 212 level \, dB;
-#X floatatom 134 234 0 0 100 0 - - -;
-#X text 175 234 liveness \, 0-100;
-#X floatatom 169 258 4 0 5000 0 - - -;
-#X floatatom 204 281 0 0 100 0 - - -;
-#X text 217 256 crossover frequency \, Hz.;
-#X text 240 283 HF damping \, percent;
-#X text 140 341 output level \, dB;
-#X text 94 52 tone;
-#X text 95 69 bursts;
-#X text 131 147 (60 for;
-#X text 114 167 middle C);
-#X obj 29 307 rev3~ 100 90 3000 20;
-#X text 263 4 REV3~ - hard-core \, 2-in \, 4-out reverberator;
-#X text 236 56 The creation arguments (level \, liveness \, crossover
-frequency \, HF damping) may also be supplied in four inlets as shown.
-The "liveness" (actually the internal feedback percentage) should be
-100 for infinite reverb \, 90 for longish \, and 80 for short. The
-crossover frequency and HF damping work together: at frequencies above
-crossover \, the feedback is diminished by the "damping" as a percentage.
-So zero HF damping means equal reverb time at all frequencies \, and
-100% damping means almost nothing above the crossover frequency gets
-through.;
-#X text 236 29 (A more expensive \, presumably better \, one than rev2~.)
-;
-#X text 470 352 modified for Pd version 0.37-1;
-#X connect 0 0 25 2;
-#X connect 1 0 9 2;
-#X connect 2 0 9 0;
-#X connect 2 0 25 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 1;
-#X connect 6 0 2 1;
-#X connect 7 0 2 0;
-#X connect 10 0 2 2;
-#X connect 14 0 25 3;
-#X connect 16 0 25 4;
-#X connect 17 0 25 5;
-#X connect 25 0 9 0;
-#X connect 25 1 9 1;
diff --git a/externals/extra/0.43.3/0.43.2/rev3~.pd b/externals/extra/0.43.3/0.43.2/rev3~.pd
deleted file mode 100644
index 0d8ea472..00000000
--- a/externals/extra/0.43.3/0.43.2/rev3~.pd
+++ /dev/null
@@ -1,439 +0,0 @@
-#N canvas 220 79 810 570 12;
-#X obj 520 105 inlet;
-#X obj 452 105 inlet;
-#X obj 370 335 line~;
-#X obj 232 394 *~;
-#X obj 301 395 *~;
-#X obj 370 284 dbtorms;
-#X obj 370 309 pack 0 30;
-#X obj 520 211 pack 0 50;
-#X obj 232 419 outlet~;
-#X obj 301 419 outlet~;
-#X obj 520 162 clip 0 100;
-#X obj 452 137 f \$1;
-#X obj 520 138 f \$2;
-#X obj 625 143 f \$3;
-#X obj 696 143 f \$4;
-#X obj 367 106 loadbang;
-#X obj 369 394 *~;
-#X obj 437 395 *~;
-#X obj 369 419 outlet~;
-#X obj 437 419 outlet~;
-#X obj 625 167 moses 1;
-#X msg 631 193 3000;
-#X obj 705 193 clip 0 100;
-#X obj 616 218 f;
-#X obj 618 105 inlet;
-#X obj 696 109 inlet;
-#X obj 705 216 f;
-#X obj 705 239 * 0.01;
-#X obj 705 263 pack 0 50;
-#X text 403 10 control inlets:;
-#X text 400 29 1: output level \, dB \, 0-100;
-#X text 399 79 4: high frequency damping \, 0-100;
-#X text 400 62 3: crossover frequency in Hz. (3000 default);
-#X text 400 45 2: liveness \, 0-100 \, usually between 85 and 100;
-#X obj 616 242 s \$0-lop;
-#N canvas 169 94 919 805 doit 0;
-#X obj 218 386 *~;
-#X obj 341 396 *~;
-#X obj 267 389 *~;
-#X obj 305 392 *~;
-#X obj 28 175 lop~;
-#X obj 27 204 -~;
-#X obj 27 291 *~;
-#X obj 16 319 +~;
-#X obj 75 182 lop~;
-#X obj 76 214 -~;
-#X obj 77 294 *~;
-#X obj 67 318 +~;
-#X obj 124 187 lop~;
-#X obj 124 214 -~;
-#X obj 125 297 *~;
-#X obj 116 322 +~;
-#X obj 176 191 lop~;
-#X obj 175 218 -~;
-#X obj 175 301 *~;
-#X obj 168 326 +~;
-#X obj 15 372 *~;
-#X obj 169 383 *~;
-#X obj 67 376 *~;
-#X obj 115 380 *~;
-#X obj 207 160 r \$0-lop;
-#X obj 183 246 r \$0-damp;
-#X obj 183 271 line~;
-#X obj 17 14 delread~ \$0-del1 10;
-#X obj 117 56 delread~ \$0-del3 13.4567;
-#X obj 68 35 delread~ \$0-del2 11.6356;
-#X obj 171 77 delread~ \$0-del4 16.7345;
-#X obj 524 407 *~;
-#X obj 631 409 *~;
-#X obj 560 408 *~;
-#X obj 595 409 *~;
-#X obj 377 399 *~;
-#X obj 488 406 *~;
-#X obj 414 402 *~;
-#X obj 451 405 *~;
-#X obj 654 354 line~;
-#X obj 708 387 r \$0-fb;
-#X obj 218 100 delread~ \$0-del5 20.1862;
-#X obj 267 121 delread~ \$0-del6 25.7417;
-#X obj 304 142 delread~ \$0-del7 31.4693;
-#X obj 341 163 delread~ \$0-del8 38.2944;
-#X obj 376 184 delread~ \$0-del9 46.6838;
-#X obj 414 205 delread~ \$0-del10 55.4567;
-#X obj 488 247 delread~ \$0-del12 76.8243;
-#X obj 524 268 delread~ \$0-del13 88.5623;
-#X obj 561 289 delread~ \$0-del14 101.278;
-#X obj 595 310 delread~ \$0-del15 115.397;
-#X obj 632 331 delread~ \$0-del16 130.502;
-#X obj 25 346 inlet~;
-#X obj 87 346 inlet~;
-#X obj 69 440 +~;
-#X obj 105 440 -~;
-#X obj 141 440 +~;
-#X obj 177 440 -~;
-#X obj 214 440 +~;
-#X obj 250 440 -~;
-#X obj 286 440 +~;
-#X obj 322 440 -~;
-#X obj 359 440 +~;
-#X obj 395 440 -~;
-#X obj 431 440 +~;
-#X obj 467 440 -~;
-#X obj 504 440 +~;
-#X obj 540 440 -~;
-#X obj 576 440 +~;
-#X obj 612 440 -~;
-#X obj 69 474 +~;
-#X obj 177 474 -~;
-#X obj 105 474 +~;
-#X obj 141 474 -~;
-#X obj 214 474 +~;
-#X obj 322 474 -~;
-#X obj 250 474 +~;
-#X obj 286 474 -~;
-#X obj 359 474 +~;
-#X obj 467 474 -~;
-#X obj 395 474 +~;
-#X obj 431 474 -~;
-#X obj 504 474 +~;
-#X obj 612 474 -~;
-#X obj 540 474 +~;
-#X obj 576 474 -~;
-#X obj 69 518 +~;
-#X obj 105 518 +~;
-#X obj 322 518 -~;
-#X obj 286 518 -~;
-#X obj 141 518 +~;
-#X obj 177 518 +~;
-#X obj 214 518 -~;
-#X obj 250 518 -~;
-#X obj 360 518 +~;
-#X obj 396 518 +~;
-#X obj 613 518 -~;
-#X obj 577 518 -~;
-#X obj 432 518 +~;
-#X obj 468 518 +~;
-#X obj 505 518 -~;
-#X obj 541 518 -~;
-#X obj 70 575 +~;
-#X obj 106 575 +~;
-#X obj 469 575 -~;
-#X obj 433 575 -~;
-#X obj 142 575 +~;
-#X obj 178 575 +~;
-#X obj 361 575 -~;
-#X obj 397 575 -~;
-#X obj 215 575 +~;
-#X obj 251 575 +~;
-#X obj 287 575 +~;
-#X obj 323 575 +~;
-#X obj 614 575 -~;
-#X obj 578 575 -~;
-#X obj 506 575 -~;
-#X obj 542 575 -~;
-#X obj 628 606 outlet~;
-#X obj 698 606 outlet~;
-#X obj 768 607 outlet~;
-#X obj 838 607 outlet~;
-#X obj 451 226 delread~ \$0-del11 65.1755;
-#X obj 614 629 delwrite~ \$0-del16 130.502;
-#X obj 361 776 delwrite~ \$0-del9 46.6838;
-#X obj 398 755 delwrite~ \$0-del10 55.4567;
-#X obj 434 734 delwrite~ \$0-del11 65.1755;
-#X obj 470 713 delwrite~ \$0-del12 76.8243;
-#X obj 506 692 delwrite~ \$0-del13 88.5623;
-#X obj 542 671 delwrite~ \$0-del14 101.278;
-#X obj 579 650 delwrite~ \$0-del15 115.397;
-#X obj 323 606 delwrite~ \$0-del8 38.2944;
-#X obj 287 628 delwrite~ \$0-del7 31.4693;
-#X obj 252 650 delwrite~ \$0-del6 25.7417;
-#X obj 215 672 delwrite~ \$0-del5 20.1862;
-#X obj 71 761 delwrite~ \$0-del1 10;
-#X obj 106 737 delwrite~ \$0-del2 11.6356;
-#X obj 141 715 delwrite~ \$0-del3 13.4567;
-#X obj 179 693 delwrite~ \$0-del4 16.7345;
-#X connect 0 0 58 0;
-#X connect 0 0 59 0;
-#X connect 1 0 60 1;
-#X connect 1 0 61 1;
-#X connect 2 0 58 1;
-#X connect 2 0 59 1;
-#X connect 3 0 60 0;
-#X connect 3 0 61 0;
-#X connect 4 0 5 0;
-#X connect 5 0 6 0;
-#X connect 6 0 7 1;
-#X connect 7 0 20 0;
-#X connect 8 0 9 0;
-#X connect 9 0 10 0;
-#X connect 10 0 11 1;
-#X connect 11 0 22 0;
-#X connect 12 0 13 0;
-#X connect 13 0 14 0;
-#X connect 14 0 15 1;
-#X connect 15 0 23 0;
-#X connect 16 0 17 0;
-#X connect 17 0 18 0;
-#X connect 18 0 19 1;
-#X connect 19 0 21 0;
-#X connect 20 0 54 0;
-#X connect 20 0 55 0;
-#X connect 21 0 56 1;
-#X connect 21 0 57 1;
-#X connect 22 0 55 1;
-#X connect 22 0 54 1;
-#X connect 23 0 56 0;
-#X connect 23 0 57 0;
-#X connect 24 0 16 1;
-#X connect 24 0 12 1;
-#X connect 24 0 8 1;
-#X connect 24 0 4 1;
-#X connect 25 0 26 0;
-#X connect 26 0 18 1;
-#X connect 26 0 14 1;
-#X connect 26 0 10 1;
-#X connect 26 0 6 1;
-#X connect 27 0 4 0;
-#X connect 27 0 5 1;
-#X connect 27 0 7 0;
-#X connect 28 0 15 0;
-#X connect 28 0 12 0;
-#X connect 28 0 13 1;
-#X connect 29 0 8 0;
-#X connect 29 0 9 1;
-#X connect 29 0 11 0;
-#X connect 30 0 19 0;
-#X connect 30 0 17 1;
-#X connect 30 0 16 0;
-#X connect 31 0 66 0;
-#X connect 31 0 67 0;
-#X connect 32 0 68 1;
-#X connect 32 0 69 1;
-#X connect 33 0 66 1;
-#X connect 33 0 67 1;
-#X connect 34 0 68 0;
-#X connect 34 0 69 0;
-#X connect 35 0 62 0;
-#X connect 35 0 63 0;
-#X connect 36 0 64 1;
-#X connect 36 0 65 1;
-#X connect 37 0 62 1;
-#X connect 37 0 63 1;
-#X connect 38 0 64 0;
-#X connect 38 0 65 0;
-#X connect 39 0 2 1;
-#X connect 39 0 0 1;
-#X connect 39 0 3 1;
-#X connect 39 0 1 1;
-#X connect 39 0 21 1;
-#X connect 39 0 23 1;
-#X connect 39 0 22 1;
-#X connect 39 0 20 1;
-#X connect 39 0 35 1;
-#X connect 39 0 38 1;
-#X connect 39 0 36 1;
-#X connect 39 0 31 1;
-#X connect 39 0 33 1;
-#X connect 39 0 34 1;
-#X connect 39 0 32 1;
-#X connect 39 0 37 1;
-#X connect 40 0 39 0;
-#X connect 41 0 0 0;
-#X connect 42 0 2 0;
-#X connect 43 0 3 0;
-#X connect 44 0 1 0;
-#X connect 45 0 35 0;
-#X connect 46 0 37 0;
-#X connect 47 0 36 0;
-#X connect 48 0 31 0;
-#X connect 49 0 33 0;
-#X connect 50 0 34 0;
-#X connect 51 0 32 0;
-#X connect 52 0 20 0;
-#X connect 53 0 22 0;
-#X connect 54 0 70 0;
-#X connect 54 0 73 0;
-#X connect 55 0 72 0;
-#X connect 55 0 71 0;
-#X connect 56 0 70 1;
-#X connect 56 0 73 1;
-#X connect 57 0 72 1;
-#X connect 57 0 71 1;
-#X connect 58 0 74 0;
-#X connect 58 0 77 0;
-#X connect 59 0 76 0;
-#X connect 59 0 75 0;
-#X connect 60 0 74 1;
-#X connect 60 0 77 1;
-#X connect 61 0 76 1;
-#X connect 61 0 75 1;
-#X connect 62 0 78 0;
-#X connect 62 0 81 0;
-#X connect 63 0 80 0;
-#X connect 63 0 79 0;
-#X connect 64 0 78 1;
-#X connect 64 0 81 1;
-#X connect 65 0 80 1;
-#X connect 65 0 79 1;
-#X connect 66 0 82 0;
-#X connect 66 0 85 0;
-#X connect 67 0 84 0;
-#X connect 67 0 83 0;
-#X connect 68 0 82 1;
-#X connect 68 0 85 1;
-#X connect 69 0 84 1;
-#X connect 69 0 83 1;
-#X connect 70 0 86 0;
-#X connect 70 0 92 0;
-#X connect 71 0 91 0;
-#X connect 71 0 88 0;
-#X connect 72 0 87 0;
-#X connect 72 0 93 0;
-#X connect 73 0 90 0;
-#X connect 73 0 89 0;
-#X connect 74 0 86 1;
-#X connect 74 0 92 1;
-#X connect 75 0 91 1;
-#X connect 75 0 88 1;
-#X connect 76 0 87 1;
-#X connect 76 0 93 1;
-#X connect 77 0 90 1;
-#X connect 77 0 89 1;
-#X connect 78 0 94 0;
-#X connect 78 0 100 0;
-#X connect 79 0 99 0;
-#X connect 79 0 96 0;
-#X connect 80 0 95 0;
-#X connect 80 0 101 0;
-#X connect 81 0 98 0;
-#X connect 81 0 97 0;
-#X connect 82 0 94 1;
-#X connect 82 0 100 1;
-#X connect 83 0 99 1;
-#X connect 83 0 96 1;
-#X connect 84 0 95 1;
-#X connect 84 0 101 1;
-#X connect 85 0 98 1;
-#X connect 85 0 97 1;
-#X connect 86 0 102 0;
-#X connect 86 0 108 0;
-#X connect 87 0 103 0;
-#X connect 87 0 109 0;
-#X connect 88 0 113 0;
-#X connect 88 0 114 0;
-#X connect 89 0 112 0;
-#X connect 89 0 115 0;
-#X connect 90 0 106 0;
-#X connect 90 0 105 0;
-#X connect 91 0 107 0;
-#X connect 91 0 104 0;
-#X connect 92 0 110 0;
-#X connect 92 0 116 0;
-#X connect 93 0 111 0;
-#X connect 93 0 117 0;
-#X connect 94 0 108 1;
-#X connect 94 0 102 1;
-#X connect 95 0 109 1;
-#X connect 95 0 103 1;
-#X connect 96 0 114 1;
-#X connect 96 0 113 1;
-#X connect 97 0 115 1;
-#X connect 97 0 112 1;
-#X connect 98 0 105 1;
-#X connect 98 0 106 1;
-#X connect 99 0 104 1;
-#X connect 99 0 107 1;
-#X connect 100 0 116 1;
-#X connect 100 0 110 1;
-#X connect 101 0 117 1;
-#X connect 101 0 111 1;
-#X connect 102 0 135 0;
-#X connect 103 0 136 0;
-#X connect 104 0 127 0;
-#X connect 105 0 126 0;
-#X connect 106 0 137 0;
-#X connect 107 0 138 0;
-#X connect 108 0 124 0;
-#X connect 109 0 125 0;
-#X connect 110 0 134 0;
-#X connect 111 0 133 0;
-#X connect 112 0 132 0;
-#X connect 113 0 131 0;
-#X connect 114 0 121 0;
-#X connect 114 0 123 0;
-#X connect 115 0 120 0;
-#X connect 115 0 130 0;
-#X connect 116 0 118 0;
-#X connect 116 0 128 0;
-#X connect 117 0 119 0;
-#X connect 117 0 129 0;
-#X connect 122 0 38 0;
-#X restore 164 317 pd doit;
-#X obj 165 255 inlet~;
-#X obj 222 255 inlet~;
-#X obj 520 241 s \$0-fb;
-#X obj 705 290 s \$0-damp;
-#X text 57 490 rev3 - 16-delay reverberator. Like rev2~ but presumably
-higher-quality and takes two audio inputs.;
-#X obj 520 187 / 400;
-#X connect 0 0 12 0;
-#X connect 1 0 11 0;
-#X connect 2 0 3 1;
-#X connect 2 0 4 1;
-#X connect 2 0 16 1;
-#X connect 2 0 17 1;
-#X connect 3 0 8 0;
-#X connect 4 0 9 0;
-#X connect 5 0 6 0;
-#X connect 6 0 2 0;
-#X connect 7 0 38 0;
-#X connect 10 0 41 0;
-#X connect 11 0 5 0;
-#X connect 12 0 10 0;
-#X connect 13 0 20 0;
-#X connect 14 0 22 0;
-#X connect 15 0 11 0;
-#X connect 15 0 12 0;
-#X connect 15 0 13 0;
-#X connect 15 0 14 0;
-#X connect 16 0 18 0;
-#X connect 17 0 19 0;
-#X connect 20 0 21 0;
-#X connect 20 1 23 0;
-#X connect 21 0 23 0;
-#X connect 22 0 26 0;
-#X connect 23 0 34 0;
-#X connect 24 0 23 0;
-#X connect 25 0 14 0;
-#X connect 26 0 27 0;
-#X connect 27 0 28 0;
-#X connect 28 0 39 0;
-#X connect 35 0 3 0;
-#X connect 35 1 4 0;
-#X connect 35 2 16 0;
-#X connect 35 3 17 0;
-#X connect 36 0 35 0;
-#X connect 37 0 35 1;
-#X connect 41 0 7 0;
diff --git a/externals/extra/0.43.3/0.43.2/sigmund~/sigmund~-help.pd b/externals/extra/0.43.3/0.43.2/sigmund~/sigmund~-help.pd
deleted file mode 100644
index 5ddbf6d1..00000000
--- a/externals/extra/0.43.3/0.43.2/sigmund~/sigmund~-help.pd
+++ /dev/null
@@ -1,194 +0,0 @@
-#N canvas 167 -7 580 617 12;
-#X text 42 4 sigmund~ - sinusoidal analysis and pitch tracking;
-#N canvas 432 117 573 597 using-with-tables 0;
-#X obj 29 368 print peak;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array insignal 1024 float 2;
-#X coords 0 1 1023 -1 200 140 1;
-#X restore 83 426 graph;
-#X obj 314 513 phasor~;
-#X obj 294 429 loadbang;
-#X obj 314 461 440;
-#X floatatom 313 488 5 0 0 0 - - -;
-#X obj 305 544 tabwrite~ insignal;
-#X obj 290 516 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
--1 -1;
-#X text 114 11 Using sigmund~ on arrays;
-#X text 42 33 If invoked with the "-t" flag (as a creation argument)
-\, sigmund~ analyzes waveforms stored in arrays. Instead of an incoming
-signal \, feed it "list" messages with the following arguments:;
-#X text 37 118 table name (a symbol);
-#X text 38 137 number of points;
-#X obj 29 342 sigmund~ -t -npeak 10 -maxfreq 5000 peaks;
-#X msg 29 316 list insignal 1024 0 44100 0;
-#X text 37 158 index of first point;
-#X text 39 179 sample rate;
-#X text 38 200 debug flag (print debugging info if nonzero);
-#X text 23 232 In this mode \, only the "env" \, "pitch" \, and "peaks"
-outputs are meaningful.;
-#X text 31 294 click here to test:;
-#X connect 2 0 6 0;
-#X connect 3 0 4 0;
-#X connect 4 0 5 0;
-#X connect 5 0 2 0;
-#X connect 5 0 7 0;
-#X connect 7 0 6 0;
-#X connect 12 0 0 0;
-#X connect 13 0 12 0;
-#X restore 330 553 pd using-with-tables;
-#X obj 40 512 phasor~;
-#X obj 40 425 loadbang;
-#X floatatom 40 471 5 0 120 0 - - -;
-#X floatatom 39 561 5 0 0 0 - - -;
-#X floatatom 245 563 5 0 0 0 - - -;
-#X obj 40 490 mtof;
-#X obj 40 448 69;
-#X text 38 579 pitch;
-#X text 222 582 envelope;
-#X text 13 28 Sigmund~ analyzes an incoming sound into sinusoidal components
-\, which may be reported individually or combined to form a pitch estimate.
-Possible outputs are specified as creation arguments:;
-#X text 56 95 pitch - output pitch continuously;
-#N canvas 518 74 588 728 setting-parameters 0;
-#X msg 182 66 print;
-#X floatatom 192 92 5 0 0 0 - - -;
-#X msg 192 113 minpower \$1;
-#X obj 182 139 sigmund~ -minpower 40;
-#X text 39 14 You can set parameters either by creation arguments \,
-or else using messages. The "print" message gives you the current values
-of all the parameters:;
-#X text 28 169 npts: number of points used in an analysis. Must be
-a power of two \, at least 128 The minimum frequency that can be tracked
-is about 2(sample_rate)/npts.;
-#X text 26 219 hop: number of points between analyses. Must be a power
-of two \, at least the DSP vector size (usually 64). This regulates
-the number of analyses done per unit of time.;
-#X text 28 271 npeak: maximum number of sinusoidal peaks to look for.
-The computation time is quadratic in the number of peaks actually found
-(this number only sets an upper limit). Use it to balance CPU time
-with quality of results.;
-#X text 30 336 maxfreq: maximum frequency of sinusoidal peaks to look
-for. This can be useful in situations where background noise creates
-high-frequency \, spurious peaks..;
-#X text 37 388 vibrato: maximum deviation from "pitch" to accept as
-normal vibrato (affects "notes" output only). If the value is too small.
-vibratos will appear as trills. If too large \, very small melodic
-intervals may not be reported as new notes.;
-#X text 33 457 stabletime: time period to wait before reporting a note
-(affects "notes" output only). The "pitch" must be present and must
-not vary more than "vibrato" for this entire period to report a note.
-If too large \, the "notes" will be unnecessarily delayed. If too small
-\, spurious notes get output.;
-#X text 31 551 minpower: minimum measured RMS level to report a pitch
-(affects "pitch" and "notes" output only). Signals quieter than this
-will be assumed to be crosstalk and ignored.;
-#X text 32 602 growth: minimum measured RMS growth to report a new
-note (affects "notes" output only). The RMS level must rise by this
-many dB (within a time period given by "stabletime") to report a repetition
-of a note at or near the previously output pitch.;
-#X connect 0 0 3 0;
-#X connect 1 0 2 0;
-#X connect 2 0 3 0;
-#X restore 330 531 pd setting-parameters;
-#N canvas 67 29 641 815 sinusoid-tracking 0;
-#X obj 124 267 sigmund~ -npeak 10 peaks;
-#X obj 124 214 phasor~;
-#X obj 124 144 loadbang;
-#X floatatom 124 190 5 0 120 0 - - -;
-#X obj 124 295 route 0 1 2 3 4 5 6 7 8 9;
-#X obj 82 339 unpack 0 0 0 0;
-#X floatatom 82 461 5 0 0 0 - - -;
-#X floatatom 122 431 5 0 0 0 - - -;
-#X floatatom 162 406 5 0 0 0 - - -;
-#X obj 124 167 440;
-#X floatatom 203 380 5 0 0 0 - - -;
-#X obj 322 349 unpack 0 0 0 0;
-#X floatatom 322 471 5 0 0 0 - - -;
-#X floatatom 362 441 5 0 0 0 - - -;
-#X floatatom 402 416 5 0 0 0 - - -;
-#X floatatom 443 390 5 0 0 0 - - -;
-#X text 385 475 frequency (Hz.);
-#X text 419 442 peak amplitude (linear);
-#X text 464 416 cosine component;
-#X text 499 390 sine component;
-#X text 79 505 loudest partial;
-#X text 332 508 quietest partial;
-#X text 36 4 You can ask for sinusoidal peaks in decreasing order of
-amplitude or arranged into maximally continuous tracks for resynthesis.
-(Or you can ask for both.) If you ask for peaks \, out come lists of
-five numbers \, one for each sinusoid at each analysis period. The
-first is the index number of the sinusoid (so you can use "route" to
-claw them apart). The other four are as shown:;
-#X obj 204 611 osc~ 440;
-#X obj 204 635 *~;
-#X obj 205 689 unpack 0 0 0 0;
-#X floatatom 205 782 5 0 0 0 - - -;
-#X floatatom 245 760 5 0 0 0 - - -;
-#X floatatom 285 737 5 0 0 0 - - -;
-#X floatatom 326 713 5 0 0 0 - - -;
-#X obj 246 638 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X text 43 535 If you ask for "tracks" \, the output is four numbers:
-index \, frequency \, and amplitude as before \, and finally a flag
-which is one for a new track \, zero for a continuation \, minus one
-for an empty track.;
-#X obj 205 662 sigmund~ -npts 16384 -hop 8192 -npeak 1 tracks;
-#X connect 0 0 4 0;
-#X connect 1 0 0 0;
-#X connect 2 0 9 0;
-#X connect 3 0 1 0;
-#X connect 4 0 5 0;
-#X connect 4 9 11 0;
-#X connect 5 0 6 0;
-#X connect 5 1 7 0;
-#X connect 5 2 8 0;
-#X connect 5 3 10 0;
-#X connect 9 0 3 0;
-#X connect 11 0 12 0;
-#X connect 11 1 13 0;
-#X connect 11 2 14 0;
-#X connect 11 3 15 0;
-#X connect 23 0 24 0;
-#X connect 24 0 32 0;
-#X connect 25 0 26 0;
-#X connect 25 1 27 0;
-#X connect 25 2 28 0;
-#X connect 25 3 29 0;
-#X connect 30 0 24 1;
-#X connect 32 0 25 0;
-#X restore 330 508 pd sinusoid-tracking;
-#X text 52 165 tracks - output sinusoidal peaks organized into tracks
-;
-#X text 56 111 notes - output pitch at the beginning of notes;
-#X text 339 485 more details:;
-#X text 10 184 Parameters you may set (in creation arguments or messages):
-;
-#X text 60 207 npts - number of points in each analysis window (1024)
-;
-#X text 60 225 hop - number of points between each analysis (512);
-#X text 60 242 npeak - number of sinusoidal peaks (20);
-#X text 61 279 vibrato - depth of vibrato to expect in 1/2-tones (1)
-;
-#X text 60 298 stabletime - time (msec) to wait to report notes (50)
-;
-#X obj 39 535 sigmund~ -hop 4096 pitch env;
-#X text 62 316 minpower - minimum power (dB) to report a pitch (50)
-;
-#X text 62 335 growth - growth (dB) to report a new note (7);
-#X text 54 147 peaks - output all sinusoidal peaks in order of amplitude
-;
-#X text 11 356 The npts and hop parameters are in samples \, and are
-powers of two. The example below specifies a huge hop of 4096 (to slow
-the output down) and to output "pitch" and "env". (Those are the default
-outputs.);
-#X text 61 260 maxfreq - maximum sinusoid frequency in Hz. (1000000)
-;
-#X text 55 128 env - output amplitude continuously;
-#X text 380 596 updated for Pd v0.41;
-#X connect 2 0 24 0;
-#X connect 3 0 8 0;
-#X connect 4 0 7 0;
-#X connect 7 0 2 0;
-#X connect 8 0 4 0;
-#X connect 24 0 5 0;
-#X connect 24 1 6 0;
diff --git a/externals/extra/0.43.3/0.43.2/sigmund~/sigmund~.c b/externals/extra/0.43.3/0.43.2/sigmund~/sigmund~.c
deleted file mode 100644
index 5d1d72f6..00000000
--- a/externals/extra/0.43.3/0.43.2/sigmund~/sigmund~.c
+++ /dev/null
@@ -1,1655 +0,0 @@
-/* Copyright (c) 2005 Miller Puckette. BSD licensed. No warranties. */
-
-/*
- fix parameter settings
- not to report pitch if evidence too scanty?
- note-on detection triggered by falling envelope (a posteriori)
- reentrancy bug setting loud flag (other parameters too?)
- tweaked freqs still not stable enough
- implement block ("-b") mode
-*/
-
-#ifdef PD
-#include "m_pd.h"
-#endif
-#ifdef MSP
-#include "ext.h"
-#include "z_dsp.h"
-#include "ext_support.h"
-#include "ext_proto.h"
-#include "ext_obex.h"
-typedef double t_floatarg;
-#define t_resizebytes(a, b, c) t_resizebytes((char *)(a), (b), (c))
-#endif
-
-/* From here to the next "#ifdef PD" or "#ifdef Max" should be extractable
-and usable in other contexts. The one external requirement is a real
-single-precision FFT, invoked as in the Mayer one: */
-
-#ifdef _MSC_VER /* this is only needed with Microsoft's compiler */
-__declspec(dllimport) extern
-#endif
-void mayer_realfft(int npoints, t_sample *buf);
-
-/* this routine is passed a buffer of npoints values, and returns the
-N/2+1 real parts of the DFT (frequency zero through Nyquist), followed
-by the N/2-1 imaginary points, in order of decreasing frequency. Pd 0.41,
-for example, defines this in the file d_fft_mayer.c or d_fft_fftsg.c. */
-
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef _WIN32
-#include <malloc.h>
-#elif ! defined(_MSC_VER)
-#include <alloca.h>
-#endif
-#include <stdlib.h>
-#ifdef _MSC_VER
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-typedef struct peak
-{
- t_float p_freq;
- t_float p_amp;
- t_float p_ampreal;
- t_float p_ampimag;
- t_float p_pit;
- t_float p_db;
- t_float p_salience;
- t_float p_tmp;
-} t_peak;
-
-/********************** service routines **************************/
-
-/* these three are dapted from elsewhere in Pd but included here for
-cmolpeteness */
-static int sigmund_ilog2(int n)
-{
- int ret = -1;
- while (n)
- {
- n >>= 1;
- ret++;
- }
- return (ret);
-}
-
-static t_float sigmund_ftom(t_float f)
-{
- return (f > 0 ? 17.3123405046 * log(.12231220585 * f) : -1500);
-}
-
-#define LOGTEN 2.302585092994
-static t_float sigmund_powtodb(t_float f)
-{
- if (f <= 0) return (0);
- else
- {
- t_float val = 100 + 10./LOGTEN * log(f);
- return (val < 0 ? 0 : val);
- }
-}
-
-/* parameters for von Hann window (change these to get Hamming if desired) */
-#define W_ALPHA 0.5
-#define W_BETA 0.5
-#define NEGBINS 4 /* number of bins of negative frequency we'll need */
-
-#define PI 3.141592653589793
-#define LOG2 0.693147180559945
-#define LOG10 2.302585092994046
-
-static t_float sinx(t_float theta, t_float sintheta)
-{
- if (theta > -0.003 && theta < 0.003)
- return (1);
- else return (sintheta/theta);
-}
-
-static t_float window_hann_mag(t_float pidetune, t_float sinpidetune)
-{
- return (W_ALPHA * sinx(pidetune, sinpidetune)
- - 0.5 * W_BETA *
- (sinx(pidetune+PI, sinpidetune) + sinx(pidetune-PI, sinpidetune)));
-}
-
-static t_float window_mag(t_float pidetune, t_float cospidetune)
-{
- return (sinx(pidetune + (PI/2), cospidetune)
- + sinx(pidetune - (PI/2), -cospidetune));
-}
-
-/*********** Routines to analyze a window into sinusoidal peaks *************/
-
-static int sigmund_cmp_freq(const void *p1, const void *p2)
-{
- if ((*(t_peak **)p1)->p_freq > (*(t_peak **)p2)->p_freq)
- return (1);
- else if ((*(t_peak **)p1)->p_freq < (*(t_peak **)p2)->p_freq)
- return (-1);
- else return (0);
-}
-
-static void sigmund_tweak(int npts, t_float *ftreal, t_float *ftimag,
- int npeak, t_peak *peaks, t_float fperbin, int loud)
-{
- t_peak **peakptrs = (t_peak **)alloca(sizeof (*peakptrs) * (npeak+1));
- t_peak negpeak;
- int peaki, j, k;
- t_float ampreal[3], ampimag[3];
- t_float binperf = 1./fperbin;
- t_float phaseperbin = (npts-0.5)/npts, oneovern = 1./npts;
- if (npeak < 1)
- return;
- for (peaki = 0; peaki < npeak; peaki++)
- peakptrs[peaki+1] = &peaks[peaki];
- qsort(peakptrs+1, npeak, sizeof (*peakptrs), sigmund_cmp_freq);
- peakptrs[0] = &negpeak;
- negpeak.p_ampreal = peakptrs[1]->p_ampreal;
- negpeak.p_ampimag = -peakptrs[1]->p_ampimag;
- negpeak.p_freq = -peakptrs[1]->p_freq;
- for (peaki = 1; peaki <= npeak; peaki++)
- {
- int cbin = peakptrs[peaki]->p_freq*binperf + 0.5;
- int nsub = (peaki == npeak ? 1:2);
- t_float windreal, windimag, windpower, detune, pidetune, sinpidetune,
- cospidetune, ampcorrect, ampout, ampoutreal, ampoutimag, freqout;
- /* post("3 nsub %d amp %f freq %f", nsub,
- peakptrs[peaki]->p_amp, peakptrs[peaki]->p_freq); */
- if (cbin < 0 || cbin > 2*npts - 3)
- continue;
- for (j = 0; j < 3; j++)
- ampreal[j] = ftreal[cbin+2*j-2], ampimag[j] = ftimag[cbin+2*j-2];
- /* post("a %f %f", ampreal[1], ampimag[1]); */
- for (j = 0; j < nsub; j++)
- {
- t_peak *neighbor = peakptrs[(peaki-1) + 2*j];
- t_float neighborreal = npts * neighbor->p_ampreal;
- t_float neighborimag = npts * neighbor->p_ampimag;
- for (k = 0; k < 3; k++)
- {
- t_float freqdiff = (0.5*PI) * ((cbin + 2*k-2)
- -binperf * neighbor->p_freq);
- t_float sx = sinx(freqdiff, sin(freqdiff));
- t_float phasere = cos(freqdiff * phaseperbin);
- t_float phaseim = sin(freqdiff * phaseperbin);
- ampreal[k] -=
- sx * (phasere * neighborreal - phaseim * neighborimag);
- ampimag[k] -=
- sx * (phaseim * neighborreal + phasere * neighborimag);
- }
- /* post("b %f %f", ampreal[1], ampimag[1]); */
- }
-
- windreal = W_ALPHA * ampreal[1] -
- (0.5 * W_BETA) * (ampreal[0] + ampreal[2]);
- windimag = W_ALPHA * ampimag[1] -
- (0.5 * W_BETA) * (ampimag[0] + ampimag[2]);
- windpower = windreal * windreal + windimag * windimag;
- detune = (
- W_BETA*(ampreal[0] - ampreal[2]) *
- (2.0*W_ALPHA * ampreal[1] - W_BETA * (ampreal[0] + ampreal[2]))
- +
- W_BETA*(ampimag[0] - ampimag[2]) *
- (2.0*W_ALPHA * ampimag[1] - W_BETA * (ampimag[0] + ampimag[2]))
- ) / (4.0 * windpower);
- if (detune > 0.5)
- detune = 0.5;
- else if (detune < -0.5)
- detune = -0.5;
- /* if (loud > 0)
- post("tweak: windpower %f, bin %d, detune %f",
- windpower, cbin, detune); */
- pidetune = PI * detune;
- sinpidetune = sin(pidetune);
- cospidetune = cos(pidetune);
-
- ampcorrect = 1.0 / window_hann_mag(pidetune, sinpidetune);
-
- ampout = oneovern * ampcorrect *sqrt(windpower);
- ampoutreal = oneovern * ampcorrect *
- (windreal * cospidetune - windimag * sinpidetune);
- ampoutimag = oneovern * ampcorrect *
- (windreal * sinpidetune + windimag * cospidetune);
- freqout = (cbin + 2*detune) * fperbin;
- /* if (loud > 1)
- post("amp %f, freq %f", ampout, freqout); */
-
- peakptrs[peaki]->p_freq = freqout;
- peakptrs[peaki]->p_amp = ampout;
- peakptrs[peaki]->p_ampreal = ampoutreal;
- peakptrs[peaki]->p_ampimag = ampoutimag;
- }
-}
-
-static void sigmund_remask(int maxbin, int bestindex, t_float powmask,
- t_float maxpower, t_float *maskbuf)
-{
- int bin;
- int bin1 = (bestindex > 52 ? bestindex-50:2);
- int bin2 = (maxbin < bestindex + 50 ? bestindex + 50 : maxbin);
- for (bin = bin1; bin < bin2; bin++)
- {
- t_float bindiff = bin - bestindex;
- t_float mymask;
- mymask = powmask/ (1. + bindiff * bindiff * bindiff * bindiff);
- if (bindiff < 2 && bindiff > -2)
- mymask = 2*maxpower;
- if (mymask > maskbuf[bin])
- maskbuf[bin] = mymask;
- }
-}
-
-#define PEAKMASKFACTOR 1.
-#define PEAKTHRESHFACTOR 0.6
-
-static void sigmund_getrawpeaks(int npts, t_float *insamps,
- int npeak, t_peak *peakv, int *nfound, t_float *power, t_float srate, int loud,
- t_float hifreq)
-{
- t_float oneovern = 1.0/ (t_float)npts;
- t_float fperbin = 0.5 * srate * oneovern, totalpower = 0;
- int npts2 = 2*npts, i, bin;
- int peakcount = 0;
- t_float *fp1, *fp2;
- t_float *rawreal, *rawimag, *maskbuf, *powbuf;
- t_float *bigbuf = alloca(sizeof (t_float ) * (2*NEGBINS + 6*npts));
- int maxbin = hifreq/fperbin;
- if (maxbin > npts - NEGBINS)
- maxbin = npts - NEGBINS;
- /* if (loud) post("tweak %d", tweak); */
- maskbuf = bigbuf + npts2;
- powbuf = maskbuf + npts;
- rawreal = powbuf + npts+NEGBINS;
- rawimag = rawreal+npts+NEGBINS;
- for (i = 0; i < npts; i++)
- maskbuf[i] = 0;
-
- for (i = 0; i < npts; i++)
- bigbuf[i] = insamps[i];
- for (i = npts; i < 2*npts; i++)
- bigbuf[i] = 0;
- mayer_realfft(npts2, bigbuf);
- for (i = 0; i < npts; i++)
- rawreal[i] = bigbuf[i];
- for (i = 1; i < npts-1; i++)
- rawimag[i] = bigbuf[npts2-i];
- rawreal[-1] = rawreal[1];
- rawreal[-2] = rawreal[2];
- rawreal[-3] = rawreal[3];
- rawreal[-4] = rawreal[4];
- rawimag[0] = rawimag[npts-1] = 0;
- rawimag[-1] = -rawimag[1];
- rawimag[-2] = -rawimag[2];
- rawimag[-3] = -rawimag[3];
- rawimag[-4] = -rawimag[4];
-#if 1
- for (i = 0, fp1 = rawreal, fp2 = rawimag; i < maxbin; i++, fp1++, fp2++)
- {
- t_float x1 = fp1[1] - fp1[-1], x2 = fp2[1] - fp2[-1], p = powbuf[i] = x1*x1+x2*x2;
- if (i >= 2)
- totalpower += p;
- }
- powbuf[maxbin] = powbuf[maxbin+1] = 0;
- *power = 0.5 * totalpower *oneovern * oneovern;
-#endif
- for (peakcount = 0; peakcount < npeak; peakcount++)
- {
- t_float pow1, maxpower = 0, windreal, windimag, windpower,
- detune, pidetune, sinpidetune, cospidetune, ampcorrect, ampout,
- ampoutreal, ampoutimag, freqout, powmask;
- int bestindex = -1;
-
- for (bin = 2, fp1 = rawreal+2, fp2 = rawimag+2;
- bin < maxbin; bin++, fp1++, fp2++)
- {
- pow1 = powbuf[bin];
- if (pow1 > maxpower && pow1 > maskbuf[bin])
- {
- t_float thresh = PEAKTHRESHFACTOR * (powbuf[bin-2]+powbuf[bin+2]);
- if (pow1 > thresh)
- maxpower = pow1, bestindex = bin;
- }
- }
-
- if (totalpower <= 0 || maxpower < 1e-10*totalpower || bestindex < 0)
- break;
- fp1 = rawreal+bestindex;
- fp2 = rawimag+bestindex;
- powmask = maxpower * PEAKMASKFACTOR;
- /* if (loud > 2)
- post("maxpower %f, powmask %f, param1 %f",
- maxpower, powmask, param1); */
- sigmund_remask(maxbin, bestindex, powmask, maxpower, maskbuf);
-
- /* if (loud > 1)
- post("best index %d, total power %f", bestindex, totalpower); */
-
- windreal = fp1[1] - fp1[-1];
- windimag = fp2[1] - fp2[-1];
- windpower = windreal * windreal + windimag * windimag;
- detune = ((fp1[1] * fp1[1] - fp1[-1]*fp1[-1])
- + (fp2[1] * fp2[1] - fp2[-1]*fp2[-1])) / (2 * windpower);
-
- if (detune > 0.5)
- detune = 0.5;
- else if (detune < -0.5)
- detune = -0.5;
- /* if (loud > 1)
- post("windpower %f, index %d, detune %f",
- windpower, bestindex, detune); */
- pidetune = PI * detune;
- sinpidetune = sin(pidetune);
- cospidetune = cos(pidetune);
- ampcorrect = 1.0 / window_mag(pidetune, cospidetune);
-
- ampout = ampcorrect *sqrt(windpower);
- ampoutreal = ampcorrect *
- (windreal * cospidetune - windimag * sinpidetune);
- ampoutimag = ampcorrect *
- (windreal * sinpidetune + windimag * cospidetune);
-
- /* the frequency is the sum of the bin frequency and detuning */
-
- peakv[peakcount].p_freq = (freqout = (bestindex + 2*detune)) * fperbin;
- peakv[peakcount].p_amp = oneovern * ampout;
- peakv[peakcount].p_ampreal = oneovern * ampoutreal;
- peakv[peakcount].p_ampimag = oneovern * ampoutimag;
- }
- sigmund_tweak(npts, rawreal, rawimag, peakcount, peakv, fperbin, loud);
- sigmund_tweak(npts, rawreal, rawimag, peakcount, peakv, fperbin, loud);
- for (i = 0; i < peakcount; i++)
- {
- peakv[i].p_pit = sigmund_ftom(peakv[i].p_freq);
- peakv[i].p_db = sigmund_powtodb(peakv[i].p_amp);
- }
- *nfound = peakcount;
-}
-
-/*************** Routines for finding fundamental pitch *************/
-
-#define PITCHNPEAK 12
-#define HALFTONEINC 0.059
-#define SUBHARMONICS 16
-#define DBPERHALFTONE 0.0
-
-static void sigmund_getpitch(int npeak, t_peak *peakv, t_float *freqp,
- t_float npts, t_float srate, t_float nharmonics, t_float amppower, int loud)
-{
- t_float fperbin = 0.5 * srate / npts;
- int npit = 48 * sigmund_ilog2(npts), i, j, k, nsalient;
- t_float bestbin, bestweight, sumamp, sumweight, sumfreq, freq;
- t_float *weights = (t_float *)alloca(sizeof(t_float) * npit);
- t_peak *bigpeaks[PITCHNPEAK];
- if (npeak < 1)
- {
- freq = 0;
- goto done;
- }
- for (i = 0; i < npit; i++)
- weights[i] = 0;
- for (i = 0; i < npeak; i++)
- {
- peakv[i].p_tmp = 0;
- peakv[i].p_salience = peakv[i].p_db - DBPERHALFTONE * peakv[i].p_pit;
- }
- for (nsalient = 0; nsalient < PITCHNPEAK; nsalient++)
- {
- t_peak *bestpeak = 0;
- t_float bestsalience = -1e20;
- for (j = 0; j < npeak; j++)
- if (peakv[j].p_tmp == 0 && peakv[j].p_salience > bestsalience)
- {
- bestsalience = peakv[j].p_salience;
- bestpeak = &peakv[j];
- }
- if (!bestpeak)
- break;
- bigpeaks[nsalient] = bestpeak;
- bestpeak->p_tmp = 1;
- /* post("peak f=%f a=%f", bestpeak->p_freq, bestpeak->p_amp); */
- }
- sumweight = 0;
- for (i = 0; i < nsalient; i++)
- {
- t_peak *thispeak = bigpeaks[i];
- t_float weightindex = (48./LOG2) *
- log(thispeak->p_freq/(2.*fperbin));
- t_float loudness = pow(thispeak->p_amp, amppower);
- /* post("index %f, uncertainty %f", weightindex, pitchuncertainty); */
- for (j = 0; j < SUBHARMONICS; j++)
- {
- t_float subindex = weightindex -
- (48./LOG2) * log(j + 1.);
- int loindex = subindex - 0.5;
- int hiindex = loindex+2;
- if (hiindex < 0)
- break;
- if (hiindex >= npit)
- continue;
- if (loindex < 0)
- loindex = 0;
- for (k = loindex; k <= hiindex; k++)
- weights[k] += loudness * nharmonics / (nharmonics + j);
- }
- sumweight += loudness;
- }
- bestbin = -1;
- bestweight = -1e20;
- for (i = 0; i < npit; i++)
- if (weights[i] > bestweight)
- bestweight = weights[i], bestbin = i;
- if (bestweight < sumweight * 0.4)
- bestbin = -1;
-
- if (bestbin < 0)
- {
- freq = 0;
- goto done;
- }
- if (bestbin > 0 && bestbin < npit-1)
- {
- int ibest = bestbin;
- bestbin += (weights[ibest+1] - weights[ibest-1]) /
- (weights[ibest+1] + weights[ibest] + weights[ibest-1]);
- }
- freq = 2*fperbin * exp((LOG2/48.)*bestbin);
- for (sumamp = sumweight = sumfreq = 0, i = 0; i < nsalient; i++)
- {
- t_peak *thispeak = bigpeaks[i];
- t_float thisloudness = thispeak->p_amp;
- t_float thisfreq = thispeak->p_freq;
- t_float harmonic = thisfreq/freq;
- t_float intpart = (int)(0.5 + harmonic);
- t_float inharm = harmonic - intpart;
-#if 0
- if (loud)
- post("freq %f intpart %f inharm %f", freq, intpart, inharm);
-#endif
- if (intpart >= 1 && intpart <= 16 &&
- inharm < 0.015 * intpart && inharm > - (0.015 * intpart))
- {
- t_float weight = thisloudness * intpart;
- sumweight += weight;
- sumfreq += weight*thisfreq/intpart;
-#if 0
- if (loud)
- post("weight %f freq %f", weight, thisfreq);
-#endif
- }
- }
- if (sumweight > 0)
- freq = sumfreq / sumweight;
-done:
- if (!(freq >= 0 || freq <= 0))
- {
- /* post("freq nan cancelled"); */
- freq = 0;
- }
- *freqp = freq;
-}
-
-/*************** gather peak lists into sinusoidal tracks *************/
-
-static void sigmund_peaktrack(int ninpeak, t_peak *inpeakv,
- int noutpeak, t_peak *outpeakv, int loud)
-{
- int incnt, outcnt;
- for (outcnt = 0; outcnt < noutpeak; outcnt++)
- outpeakv[outcnt].p_tmp = -1;
-
- /* first pass. Match each "in" peak with the closest previous
- "out" peak, but no two to the same one. */
- for (incnt = 0; incnt < ninpeak; incnt++)
- {
- t_float besterror = 1e20;
- int bestcnt = -1;
- inpeakv[incnt].p_tmp = -1;
- for (outcnt = 0; outcnt < noutpeak; outcnt++)
- {
- t_float thiserror =
- inpeakv[incnt].p_freq - outpeakv[outcnt].p_freq;
- if (thiserror < 0)
- thiserror = -thiserror;
- if (thiserror < besterror)
- {
- besterror = thiserror;
- bestcnt = outcnt;
- }
- }
- if (outpeakv[bestcnt].p_tmp < 0)
- {
- outpeakv[bestcnt] = inpeakv[incnt];
- inpeakv[incnt].p_tmp = 0;
- outpeakv[bestcnt].p_tmp = 0;
- }
- }
- /* second pass. Unmatched "in" peaks assigned to free "out"
- peaks */
- for (incnt = 0; incnt < ninpeak; incnt++)
- if (inpeakv[incnt].p_tmp < 0)
- {
- for (outcnt = 0; outcnt < noutpeak; outcnt++)
- if (outpeakv[outcnt].p_tmp < 0)
- {
- outpeakv[outcnt] = inpeakv[incnt];
- inpeakv[incnt].p_tmp = 0;
- outpeakv[outcnt].p_tmp = 1;
- break;
- }
- }
- for (outcnt = 0; outcnt < noutpeak; outcnt++)
- if (outpeakv[outcnt].p_tmp == -1)
- outpeakv[outcnt].p_amp = 0;
-}
-
-/**************** parse continuous pitch into note starts ***************/
-
-#define NHISTPOINT 100
-
-typedef struct _histpoint
-{
- t_float h_freq;
- t_float h_power;
-} t_histpoint;
-
-typedef struct _notefinder
-{
- t_float n_age;
- t_float n_hifreq;
- t_float n_lofreq;
- int n_peaked;
- t_histpoint n_hist[NHISTPOINT];
- int n_histphase;
-} t_notefinder;
-
-
-static void notefinder_init(t_notefinder *x)
-{
- int i;
- x->n_peaked = x->n_age = 0;
- x->n_hifreq = x->n_lofreq = 0;
- x->n_histphase = 0;
- for (i = 0; i < NHISTPOINT; i++)
- x->n_hist[i].h_freq =x->n_hist[i].h_power = 0;
-}
-
-static void notefinder_doit(t_notefinder *x, t_float freq, t_float power,
- t_float *note, t_float vibrato, int stableperiod, t_float powerthresh,
- t_float growththresh, int loud)
-{
- /* calculate frequency ratio between allowable vibrato extremes
- (equal to twice the vibrato deviation from center) */
- t_float vibmultiple = exp((2*LOG2/12) * vibrato);
- int oldhistphase, i, k;
- if (stableperiod > NHISTPOINT - 1)
- stableperiod = NHISTPOINT - 1;
- else if (stableperiod < 1)
- stableperiod = 1;
- if (++x->n_histphase == NHISTPOINT)
- x->n_histphase = 0;
- x->n_hist[x->n_histphase].h_freq = freq;
- x->n_hist[x->n_histphase].h_power = power;
- x->n_age++;
- *note = 0;
-#if 0
- if (loud)
- {
- post("stable %d, age %d, vibmultiple %f, powerthresh %f, hifreq %f",
- stableperiod, (int)x->n_age ,vibmultiple, powerthresh, x->n_hifreq);
- post("histfreq %f %f %f %f",
- x->n_hist[x->n_histphase].h_freq,
- x->n_hist[(x->n_histphase+NHISTPOINT-1)%NHISTPOINT].h_freq,
- x->n_hist[(x->n_histphase+NHISTPOINT-2)%NHISTPOINT].h_freq,
- x->n_hist[(x->n_histphase+NHISTPOINT-3)%NHISTPOINT].h_freq);
- post("power %f %f %f %f",
- x->n_hist[x->n_histphase].h_power,
- x->n_hist[(x->n_histphase+NHISTPOINT-1)%NHISTPOINT].h_power,
- x->n_hist[(x->n_histphase+NHISTPOINT-2)%NHISTPOINT].h_power,
- x->n_hist[(x->n_histphase+NHISTPOINT-3)%NHISTPOINT].h_power);
- for (i = 0, k = x->n_histphase; i < stableperiod; i++)
- {
- post("pit %5.1f pow %f", sigmund_ftom(x->n_hist[k].h_freq),
- x->n_hist[k].h_power);
- if (--k < 0)
- k = NHISTPOINT - 1;
- }
- }
-#endif
- /* look for shorter notes than "stableperiod" in length.
- The amplitude must rise and then fall while the pitch holds
- steady. */
- if (x->n_hifreq <= 0 && x->n_age > stableperiod)
- {
- t_float maxpow = 0, freqatmaxpow = 0,
- localhifreq = -1e20, locallofreq = 1e20;
- int startphase = x->n_histphase - stableperiod + 1;
- if (startphase < 0)
- startphase += NHISTPOINT;
- for (i = 0, k = startphase; i < stableperiod; i++)
- {
- if (x->n_hist[k].h_freq <= 0)
- break;
- if (x->n_hist[k].h_power > maxpow)
- maxpow = x->n_hist[k].h_power,
- freqatmaxpow = x->n_hist[k].h_freq;
- if (x->n_hist[k].h_freq > localhifreq)
- localhifreq = x->n_hist[k].h_freq;
- if (x->n_hist[k].h_freq < locallofreq)
- locallofreq = x->n_hist[k].h_freq;
- if (localhifreq > locallofreq * vibmultiple)
- break;
- if (maxpow > power * growththresh &&
- maxpow > x->n_hist[startphase].h_power * growththresh &&
- localhifreq < vibmultiple * locallofreq
- && freqatmaxpow > 0 && maxpow > powerthresh)
- {
- x->n_hifreq = x->n_lofreq = *note = freqatmaxpow;
- x->n_age = 0;
- x->n_peaked = 0;
- /* post("got short note"); */
- return;
- }
- if (++k >= NHISTPOINT)
- k = 0;
- }
-
- }
- if (x->n_hifreq > 0)
- {
- /* test if we're within "vibrato" range, and if so update range */
- if (freq * vibmultiple >= x->n_hifreq &&
- x->n_lofreq * vibmultiple >= freq)
- {
- if (freq > x->n_hifreq)
- x->n_hifreq = freq;
- if (freq < x->n_lofreq)
- x->n_lofreq = freq;
- }
- else if (x->n_hifreq > 0 && x->n_age > stableperiod)
- {
- /* if we've been out of range at least 1/2 the
- last "stableperiod+1" analyses, clear the note */
- int nbad = 0;
- for (i = 0, k = x->n_histphase; i < stableperiod + 1; i++)
- {
- if (--k < 0)
- k = NHISTPOINT - 1;
- if (x->n_hist[k].h_freq * vibmultiple <= x->n_hifreq ||
- x->n_lofreq * vibmultiple <= x->n_hist[k].h_freq)
- nbad++;
- }
- if (2 * nbad >= stableperiod + 1)
- {
- x->n_hifreq = x->n_lofreq = 0;
- x->n_age = 0;
- }
- }
- }
-
- oldhistphase = x->n_histphase - stableperiod;
- if (oldhistphase < 0)
- oldhistphase += NHISTPOINT;
-
- /* look for envelope attacks */
-
- if (x->n_hifreq > 0 && x->n_peaked)
- {
- if (freq > 0 && power > powerthresh &&
- power > x->n_hist[oldhistphase].h_power *
- exp((LOG10*0.1)*growththresh))
- {
- /* clear it and fall through for new stable-note test */
- x->n_peaked = 0;
- x->n_hifreq = x->n_lofreq = 0;
- x->n_age = 0;
- }
- }
- else if (!x->n_peaked)
- {
- if (x->n_hist[oldhistphase].h_power > powerthresh &&
- x->n_hist[oldhistphase].h_power > power)
- x->n_peaked = 1;
- }
-
- /* test for a new note using a stability criterion. */
-
- if (freq >= 0 &&
- (x->n_hifreq <= 0 || freq > x->n_hifreq || freq < x->n_lofreq))
- {
- t_float testfhi = freq, testflo = freq,
- maxpow = x->n_hist[x->n_histphase].h_freq;
- for (i = 0, k = x->n_histphase; i < stableperiod-1; i++)
- {
- if (--k < 0)
- k = NHISTPOINT - 1;
- if (x->n_hist[k].h_freq > testfhi)
- testfhi = x->n_hist[k].h_freq;
- if (x->n_hist[k].h_freq < testflo)
- testflo = x->n_hist[k].h_freq;
- if (x->n_hist[k].h_power > maxpow)
- maxpow = x->n_hist[k].h_power;
- }
-#if 0
- if (loud)
- post("freq %.2g testfhi %.2g testflo %.2g maxpow %.2g",
- freq, testfhi, testflo, maxpow);
-#endif
- if (testflo > 0 && testfhi <= vibmultiple * testflo
- && maxpow > powerthresh)
- {
- /* report new note */
- t_float sumf = 0, sumw = 0, thisw;
- for (i = 0, k = x->n_histphase; i < stableperiod; i++)
- {
- thisw = x->n_hist[k].h_power;
- sumw += thisw;
- sumf += thisw*x->n_hist[k].h_freq;
- if (--k < 0)
- k = NHISTPOINT - 1;
- }
- x->n_hifreq = x->n_lofreq = *note = (sumw > 0 ? sumf/sumw : 0);
-#if 0
- /* debugging printout */
- for (i = 0; i < stableperiod; i++)
- {
- int k3 = x->n_histphase - i;
- if (k3 < 0)
- k3 += NHISTPOINT;
- startpost("%5.1f ", sigmund_ftom(x->n_hist[k3].h_freq));
- }
- post("");
-#endif
- x->n_age = 0;
- x->n_peaked = 0;
- return;
- }
- }
- *note = 0;
- return;
-}
-
-/**************** object structure for Pd and Max. *********************/
-
-/* From here onward, the code is specific to eithr Pd, Max, or both. If
-neither "PD 'nor "MSP" is defined, none of this is compiled, so that the
-whole file can be included in other, non-PD and non-Max projects. */
-
-#if (defined(PD) || defined (MSP))
-
-#define NHIST 100
-
-#define MODE_STREAM 1
-#define MODE_BLOCK 2 /* unimplemented */
-#define MODE_TABLE 3
-
-#define NPOINTS_DEF 1024
-#define NPOINTS_MIN 128
-
-#define HOP_DEF 512
-#define NPEAK_DEF 20
-
-#define VIBRATO_DEF 1
-#define STABLETIME_DEF 50
-#define MINPOWER_DEF 50
-#define GROWTH_DEF 7
-
-#define OUT_PITCH 0
-#define OUT_ENV 1
-#define OUT_NOTE 2
-#define OUT_PEAKS 3
-#define OUT_TRACKS 4
-#define OUT_SMSPITCH 5
-#define OUT_SMSNONPITCH 6
-
-typedef struct _varout
-{
-#ifdef PD
- t_outlet *v_outlet;
-#endif /* PD */
-#ifdef MSP
- void *v_outlet;
-#endif /* MSP */
- int v_what;
-} t_varout;
-
-typedef struct _sigmund
-{
-#ifdef PD
- t_object x_obj;
- t_clock *x_clock;
- t_float x_f; /* for main signal inlet */
-#endif /* PD */
-#ifdef MSP
- t_pxobject x_obj;
- void *obex;
- void *x_clock;
- t_sample *x_inbuf2; /* extra input buffer to eat clock/DSP jitter */
-#endif /* MSP */
- t_varout *x_varoutv;
- int x_nvarout;
- t_float x_sr; /* sample rate */
- int x_mode; /* MODE_STREAM, etc. */
- int x_npts; /* number of points in analysis window */
- int x_npeak; /* number of peaks to find */
- int x_loud; /* debug level */
- t_sample *x_inbuf; /* input buffer */
- int x_infill; /* number of points filled */
- int x_countdown; /* countdown to start filling buffer */
- int x_hop; /* samples between analyses */
- t_float x_maxfreq; /* highest-frequency peak to report */
- t_float x_vibrato; /* vibrato depth in half tones */
- t_float x_stabletime; /* period of stability needed for note */
- t_float x_growth; /* growth to set off a new note */
- t_float x_minpower; /* minimum power, in DB, for a note */
- t_float x_param1; /* three parameters for temporary use */
- t_float x_param2;
- t_float x_param3;
- t_notefinder x_notefinder; /* note parsing state */
- t_peak *x_trackv; /* peak tracking state */
- int x_ntrack; /* number of peaks tracked */
- unsigned int x_dopitch:1; /* which things to calculate */
- unsigned int x_donote:1;
- unsigned int x_dotracks:1;
-} t_sigmund;
-
-static void sigmund_preinit(t_sigmund *x)
-{
- x->x_npts = NPOINTS_DEF;
- x->x_param1 = 6;
- x->x_param2 = 0.5;
- x->x_param3 = 0;
- x->x_hop = HOP_DEF;
- x->x_mode = MODE_STREAM;
- x->x_npeak = NPEAK_DEF;
- x->x_vibrato = VIBRATO_DEF;
- x->x_stabletime = STABLETIME_DEF;
- x->x_growth = GROWTH_DEF;
- x->x_minpower = MINPOWER_DEF;
- x->x_maxfreq = 1000000;
- x->x_loud = 0;
- x->x_sr = 1;
- x->x_nvarout = 0;
- x->x_varoutv = (t_varout *)getbytes(0);
- x->x_trackv = 0;
- x->x_ntrack = 0;
- x->x_dopitch = x->x_donote = x->x_dotracks = 0;
- x->x_inbuf = 0;
-#ifdef MSP
- x->x_inbuf2 = 0;
-#endif
-}
-
-static void sigmund_npts(t_sigmund *x, t_floatarg f)
-{
- int nwas = x->x_npts, npts = f;
- /* check parameter ranges */
- if (npts < NPOINTS_MIN)
- post("sigmund~: minimum points %d", NPOINTS_MIN),
- npts = NPOINTS_MIN;
- if (npts != (1 << sigmund_ilog2(npts)))
- post("sigmund~: adjusting analysis size to %d points",
- (npts = (1 << sigmund_ilog2(npts))));
- if (npts != nwas)
- x->x_countdown = x->x_infill = 0;
- if (x->x_mode == MODE_STREAM)
- {
- if (x->x_inbuf)
- {
- x->x_inbuf = (t_sample *)t_resizebytes(x->x_inbuf,
- sizeof(*x->x_inbuf) * nwas, sizeof(*x->x_inbuf) * npts);
-#ifdef MSP
- x->x_inbuf2 = (t_sample *)t_resizebytes(x->x_inbuf2,
- sizeof(*x->x_inbuf2) * nwas, sizeof(*x->x_inbuf2) * npts);
-#endif
- }
- else
- {
- x->x_inbuf = (t_sample *)getbytes(sizeof(*x->x_inbuf) * npts);
- memset((char *)(x->x_inbuf), 0, sizeof(*x->x_inbuf) * npts);
-#ifdef MSP
- x->x_inbuf2 = (t_sample *)getbytes(sizeof(*x->x_inbuf2) * npts);
- memset((char *)(x->x_inbuf2), 0, sizeof(*x->x_inbuf2) * npts);
-#endif
- }
- }
- else x->x_inbuf = 0;
- x->x_npts = npts;
-}
-
-static void sigmund_hop(t_sigmund *x, t_floatarg f)
-{
- x->x_hop = f;
- /* check parameter ranges */
- if (x->x_hop != (1 << sigmund_ilog2(x->x_hop)))
- post("sigmund~: adjusting analysis size to %d points",
- (x->x_hop = (1 << sigmund_ilog2(x->x_hop))));
-}
-
-static void sigmund_npeak(t_sigmund *x, t_floatarg f)
-{
- if (f < 1)
- f = 1;
- x->x_npeak = f;
-}
-
-static void sigmund_maxfreq(t_sigmund *x, t_floatarg f)
-{
- x->x_maxfreq = f;
-}
-
-static void sigmund_vibrato(t_sigmund *x, t_floatarg f)
-{
- if (f < 0)
- f = 0;
- x->x_vibrato = f;
-}
-
-static void sigmund_stabletime(t_sigmund *x, t_floatarg f)
-{
- if (f < 0)
- f = 0;
- x->x_stabletime = f;
-}
-
-static void sigmund_growth(t_sigmund *x, t_floatarg f)
-{
- if (f < 0)
- f = 0;
- x->x_growth = f;
-}
-
-static void sigmund_minpower(t_sigmund *x, t_floatarg f)
-{
- if (f < 0)
- f = 0;
- x->x_minpower = f;
-}
-
-static void sigmund_doit(t_sigmund *x, int npts, t_float *arraypoints,
- int loud, t_float srate)
-{
- t_peak *peakv = (t_peak *)alloca(sizeof(t_peak) * x->x_npeak);
- int nfound, i, cnt;
- t_float freq = 0, power, note = 0;
- sigmund_getrawpeaks(npts, arraypoints, x->x_npeak, peakv,
- &nfound, &power, srate, loud, x->x_maxfreq);
- if (x->x_dopitch)
- sigmund_getpitch(nfound, peakv, &freq, npts, srate,
- x->x_param1, x->x_param2, loud);
- if (x->x_donote)
- notefinder_doit(&x->x_notefinder, freq, power, &note, x->x_vibrato,
- 1 + x->x_stabletime * 0.001 * x->x_sr / (t_float)x->x_hop,
- exp(LOG10*0.1*(x->x_minpower - 100)), x->x_growth, loud);
- if (x->x_dotracks)
- sigmund_peaktrack(nfound, peakv, x->x_ntrack, x->x_trackv, loud);
-
- for (cnt = x->x_nvarout; cnt--;)
- {
- t_varout *v = &x->x_varoutv[cnt];
- switch (v->v_what)
- {
- case OUT_PITCH:
- outlet_float(v->v_outlet, sigmund_ftom(freq));
- break;
- case OUT_ENV:
- outlet_float(v->v_outlet, sigmund_powtodb(power));
- break;
- case OUT_NOTE:
- if (note > 0)
- outlet_float(v->v_outlet, sigmund_ftom(note));
- break;
- case OUT_PEAKS:
- for (i = 0; i < nfound; i++)
- {
- t_atom at[5];
- SETFLOAT(at, (t_float)i);
- SETFLOAT(at+1, peakv[i].p_freq);
- SETFLOAT(at+2, 2*peakv[i].p_amp);
- SETFLOAT(at+3, 2*peakv[i].p_ampreal);
- SETFLOAT(at+4, 2*peakv[i].p_ampimag);
- outlet_list(v->v_outlet, 0, 5, at);
- }
- break;
- case OUT_TRACKS:
- for (i = 0; i < x->x_ntrack; i++)
- {
- t_atom at[4];
- SETFLOAT(at, (t_float)i);
- SETFLOAT(at+1, x->x_trackv[i].p_freq);
- SETFLOAT(at+2, 2*x->x_trackv[i].p_amp);
- SETFLOAT(at+3, x->x_trackv[i].p_tmp);
- outlet_list(v->v_outlet, 0, 4, at);
- }
- break;
- }
- }
-}
-
-static t_int *sigmund_perform(t_int *w);
-static void sigmund_dsp(t_sigmund *x, t_signal **sp)
-{
- if (x->x_mode == MODE_STREAM)
- {
- if (x->x_hop % sp[0]->s_n)
- post("sigmund: adjusting hop size to %d",
- (x->x_hop = sp[0]->s_n * (x->x_hop / sp[0]->s_n)));
- x->x_sr = sp[0]->s_sr;
- dsp_add(sigmund_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
- }
-}
-
-static void sigmund_print(t_sigmund *x)
-{
- post("sigmund~ settings:");
- post("npts %d", (int)x->x_npts);
- post("hop %d", (int)x->x_hop);
- post("npeak %d", (int)x->x_npeak);
- post("maxfreq %g", x->x_maxfreq);
- post("vibrato %g", x->x_vibrato);
- post("stabletime %g", x->x_stabletime);
- post("growth %g", x->x_growth);
- post("minpower %g", x->x_minpower);
- x->x_loud = 1;
-}
-
-static void sigmund_free(t_sigmund *x)
-{
- if (x->x_inbuf)
- {
- freebytes(x->x_inbuf, x->x_npts * sizeof(*x->x_inbuf));
-#ifdef MSP
- freebytes(x->x_inbuf2, x->x_npts * sizeof(*x->x_inbuf2));
-#endif
- }
- if (x->x_trackv)
- freebytes(x->x_trackv, x->x_ntrack * sizeof(*x->x_trackv));
- clock_free(x->x_clock);
-}
-
-#endif /* PD or MSP */
-/*************************** Glue for Pd ************************/
-#ifdef PD
-
-static t_class *sigmund_class;
-
-static void sigmund_tick(t_sigmund *x);
-static void sigmund_clear(t_sigmund *x);
-static void sigmund_npts(t_sigmund *x, t_floatarg f);
-static void sigmund_hop(t_sigmund *x, t_floatarg f);
-static void sigmund_npeak(t_sigmund *x, t_floatarg f);
-static void sigmund_maxfreq(t_sigmund *x, t_floatarg f);
-static void sigmund_vibrato(t_sigmund *x, t_floatarg f);
-static void sigmund_stabletime(t_sigmund *x, t_floatarg f);
-static void sigmund_growth(t_sigmund *x, t_floatarg f);
-static void sigmund_minpower(t_sigmund *x, t_floatarg f);
-
-static void sigmund_tick(t_sigmund *x)
-{
- if (x->x_infill == x->x_npts)
- {
- sigmund_doit(x, x->x_npts, x->x_inbuf, x->x_loud, x->x_sr);
- if (x->x_hop >= x->x_npts)
- {
- x->x_infill = 0;
- x->x_countdown = x->x_hop - x->x_npts;
- }
- else
- {
- memmove(x->x_inbuf, x->x_inbuf + x->x_hop,
- (x->x_infill = x->x_npts - x->x_hop) * sizeof(*x->x_inbuf));
- x->x_countdown = 0;
- }
- if (x->x_loud)
- x->x_loud--;
- }
-}
-
-static t_int *sigmund_perform(t_int *w)
-{
- t_sigmund *x = (t_sigmund *)(w[1]);
- t_sample *in = (t_sample *)(w[2]);
- int n = (int)(w[3]);
-
- if (x->x_hop % n)
- return (w+4);
- if (x->x_countdown > 0)
- x->x_countdown -= n;
- else if (x->x_infill != x->x_npts)
- {
- int j;
- t_float *fp = x->x_inbuf + x->x_infill;
- for (j = 0; j < n; j++)
- *fp++ = *in++;
- x->x_infill += n;
- if (x->x_infill == x->x_npts)
- clock_delay(x->x_clock, 0);
- }
- return (w+4);
-}
-
-static void *sigmund_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_sigmund *x = (t_sigmund *)pd_new(sigmund_class);
- sigmund_preinit(x);
-
- while (argc > 0)
- {
- t_symbol *firstarg = atom_getsymbolarg(0, argc, argv);
- if (!strcmp(firstarg->s_name, "-t"))
- {
- x->x_mode = MODE_TABLE;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "-s"))
- {
- x->x_mode = MODE_STREAM;
- argc--, argv++;
- }
-#if 0
- else if (!strcmp(firstarg->s_name, "-b"))
- {
- x->x_mode = MODE_BLOCK;
- argc--, argv++;
- }
-#endif
- else if (!strcmp(firstarg->s_name, "-npts") && argc > 1)
- {
- x->x_npts = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-hop") && argc > 1)
- {
- sigmund_hop(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-npeak") && argc > 1)
- {
- sigmund_npeak(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-maxfreq") && argc > 1)
- {
- sigmund_maxfreq(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-vibrato") && argc > 1)
- {
- sigmund_vibrato(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-stabletime") && argc > 1)
- {
- sigmund_stabletime(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-growth") && argc > 1)
- {
- sigmund_growth(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-minpower") && argc > 1)
- {
- sigmund_minpower(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "pitch"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[x->x_nvarout].v_what = OUT_PITCH;
- x->x_nvarout = n2;
- x->x_dopitch = 1;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "env"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[x->x_nvarout].v_what = OUT_ENV;
- x->x_nvarout = n2;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "note")
- || !strcmp(firstarg->s_name, "notes"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[x->x_nvarout].v_what = OUT_NOTE;
- x->x_nvarout = n2;
- x->x_dopitch = x->x_donote = 1;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "peaks"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_list);
- x->x_varoutv[x->x_nvarout].v_what = OUT_PEAKS;
- x->x_nvarout = n2;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "tracks"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_list);
- x->x_varoutv[x->x_nvarout].v_what = OUT_TRACKS;
- x->x_nvarout = n2;
- x->x_dotracks = 1;
- argc--, argv++;
- }
- else
- {
- pd_error(x, "sigmund: %s: unknown flag or argument missing",
- firstarg->s_name);
- argc--, argv++;
- }
- }
- if (!x->x_nvarout)
- {
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- 0, 2*sizeof(t_varout));
- x->x_varoutv[0].v_outlet = outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[0].v_what = OUT_PITCH;
- x->x_varoutv[1].v_outlet = outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[1].v_what = OUT_ENV;
- x->x_nvarout = 2;
- x->x_dopitch = 1;
- }
- if (x->x_dotracks)
- {
- x->x_ntrack = x->x_npeak;
- x->x_trackv = (t_peak *)getbytes(x->x_ntrack * sizeof(*x->x_trackv));
- }
- x->x_clock = clock_new(&x->x_obj.ob_pd, (t_method)sigmund_tick);
-
- x->x_infill = 0;
- x->x_countdown = 0;
- sigmund_npts(x, x->x_npts);
- notefinder_init(&x->x_notefinder);
- sigmund_clear(x);
- return (x);
-}
-
-static void sigmund_list(t_sigmund *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_symbol *syminput = atom_getsymbolarg(0, argc, argv);
- int npts = atom_getintarg(1, argc, argv);
- int onset = atom_getintarg(2, argc, argv);
- t_float srate = atom_getfloatarg(3, argc, argv);
- int loud = atom_getfloatarg(4, argc, argv);
- int arraysize, totstorage, nfound, i;
- t_garray *a;
- t_float *arraypoints, pit;
- t_word *wordarray = 0;
- if (argc < 5)
- {
- post(
- "sigmund: array-name, npts, array-onset, samplerate, loud");
- return;
- }
- if (npts < 64 || npts != (1 << ilog2(npts)))
- {
- error("sigmund: bad npoints");
- return;
- }
- if (onset < 0)
- {
- error("sigmund: negative onset");
- return;
- }
- arraypoints = alloca(sizeof(t_float)*npts);
- if (!(a = (t_garray *)pd_findbyclass(syminput, garray_class)) ||
- !garray_getfloatwords(a, &arraysize, &wordarray) ||
- arraysize < onset + npts)
- {
- error("%s: array missing or too small", syminput->s_name);
- return;
- }
- if (arraysize < npts)
- {
- error("sigmund~: too few points in array");
- return;
- }
- for (i = 0; i < npts; i++)
- arraypoints[i] = wordarray[i+onset].w_float;
- sigmund_doit(x, npts, arraypoints, loud, srate);
-}
-
-static void sigmund_clear(t_sigmund *x)
-{
- if (x->x_trackv)
- memset(x->x_trackv, 0, x->x_ntrack * sizeof(*x->x_trackv));
- x->x_infill = x->x_countdown = 0;
-}
-
- /* these are for testing; their meanings vary... */
-static void sigmund_param1(t_sigmund *x, t_floatarg f)
-{
- x->x_param1 = f;
-}
-
-static void sigmund_param2(t_sigmund *x, t_floatarg f)
-{
- x->x_param2 = f;
-}
-
-static void sigmund_param3(t_sigmund *x, t_floatarg f)
-{
- x->x_param3 = f;
-}
-
-static void sigmund_printnext(t_sigmund *x, t_float f)
-{
- x->x_loud = f;
-}
-
-void sigmund_tilde_setup(void)
-{
- sigmund_class = class_new(gensym("sigmund~"), (t_newmethod)sigmund_new,
- (t_method)sigmund_free, sizeof(t_sigmund), 0, A_GIMME, 0);
- class_addlist(sigmund_class, sigmund_list);
- class_addmethod(sigmund_class, (t_method)sigmund_dsp, gensym("dsp"), 0);
- CLASS_MAINSIGNALIN(sigmund_class, t_sigmund, x_f);
- class_addmethod(sigmund_class, (t_method)sigmund_param1,
- gensym("param1"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_param2,
- gensym("param2"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_param3,
- gensym("param3"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_npts,
- gensym("npts"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_hop,
- gensym("hop"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_maxfreq,
- gensym("maxfreq"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_npeak,
- gensym("npeak"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_vibrato,
- gensym("vibrato"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_stabletime,
- gensym("stabletime"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_growth,
- gensym("growth"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_minpower,
- gensym("minpower"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_print,
- gensym("print"), 0);
- class_addmethod(sigmund_class, (t_method)sigmund_printnext,
- gensym("printnext"), A_FLOAT, 0);
- post("sigmund~ version 0.07");
-}
-
-#endif /* PD */
-
-/************************ Max/MSP glue **********************************/
-
-/* -------------------------- MSP glue ------------------------- */
-#ifdef MSP
-static void *sigmund_class;
-
-/* Max/MSP has laxer sync between DSP and "tick"s - so in the perf routine we
-keep a circular buffer that is rectified into inbuf only when the tick comes. */
-
-static void sigmund_tick(t_sigmund *x)
-{
- int i, j, npts = x->x_npts;
- if (!x->x_inbuf)
- return;
- for (i = x->x_infill, j = 0; i < npts; i++, j++)
- x->x_inbuf[j] = x->x_inbuf2[i];
- for (i = 0; j < npts; i++, j++)
- x->x_inbuf[j] = x->x_inbuf2[i];
- sigmund_doit(x, x->x_npts, x->x_inbuf, x->x_loud, x->x_sr);
- x->x_loud = 0;
-}
-
-static t_int *sigmund_perform(t_int *w)
-{
- t_sigmund *x = (t_sigmund *)(w[1]);
- t_float *in = (t_float *)(w[2]);
- int n = (int)(w[3]), j;
- int infill = x->x_infill;
- t_float *fp = x->x_inbuf2 + infill;
-
- if (x->x_obj.z_disabled) /* return if in muted MSP subpatch -Rd */
- return (w+4);
-
- if (infill < 0 || infill >= x->x_npts)
- infill = 0;
- /* for some reason this sometimes happens: */
- if (!x->x_inbuf2)
- return (w+4);
- for (j = 0; j < n; j++)
- {
- *fp++ = *in++;
- if (++infill == x->x_npts)
- infill = 0, fp = x->x_inbuf2;
- }
- x->x_infill = infill;
- if (x->x_countdown <= 0)
- {
- x->x_countdown = x->x_hop;
- clock_delay(x->x_clock, 0);
- }
- x->x_countdown -= n;
- return (w+4);
-}
-
-static void *sigmund_new(t_symbol *s, long ac, t_atom *av)
-{
- t_sigmund *x;
- t_varout *g;
- int i, j;
- if (!(x = (t_sigmund *)object_alloc(sigmund_class)))
- return (0);
- sigmund_preinit(x);
- attr_args_process(x, ac, av);
- dsp_setup((t_pxobject *)x, 1);
- object_obex_store(x, gensym("dumpout"), outlet_new(x, NULL));
-
- for (i = 0; i < ac; i++)
- if (av[i].a_type == A_SYM)
- {
- char *s = av[i].a_w.w_sym->s_name;
- if (!strcmp(s, "pitch"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_PITCH;
- x->x_nvarout = n2;
- x->x_dopitch = 1;
- }
- else if (!strcmp(s, "env"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_ENV;
- x->x_nvarout = n2;
- }
- else if (!strcmp(s, "note") || !strcmp(s, "notes"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_NOTE;
- x->x_nvarout = n2;
- x->x_dopitch = x->x_donote = 1;
- }
- else if (!strcmp(s, "peaks"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_PEAKS;
- x->x_nvarout = n2;
- }
- else if (!strcmp(s, "tracks"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_TRACKS;
- x->x_nvarout = n2;
- x->x_dotracks = 1;
- }
- else if (s[0] != '@')
- post("sigmund: ignoring unknown argument '%s'" ,s);
- }
- if (!x->x_nvarout)
- {
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- 0, 2*sizeof(t_varout));
- x->x_varoutv[0].v_what = OUT_PITCH;
- x->x_varoutv[1].v_what = OUT_ENV;
- x->x_nvarout = 2;
- x->x_dopitch = 1;
- }
- for (j = 0, g = x->x_varoutv + x->x_nvarout-1; j < x->x_nvarout; j++, g--)
- g->v_outlet = ((g->v_what == OUT_PITCH || g->v_what == OUT_ENV ||
- g->v_what == OUT_NOTE) ?
- floatout((t_object *)x) : listout((t_object *)x));
- if (x->x_dotracks)
- {
- x->x_ntrack = x->x_npeak;
- x->x_trackv = (t_peak *)getbytes(x->x_ntrack * sizeof(*x->x_trackv));
- }
- x->x_clock = clock_new(x, (method)sigmund_tick);
- x->x_infill = 0;
- x->x_countdown = 0;
- sigmund_npts(x, x->x_npts);
- notefinder_init(&x->x_notefinder);
- return (x);
-}
-
-/* Attribute setters. */
-void sigmund_npts_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_npts(x, atom_getfloat(av));
-}
-
-void sigmund_hop_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_hop(x, atom_getfloat(av));
-}
-
-void sigmund_npeak_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_npeak(x, atom_getfloat(av));
-}
-
-void sigmund_maxfreq_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_maxfreq(x, atom_getfloat(av));
-}
-
-void sigmund_vibrato_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_vibrato(x, atom_getfloat(av));
-}
-
-void sigmund_stabletime_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_stabletime(x, atom_getfloat(av));
-}
-
-void sigmund_growth_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_growth(x, atom_getfloat(av));
-}
-
-void sigmund_minpower_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_minpower(x, atom_getfloat(av));
-}
-
-/* end attr setters */
-
-void sigmund_assist(t_sigmund *x, void *b, long m, long a, char *s)
-{
-}
-
-int main()
-{
- t_class *c;
- long attrflags = 0;
- t_symbol *sym_long = gensym("long"), *sym_float32 = gensym("float32");
-
- c = class_new("sigmund~", (method)sigmund_new,
- (method)sigmund_free, sizeof(t_sigmund), (method)0L, A_GIMME, 0);
-
- class_obexoffset_set(c, calcoffset(t_sigmund, obex));
-
- class_addattr(c, attr_offset_new("npts", sym_long, attrflags,
- (method)0L, (method)sigmund_npts_set,
- calcoffset(t_sigmund, x_npts)));
- class_addattr(c ,attr_offset_new("hop", sym_long, attrflags,
- (method)0L, (method)sigmund_hop_set,
- calcoffset(t_sigmund, x_hop)));
- class_addattr(c ,attr_offset_new("maxfreq", sym_float32, attrflags,
- (method)0L, (method)sigmund_maxfreq_set,
- calcoffset(t_sigmund, x_maxfreq)));
- class_addattr(c ,attr_offset_new("npeak", sym_long, attrflags,
- (method)0L, (method)sigmund_npeak_set,
- calcoffset(t_sigmund, x_npeak)));
- class_addattr(c ,attr_offset_new("vibrato", sym_float32, attrflags,
- (method)0L, (method)sigmund_vibrato_set,
- calcoffset(t_sigmund, x_vibrato)));
- class_addattr(c ,attr_offset_new("stabletime", sym_float32, attrflags,
- (method)0L, (method)sigmund_stabletime_set,
- calcoffset(t_sigmund, x_stabletime)));
- class_addattr(c ,attr_offset_new("growth", sym_float32, attrflags,
- (method)0L, (method)sigmund_growth_set,
- calcoffset(t_sigmund, x_growth)));
- class_addattr(c ,attr_offset_new("minpower", sym_float32, attrflags,
- (method)0L, (method)sigmund_minpower_set,
- calcoffset(t_sigmund, x_minpower)));
-
- class_addmethod(c, (method)sigmund_dsp, "dsp", A_CANT, 0);
- class_addmethod(c, (method)sigmund_print, "print", 0);
- class_addmethod(c, (method)sigmund_print, "printnext", A_DEFFLOAT, 0);
- class_addmethod(c, (method)sigmund_assist, "assist", A_CANT, 0);
-
- class_addmethod(c, (method)object_obex_dumpout, "dumpout", A_CANT, 0);
- class_addmethod(c, (method)object_obex_quickref, "quickref", A_CANT, 0);
-
- class_dspinit(c);
-
- class_register(CLASS_BOX, c);
- sigmund_class = c;
-
- post("sigmund~ version 0.07");
- return (0);
-}
-
-
-#endif /* MSP */
-
-
diff --git a/externals/extra/0.43.3/0.43.2/stdout/stdout-help.pd b/externals/extra/0.43.3/0.43.2/stdout/stdout-help.pd
deleted file mode 100644
index 91edbc41..00000000
--- a/externals/extra/0.43.3/0.43.2/stdout/stdout-help.pd
+++ /dev/null
@@ -1,19 +0,0 @@
-#N canvas 121 60 488 321 12;
-#X msg 126 203 walk the dog;
-#X msg 117 156 1;
-#X obj 117 240 stdout;
-#X text 269 287 updated for Pd version 0.42;
-#X obj 14 13 stdout;
-#X text 67 14 - write messages to standard output;
-#X msg 122 179 1 2;
-#X obj 119 291 pd~;
-#X text 44 291 see also:;
-#X text 34 39 Sends messages to Pd's standard output. This is useful
-in conjunction with the pd~ object \, which starts a pd sub-process.
-Messages sent to the sub-process standard output appear on the output
-of the pd~ object in the owning process. This might also be useful
-in other situations. Note that there's no corresponding "stdin" object
-- there seems to be no one canonical way such a thing should act.;
-#X connect 0 0 2 0;
-#X connect 1 0 2 0;
-#X connect 6 0 2 0;
diff --git a/externals/extra/0.43.3/0.43.2/stdout/stdout.c b/externals/extra/0.43.3/0.43.2/stdout/stdout.c
deleted file mode 100644
index 5cd52f25..00000000
--- a/externals/extra/0.43.3/0.43.2/stdout/stdout.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* stdout -- write messages to standard output.
-
- Copyright 2008 Miller Puckette
- BSD license; see README.txt in this distribution for details.
-*/
-
-#include "m_pd.h"
-#include <stdio.h>
-#include <string.h>
-static t_class *stdout_class;
-
-typedef struct _stdout
-{
- t_object x_obj;
-} t_stdout;
-
-static void *stdout_new(t_float fnonrepeat)
-{
- t_stdout *x = (t_stdout *)pd_new(stdout_class);
- return (x);
-}
-
-static void stdout_anything(t_stdout *x, t_symbol *s, int argc, t_atom *argv)
-{
- char msgbuf[MAXPDSTRING], *sp, *ep = msgbuf+MAXPDSTRING;
- msgbuf[0] = 0;
- strncpy(msgbuf, s->s_name, MAXPDSTRING);
- msgbuf[MAXPDSTRING-1] = 0;
- sp = msgbuf + strlen(msgbuf);
- while (argc--)
- {
- if (sp < ep-1)
- sp[0] = ' ', sp[1] = 0, sp++;
- atom_string(argv++, sp, ep-sp);
- sp += strlen(sp);
- }
- printf("%s;\n", msgbuf);
-}
-
-static void stdout_free(t_stdout *x)
-{
- fflush(stdout);
-}
-
-void stdout_setup(void)
-{
- stdout_class = class_new(gensym("stdout"), (t_newmethod)stdout_new,
- (t_method)stdout_free, sizeof(t_stdout), 0, 0);
- class_addanything(stdout_class, stdout_anything);
-}
diff --git a/externals/extra/0.43.3/LICENSE.txt b/externals/extra/0.43.3/LICENSE.txt
deleted file mode 100644
index bb6c6e6e..00000000
--- a/externals/extra/0.43.3/LICENSE.txt
+++ /dev/null
@@ -1,378 +0,0 @@
-
-Most of the code is covered by a BSD license, but the 'expr' code is covered by a GPL license:
-
-------------------------------------------------------------------------------
-
-This software is copyrighted by Miller Puckette and others. The following
-terms (the "Standard Improved BSD License") apply to all files associated with
-the software unless explicitly disclaimed in individual files:
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-3. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior
- written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
-
-------------------------------------------------------------------------------
-
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/externals/extra/0.43.3/Makefile b/externals/extra/0.43.3/Makefile
deleted file mode 100644
index e3b0e63e..00000000
--- a/externals/extra/0.43.3/Makefile
+++ /dev/null
@@ -1,263 +0,0 @@
-# To use this Makefile for your project, first put the name of your library in
-# LIBRARY_NAME variable. The folder for your project should have the same name
-# as your library.
-LIBRARY_NAME = extra
-
-# Next, add your source files to the SOURCES variable.
-SOURCES = bonk~/bonk~.c choice/choice.c fiddle~/fiddle~.c loop~/loop~.c lrshift~/lrshift~.c pique/pique.c sigmund~/sigmund~.c stdout/stdout.c
-
-# For objects that only build on certain platforms, add those to the SOURCES
-# line for the right platforms.
-SOURCES_Darwin = pd~/pd~.c
-SOURCES_Linux = pd~/pd~.c
-
-# include these abstractions with their help patches
-PD_OBJECTS = complex-mod~.pd hilbert~.pd rev1~.pd rev2~.pd rev3~.pd
-
-# these are meant to be customizable
-CFLAGS = -Wall -W -g
-LDFLAGS =
-
-#------------------------------------------------------------------------------#
-#
-# you shouldn't need to edit anything below here, if we did it right :)
-#
-#------------------------------------------------------------------------------#
-
-# where Pd lives
-PD_PATH = ../../pd
-# where to install the library
-prefix = /usr/local
-libdir = $(prefix)/lib
-pkglibdir = $(libdir)/pd-externals
-objectsdir = $(pkglibdir)
-
-ALL_CFLAGS = -DPD -I$(PD_PATH)/src
-ALL_LDFLAGS =
-LIBS =
-
-LN_S = ln -s
-
-INSTALL = install
-INSTALL_PROGRAM = $(INSTALL) -p -m 644
-INSTALL_DATA = $(INSTALL) -p -m 644
-INSTALL_DIR = $(INSTALL) -p -m 755 -d
-
-UNAME := $(shell uname -s)
-ifeq ($(UNAME),Darwin)
- SOURCES += $(SOURCES_Darwin)
- EXTENSION = pd_darwin
- OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast
- FAT_FLAGS = -arch i386 -arch ppc -mmacosx-version-min=10.4
- ALL_CFLAGS += -fPIC $(FAT_FLAGS)
- ALL_LDFLAGS += -bundle -undefined dynamic_lookup $(FAT_FLAGS)
- LIBS += -lc -lm
- STRIP = strip -x
- endif
-ifeq ($(UNAME),Linux)
- SOURCES += $(SOURCES_Linux)
- EXTENSION = pd_linux
- OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
- ALL_CFLAGS += -fPIC
- ALL_LDFLAGS += -Wl,--export-dynamic -shared -fPIC
- LIBS += -lc
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-ifeq ($(UNAME),GNU)
- # GNU/Hurd, should work like GNU/Linux for basically all externals
- SOURCES += $(SOURCES_linux)
- EXTENSION = pd_linux
- OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
- ALL_CFLAGS += -fPIC
- ALL_LDFLAGS += -Wl,--export-dynamic -shared -fPIC
- LIBS += -lc
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-ifeq ($(UNAME),GNU/kFreeBSD)
- # Debian GNU/kFreeBSD, should work like GNU/Linux for basically all externals
- SOURCES += $(SOURCES_linux)
- EXTENSION = pd_linux
- OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
- ALL_CFLAGS += -fPIC
- ALL_LDFLAGS += -Wl,--export-dynamic -shared -fPIC
- LIBS += -lc
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME)))
-# SOURCES += $(SOURCES_Linux)
- EXTENSION = dll
- OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
- ALL_CFLAGS += -fPIC
- ALL_LDFLAGS += -L$(PD_PATH)/src -Wl,--export-dynamic -shared -fPIC
- LIBS += -lc -lpd
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-ifeq (MINGW,$(findstring MINGW,$(UNAME)))
- SOURCES += $(SOURCES_Windows)
- EXTENSION = dll
- CC=gcc
- OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer -march=i686 -mtune=pentium4
- WINDOWS_HACKS = -D'O_NONBLOCK=1'
- ALL_CFLAGS += -mms-bitfields $(WINDOWS_HACKS)
- ALL_LDFLAGS += -s -shared -Wl,--enable-auto-import
- LIBS += -L$(PD_PATH)/src -lpd -lwsock32 -lkernel32 -luser32 -lgdi32
- STRIP = strip --strip-unneeded -R .note -R .comment
-endif
-
-ALL_CFLAGS += $(OPT_CFLAGS)
-
-
-.PHONY = install libdir_install single_install install-doc install-exec clean dist etags
-
-# kludges for objects with strange build requirements
-EXPR_OBJECTS = expr~/expr~.$(EXTENSION) fexpr~.$(EXTENSION) expr.$(EXTENSION)
-# special cases, where there are multiple .c files for a single class
-EXPR_SOURCES = expr~/vexp.c expr~/vexp_fun.c expr~/vexp_if.c
-
-
-# get library version from meta file
-LIBRARY_VERSION = $(shell sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' $(LIBRARY_NAME)-meta.pd)
-DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION)
-ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION)
-
-
-all: $(SOURCES:.c=.$(EXTENSION)) $(EXPR_OBJECTS) pd~/pdsched.$(EXTENSION)
-
-%.o: %.c
- $(CC) $(ALL_CFLAGS) $(CFLAGS) -o "$*.o" -c "$*.c"
-
-%.$(EXTENSION): %.o
- $(CC) $(ALL_LDFLAGS) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS)
- chmod a-x "$*.$(EXTENSION)"
-
-
-expr~/expr~.$(EXTENSION): $(EXPR_SOURCES:.c=.o)
- $(CC) $(ALL_LDFLAGS) $(LDFLAGS) -o expr~/expr~.$(EXTENSION) $(EXPR_SOURCES:.c=.o) $(LIBS)
- chmod a-x expr~/expr~.$(EXTENSION)
-
-expr.$(EXTENSION): expr~/expr~.$(EXTENSION)
- test -e expr.$(EXTENSION) || \
- $(LN_S) expr~/expr~.$(EXTENSION) expr.$(EXTENSION)
-
-fexpr~.$(EXTENSION): expr~/expr~.$(EXTENSION)
- test -e fexpr~.$(EXTENSION) || \
- $(LN_S) expr~/expr~.$(EXTENSION) fexpr~.$(EXTENSION)
-
-install: all install-doc install-exec install-special
-
-# install all the weird old kludgey build stuff here
-install-special:
- $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) extra-meta.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(EXPR_OBJECTS) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(SOURCES:.c=-help.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) rev1-final.pd rev1-stage.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) expr-help.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/*.$(EXTENSION)
-
-install-doc:
- $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(SOURCES:.c=-help.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(PD_OBJECTS:.pd=-help.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) pd~/pd~-subprocess.pd pd~/z.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) README.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt
-
-install-exec:
- $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) $(PD_OBJECTS) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
- $(INSTALL_DATA) pd~/pdsched.$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
-
-dist:
- $(INSTALL_DIR) $(DISTDIR)
- $(INSTALL_DATA) Makefile $(DISTDIR)
- $(INSTALL_DATA) README.txt $(DISTDIR)
- $(INSTALL_DATA) LICENSE.txt $(DISTDIR)
- $(INSTALL_DATA) extra-meta.pd $(DISTDIR)
- $(INSTALL_DATA) complex-mod~-help.pd $(DISTDIR)
- $(INSTALL_DATA) complex-mod~.pd $(DISTDIR)
- $(INSTALL_DATA) hilbert~-help.pd $(DISTDIR)
- $(INSTALL_DATA) hilbert~.pd $(DISTDIR)
- $(INSTALL_DATA) rev1-final.pd $(DISTDIR)
- $(INSTALL_DATA) rev1~-help.pd $(DISTDIR)
- $(INSTALL_DATA) rev1~.pd $(DISTDIR)
- $(INSTALL_DATA) rev1-stage.pd $(DISTDIR)
- $(INSTALL_DATA) rev2~-help.pd $(DISTDIR)
- $(INSTALL_DATA) rev2~.pd $(DISTDIR)
- $(INSTALL_DATA) rev3~-help.pd $(DISTDIR)
- $(INSTALL_DATA) rev3~.pd $(DISTDIR)
- $(INSTALL_DATA) expr-help.pd $(DISTDIR)
- $(INSTALL_DIR) $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/fts_to_pd.h $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/LICENSE.txt $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/README.txt $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/vexp.c $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/vexp_fun.c $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/vexp.h $(DISTDIR)/expr~
- $(INSTALL_DATA) expr~/vexp_if.c $(DISTDIR)/expr~
- $(INSTALL_DIR) $(DISTDIR)/bonk~
- $(INSTALL_DATA) bonk~/bonk~.c $(DISTDIR)/bonk~
- $(INSTALL_DATA) bonk~/bonk~-help.pd $(DISTDIR)/bonk~
- $(INSTALL_DATA) bonk~/templates.txt $(DISTDIR)/bonk~
- $(INSTALL_DIR) $(DISTDIR)/choice
- $(INSTALL_DATA) choice/choice.c $(DISTDIR)/choice
- $(INSTALL_DATA) choice/choice-help.pd $(DISTDIR)/choice
- $(INSTALL_DIR) $(DISTDIR)/fiddle~
- $(INSTALL_DATA) fiddle~/fiddle~.c $(DISTDIR)/fiddle~
- $(INSTALL_DATA) fiddle~/fiddle~-help.pd $(DISTDIR)/fiddle~
- $(INSTALL_DIR) $(DISTDIR)/loop~
- $(INSTALL_DATA) loop~/loop~.c $(DISTDIR)/loop~
- $(INSTALL_DATA) loop~/loop~-help.pd $(DISTDIR)/loop~
- $(INSTALL_DATA) loop~/test-loop~.pd $(DISTDIR)/loop~
- $(INSTALL_DIR) $(DISTDIR)/lrshift~
- $(INSTALL_DATA) lrshift~/lrshift~.c $(DISTDIR)/lrshift~
- $(INSTALL_DATA) lrshift~/lrshift~-help.pd $(DISTDIR)/lrshift~
- $(INSTALL_DIR) $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/notes.txt $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/pd~.c $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/pd~-help.pd $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/pdsched.c $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/pd~-subprocess.pd $(DISTDIR)/pd~
- $(INSTALL_DATA) pd~/z.pd $(DISTDIR)/pd~
- $(INSTALL_DIR) $(DISTDIR)/pique
- $(INSTALL_DATA) pique/pique.c $(DISTDIR)/pique
- $(INSTALL_DATA) pique/pique-help.pd $(DISTDIR)/pique
- $(INSTALL_DIR) $(DISTDIR)/sigmund~
- $(INSTALL_DATA) sigmund~/sigmund~.c $(DISTDIR)/sigmund~
- $(INSTALL_DATA) sigmund~/sigmund~-help.pd $(DISTDIR)/sigmund~
- $(INSTALL_DIR) $(DISTDIR)/stdout
- $(INSTALL_DATA) stdout/stdout.c $(DISTDIR)/stdout
- $(INSTALL_DATA) stdout/stdout-help.pd $(DISTDIR)/stdout
- tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR)
-
-distclean: clean
- -rm -f -- $(DISTBINDIR).tar.gz
- -rm -rf -- $(DISTBINDIR)
- -rm -f -- $(DISTDIR).tar.gz
- -rm -rf -- $(DISTDIR)
- -rm -f -- $(ORIGDIR).tar.gz
- -rm -rf -- $(ORIGDIR)
-
-# make a Debian source package
-dpkg-source:
- debclean
- make distclean dist
- mv $(DISTDIR) $(ORIGDIR)
- tar --exclude-vcs -czpf ../$(ORIGDIR).orig.tar.gz $(ORIGDIR)
- rm -f -- $(DISTDIR).tar.gz
- rm -rf -- $(DISTDIR) $(ORIGDIR)
- cd .. && dpkg-source -b $(LIBRARY_NAME)
-
-clean:
- -rm -f -- $(SOURCES:.c=.o)
- -rm -f -- $(SOURCES:.c=.$(EXTENSION))
- -rm -f -- $(LIBRARY_NAME).$(EXTENSION)
- -rm -f -- $(EXPR_SOURCES:.c=.o)
- -rm -f -- $(EXPR_OBJECTS) pd~/pdsched.$(EXTENSION)
-
-showpaths:
- @echo "PD_PATH: $(PD_PATH)"
- @echo "objectsdir: $(objectsdir)"
- @echo "LIBRARY_NAME: $(LIBRARY_NAME)"
- @echo "SOURCES: $(SOURCES)"
diff --git a/externals/extra/0.43.3/README.txt b/externals/extra/0.43.3/README.txt
deleted file mode 100644
index 850e3032..00000000
--- a/externals/extra/0.43.3/README.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-This is the README file for the "extras" library, consisting of Pd
-objects which are too specialized or otherwise non-canonical for
-inclusion into Pd proper. These files are open source; see
-LICENSE.txt in this distribution for details.
-Note however that "expr" is GPL (the rest is all BSD).
-
-This package should run in Pd under linux, MSW, or Mac OSX.
-You can additionally compile fiddle~. bonk~, and paf~ for Max/MSP.
-
-contents:
-
-externs:
-fiddle~ -- pitch tracker
-bonk~ - percussion detector
-choose - find the "best fit" of incoming vector with stored profiles
-paf~ -- phase aligned formant generator
-loop~ -- sample looper
-expr -- arithmetic expression evaluation (Shahrokh Yadegari)
-pique - fft-based peak finder
-lrshift~ - left or right shift an audio vector
-
-abstractions:
-hilbert~ - Hilbert transform for SSB modulation
-complex-mod~ - ring modulation for complex (real+imaginary) audio signals
-rev1~, etc. - reverberators
-
-These objects are part of the regular Pd distribution as of Pd version
-0.30. Macintosh versions of fiddle~, bonk~, and paf~ are available
-from http://www.crca.ucsd.edu/~tapel
-- msp@ucsd.edu
diff --git a/externals/extra/0.43.3/bonk~/bonk~-help.pd b/externals/extra/0.43.3/bonk~/bonk~-help.pd
deleted file mode 100644
index 4666d6f5..00000000
--- a/externals/extra/0.43.3/bonk~/bonk~-help.pd
+++ /dev/null
@@ -1,209 +0,0 @@
-#N canvas 0 0 1052 581 12;
-#X obj 382 492 spigot;
-#X msg 484 293 bang;
-#X obj 483 454 bonk~;
-#X msg 483 357 print;
-#X obj 435 428 adc~;
-#X msg 637 506 \; pd dsp 1;
-#X obj 300 492 spigot;
-#N canvas 366 126 604 404 synth 0;
-#X obj 112 24 r bonk-cooked;
-#X obj 112 49 unpack;
-#X obj 112 99 * 12;
-#X obj 112 124 div 7;
-#X obj 112 74 + 1;
-#X obj 112 174 mtof;
-#X obj 112 224 osc~;
-#X obj 112 249 cos~;
-#X obj 112 149 + 47;
-#X obj 209 247 line~;
-#X obj 209 272 *~;
-#X obj 209 297 lop~ 500;
-#X obj 112 274 *~;
-#X obj 103 361 dac~;
-#X obj 253 165 dbtorms;
-#X obj 253 115 * 0.5;
-#X obj 253 140 + 50;
-#X obj 211 189 f;
-#X msg 173 159 bang;
-#X obj 258 83 inlet;
-#X obj 111 307 hip~ 5;
-#X msg 34 24 0 60;
-#X obj 112 199 sig~;
-#X msg 209 222 \$1 \, 0 200;
-#X connect 0 0 1 0;
-#X connect 1 0 4 0;
-#X connect 2 0 3 0;
-#X connect 3 0 8 0;
-#X connect 4 0 2 0;
-#X connect 5 0 18 0;
-#X connect 5 0 22 0;
-#X connect 6 0 7 0;
-#X connect 7 0 12 0;
-#X connect 8 0 5 0;
-#X connect 9 0 10 0;
-#X connect 9 0 10 1;
-#X connect 10 0 11 0;
-#X connect 11 0 12 1;
-#X connect 12 0 20 0;
-#X connect 14 0 17 1;
-#X connect 15 0 16 0;
-#X connect 16 0 14 0;
-#X connect 17 0 23 0;
-#X connect 18 0 17 0;
-#X connect 19 0 15 0;
-#X connect 20 0 13 1;
-#X connect 20 0 13 0;
-#X connect 21 0 1 0;
-#X connect 22 0 6 0;
-#X connect 23 0 9 0;
-#X restore 869 523 pd synth;
-#X floatatom 869 500 0 0 0 0 - - -;
-#X msg 869 470 0;
-#X msg 900 470 90;
-#X text 625 472 click here;
-#X text 626 485 to start DSP;
-#X text 5 285 In this patch \, after starting DSP \, you can print
-out the raw or cooked output using the two "spigots" or listen to a
-synthesizer output by raising its volume.;
-#X text 770 469 output volume;
-#X text 784 487 (0-100);
-#X msg 483 138 mask 4 0.7;
-#X text 578 120 Describes how energy in each frequency band masks later
-energy in the band. Here the masking is total for 4 analysis periods
-and then drops by 0.7 each period.;
-#X text 528 286 Poll the current spectrum via "raw" outlet \, You can
-set a very high threshold if you don't want attacks mixed in.;
-#X msg 483 331 debug 0;
-#X text 561 331 turn debugging on or off.;
-#X obj 349 493 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 431 493 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X obj 382 522 print cooked;
-#X obj 300 522 print raw;
-#X text 162 491 enable printout:;
-#X text 560 202 Minimum "velocity" to output (quieter notes are ignored.)
-;
-#X obj 485 481 s bonk-cooked;
-#X text 8 145 Bonk's two outputs are the raw spectrum of the attack
-(provided as a list of 11 numbers giving the signal "loudness" in the
-11 frequency bands used) \, and the "cooked" output which gives only
-an instrument number (counting up from zero) and a "velocity". This
-"velocity" is the sum of the square roots of the amplitudes of the
-bands \, normalized so that 100 is an attack of amplitude of about
-1 The instrument number is significant only if Bonk has a "template
-set" in memory.;
-#X text 580 35 Set low and high thresholds. Signal growth must exceed
-the high one and then fall to the low one to make an attack. The unit
-is the sum of the proportional growth in the 11 filter bands. Proportional
-growth is essentially the logarithmic time derivative.;
-#X msg 483 384 print 1;
-#X text 551 386 print out filterbank settings;
-#X text 9 33 The Bonk object takes an audio signal input and looks
-for "attacks" defined as sharp changes in the spectral envelope of
-the incoming sound. Optionally \, and less reliably \, you can have
-Bonk check the attack against a collection of stored templates to try
-to guess which of two or more instruments was hit. Bonk is described
-theoretically in the 1998 ICMC proceedings \, reprinted on crca.ucsd.edu/~msp
-.;
-#N canvas 0 0 699 717 creation-arguments 1;
-#X text 228 14 creation arguments for bonk~;
-#X text 70 272 -npts 256;
-#X text 44 244 default value:;
-#X text 70 308 -hop 128;
-#X text 70 342 -nfilters 11;
-#X text 68 380 -halftones 6;
-#X text 76 514 -overlap 1;
-#X text 79 567 -firstbin 1;
-#X text 71 454 -minbandwidth 1.5;
-#X text 122 147 All frequency parameters are specified in 'bins'. One
-bin is the sample rate divided by the window size. The minimum possible
-bandwidth is 1.5 bins. Higher bandwidths give numerically more robust
-outputs.;
-#X text 43 229 Arguments and;
-#X text 212 270 window size in points;
-#X text 210 306 analysis period ("hop size") in points;
-#X text 212 340 number of filters to use;
-#X text 212 379 desired bandwidth of filters in halftones \, effective
-in the exponentially spaced region. (At lower center frequencies the
-bandwidth is supported by the "minbandwidth" parameter below).;
-#X text 212 511 overlap factor between filters. If 1 \, the filters
-are spaced to line up at their half-power points. Other values specify
-more or fewer filters proportionally.;
-#X text 121 49 bonk~ uses a filterbank whose center frequencies are
-spaced equally at low frequencies and proportionally at high ones -
-i.e. \, they increase linearly \, then exponentially. They are determined
-by the filters' bandwidths and overlap. The bandwidths are specified
-proportionally to frequency but bounded below by a specified minimum.
-;
-#X text 210 455 minimum bandwidth in bins. If the bandwidth specified
-by "halftones" is smaller than this \, this value is used. This must
-be at least 1.5.;
-#X text 212 567 center frequency \, in bins \, of the lowest filter.
-The others are computed from this.;
-#X restore 147 414 pd creation-arguments;
-#N canvas 660 173 579 589 templates 0;
-#X msg 76 197 learn 0;
-#X msg 76 227 forget;
-#X msg 76 257 write templates.txt;
-#X msg 76 287 read templates.txt;
-#X msg 76 107 debounce 0;
-#X msg 76 137 learn 10;
-#X obj 62 431 outlet;
-#X text 155 133 Forget all templates and start learning new ones. The
-argument gives the number of times you will hit each instrument (10
-recommended.) Turn on the output volume above for audible feedback
-as you train Bonk. "Learn 0" exits learn mode.;
-#X text 155 217 Forget the last template. In Learn mode \, use "forget"
-to erase and record over a template.;
-#X text 220 253 Write templates to a file in text-editable format.
-;
-#X text 221 283 Read templates from a file.;
-#X text 157 104 Minimum time (msec) between attacks in learn mode;
-#X connect 0 0 6 0;
-#X connect 1 0 6 0;
-#X connect 2 0 6 0;
-#X connect 3 0 6 0;
-#X connect 4 0 6 0;
-#X connect 5 0 6 0;
-#X restore 500 421 pd templates;
-#X msg 483 68 thresh 2.5 5;
-#X msg 483 173 attack-frames 1;
-#X text 608 174 number of frames over which to measure growth;
-#X text 605 422 more messages for managing templates;
-#X msg 483 201 minvel 7;
-#X msg 483 228 spew 0;
-#X text 550 230 Turn spew mode on/off;
-#X msg 483 255 useloudness 0;
-#X text 597 254 experimental: use alternative loudness units;
-#X text 212 9 BONK~ - attack detection and spectral envelope measurement
-;
-#X text 734 552 Updated for Pd version 0.42;
-#X text 5 344 By default bonk's analysis is carried out on a 256-point
-window (6 msec at 44.1 kHz) and the analysis period is 128 samples.
-These and other parameters may be overridden using creation arguments
-as shown in the subpatch below:;
-#X text 552 356 Print out settings and templates.;
-#X connect 0 0 23 0;
-#X connect 1 0 2 0;
-#X connect 2 0 6 0;
-#X connect 2 1 0 0;
-#X connect 2 1 27 0;
-#X connect 3 0 2 0;
-#X connect 4 0 2 0;
-#X connect 6 0 24 0;
-#X connect 8 0 7 0;
-#X connect 9 0 8 0;
-#X connect 10 0 8 0;
-#X connect 16 0 2 0;
-#X connect 19 0 2 0;
-#X connect 21 0 6 1;
-#X connect 22 0 0 1;
-#X connect 30 0 2 0;
-#X connect 34 0 2 0;
-#X connect 35 0 2 0;
-#X connect 36 0 2 0;
-#X connect 39 0 2 0;
-#X connect 40 0 2 0;
-#X connect 42 0 2 0;
diff --git a/externals/extra/0.43.3/bonk~/bonk~.c b/externals/extra/0.43.3/bonk~/bonk~.c
deleted file mode 100644
index c3516775..00000000
--- a/externals/extra/0.43.3/bonk~/bonk~.c
+++ /dev/null
@@ -1,1638 +0,0 @@
-/*
- ###########################################################################
- # bonk~ - a Max/MSP external
- # by miller puckette and ted apel
- # http://crca.ucsd.edu/~msp/
- # Max/MSP port by barry threw
- # http://www.barrythrew.com
- # me@barrythrew.com
- # San Francisco, CA
- # (c) 2008
- # for Kesumo - http://www.kesumo.com
- ###########################################################################
- // bonk~ detects attacks in an audio signal
- ###########################################################################
- This software is copyrighted by Miller Puckette and others. The following
- terms (the "Standard Improved BSD License") apply to all files associated with
- the software unless explicitly disclaimed in individual files:
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- 3. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior
- written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
-dolist:
-decay and other times in msec
-*/
-
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
-/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
-#ifdef _MSC_VER
-#pragma warning (disable: 4305 4244)
-#endif
-
-#ifdef MSP
-#include "ext.h"
-#include "z_dsp.h"
-#include "math.h"
-#include "ext_support.h"
-#include "ext_proto.h"
-#include "ext_obex.h"
-
-typedef double t_floatarg; /* from m_pd.h */
-#define flog log
-#define fexp exp
-#define fsqrt sqrt
-#define t_resizebytes(a, b, c) t_resizebytes((char *)(a), (b), (c))
-
-void *bonk_class;
-#define getbytes t_getbytes
-#define freebytes t_freebytes
-#endif /* MSP */
-
-#ifdef PD
-#include "m_pd.h"
-static t_class *bonk_class;
-#endif
-
-#ifdef _WIN32
-#include <malloc.h>
-#elif ! defined(_MSC_VER)
-#include <alloca.h>
-#endif
-
-/* ------------------------ bonk~ ----------------------------- */
-
-#define DEFNPOINTS 256
-#define MAXCHANNELS 8
-#define MINPOINTS 64
-#define DEFPERIOD 128
-#define DEFNFILTERS 11
-#define DEFHALFTONES 6
-#define DEFOVERLAP 1
-#define DEFFIRSTBIN 1
-#define DEFMINBANDWIDTH 1.5
-#define DEFHITHRESH 5
-#define DEFLOTHRESH 2.5
-#define DEFMASKTIME 4
-#define DEFMASKDECAY 0.7
-#define DEFDEBOUNCEDECAY 0
-#define DEFMINVEL 7
-#define DEFATTACKBINS 1
-#define MAXATTACKWAIT 4
-
-typedef struct _filterkernel
-{
- int k_filterpoints;
- int k_hoppoints;
- int k_skippoints;
- int k_nhops;
- t_float k_centerfreq; /* center frequency, bins */
- t_float k_bandwidth; /* bandwidth, bins */
- t_float *k_stuff;
-} t_filterkernel;
-
-typedef struct _filterbank
-{
- int b_nfilters; /* number of filters in bank */
- int b_npoints; /* input vector size */
- t_float b_halftones; /* filter bandwidth in halftones */
- t_float b_overlap; /* overlap; default 1 for 1/2-power pts */
- t_float b_firstbin; /* freq of first filter in bins, default 1 */
- t_float b_minbandwidth; /* minimum bandwidth, default 1.5 */
- t_filterkernel *b_vec; /* filter kernels */
- int b_refcount; /* number of bonk~ objects using this */
- struct _filterbank *b_next; /* next in linked list */
-} t_filterbank;
-
-#if 0 /* this is the design for 1.0: */
-static t_filterkernel bonk_filterkernels[] =
- {{256, 2, .01562}, {256, 4, .01562}, {256, 6, .01562}, {180, 6, .02222},
- {128, 6, .01803}, {90, 6, .02222}, {64, 6, .02362}, {46, 6, .02773},
- {32, 6, .03227}, {22, 6, .03932}, {16, 6, .04489}};
-#endif
-
-#if 0
- /* here's the 1.1 rev: */
-static t_filterkernel bonk_filterkernels[] =
- {{256, 1, .01562, 0}, {256, 3, .01562, 0}, {256, 5, .01562, 0},
- {212, 6, .01886, 0}, {150, 6, .01885, 0}, {106, 6, .02179, 0},
- {76, 6, .0236, 0}, {54, 6, .02634, 0}, {38, 6, .03047, 0},
- {26, 6, .03667, 0}, {18, 6, .04458, 0}};
-
-#define NFILTERS \
- ((int)(sizeof(bonk_filterkernels) / sizeof(bonk_filterkernels[0])))
-
-#endif
-
-#if 0
- /* and 1.2 */
-#define NFILTERS 11
-static t_filterkernel bonk_filterkernels[NFILTERS];
-#endif
-
- /* and 1.3 */
-#define MAXNFILTERS 50
-#define MASKHIST 8
-
-static t_filterbank *bonk_filterbanklist;
-
-typedef struct _hist
-{
- t_float h_power;
- t_float h_before;
- t_float h_outpower;
- int h_countup;
- t_float h_mask[MASKHIST];
-} t_hist;
-
-typedef struct template
-{
- t_float t_amp[MAXNFILTERS];
-} t_template;
-
-typedef struct _insig
-{
- t_hist g_hist[MAXNFILTERS]; /* history for each filter */
-#ifdef PD
- t_outlet *g_outlet; /* outlet for raw data */
-#endif
-#ifdef MSP
- void *g_outlet; /* outlet for raw data */
-#endif
- t_float *g_inbuf; /* buffered input samples */
- t_float *g_invec; /* new input samples */
-} t_insig;
-
-typedef struct _bonk
-{
-#ifdef PD
- t_object x_obj;
- t_outlet *x_cookedout;
- t_clock *x_clock;
- t_canvas *x_canvas; /* ptr to current canvas --fbar */
-#endif /* PD */
-#ifdef MSP
- t_pxobject x_obj;
- void *obex;
- void *x_cookedout;
- void *x_clock;
-#endif /* MSP */
- /* parameters */
- int x_npoints; /* number of points in input buffer */
- int x_period; /* number of input samples between analyses */
- int x_nfilters; /* number of filters requested */
- t_float x_halftones; /* nominal halftones between filters */
- t_float x_overlap;
- t_float x_firstbin;
- t_float x_minbandwidth;
- t_float x_hithresh; /* threshold for total growth to trigger */
- t_float x_lothresh; /* threshold for total growth to re-arm */
- t_float x_minvel; /* minimum velocity we output */
- t_float x_maskdecay;
- int x_masktime;
- int x_useloudness; /* use loudness spectra instead of power */
- t_float x_debouncedecay;
- t_float x_debouncevel;
- double x_learndebounce; /* debounce time (in "learn" mode only) */
- int x_attackbins; /* number of bins to wait for attack */
-
- t_filterbank *x_filterbank;
- t_hist x_hist[MAXNFILTERS];
- t_template *x_template;
- t_insig *x_insig;
- int x_ninsig;
- int x_ntemplate;
- int x_infill;
- int x_countdown;
- int x_willattack;
- int x_attacked;
- int x_debug;
- int x_learn;
- int x_learncount; /* countup for "learn" mode */
- int x_spew; /* if true, always generate output! */
- int x_maskphase; /* phase, 0 to MASKHIST-1, for mask history */
- t_float x_sr; /* current sample rate in Hz. */
- int x_hit; /* next "tick" called because of a hit, not a poll */
-} t_bonk;
-
-#ifdef MSP
-static void *bonk_new(t_symbol *s, long ac, t_atom *av);
-static void bonk_tick(t_bonk *x);
-static void bonk_doit(t_bonk *x);
-static t_int *bonk_perform(t_int *w);
-static void bonk_dsp(t_bonk *x, t_signal **sp);
-void bonk_assist(t_bonk *x, void *b, long m, long a, char *s);
-static void bonk_free(t_bonk *x);
-void bonk_setup(void);
-int main();
-
-static void bonk_thresh(t_bonk *x, t_floatarg f1, t_floatarg f2);
-static void bonk_print(t_bonk *x, t_floatarg f);
-static void bonk_bang(t_bonk *x);
-
-static void bonk_write(t_bonk *x, t_symbol *s);
-static void bonk_dowrite(t_bonk *x, t_symbol *s);
-static void bonk_writefile(t_bonk *x, char *filename, short path);
-
-static void bonk_read(t_bonk *x, t_symbol *s);
-static void bonk_doread(t_bonk *x, t_symbol *s);
-static void bonk_openfile(t_bonk *x, char *filename, short path);
-
-void bonk_minvel_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_lothresh_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_hithresh_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_masktime_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_maskdecay_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_debouncedecay_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_debug_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_spew_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_useloudness_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_attackbins_set(t_bonk *x, void *attr, long ac, t_atom *av);
-void bonk_learn_set(t_bonk *x, void *attr, long ac, t_atom *av);
-
-t_float qrsqrt(t_float f);
-double clock_getsystime();
-double clock_gettimesince(double prevsystime);
-char *strcpy(char *s1, const char *s2);
-#endif
-
-static void bonk_tick(t_bonk *x);
-
-#define HALFWIDTH 0.75 /* half peak bandwidth at half power point in bins */
-#define SLIDE 0.25 /* relative slide between filter subwindows */
-
-static t_filterbank *bonk_newfilterbank(int npoints, int nfilters,
- t_float halftones, t_float overlap, t_float firstbin, t_float minbandwidth)
-{
- int i, j;
- t_float cf, bw, h, relspace;
- t_filterbank *b = (t_filterbank *)getbytes(sizeof(*b));
- b->b_npoints = npoints;
- b->b_nfilters = nfilters;
- b->b_halftones = halftones;
- b->b_overlap = overlap;
- b->b_firstbin = firstbin;
- b->b_minbandwidth = minbandwidth;
- b->b_refcount = 0;
- b->b_next = bonk_filterbanklist;
- bonk_filterbanklist = b;
- b->b_vec = (t_filterkernel *)getbytes(nfilters * sizeof(*b->b_vec));
-
- h = exp((log(2.)/12.)*halftones); /* specced interval between filters */
- relspace = (h - 1)/(h + 1); /* nominal spacing-per-f for fbank */
-
- if (minbandwidth < 2*HALFWIDTH)
- minbandwidth = 2*HALFWIDTH;
- if (firstbin < minbandwidth/(2*HALFWIDTH))
- firstbin = minbandwidth/(2*HALFWIDTH);
- cf = firstbin;
- bw = cf * relspace * overlap;
- if (bw < (0.5*minbandwidth))
- bw = (0.5*minbandwidth);
- for (i = 0; i < nfilters; i++)
- {
- t_float *fp, newcf, newbw;
- t_float normalizer = 0;
- int filterpoints, skippoints, hoppoints, nhops;
-
- filterpoints = npoints * HALFWIDTH/bw;
- if (cf > npoints/2)
- {
- post("bonk~: only using %d filters (ran past Nyquist)", i+1);
- break;
- }
- if (filterpoints < 4)
- {
- post("bonk~: only using %d filters (kernels got too short)", i+1);
- break;
- }
- else if (filterpoints > npoints)
- filterpoints = npoints;
-
- hoppoints = SLIDE * npoints * HALFWIDTH/bw;
-
- nhops = 1. + (npoints-filterpoints)/(t_float)hoppoints;
- skippoints = 0.5 * (npoints-filterpoints - (nhops-1) * hoppoints);
-
- b->b_vec[i].k_stuff =
- (t_float *)getbytes(2 * sizeof(t_float) * filterpoints);
- b->b_vec[i].k_filterpoints = filterpoints;
- b->b_vec[i].k_nhops = nhops;
- b->b_vec[i].k_hoppoints = hoppoints;
- b->b_vec[i].k_skippoints = skippoints;
- b->b_vec[i].k_centerfreq = cf;
- b->b_vec[i].k_bandwidth = bw;
-
- for (fp = b->b_vec[i].k_stuff, j = 0; j < filterpoints; j++, fp+= 2)
- {
- t_float phase = j * cf * (2*3.141592653589793 / npoints);
- t_float wphase = j * (2*3.141592653589793 / filterpoints);
- t_float window = sin(0.5*wphase);
- fp[0] = window * cos(phase);
- fp[1] = window * sin(phase);
- normalizer += window;
- }
- normalizer = 1/(normalizer * sqrt(nhops));
- for (fp = b->b_vec[i].k_stuff, j = 0;
- j < filterpoints; j++, fp+= 2)
- fp[0] *= normalizer, fp[1] *= normalizer;
-#if 0
- post("i %d cf %.2f bw %.2f nhops %d, hop %d, skip %d, npoints %d",
- i, cf, bw, nhops, hoppoints, skippoints, filterpoints);
-#endif
- newcf = (cf + bw/overlap)/(1 - relspace);
- newbw = newcf * overlap * relspace;
- if (newbw < 0.5*minbandwidth)
- {
- newbw = 0.5*minbandwidth;
- newcf = cf + minbandwidth / overlap;
- }
- cf = newcf;
- bw = newbw;
- }
- for (; i < nfilters; i++)
- b->b_vec[i].k_stuff = 0, b->b_vec[i].k_filterpoints = 0;
- return (b);
-}
-
-static void bonk_freefilterbank(t_filterbank *b)
-{
- t_filterbank *b2, *b3;
- int i;
- if (bonk_filterbanklist == b)
- bonk_filterbanklist = b->b_next;
- else for (b2 = bonk_filterbanklist; b3 = b2->b_next; b2 = b3)
- if (b3 == b)
- {
- b2->b_next = b3->b_next;
- break;
- }
- for (i = 0; i < b->b_nfilters; i++)
- if (b->b_vec[i].k_stuff)
- freebytes(b->b_vec[i].k_stuff,
- b->b_vec[i].k_filterpoints * sizeof(t_float));
- freebytes(b, sizeof(*b));
-}
-
-static void bonk_donew(t_bonk *x, int npoints, int period, int nsig,
- int nfilters, t_float halftones, t_float overlap, t_float firstbin,
- t_float minbandwidth, t_float samplerate)
-{
- int i, j;
- t_hist *h;
- t_float *fp;
- t_insig *g;
- t_filterbank *fb;
- for (j = 0, g = x->x_insig; j < nsig; j++, g++)
- {
- for (i = 0, h = g->g_hist; i--; h++)
- {
- h->h_power = h->h_before = 0, h->h_countup = 0;
- for (j = 0; j < MASKHIST; j++)
- h->h_mask[j] = 0;
- }
- /* we ought to check for failure to allocate memory here */
- g->g_inbuf = (t_float *)getbytes(npoints * sizeof(t_float));
- for (i = npoints, fp = g->g_inbuf; i--; fp++) *fp = 0;
- }
- if (!period) period = npoints/2;
- x->x_npoints = npoints;
- x->x_period = period;
- x->x_ninsig = nsig;
- x->x_nfilters = nfilters;
- x->x_halftones = halftones;
- x->x_template = (t_template *)getbytes(0);
- x->x_ntemplate = 0;
- x->x_infill = 0;
- x->x_countdown = 0;
- x->x_willattack = 0;
- x->x_attacked = 0;
- x->x_maskphase = 0;
- x->x_debug = 0;
- x->x_hithresh = DEFHITHRESH;
- x->x_lothresh = DEFLOTHRESH;
- x->x_masktime = DEFMASKTIME;
- x->x_maskdecay = DEFMASKDECAY;
- x->x_learn = 0;
- x->x_learndebounce = clock_getsystime();
- x->x_learncount = 0;
- x->x_debouncedecay = DEFDEBOUNCEDECAY;
- x->x_minvel = DEFMINVEL;
- x->x_useloudness = 0;
- x->x_debouncevel = 0;
- x->x_attackbins = DEFATTACKBINS;
- x->x_sr = samplerate;
- x->x_filterbank = 0;
- x->x_hit = 0;
- for (fb = bonk_filterbanklist; fb; fb = fb->b_next)
- if (fb->b_nfilters == x->x_nfilters &&
- fb->b_halftones == x->x_halftones &&
- fb->b_firstbin == firstbin &&
- fb->b_overlap == overlap &&
- fb->b_npoints == x->x_npoints &&
- fb->b_minbandwidth == minbandwidth)
- {
- fb->b_refcount++;
- x->x_filterbank = fb;
- break;
- }
- if (!x->x_filterbank)
- x->x_filterbank = bonk_newfilterbank(npoints, nfilters,
- halftones, overlap, firstbin, minbandwidth),
- x->x_filterbank->b_refcount++;
-}
-
-static void bonk_tick(t_bonk *x)
-{
- t_atom at[MAXNFILTERS], *ap, at2[3];
- int i, j, k, n;
- t_hist *h;
- t_float *pp, vel = 0., temperature = 0.;
- t_float *fp;
- t_template *tp;
- int nfit, ninsig = x->x_ninsig, ntemplate = x->x_ntemplate, nfilters = x->x_nfilters;
- t_insig *gp;
-#ifdef _MSC_VER
- t_float powerout[MAXNFILTERS*MAXCHANNELS];
-#else
- t_float *powerout = alloca(x->x_nfilters * x->x_ninsig * sizeof(*powerout));
-#endif
-
- for (i = ninsig, pp = powerout, gp = x->x_insig; i--; gp++)
- {
- for (j = 0, h = gp->g_hist; j < nfilters; j++, h++, pp++)
- {
- t_float power = h->h_outpower;
- t_float intensity = *pp = (power > 0. ? 100. * qrsqrt(qrsqrt(power)) : 0.);
- vel += intensity;
- temperature += intensity * (t_float)j;
- }
- }
- if (vel > 0) temperature /= vel;
- else temperature = 0;
- vel *= 0.5 / ninsig; /* fudge factor */
- if (x->x_hit)
- {
- /* if hit nonzero it's a clock callback. if in "learn" mode update the
- template list; in any event match the hit to known templates. */
-
- if (vel < x->x_debouncevel)
- {
- if (x->x_debug)
- post("bounce cancelled: vel %f debounce %f",
- vel, x->x_debouncevel);
- return;
- }
- if (vel < x->x_minvel)
- {
- if (x->x_debug)
- post("low velocity cancelled: vel %f, minvel %f",
- vel, x->x_minvel);
- return;
- }
- x->x_debouncevel = vel;
- if (x->x_learn)
- {
- double lasttime = x->x_learndebounce;
- double msec = clock_gettimesince(lasttime);
- if ((!ntemplate) || (msec > 200))
- {
- int countup = x->x_learncount;
- /* normalize to 100 */
- t_float norm;
- for (i = nfilters * ninsig, norm = 0, pp = powerout; i--; pp++)
- norm += *pp * *pp;
- if (norm < 1.0e-15) norm = 1.0e-15;
- norm = 100. * qrsqrt(norm);
- /* check if this is the first strike for a new template */
- if (!countup)
- {
- int oldn = ntemplate;
- x->x_ntemplate = ntemplate = oldn + ninsig;
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- oldn * sizeof(x->x_template[0]),
- ntemplate * sizeof(x->x_template[0]));
- for (i = ninsig, pp = powerout; i--; oldn++)
- for (j = nfilters, fp = x->x_template[oldn].t_amp; j--;
- pp++, fp++)
- *fp = *pp * norm;
- }
- else
- {
- int oldn = ntemplate - ninsig;
- if (oldn < 0) post("bonk_tick bug");
- for (i = ninsig, pp = powerout; i--; oldn++)
- {
- for (j = nfilters, fp = x->x_template[oldn].t_amp; j--;
- pp++, fp++)
- *fp = (countup * *fp + *pp * norm)
- /(countup + 1.0);
- }
- }
- countup++;
- if (countup == x->x_learn) countup = 0;
- x->x_learncount = countup;
- }
- else return;
- }
- x->x_learndebounce = clock_getsystime();
- if (ntemplate)
- {
- t_float bestfit = -1e30;
- int templatecount;
- nfit = -1;
- for (i = 0, templatecount = 0, tp = x->x_template;
- templatecount < ntemplate; i++)
- {
- t_float dotprod = 0;
- for (k = 0, pp = powerout;
- k < ninsig && templatecount < ntemplate;
- k++, tp++, templatecount++)
- {
- for (j = nfilters, fp = tp->t_amp;
- j--; fp++, pp++)
- {
- if (*fp < 0 || *pp < 0) post("bonk_tick bug 2");
- dotprod += *fp * *pp;
- }
- }
- if (dotprod > bestfit)
- {
- bestfit = dotprod;
- nfit = i;
- }
- }
- if (nfit < 0) post("bonk_tick bug");
- }
- else nfit = 0;
- }
- else nfit = -1; /* hit is zero; this is the "bang" method. */
-
- x->x_attacked = 1;
- if (x->x_debug)
- post("bonk out: number %d, vel %f, temperature %f",
- nfit, vel, temperature);
-
- SETFLOAT(at2, nfit);
- SETFLOAT(at2+1, vel);
- SETFLOAT(at2+2, temperature);
- outlet_list(x->x_cookedout, 0, 3, at2);
-
- for (n = 0, gp = x->x_insig + (ninsig-1),
- pp = powerout + nfilters * (ninsig-1); n < ninsig;
- n++, gp--, pp -= nfilters)
- {
- t_float *pp2;
- for (i = 0, ap = at, pp2 = pp; i < nfilters;
- i++, ap++, pp2++)
- {
- ap->a_type = A_FLOAT;
- ap->a_w.w_float = *pp2;
- }
- outlet_list(gp->g_outlet, 0, nfilters, at);
- }
-}
-
-static void bonk_doit(t_bonk *x)
-{
- int i, j, ch, n;
- t_filterkernel *k;
- t_hist *h;
- t_float growth = 0, *fp1, *fp3, *fp4, hithresh, lothresh;
- int ninsig = x->x_ninsig, nfilters = x->x_nfilters,
- maskphase = x->x_maskphase, nextphase, oldmaskphase;
- t_insig *gp;
- nextphase = maskphase + 1;
- if (nextphase >= MASKHIST)
- nextphase = 0;
- x->x_maskphase = nextphase;
- oldmaskphase = nextphase - x->x_attackbins;
- if (oldmaskphase < 0)
- oldmaskphase += MASKHIST;
- if (x->x_useloudness)
- hithresh = qrsqrt(qrsqrt(x->x_hithresh)),
- lothresh = qrsqrt(qrsqrt(x->x_lothresh));
- else hithresh = x->x_hithresh, lothresh = x->x_lothresh;
- for (ch = 0, gp = x->x_insig; ch < ninsig; ch++, gp++)
- {
- for (i = 0, k = x->x_filterbank->b_vec, h = gp->g_hist;
- i < nfilters; i++, k++, h++)
- {
- t_float power = 0, maskpow = h->h_mask[maskphase];
- t_float *inbuf= gp->g_inbuf + k->k_skippoints;
- int countup = h->h_countup;
- int filterpoints = k->k_filterpoints;
- /* if the user asked for more filters that fit under the
- Nyquist frequency, some filters won't actually be filled in
- so we skip running them. */
- if (!filterpoints)
- {
- h->h_countup = 0;
- h->h_mask[nextphase] = 0;
- h->h_power = 0;
- continue;
- }
- /* run the filter repeatedly, sliding it forward by hoppoints,
- for nhop times */
- for (fp1 = inbuf, n = 0;
- n < k->k_nhops; fp1 += k->k_hoppoints, n++)
- {
- t_float rsum = 0, isum = 0;
- for (fp3 = fp1, fp4 = k->k_stuff, j = filterpoints; j--;)
- {
- t_float g = *fp3++;
- rsum += g * *fp4++;
- isum += g * *fp4++;
- }
- power += rsum * rsum + isum * isum;
- }
- if (!x->x_willattack)
- h->h_before = maskpow;
-
- if (power > h->h_mask[oldmaskphase])
- {
- if (x->x_useloudness)
- growth += qrsqrt(qrsqrt(
- power/(h->h_mask[oldmaskphase] + 1.0e-15))) - 1.;
- else growth += power/(h->h_mask[oldmaskphase] + 1.0e-15) - 1.;
- }
- if (!x->x_willattack && countup >= x->x_masktime)
- maskpow *= x->x_maskdecay;
-
- if (power > maskpow)
- {
- maskpow = power;
- countup = 0;
- }
- countup++;
- h->h_countup = countup;
- h->h_mask[nextphase] = maskpow;
- h->h_power = power;
- }
- }
- if (x->x_willattack)
- {
- if (x->x_willattack > MAXATTACKWAIT || growth < x->x_lothresh)
- {
- /* if haven't yet, and if not in spew mode, report a hit */
- if (!x->x_spew && !x->x_attacked)
- {
- for (ch = 0, gp = x->x_insig; ch < ninsig; ch++, gp++)
- for (i = nfilters, h = gp->g_hist; i--; h++)
- h->h_outpower = h->h_mask[nextphase];
- x->x_hit = 1;
- clock_delay(x->x_clock, 0);
- }
- }
- if (growth < x->x_lothresh)
- x->x_willattack = 0;
- else x->x_willattack++;
- }
- else if (growth > x->x_hithresh)
- {
- if (x->x_debug) post("attack: growth = %f", growth);
- x->x_willattack = 1;
- x->x_attacked = 0;
- for (ch = 0, gp = x->x_insig; ch < ninsig; ch++, gp++)
- for (i = nfilters, h = gp->g_hist; i--; h++)
- h->h_mask[nextphase] = h->h_power, h->h_countup = 0;
- }
-
- /* if in "spew" mode just always output */
- if (x->x_spew)
- {
- for (ch = 0, gp = x->x_insig; ch < ninsig; ch++, gp++)
- for (i = nfilters, h = gp->g_hist; i--; h++)
- h->h_outpower = h->h_power;
- x->x_hit = 0;
- clock_delay(x->x_clock, 0);
- }
- x->x_debouncevel *= x->x_debouncedecay;
-}
-
-static t_int *bonk_perform(t_int *w)
-{
- t_bonk *x = (t_bonk *)(w[1]);
- int n = (int)(w[2]);
- int onset = 0;
- if (x->x_countdown >= n)
- x->x_countdown -= n;
- else
- {
- int i, j, ninsig = x->x_ninsig;
- t_insig *gp;
- if (x->x_countdown > 0)
- {
- n -= x->x_countdown;
- onset += x->x_countdown;
- x->x_countdown = 0;
- }
- while (n > 0)
- {
- int infill = x->x_infill;
- int m = (n < (x->x_npoints - infill) ?
- n : (x->x_npoints - infill));
- for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
- {
- t_float *fp = gp->g_inbuf + infill;
- t_float *in1 = gp->g_invec + onset;
- for (j = 0; j < m; j++)
- *fp++ = *in1++;
- }
- infill += m;
- x->x_infill = infill;
- if (infill == x->x_npoints)
- {
- bonk_doit(x);
-
- /* shift or clear the input buffer and update counters */
- if (x->x_period > x->x_npoints)
- x->x_countdown = x->x_period - x->x_npoints;
- else x->x_countdown = 0;
- if (x->x_period < x->x_npoints)
- {
- int overlap = x->x_npoints - x->x_period;
- t_float *fp1, *fp2;
- for (n = 0, gp = x->x_insig; n < ninsig; n++, gp++)
- for (i = overlap, fp1 = gp->g_inbuf,
- fp2 = fp1 + x->x_period; i--;)
- *fp1++ = *fp2++;
- x->x_infill = overlap;
- }
- else x->x_infill = 0;
- }
- n -= m;
- onset += m;
- }
- }
- return (w+3);
-}
-
-static void bonk_dsp(t_bonk *x, t_signal **sp)
-{
- int i, n = sp[0]->s_n, ninsig = x->x_ninsig;
- t_insig *gp;
-
- x->x_sr = sp[0]->s_sr;
-
- for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
- gp->g_invec = (*(sp++))->s_vec;
-
- dsp_add(bonk_perform, 2, x, n);
-}
-
-static void bonk_thresh(t_bonk *x, t_floatarg f1, t_floatarg f2)
-{
- if (f1 > f2)
- post("bonk: warning: low threshold greater than hi threshold");
- x->x_lothresh = (f1 <= 0 ? 0.0001 : f1);
- x->x_hithresh = (f2 <= 0 ? 0.0001 : f2);
-}
-
-#ifdef PD
-static void bonk_mask(t_bonk *x, t_floatarg f1, t_floatarg f2)
-{
- int ticks = f1;
- if (ticks < 0) ticks = 0;
- if (f2 < 0) f2 = 0;
- else if (f2 > 1) f2 = 1;
- x->x_masktime = ticks;
- x->x_maskdecay = f2;
-}
-
-static void bonk_debounce(t_bonk *x, t_floatarg f1)
-{
- if (f1 < 0) f1 = 0;
- else if (f1 > 1) f1 = 1;
- x->x_debouncedecay = f1;
-}
-
-static void bonk_minvel(t_bonk *x, t_floatarg f)
-{
- if (f < 0) f = 0;
- x->x_minvel = f;
-}
-
-static void bonk_debug(t_bonk *x, t_floatarg f)
-{
- x->x_debug = (f != 0);
-}
-
-static void bonk_spew(t_bonk *x, t_floatarg f)
-{
- x->x_spew = (f != 0);
-}
-
-static void bonk_useloudness(t_bonk *x, t_floatarg f)
-{
- x->x_useloudness = (f != 0);
-}
-
-static void bonk_attackbins(t_bonk *x, t_floatarg f)
-{
- if (f < 1)
- f = 1;
- else if (f > MASKHIST)
- f = MASKHIST;
- x->x_attackbins = f;
-}
-
-static void bonk_learn(t_bonk *x, t_floatarg f)
-{
- int n = f;
- if (n < 0) n = 0;
- if (n)
- {
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(x->x_template[0]), 0);
- x->x_ntemplate = 0;
- }
- x->x_learn = n;
- x->x_learncount = 0;
-}
-#endif
-
-static void bonk_print(t_bonk *x, t_floatarg f)
-{
- int i;
- post("thresh %f %f", x->x_lothresh, x->x_hithresh);
- post("mask %d %f", x->x_masktime, x->x_maskdecay);
- post("attack-frames %d", x->x_attackbins);
- post("debounce %f", x->x_debouncedecay);
- post("minvel %f", x->x_minvel);
- post("spew %d", x->x_spew);
- post("useloudness %d", x->x_useloudness);
-
-#if 0 /* LATER rewrite without hard-coded 11 filters */
- if (x->x_ntemplate)
- {
- post("templates:");
- for (i = 0; i < x->x_ntemplate; i++)
- post(
-"%2d %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f",
- i,
- x->x_template[i].t_amp[0],
- x->x_template[i].t_amp[1],
- x->x_template[i].t_amp[2],
- x->x_template[i].t_amp[3],
- x->x_template[i].t_amp[4],
- x->x_template[i].t_amp[5],
- x->x_template[i].t_amp[6],
- x->x_template[i].t_amp[7],
- x->x_template[i].t_amp[8],
- x->x_template[i].t_amp[9],
- x->x_template[i].t_amp[10]);
- }
- else post("no templates");
-#endif
- post("number of templates %d", x->x_ntemplate);
- if (x->x_learn) post("learn mode");
- if (f != 0)
- {
- int j, ninsig = x->x_ninsig;
- t_insig *gp;
- for (j = 0, gp = x->x_insig; j < ninsig; j++, gp++)
- {
- t_hist *h;
- if (ninsig > 1) post("input %d:", j+1);
- for (i = x->x_nfilters, h = gp->g_hist; i--; h++)
- post("pow %f mask %f before %f count %d",
- h->h_power, h->h_mask[x->x_maskphase],
- h->h_before, h->h_countup);
- }
- post("filter details (frequencies are in units of %.2f-Hz. bins):",
- x->x_sr/x->x_npoints);
- for (j = 0; j < x->x_nfilters; j++)
- post("%2d cf %.2f bw %.2f nhops %d hop %d skip %d npoints %d",
- j,
- x->x_filterbank->b_vec[j].k_centerfreq,
- x->x_filterbank->b_vec[j].k_bandwidth,
- x->x_filterbank->b_vec[j].k_nhops,
- x->x_filterbank->b_vec[j].k_hoppoints,
- x->x_filterbank->b_vec[j].k_skippoints,
- x->x_filterbank->b_vec[j].k_filterpoints);
- }
- if (x->x_debug) post("debug mode");
-}
-
-static void bonk_forget(t_bonk *x)
-{
- int ntemplate = x->x_ntemplate, newn = ntemplate - x->x_ninsig;
- if (newn < 0) newn = 0;
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(x->x_template[0]),
- newn * sizeof(x->x_template[0]));
- x->x_ntemplate = newn;
- x->x_learncount = 0;
-}
-
-static void bonk_bang(t_bonk *x)
-{
- int i, ch;
- t_insig *gp;
- x->x_hit = 0;
- for (ch = 0, gp = x->x_insig; ch < x->x_ninsig; ch++, gp++)
- {
- t_hist *h;
- for (i = 0, h = gp->g_hist; i < x->x_nfilters; i++, h++)
- h->h_outpower = h->h_power;
- }
- bonk_tick(x);
-}
-
-#ifdef PD
-static void bonk_read(t_bonk *x, t_symbol *s)
-{
- t_float vec[MAXNFILTERS];
- int i, ntemplate = 0, remaining;
- t_float *fp, *fp2;
-
- /* fbar: canvas_open code taken from g_array.c */
- FILE *fd;
- char buf[MAXPDSTRING], *bufptr;
- int filedesc;
-
- if ((filedesc = canvas_open(x->x_canvas,
- s->s_name, "", buf, &bufptr, MAXPDSTRING, 0)) < 0
- || !(fd = fdopen(filedesc, "r")))
- {
- post("%s: open failed", s->s_name);
- return;
- }
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(t_template), 0);
- while (1)
- {
- for (i = x->x_nfilters, fp = vec; i--; fp++)
- if (fscanf(fd, "%f", fp) < 1) goto nomore;
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate + 1) * sizeof(t_template));
- for (i = x->x_nfilters, fp = vec,
- fp2 = x->x_template[ntemplate].t_amp; i--;)
- *fp2++ = *fp++;
- ntemplate++;
- }
-nomore:
- if (remaining = (ntemplate % x->x_ninsig))
- {
- post("bonk_read: %d templates not a multiple of %d; dropping extras");
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate - remaining) * sizeof(t_template));
- ntemplate = ntemplate - remaining;
- }
- post("bonk: read %d templates\n", ntemplate);
- x->x_ntemplate = ntemplate;
- fclose(fd);
-}
-#endif
-
-#ifdef MSP
-static void bonk_read(t_bonk *x, t_symbol *s)
-{
- defer(x, (method)bonk_doread, s, 0, NULL);
-}
-
-static void bonk_doread(t_bonk *x, t_symbol *s)
-{
- long filetype = 'TEXT', outtype;
- char filename[512];
- short path;
-
- if (s == gensym("")) {
- if (open_dialog(filename, &path, &outtype, &filetype, 1))
- return;
- } else {
- strcpy(filename, s->s_name);
- if (locatefile_extended(filename, &path, &outtype, &filetype, 1)) {
- object_error((t_object *) x, "%s: not found", s->s_name);
- return;
- }
- }
- // we have a file
- bonk_openfile(x, filename, path);
-}
-
-static void bonk_openfile(t_bonk *x, char *filename, short path) {
- t_float vec[MAXNFILTERS];
- int i, ntemplate = 0, remaining;
- t_float *fp, *fp2;
-
- t_filehandle fh;
- char **texthandle;
- char *tokptr;
-
- if (path_opensysfile(filename, path, &fh, READ_PERM)) {
- object_error((t_object *) x, "error opening %s", filename);
- return;
- }
-
- texthandle = sysmem_newhandle(0);
- sysfile_readtextfile(fh, texthandle, 0, TEXT_LB_NATIVE);
- sysfile_close(fh);
-
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(t_template), 0);
-
- tokptr = strtok(*texthandle, " \n");
-
- while(tokptr != NULL)
- {
- for (i = x->x_nfilters, fp = vec; i--; fp++) {
- if (sscanf(tokptr, "%f", fp) < 1)
- goto nomore;
- tokptr = strtok(NULL, " \n");
- }
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate + 1) * sizeof(t_template));
- for (i = x->x_nfilters, fp = vec,
- fp2 = x->x_template[ntemplate].t_amp; i--;)
- *fp2++ = *fp++;
- ntemplate++;
- }
-nomore:
- if (remaining = (ntemplate % x->x_ninsig))
- {
- post("bonk_read: %d templates not a multiple of %d; dropping extras");
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate - remaining) * sizeof(t_template));
- ntemplate = ntemplate - remaining;
- }
-
- sysmem_freehandle(texthandle);
- post("bonk: read %d templates\n", ntemplate);
- x->x_ntemplate = ntemplate;
-}
-#endif
-
-#ifdef PD
-static void bonk_write(t_bonk *x, t_symbol *s)
-{
- FILE *fd;
- char buf[MAXPDSTRING]; /* fbar */
- int i, ntemplate = x->x_ntemplate;
- t_template *tp = x->x_template;
- t_float *fp;
-
- /* fbar: canvas-code as in g_array.c */
- canvas_makefilename(x->x_canvas, s->s_name,
- buf, MAXPDSTRING);
- sys_bashfilename(buf, buf);
-
- if (!(fd = fopen(buf, "w")))
- {
- post("%s: couldn't create", s->s_name);
- return;
- }
- for (; ntemplate--; tp++)
- {
- for (i = x->x_nfilters, fp = tp->t_amp; i--; fp++)
- fprintf(fd, "%6.2f ", *fp);
- fprintf(fd, "\n");
- }
- post("bonk: wrote %d templates\n", x->x_ntemplate);
- fclose(fd);
-}
-#endif
-
-#ifdef MSP
-static void bonk_write(t_bonk *x, t_symbol *s)
-{
- defer(x, (method)bonk_dowrite, s, 0, NULL);
-}
-
-static void bonk_dowrite(t_bonk *x, t_symbol *s)
-{
- long filetype = 'TEXT', outtype;
- char filename[MAX_FILENAME_CHARS];
- short path;
-
- if (s == gensym("")) {
- sprintf(filename, "bonk_template.txt");
- saveas_promptset("Save template as...");
- if (saveasdialog_extended(filename, &path, &outtype, &filetype, 0))
- return;
- } else {
- strcpy(filename, s->s_name);
- path = path_getdefault();
- }
- bonk_writefile(x, filename, path);
-}
-
-void bonk_writefile(t_bonk *x, char *filename, short path)
-{
- int i, ntemplate = x->x_ntemplate;
- t_template *tp = x->x_template;
- t_float *fp;
- long err;
- long buflen;
-
- t_filehandle fh;
-
- char buf[20];
-
- err = path_createsysfile(filename, path, 'TEXT', &fh);
-
- if (err)
- return;
-
- for (; ntemplate--; tp++)
- {
- for (i = x->x_nfilters, fp = tp->t_amp; i--; fp++) {
- snprintf(buf, 20, "%6.2f ", *fp);
- buflen = strlen(buf);
- sysfile_write(fh, &buflen, buf);
- }
- buflen = 1;
- sysfile_write(fh, &buflen, "\n");
- }
-
- sysfile_close(fh);
-}
-#endif
-
-static void bonk_free(t_bonk *x)
-{
-
- int i, ninsig = x->x_ninsig;
- t_insig *gp = x->x_insig;
-#ifdef MSP
- dsp_free((t_pxobject *)x);
-#endif
- for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
- freebytes(gp->g_inbuf, x->x_npoints * sizeof(t_float));
- clock_free(x->x_clock);
- if (!--(x->x_filterbank->b_refcount))
- bonk_freefilterbank(x->x_filterbank);
-
-}
-
-/* -------------------------- Pd glue ------------------------- */
-#ifdef PD
-
-static void *bonk_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_bonk *x = (t_bonk *)pd_new(bonk_class);
- int nsig = 1, period = DEFPERIOD, npts = DEFNPOINTS,
- nfilters = DEFNFILTERS, j;
- t_float halftones = DEFHALFTONES, overlap = DEFOVERLAP,
- firstbin = DEFFIRSTBIN, minbandwidth = DEFMINBANDWIDTH;
- t_insig *g;
-
- x->x_canvas = canvas_getcurrent(); /* fbar: bind current canvas to x */
- if (argc > 0 && argv[0].a_type == A_FLOAT)
- {
- /* old style args for compatibility */
- period = atom_getfloatarg(0, argc, argv);
- nsig = atom_getfloatarg(1, argc, argv);
- }
- else while (argc > 0)
- {
- t_symbol *firstarg = atom_getsymbolarg(0, argc, argv);
- if (!strcmp(firstarg->s_name, "-npts") && argc > 1)
- {
- npts = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-hop") && argc > 1)
- {
- period = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-nsigs") && argc > 1)
- {
- nsig = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-nfilters") && argc > 1)
- {
- nfilters = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-halftones") && argc > 1)
- {
- halftones = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-overlap") && argc > 1)
- {
- overlap = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-firstbin") && argc > 1)
- {
- firstbin = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-minbandwidth") && argc > 1)
- {
- minbandwidth = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-spew") && argc > 1)
- {
- x->x_spew = (atom_getfloatarg(1, argc, argv) != 0);
- argc -= 2; argv += 2;
- }
- else
- {
- pd_error(x,
-"usage is: bonk [-npts #] [-hop #] [-nsigs #] [-nfilters #] [-halftones #]");
- post(
-"... [-overlap #] [-firstbin #] [-spew #]");
- argc = 0;
- }
- }
-
- x->x_npoints = (npts >= MINPOINTS ? npts : DEFNPOINTS);
- x->x_period = (period >= 1 ? period : npts/2);
- x->x_nfilters = (nfilters >= 1 ? nfilters : DEFNFILTERS);
- if (halftones < 0.01)
- halftones = DEFHALFTONES;
- else if (halftones > 12)
- halftones = 12;
- if (nsig < 1)
- nsig = 1;
- else if (nsig > MAXCHANNELS)
- nsig = MAXCHANNELS;
- if (firstbin < 0.5)
- firstbin = 0.5;
- if (overlap < 1)
- overlap = 1;
-
- x->x_clock = clock_new(x, (t_method)bonk_tick);
- x->x_insig = (t_insig *)getbytes(nsig * sizeof(*x->x_insig));
- for (j = 0, g = x->x_insig; j < nsig; j++, g++)
- {
- g->g_outlet = outlet_new(&x->x_obj, gensym("list"));
- if (j)
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- }
- x->x_cookedout = outlet_new(&x->x_obj, gensym("list"));
- bonk_donew(x, npts, period, nsig, nfilters, halftones, overlap,
- firstbin, minbandwidth, sys_getsr());
- return (x);
-}
-
-void bonk_tilde_setup(void)
-{
- bonk_class = class_new(gensym("bonk~"), (t_newmethod)bonk_new,
- (t_method)bonk_free, sizeof(t_bonk), 0, A_GIMME, 0);
- class_addmethod(bonk_class, nullfn, gensym("signal"), 0);
- class_addmethod(bonk_class, (t_method)bonk_dsp, gensym("dsp"), 0);
- class_addbang(bonk_class, bonk_bang);
- class_addmethod(bonk_class, (t_method)bonk_learn,
- gensym("learn"), A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_forget, gensym("forget"), 0);
- class_addmethod(bonk_class, (t_method)bonk_thresh,
- gensym("thresh"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_mask,
- gensym("mask"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_debounce,
- gensym("debounce"), A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_minvel,
- gensym("minvel"), A_FLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_print,
- gensym("print"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_debug,
- gensym("debug"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_spew,
- gensym("spew"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_useloudness,
- gensym("useloudness"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_attackbins,
- gensym("attack-bins"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_attackbins,
- gensym("attack-frames"), A_DEFFLOAT, 0);
- class_addmethod(bonk_class, (t_method)bonk_read,
- gensym("read"), A_SYMBOL, 0);
- class_addmethod(bonk_class, (t_method)bonk_write,
- gensym("write"), A_SYMBOL, 0);
- post("bonk version 1.5");
-}
-#endif
-
-/* -------------------------- MSP glue ------------------------- */
-#ifdef MSP
-
-int main()
-{
- t_class *c;
- t_object *attr;
- long attrflags = 0;
- t_symbol *sym_long = gensym("long"), *sym_float32 = gensym("float32");
-
- c = class_new("bonk~", (method)bonk_new, (method)bonk_free, sizeof(t_bonk), (method)0L, A_GIMME, 0);
-
- class_obexoffset_set(c, calcoffset(t_bonk, obex));
-
- attr = attr_offset_new("npoints", sym_long, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_npoints));
- class_addattr(c, attr);
-
- attr = attr_offset_new("hop", sym_long, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_period));
- class_addattr(c, attr);
-
- attr = attr_offset_new("nfilters", sym_long, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_nfilters));
- class_addattr(c, attr);
-
- attr = attr_offset_new("halftones", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_halftones));
- class_addattr(c, attr);
-
- attr = attr_offset_new("overlap", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_overlap));
- class_addattr(c, attr);
-
- attr = attr_offset_new("firstbin", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_firstbin));
- class_addattr(c, attr);
-
- attr = attr_offset_new("minbandwidth", sym_float32, attrflags, (method)0L, (method)0L, calcoffset(t_bonk, x_minbandwidth));
- class_addattr(c, attr);
-
- attr = attr_offset_new("minvel", sym_float32, attrflags, (method)0L, (method)bonk_minvel_set, calcoffset(t_bonk, x_minvel));
- class_addattr(c, attr);
-
- attr = attr_offset_new("lothresh", sym_float32, attrflags, (method)0L, (method)bonk_lothresh_set, calcoffset(t_bonk, x_lothresh));
- class_addattr(c, attr);
-
- attr = attr_offset_new("hithresh", sym_float32, attrflags, (method)0L, (method)bonk_hithresh_set, calcoffset(t_bonk, x_hithresh));
- class_addattr(c, attr);
-
- attr = attr_offset_new("masktime", sym_long, attrflags, (method)0L, (method)bonk_masktime_set, calcoffset(t_bonk, x_masktime));
- class_addattr(c, attr);
-
- attr = attr_offset_new("maskdecay", sym_float32, attrflags, (method)0L, (method)bonk_maskdecay_set, calcoffset(t_bonk, x_maskdecay));
- class_addattr(c, attr);
-
- attr = attr_offset_new("debouncedecay", sym_float32, attrflags, (method)0L, (method)bonk_debouncedecay_set, calcoffset(t_bonk, x_debouncedecay));
- class_addattr(c, attr);
-
- attr = attr_offset_new("debug", sym_long, attrflags, (method)0L, (method)bonk_debug_set, calcoffset(t_bonk, x_debug));
- class_addattr(c, attr);
-
- attr = attr_offset_new("spew", sym_long, attrflags, (method)0L, (method)bonk_spew_set, calcoffset(t_bonk, x_spew));
- class_addattr(c, attr);
-
- attr = attr_offset_new("useloudness", sym_long, attrflags, (method)0L, (method)bonk_useloudness_set, calcoffset(t_bonk, x_useloudness));
- class_addattr(c, attr);
-
- attr = attr_offset_new("attackframes", sym_long, attrflags, (method)0L, (method)bonk_attackbins_set, calcoffset(t_bonk, x_attackbins));
- class_addattr(c, attr);
-
- attr = attr_offset_new("learn", sym_long, attrflags, (method)0L, (method)bonk_learn_set, calcoffset(t_bonk, x_learn));
- class_addattr(c, attr);
-
- class_addmethod(c, (method)bonk_dsp, "dsp", A_CANT, 0);
- class_addmethod(c, (method)bonk_bang, "bang", A_CANT, 0);
- class_addmethod(c, (method)bonk_forget, "forget", 0);
- class_addmethod(c, (method)bonk_thresh, "thresh", A_FLOAT, A_FLOAT, 0);
- class_addmethod(c, (method)bonk_print, "print", A_DEFFLOAT, 0);
- class_addmethod(c, (method)bonk_read, "read", A_DEFSYM, 0);
- class_addmethod(c, (method)bonk_write, "write", A_DEFSYM, 0);
- class_addmethod(c, (method)bonk_assist, "assist", A_CANT, 0);
-
- class_addmethod(c, (method)object_obex_dumpout, "dumpout", A_CANT, 0);
- class_addmethod(c, (method)object_obex_quickref, "quickref", A_CANT, 0);
-
- class_dspinit(c);
-
- class_register(CLASS_BOX, c);
- bonk_class = c;
-
- post("bonk~ v1.5");
- return (0);
-}
-
-static void *bonk_new(t_symbol *s, long ac, t_atom *av)
-{
- short j;
- t_bonk *x;
-
- if (x = (t_bonk *)object_alloc(bonk_class)) {
-
- t_insig *g;
-
- x->x_npoints = DEFNPOINTS;
- x->x_period = DEFPERIOD;
- x->x_nfilters = DEFNFILTERS;
- x->x_halftones = DEFHALFTONES;
- x->x_firstbin = DEFFIRSTBIN;
- x->x_minbandwidth = DEFMINBANDWIDTH;
- x->x_overlap = DEFOVERLAP;
- x->x_ninsig = 1;
-
- x->x_hithresh = DEFHITHRESH;
- x->x_lothresh = DEFLOTHRESH;
- x->x_masktime = DEFMASKTIME;
- x->x_maskdecay = DEFMASKDECAY;
- x->x_debouncedecay = DEFDEBOUNCEDECAY;
- x->x_minvel = DEFMINVEL;
- x->x_attackbins = DEFATTACKBINS;
-
- if (!x->x_period) x->x_period = x->x_npoints/2;
- x->x_template = (t_template *)getbytes(0);
- x->x_ntemplate = 0;
- x->x_infill = 0;
- x->x_countdown = 0;
- x->x_willattack = 0;
- x->x_attacked = 0;
- x->x_maskphase = 0;
- x->x_debug = 0;
- x->x_learn = 0;
- x->x_learndebounce = clock_getsystime();
- x->x_learncount = 0;
- x->x_useloudness = 0;
- x->x_debouncevel = 0;
- x->x_sr = sys_getsr();
-
- if (ac) {
- switch (av[0].a_type) {
- case A_LONG:
- x->x_ninsig = av[0].a_w.w_long;
- break;
- }
- }
-
- if (x->x_ninsig < 1) x->x_ninsig = 1;
- if (x->x_ninsig > MAXCHANNELS) x->x_ninsig = MAXCHANNELS;
-
- attr_args_process(x, ac, av);
-
- x->x_insig = (t_insig *)getbytes(x->x_ninsig * sizeof(*x->x_insig));
-
- dsp_setup((t_pxobject *)x, x->x_ninsig);
-
- object_obex_store(x, gensym("dumpout"), outlet_new(x, NULL));
-
- x->x_cookedout = listout((t_object *)x);
-
- for (j = 0, g = x->x_insig + x->x_ninsig-1; j < x->x_ninsig; j++, g--) {
- g->g_outlet = listout((t_object *)x);
- }
-
- x->x_clock = clock_new(x, (method)bonk_tick);
-
- bonk_donew(x, x->x_npoints, x->x_period, x->x_ninsig, x->x_nfilters,
- x->x_halftones, x->x_overlap, x->x_firstbin, x->x_minbandwidth,
- sys_getsr());
- }
- return (x);
-}
-
-/* Attribute setters. */
-void bonk_minvel_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- if (f < 0) f = 0;
- x->x_minvel = f;
- }
-}
-
-void bonk_lothresh_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- if (f > x->x_hithresh)
- post("bonk: warning: low threshold greater than hi threshold");
- x->x_lothresh = (f <= 0 ? 0.0001 : f);
- }
-}
-
-void bonk_hithresh_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- if (f < x->x_lothresh)
- post("bonk: warning: low threshold greater than hi threshold");
- x->x_hithresh = (f <= 0 ? 0.0001 : f);
- }
-}
-
-void bonk_masktime_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- x->x_masktime = (n < 0) ? 0 : n;
- }
-}
-
-void bonk_maskdecay_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- f = (f < 0) ? 0 : f;
- f = (f > 1) ? 1 : f;
- x->x_maskdecay = f;
- }
-}
-
-void bonk_debouncedecay_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- t_float f = atom_getfloat(av);
- f = (f < 0) ? 0 : f;
- f = (f > 1) ? 1 : f;
- x->x_debouncedecay = f;
- }
-}
-
-void bonk_debug_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- x->x_debug = (n != 0);
- }
-}
-
-void bonk_spew_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- x->x_spew = (n != 0);
- }
-}
-
-void bonk_useloudness_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- x->x_useloudness = (n != 0);
- }
-}
-
-void bonk_attackbins_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- n = (n < 1) ? 1 : n;
- n = (n > MASKHIST) ? MASKHIST : n;
- x->x_attackbins = n;
- }
-}
-
-void bonk_learn_set(t_bonk *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av) {
- int n = atom_getlong(av);
- if (n != 0) {
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(x->x_template[0]), 0);
- x->x_ntemplate = 0;
- }
- x->x_learn = n;
- x->x_learncount = 0;
- }
-}
-/* end attr setters */
-
-void bonk_assist(t_bonk *x, void *b, long m, long a, char *s)
-{
-}
-
- /* get current system time */
-double clock_getsystime()
-{
- return gettime();
-}
-
- /* elapsed time in milliseconds since the given system time */
-double clock_gettimesince(double prevsystime)
-{
- return ((gettime() - prevsystime));
-}
-
-t_float qrsqrt(t_float f)
-{
- return 1/sqrt(f);
-}
-#endif /* MSP */
diff --git a/externals/extra/0.43.3/bonk~/templates.txt b/externals/extra/0.43.3/bonk~/templates.txt
deleted file mode 100644
index f3528d78..00000000
--- a/externals/extra/0.43.3/bonk~/templates.txt
+++ /dev/null
@@ -1,4 +0,0 @@
- 10.47 9.65 14.95 23.77 28.32 38.84 53.21 41.20 31.25 21.70 16.48
- 6.52 13.93 27.82 58.05 24.11 35.26 35.98 37.78 22.54 13.56 10.75
- 30.45 28.86 29.42 21.94 29.92 35.70 38.49 32.01 28.19 27.38 22.10
- 66.77 46.27 28.82 25.95 22.84 20.61 20.33 14.18 6.86 8.92 7.37
diff --git a/externals/extra/0.43.3/choice/choice-help.pd b/externals/extra/0.43.3/choice/choice-help.pd
deleted file mode 100644
index 0677db87..00000000
--- a/externals/extra/0.43.3/choice/choice-help.pd
+++ /dev/null
@@ -1,58 +0,0 @@
-#N canvas 16 5 609 600 12;
-#X obj 8 195 choice;
-#X msg 41 86 print;
-#X msg 29 63 clear;
-#X msg 8 34 add 1 0 0 \, add 0 1 0 \, add 0 0 1 \, add 1 1 1 \, add
-1 1 0;
-#X obj 77 171 pack 0 0 0;
-#X floatatom 182 125 0 0 0 0 - - -;
-#X floatatom 148 125 0 0 0 0 - - -;
-#X floatatom 115 125 0 0 0 0 - - -;
-#X obj 77 147 f;
-#X msg 77 125 bang;
-#X floatatom 8 216 0 0 0 0 - - -;
-#X obj 71 196 choice 1;
-#X floatatom 71 217 0 0 0 0 - - -;
-#X obj 76 4 choice;
-#X text 135 3 - search for a best match to an incoming list;
-#X text 19 243 The choice object holds a list of vectors \, each having
-up to ten elements. When sent a list of numbers \, it outputs the index
-of the known vector that matches most closely. The quality of the match
-is the dot product of the two vectors after normalizing them \, i.e.
-\, the vector whose direction is closest to that of the input wins.
-;
-#X text 19 340 If given a nonzero creation argument \, choice tries
-to avoid repetitious outputs by weighting less recently output vectors
-preferentially.;
-#X text 20 389 You can use this to choose interactively between a number
-of behaviors depending on their attributes. For example \, you might
-have stored a number of melodies \, of which some are syncopated \,
-some chromatic \, some are more than 100 years old \, some are bugle
-calls \, and some are Christmas carols. You could then ask to find
-a syncopated bugle call (1 \, 0 \, 0 \, 1 \, 0) and you'll get the
-thing most closely matching the request.;
-#X text 19 514 You can use numbers other than 0 and 1 to indicate relative
-strengths of the attributes \, or even use negative numbers to indicate
-opposites \, either in the incoming lists or in the stored ones.;
-#X text 320 572 updated for Pd version-0.30;
-#X text 79 62 delete all stored vectors;
-#X text 498 34 add vectors;
-#X text 94 84 debugging printout;
-#X text 69 104 tweak the numbers and hit "bang" to input a list;
-#X text 151 197 creation argument to avoid repeated outout;
-#X text 108 219 output is the index of best match \, counting from
-zero;
-#X connect 0 0 10 0;
-#X connect 1 0 0 0;
-#X connect 2 0 0 0;
-#X connect 2 0 11 0;
-#X connect 3 0 0 0;
-#X connect 3 0 11 0;
-#X connect 4 0 0 0;
-#X connect 4 0 11 0;
-#X connect 5 0 4 2;
-#X connect 6 0 4 1;
-#X connect 7 0 8 1;
-#X connect 8 0 4 0;
-#X connect 9 0 8 0;
-#X connect 11 0 12 0;
diff --git a/externals/extra/0.43.3/choice/choice.c b/externals/extra/0.43.3/choice/choice.c
deleted file mode 100644
index 9b8bfb1c..00000000
--- a/externals/extra/0.43.3/choice/choice.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* choice -- match incoming list against a collection of stored templates. */
-
-/* Copyright 1999 Miller Puckette.
-Permission is granted to use this software for any purpose provided you
-keep this copyright notice intact.
-
-THE AUTHOR AND HIS EMPLOYERS MAKE NO WARRANTY, EXPRESS OR IMPLIED,
-IN CONNECTION WITH THIS SOFTWARE.
-
-This file is downloadable from http://www.crca.ucsd.edu/~msp .
-*/
-
-#include "m_pd.h"
-#include <math.h>
-static t_class *choice_class;
-#define DIMENSION 10
-
-typedef struct _elem
-{
- t_float e_age;
- t_float e_weight[DIMENSION];
-} t_elem;
-
-typedef struct _choice
-{
- t_object x_obj;
- t_elem *x_vec;
- int x_n;
- int x_nonrepeat;
-} t_choice;
-
-static void *choice_new(t_float fnonrepeat)
-{
- t_choice *x = (t_choice *)pd_new(choice_class);
- outlet_new(&x->x_obj, gensym("float"));
- x->x_vec = (t_elem *)getbytes(0);
- x->x_n = 0;
- x->x_nonrepeat = (fnonrepeat != 0);
- return (x);
-}
-
-static void choice_clear(t_choice *x)
-{
- x->x_vec = (t_elem *)resizebytes(x->x_vec, x->x_n * sizeof(t_elem), 0);
- x->x_n = 0;
-}
-
-static void choice_print(t_choice *x)
-{
- int j;
- for (j = 0; j < x->x_n; j++)
- {
- t_elem *e = x->x_vec + j;
- t_float *w = e->e_weight;
- post("%2d age %2d \
-w %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f",
- j, (int)(e->e_age), w[0], w[1], w[2], w[3], w[4], w[5],
- w[6], w[7], w[8], w[9]);
- }
-}
-
-static void choice_add(t_choice *x, t_symbol *s, int argc, t_atom *argv)
-{
- int oldn = x->x_n, newn = oldn + 1, i;
- t_elem *e;
- t_float sum, normal;
- x->x_vec = (t_elem *)resizebytes(x->x_vec, oldn * sizeof(t_elem),
- newn * sizeof(t_elem));
- x->x_n = newn;
- e = x->x_vec + oldn;
- e->e_age = 2;
-
- for (i = 0, sum = 0; i < DIMENSION; i++)
- {
- t_float f = atom_getfloatarg(i, argc, argv);
- e->e_weight[i] = f;
- sum += f*f;
- }
- normal = (t_float)(sum > 0 ? 1./sqrt(sum) : 1);
- for (i = 0; i < DIMENSION; i++)
- e->e_weight[i] *= normal;
-}
-
-static void choice_list(t_choice *x, t_symbol *s, int argc, t_atom *argv)
-{
- int i, j;
- t_float bestsum = 0;
- int bestindex = -1;
- t_float invec[DIMENSION];
- for (i = 0; i < DIMENSION; i++)
- invec[i] = atom_getfloatarg(i, argc, argv);
- for (j = 0; j < x->x_n; j++)
- {
- t_elem *e = x->x_vec + j;
- t_float sum;
- for (i = 0, sum = 0; i < DIMENSION; i++)
- sum += e->e_weight[i] * invec[i];
- if (x->x_nonrepeat) sum *= (t_float)(log(e->e_age));
- if (sum > bestsum)
- {
- bestsum = sum;
- sum = 1;
- bestindex = j;
- }
- }
- if (bestindex >= 0)
- {
- for (j = 0; j < x->x_n; j++)
- x->x_vec[j].e_age += 1.;
- x->x_vec[bestindex].e_age = 1;
- }
- outlet_float(x->x_obj.ob_outlet, (t_float)bestindex);
-}
-
-static void choice_free(t_choice *x)
-{
- freebytes(x->x_vec, x->x_n * sizeof(t_elem));
-}
-
-void choice_setup(void)
-{
- choice_class = class_new(gensym("choice"), (t_newmethod)choice_new,
- (t_method)choice_free, sizeof(t_choice), 0, A_DEFFLOAT, 0);
- class_addmethod(choice_class, (t_method)choice_add, gensym("add"), A_GIMME, 0);
- class_addmethod(choice_class, (t_method)choice_clear, gensym("clear"), 0);
- class_addmethod(choice_class, (t_method)choice_print, gensym("print"), 0);
- class_addlist(choice_class, choice_list);
-}
diff --git a/externals/extra/0.43.3/complex-mod~-help.pd b/externals/extra/0.43.3/complex-mod~-help.pd
deleted file mode 100644
index 9e14904d..00000000
--- a/externals/extra/0.43.3/complex-mod~-help.pd
+++ /dev/null
@@ -1,26 +0,0 @@
-#N canvas 136 85 600 480 12;
-#X graph graph1 0 -1 882 1 279 209 579 39;
-#X array mod-output 882 float;
-#X pop;
-#X msg 84 256 bang \; pd dsp 1;
-#X floatatom 67 56;
-#X obj 67 186 complex-mod~;
-#X obj 67 84 phasor~ 440;
-#X obj 67 115 cos~;
-#X obj 106 138 cos~;
-#X obj 106 114 -~ 0.25;
-#X floatatom 145 152;
-#X text 93 351 The complex modulator takes two signals in which it considers to be the real and imaginary part of a complex-valued signal. It then does a complex multiplication by a sinusoud to shift all frequencies up or down by any frequency shift in Hz. See also hilbert~.;
-#X obj 69 298 tabwrite~ mod-output;
-#X text 149 204 right outlet;
-#X text 151 220 gives the other;
-#X text 149 236 sideband;
-#X connect 1 0 10 0;
-#X connect 2 0 4 0;
-#X connect 3 0 10 0;
-#X connect 4 0 5 0;
-#X connect 4 0 7 0;
-#X connect 5 0 3 0;
-#X connect 6 0 3 1;
-#X connect 7 0 6 0;
-#X connect 8 0 3 2;
diff --git a/externals/extra/0.43.3/complex-mod~.pd b/externals/extra/0.43.3/complex-mod~.pd
deleted file mode 100644
index df78a3bf..00000000
--- a/externals/extra/0.43.3/complex-mod~.pd
+++ /dev/null
@@ -1,30 +0,0 @@
-#N canvas 206 108 428 341 12;
-#X obj 142 87 inlet~;
-#X obj 315 166 cos~;
-#X obj 351 144 +~ -0.25;
-#X obj 351 166 cos~;
-#X obj 225 87 inlet~;
-#X obj 142 215 *~;
-#X obj 225 216 *~;
-#X obj 142 251 -~;
-#X obj 142 284 outlet~;
-#X obj 212 285 outlet~;
-#X obj 212 252 +~;
-#X text 140 310 positive;
-#X text 213 311 negative;
-#X obj 315 114 phasor~;
-#X obj 315 88 inlet~;
-#X connect 0 0 5 0;
-#X connect 1 0 5 1;
-#X connect 2 0 3 0;
-#X connect 3 0 6 1;
-#X connect 4 0 6 0;
-#X connect 5 0 7 0;
-#X connect 5 0 10 0;
-#X connect 6 0 7 1;
-#X connect 6 0 10 1;
-#X connect 7 0 8 0;
-#X connect 10 0 9 0;
-#X connect 13 0 2 0;
-#X connect 13 0 1 0;
-#X connect 14 0 13 0;
diff --git a/externals/extra/0.43.3/debian/changelog b/externals/extra/0.43.3/debian/changelog
deleted file mode 100644
index 1aaa941b..00000000
--- a/externals/extra/0.43.3/debian/changelog
+++ /dev/null
@@ -1,5 +0,0 @@
-pd-extra (0.42.6-1) unstable; urgency=low
-
- * Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
-
- -- Hans-Christoph Steiner <hans@eds.org> Thu, 21 Jan 2010 23:27:04 -0500
diff --git a/externals/extra/0.43.3/debian/compat b/externals/extra/0.43.3/debian/compat
deleted file mode 100644
index 7f8f011e..00000000
--- a/externals/extra/0.43.3/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-7
diff --git a/externals/extra/0.43.3/debian/control b/externals/extra/0.43.3/debian/control
deleted file mode 100644
index f6000b5c..00000000
--- a/externals/extra/0.43.3/debian/control
+++ /dev/null
@@ -1,35 +0,0 @@
-Source: pd-extra
-Section: sound
-Priority: optional
-Maintainer: Debian Multimedia Maintainers <pkg-multimedia-maintainers@lists.alioth.debian.org>
-Uploaders: Hans-Christoph Steiner <hans@eds.org>
-Build-Depends: debhelper (>= 7.0.50~),
- puredata
-Standards-Version: 3.9.1
-Homepage: http://puredata.info
-
-Package: pd-extra
-Architecture: any
-Depends: ${shlibs:Depends},
- pd,
- pd-libdir,
- ${misc:Depends}
-Recommends: pd-import
-Description: Pd library of core extras distributed as part of Pure Data
- Pure Data ships with a separate collection of objects known as
- 'extra'. Included in this collection is a set of audio functions like audio
- analysis and reverb.
- .
- bonk~: attack detection and spectral envelope measurement
- choice: search for a best match to an incoming list
- complex-mod~: complex multiplication
- expr, expr~, fexpr~: objects for evalutaing mathematical expressions
- fiddle~: pitch estimator and sinusoidal peak finder
- hilbert~: a phase quadrature for signal sideband modulation
- loop~: phase generator for looping samplers
- lrshift~: shift signal vector elements left or right
- pd~: run pd as a subprocess of pd itself
- pique: find peaks in an FFT spectrum
- rev1~, rev2~, rev3~: different reverberation algorithms
- sigmund~: sinusoidal analysis and pitch tracking
- stdout: write messages to stdout
diff --git a/externals/extra/0.43.3/debian/copyright b/externals/extra/0.43.3/debian/copyright
deleted file mode 100644
index 231abfd2..00000000
--- a/externals/extra/0.43.3/debian/copyright
+++ /dev/null
@@ -1,63 +0,0 @@
-Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?rev=135
-Name: extra
-Maintainer: Miller Puckette and others
-Source: http://sourceforge.net/projects/pure-data/files/libraries/extra/
-
-Files: *
-Copyright: 1997-2010, Miller Puckette
- 1997-1999, Ted Apel
-License: BSD Pd License
-
-Files: expr~/*
-Copyright: 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
-License: GPL-2+
-
-License: BSD Pd License
-This software is copyrighted by Miller Puckette and others. The following
-terms (the "Standard Improved BSD License") apply to all files associated with
-the software unless explicitly disclaimed in individual files:
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-3. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior
- written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
-
-
-License: GPL-2+
- This package is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- .
- This package is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- .
- You should have received a copy of the GNU General Public License
- along with this package; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-X-Comment: On Debian systems, the complete text of the GNU General
- Public License can be found in `/usr/share/common-licenses/GPL-2'.
diff --git a/externals/extra/0.43.3/debian/gbp.conf b/externals/extra/0.43.3/debian/gbp.conf
deleted file mode 100644
index ae1dc367..00000000
--- a/externals/extra/0.43.3/debian/gbp.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-[DEFAULT]
-upstream-branch = upstream
-debian-branch = master
-upstream-tag = upstream/%(version)s
-debian-tag = debian/%(version)s
-pristine-tar = True
-sign-tags = True
diff --git a/externals/extra/0.43.3/debian/links b/externals/extra/0.43.3/debian/links
deleted file mode 100644
index d97ab7c9..00000000
--- a/externals/extra/0.43.3/debian/links
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib/pd/extra/extra/README.txt usr/share/doc/pd-extra/README
diff --git a/externals/extra/0.43.3/debian/rules b/externals/extra/0.43.3/debian/rules
deleted file mode 100755
index 67fca227..00000000
--- a/externals/extra/0.43.3/debian/rules
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/make -f
-
-LIBRARY_NAME = extra
-PACKAGE = pd-$(LIBRARY_NAME)
-pkglibdir = /usr/lib/pd/extra
-
-%:
- dh $@ --buildsystem=makefile
-
-override_dh_auto_install:
- dh_auto_install -- prefix=/usr pkglibdir=$(pkglibdir)
-
-override_dh_shlibdeps:
- dpkg-shlibdeps $(CURDIR)/debian/$(PACKAGE)$(pkglibdir)/$(LIBRARY_NAME)/*.pd_linux \
- -T$(CURDIR)/debian/$(PACKAGE).substvars
diff --git a/externals/extra/0.43.3/debian/source/format b/externals/extra/0.43.3/debian/source/format
deleted file mode 100644
index 163aaf8d..00000000
--- a/externals/extra/0.43.3/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/externals/extra/0.43.3/debian/watch b/externals/extra/0.43.3/debian/watch
deleted file mode 100644
index 06eccab4..00000000
--- a/externals/extra/0.43.3/debian/watch
+++ /dev/null
@@ -1,2 +0,0 @@
-version=3
-http://sf.net/pure-data/extra-(.*)\.tar\.gz
diff --git a/externals/extra/0.43.3/expr-help.pd b/externals/extra/0.43.3/expr-help.pd
deleted file mode 100644
index 8fafb35d..00000000
--- a/externals/extra/0.43.3/expr-help.pd
+++ /dev/null
@@ -1,497 +0,0 @@
-#N canvas 165 94 1012 579 12;
-#X text 66 10 expression evaluation family - expr \, expr~ \, fexpr~
-;
-#X text 63 239 Syntyax:;
-#X text 64 311 $f#: float input variable;
-#X text 65 326 $s#: symbol input variable;
-#X text 553 90 Used for expr~ only:;
-#X text 553 105 $v#: signal (vector) input (vector by vector evaluation)
-;
-#X text 550 164 Used for fexpr~ only:;
-#X text 550 220 $y[n]: the output value indexed by n where n has to
-satisfy 0 > n >= -vector size.;
-#X text 550 248 (the vector size can be changed by the "block~" object.)
-;
-#X text 550 179 $x#[n]: the sample from inlet # indexed by n where
-n has to satisfy 0 => n >= -vector size \, ($x# is a shorthand for
-$x#[0] \, specifying the current sample);
-#X text 63 151 expr~ is used for expression evaluaion of signal data
-on the vector by vector basis;
-#X text 63 136 expr is used for expression evaluaion of control data
-;
-#X text 67 39 For a more detailed documentaion refer to http://www.crca.ucsd.edu/~yadegari/expr.html
-;
-#X text 64 254 The syntax is very close to how expressions are written
-in C. Variables are specified as follows where the '#' stands for the
-inlet number:;
-#X text 65 297 $i#: integer input variable;
-#X text 63 179 fexpr~ is used for expression evaluaion on sample level
-data \; i.e. \, filter design. Warning: fexpr~ is very cpu intensive.
-;
-#X text 633 12 updated for Pd 0.35 test 26 and expr* 0.4;
-#X text 67 85 you can define multiple expressoins in the same object.
-semicolon is used to separates the expressions.;
-#X text 635 294 $y -> $y1[-1];
-#X text 550 263 Shorthands: $x -> $x1[0];
-#X text 635 279 $x1 -> $x1[0] $x2 -> $x2[0] .....;
-#X text 635 309 $y1 -> $y1[-1] $y2 -> $y2[-1] .....;
-#N canvas 0 0 828 385 Examples 0;
-#X obj 33 151 expr 1;
-#X floatatom 197 119 0 0 0 0 - - -;
-#X floatatom 33 181 0 0 0 0 - - -;
-#X msg 33 123 bang;
-#X obj 101 149 expr 2 + 3;
-#X msg 101 122 bang;
-#X floatatom 101 177 0 0 0 0 - - -;
-#X floatatom 196 177 0 0 0 0 - - -;
-#X obj 196 149 expr 2+$f1;
-#X floatatom 34 220 0 0 0 0 - - -;
-#X floatatom 34 277 0 0 0 0 - - -;
-#X obj 34 249 expr $f1 * $f2;
-#X floatatom 113 220 0 0 0 0 - - -;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array array1 10 float 0;
-#X coords 0 10 10 0 200 150 1;
-#X restore 584 180 graph;
-#X floatatom 35 315 0 0 0 0 - - -;
-#X floatatom 35 371 0 0 0 0 - - -;
-#X floatatom 194 219 0 0 0 0 - - -;
-#X floatatom 194 276 0 0 0 0 - - -;
-#X obj 194 248 expr $s2[$f1];
-#X msg 267 220 symbol array1;
-#X obj 35 343 expr sin(2 * 3.14159 * $f1 / 360);
-#X msg 330 281 \; array1 1 4 2 8 5 6 1 4 2 8 5 6;
-#X floatatom 310 184 5 0 0 0 - - -;
-#X floatatom 395 186 5 0 0 0 - - -;
-#X floatatom 480 184 5 0 0 0 - - -;
-#X floatatom 310 105 5 0 0 0 - - -;
-#X obj 310 132 expr $f1 \; if ($f1 > 0 \, $f1 * 2 \, 0) \; if ($f1
-<= 0 \, $f1 / 2 \, 0);
-#X text 34 56 Examples of expr object;
-#X text 304 88 an example of multiple expressions and the use of 'if'
-;
-#X connect 0 0 2 0;
-#X connect 1 0 8 0;
-#X connect 3 0 0 0;
-#X connect 4 0 6 0;
-#X connect 5 0 4 0;
-#X connect 8 0 7 0;
-#X connect 9 0 11 0;
-#X connect 11 0 10 0;
-#X connect 12 0 11 1;
-#X connect 14 0 20 0;
-#X connect 16 0 18 0;
-#X connect 18 0 17 0;
-#X connect 19 0 18 1;
-#X connect 20 0 15 0;
-#X connect 25 0 26 0;
-#X connect 26 0 22 0;
-#X connect 26 1 23 0;
-#X connect 26 2 24 0;
-#X restore 307 398 pd Examples of expr;
-#N canvas 23 24 882 676 Examples 0;
-#X text -88 101 expr~ examples:;
-#X obj -24 355 print~;
-#X msg 13 334 bang;
-#X obj -24 276 sig~ 440;
-#X floatatom 49 293 0 0 0 0 - - -;
-#X floatatom -24 253 0 0 0 0 - - -;
-#X obj -24 316 expr~ $v1*$f2;
-#X obj 85 356 print~;
-#X msg 101 335 bang;
-#X floatatom 85 268 0 0 0 0 - - -;
-#X floatatom 158 270 0 0 0 0 - - -;
-#X floatatom 357 291 0 0 0 0 - - -;
-#X floatatom 244 267 0 0 0 0 - - -;
-#X obj 244 294 osc~;
-#X msg 369 47 \; pd dsp 0;
-#X msg 291 49 \; pd dsp 1;
-#X text 294 26 audio on;
-#X text 377 25 audio off;
-#X text -45 236 vector times scalar;
-#X text 87 236 vector;
-#X obj 243 354 dac~;
-#X text 241 245 frequency;
-#X text 373 273 amplitude;
-#X obj 85 315 expr~ $v1*$v2;
-#X floatatom 207 471 5 0 0 0 - - -;
-#X obj -40 520 tabsend~ a1;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array a1 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore -39 542 graph;
-#X obj -40 497 expr~ max(min($v1 \, $f2/10) \, -$f2/10);
-#X text -38 123 NOTES: the first inlet of expr~ cannot be a $f1 or
-$i1 \, this may change in later releases;
-#X text -87 420 A simple limiter example;
-#X obj 356 158 vsl 15 128 0 127 0 0 empty empty empty 20 8 0 8 -262144
--1 -1 0 1;
-#X obj 243 315 expr~ $v1*$f2/128;
-#X text -82 28 make sure you turn on audio for the expr~ examples;
-#X obj -40 473 osc~ 2756.25;
-#X text 122 436 Move the value below between 0 and 10;
-#X text 126 451 to change the limiter threshold;
-#X obj 417 522 tabsend~ a2;
-#X obj 580 518 tabsend~ a3;
-#X obj 417 439 osc~ 2756.25;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array a2 64 float 1;
-#A 0 -0.797042 -0.728354 -0.551199 -0.29486 -5.74798e-08 0.28779 0.525076
-0.677165 0.723186 0.658973 0.49724 0.265198 -5.86755e-06 -0.257244
--0.467812 -0.601285 -0.639938 -0.581051 -0.436842 -0.232108 -4.49318e-08
-0.223344 0.404462 0.517604 0.548393 0.495593 0.370771 0.195993 -4.2964e-06
--0.186556 -0.335875 -0.427214 -0.449737 -0.4037 -0.299884 -0.157342
--3.00576e-08 0.14734 0.262927 0.331275 0.34523 0.306564 0.225106 0.116645
--2.503e-06 -0.106219 -0.186565 -0.231035 -0.236249 -0.205455 -0.147412
--0.0744387 -1.36289e-08 0.0637127 0.10778 0.127799 0.124205 0.101679
-0.0677997 0.0312617 -5.8003e-07 -0.0203835 -0.0275998 -0.0229047;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 347 554 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array a3 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 569 554 graph;
-#X obj 417 473 expr~ $v1 *$v2 \; if ($v2 > 0 \, 0 \, $v1*$v2);
-#X obj 580 439 osc~ 100;
-#X connect 2 0 1 0;
-#X connect 3 0 6 0;
-#X connect 4 0 6 1;
-#X connect 5 0 3 0;
-#X connect 6 0 1 0;
-#X connect 8 0 7 0;
-#X connect 9 0 23 0;
-#X connect 10 0 23 1;
-#X connect 11 0 31 1;
-#X connect 12 0 13 0;
-#X connect 13 0 31 0;
-#X connect 23 0 7 0;
-#X connect 24 0 27 1;
-#X connect 27 0 25 0;
-#X connect 30 0 11 0;
-#X connect 31 0 20 0;
-#X connect 31 0 20 1;
-#X connect 33 0 27 0;
-#X connect 38 0 41 0;
-#X connect 41 0 36 0;
-#X connect 41 1 37 0;
-#X connect 42 0 41 1;
-#X restore 307 433 pd Examples of expr~;
-#X text 40 399 For expr examples click here ->;
-#X text 41 433 For expr~ examples click here ->;
-#X text 40 471 For fexpr~ examples click here ->;
-#N canvas 0 0 1059 688 examples 0;
-#X msg 519 84 \; pd dsp 0;
-#X msg 428 84 \; pd dsp 1;
-#X text 426 64 audio on;
-#X text 518 65 audio off;
-#X floatatom 126 304 0 0 0 0 - - -;
-#X floatatom 259 323 0 0 0 0 - - -;
-#X msg 226 283 -10;
-#X text 53 103 fexpr~ examples:;
-#X obj 125 571 print~;
-#X msg 247 552 bang;
-#X floatatom 125 475 0 0 0 0 - - -;
-#X obj 126 347 fexpr~ ($x1[$f2]+$x1)/2;
-#X obj 125 532 fexpr~ $x1+$y[-1];
-#X floatatom 635 366 0 0 0 0 - - -;
-#X floatatom 795 387 0 0 0 0 - - -;
-#X obj 630 456 dac~;
-#X obj 632 407 fexpr~ ($x1[$f2/1000]+$x1)/2;
-#X msg 864 317 0 10000;
-#X obj 795 368 line 0;
-#X msg 798 318 -10000;
-#X obj 120 389 dac~;
-#X text 96 227 Simple FIR filter;
-#X text 557 134 Simple FIR filter using fractional offset;
-#X msg 704 318 -10000 10000;
-#X obj 635 387 osc~ 2205;
-#X msg 644 343 1102.5;
-#X msg 862 342 0 10000;
-#X msg 796 343 -20000;
-#X msg 702 343 -20000 10000;
-#X msg 635 318 2205;
-#X msg 548 312 start;
-#X msg 550 334 stop;
-#X msg 57 284 start;
-#X msg 56 309 stop;
-#X msg 75 469 start;
-#X msg 74 494 stop;
-#X obj 491 335 loadbang;
-#X obj 18 495 loadbang;
-#X obj 1 309 loadbang;
-#X text 617 291 frequency;
-#X text 707 300 of the simple filter;
-#X msg 293 282 -20;
-#X obj 126 325 osc~ 2205;
-#X msg 156 281 1102.5;
-#X msg 110 281 2205;
-#X msg 260 282 0;
-#X text 123 445 simple accumulator defined as and an IIR filter;
-#X text 52 148 NOTE: fexpr~ could use lots of CPU power \, by default
-fexpr~ is on when it is loaded. In this page we are turning them off
-with loadbang \, so to hear them you have to turn them on explicitly.
-You can use the "start" and "stop" messages to start and stop fexpr~
-and expr~;
-#X text 706 288 index defining the frequency;
-#X text 95 240 -10 offset will fully filter audio frequency of 2205
-\, and -20 offset will filter audio at frequency of 1102.5;
-#X text 559 215 Thus \, the offset -10000 will filter audio at frequency
-of 2205 and the offset value -20000 will filter the audio at frequency
-of 1102.5.;
-#X text 558 161 When fractional offset is used \, fexpr~ determines
-indexed by linear interpolation. In the following example the offset
-value is divided by 1000 \, thus we can continuously change the offset
-without an audible click in the output.;
-#X text 288 318 If you change this value you;
-#X text 290 330 hear a click;
-#X text 51 87 make sure you turn on audio for the fexpr~ examples;
-#X text 55 -323 Used for fexpr~ only:;
-#X text 55 -267 $y[n]: the output value indexed by n where n has to
-satisfy 0 > n >= -vector size.;
-#X text 55 -239 (the vector size can be changed by the "block~" object.)
-;
-#X text 55 -308 $x#[n]: the sample from inlet # indexed by n where
-n has to satisfy 0 => n >= -vector size \, ($x# is a shorthand for
-$x#[0] \, specifying the current sample);
-#X text 140 -193 $y -> $y1[-1];
-#X text 55 -224 Shorthands: $x -> $x1[0];
-#X text 140 -208 $x1 -> $x1[0] $x2 -> $x2[0] .....;
-#X text 140 -178 $y1 -> $y1[-1] $y2 -> $y2[-1] .....;
-#X text 64 -125 fexpr~ responds to the following methods;
-#X text 66 -106 clear - clears all the previous input and output buffers
-;
-#X text 65 -92 clear x# - clears the previous values of the #th input
-;
-#X text 66 -79 clear y# - clears the previous values of the #th output
-;
-#X text 66 -33 set x# val-1 val-2 ... - sets the as many supplied values
-of the #th input;
-#X text 513 -22 e.g. \, set x2 3.4 0.4 sets x2[-1]=3.4 and x2[-2]=0.4
-;
-#X text 66 -2 set y# val-1 val-2 ... - sets the as many supplied values
-of the #th input;
-#X text 514 4 e.g. \, set y3 1.1 3.3 4.5 sets y3[-1]=1.1 y3[-2]=3.3
-and y3[-3]=4.5;
-#X text 64 -54 set val val ... - sets the first past values of each
-output;
-#X text 513 -59 e.g. \, set 0.1 2.2 0.4 sets y1[-1]=0.1 y2[-1]=2.2
-\, and y3[-1]=0.4;
-#X msg 244 475 set 4000;
-#X obj 125 504 sig~ 0.001;
-#X msg 245 498 clear;
-#X text 22 442 comment;
-#X text 14 431 1 first click the start button;
-#X text 307 494 2 click the set or the clear button;
-#X text 304 547 3 then click bang to see how set and clear work;
-#X connect 4 0 42 0;
-#X connect 5 0 11 1;
-#X connect 6 0 5 0;
-#X connect 9 0 8 0;
-#X connect 10 0 74 0;
-#X connect 11 0 20 0;
-#X connect 11 0 20 1;
-#X connect 12 0 8 0;
-#X connect 13 0 24 0;
-#X connect 14 0 16 1;
-#X connect 16 0 15 0;
-#X connect 16 0 15 1;
-#X connect 17 0 18 0;
-#X connect 18 0 14 0;
-#X connect 19 0 18 0;
-#X connect 23 0 18 0;
-#X connect 24 0 16 0;
-#X connect 25 0 13 0;
-#X connect 26 0 18 0;
-#X connect 27 0 18 0;
-#X connect 28 0 18 0;
-#X connect 29 0 13 0;
-#X connect 30 0 16 0;
-#X connect 31 0 16 0;
-#X connect 32 0 11 0;
-#X connect 33 0 11 0;
-#X connect 34 0 12 0;
-#X connect 35 0 12 0;
-#X connect 36 0 31 0;
-#X connect 37 0 35 0;
-#X connect 38 0 33 0;
-#X connect 41 0 5 0;
-#X connect 42 0 11 0;
-#X connect 43 0 4 0;
-#X connect 44 0 4 0;
-#X connect 45 0 5 0;
-#X connect 73 0 12 0;
-#X connect 74 0 12 0;
-#X connect 75 0 12 0;
-#X restore 306 472 pd examples of fexpr~;
-#X text 42 504 For using fexpr~ for solving;
-#X text 43 520 differential equations click here ->;
-#N canvas 112 22 944 449 lorenz 0;
-#X obj 176 67 v pr;
-#X obj 307 68 v r;
-#X obj 233 69 v b;
-#X floatatom 176 38 5 0 0 0 - - -;
-#X floatatom 307 40 5 0 0 0 - - -;
-#X msg 177 13 10;
-#X obj 231 10 expr 8./3;
-#X msg 128 136 set 1.2 2.3 4.4;
-#X floatatom 233 39 7 0 0 0 - - -;
-#X msg 75 46 stop;
-#X msg 75 67 start;
-#X floatatom 399 40 5 0 0 0 - - -;
-#X obj 399 69 v dt;
-#X msg 310 12 18;
-#X msg 395 13 0.01;
-#X obj 68 296 dac~;
-#X obj 128 -41 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X text 201 -41 <- turn audio on and bang here;
-#X text 463 42 <- experiment with these numbers;
-#X text 472 72 if you hear a buzz \, you have probably gone unstable
-bang on the top again;
-#X obj 489 15 line;
-#X obj 128 241 /~ 20;
-#X obj 234 238 /~ 20;
-#X obj 340 237 /~ 20;
-#X msg 484 -11 0.01 \, 0.04 5000;
-#X obj 128 185 fexpr~ $y1+(pr*$y2-pr*$y1)*dt \; $y2 +(-$y1*$y3 + r*$y1-$y2)*dt
-\; $y3+($y1*$y2 - b*$y3)*dt;
-#X obj 14 65 loadbang;
-#X text 113 -100 This is an example of how fexpr~ could be used for
-solving differential equations \, in this case the lorenz equations
-which generate chotic signals;
-#X text 361 182 Note the following shorthands:;
-#X text 360 198 $y1 -> $y1[-1] \, $y2 -> $y2[-1] \, .....;
-#X text 248 136 the 'set' commands sets the initial previous values
-;
-#X obj 128 298 tabsend~ lorenz1a;
-#X obj 234 278 tabsend~ lorenz2a;
-#X obj 339 259 tabsend~ lorenz3a;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz1a 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 73 437 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz2a 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 331 435 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz3a 64 float 0;
-#X coords 0 1 63 -1 200 140 1;
-#X restore 592 436 graph;
-#X text 301 315 You can see the graphs if you scroll down;
-#X text 301 328 but the redrawings may cause clicks in the audio;
-#X connect 3 0 0 0;
-#X connect 4 0 1 0;
-#X connect 5 0 3 0;
-#X connect 6 0 8 0;
-#X connect 7 0 25 0;
-#X connect 8 0 2 0;
-#X connect 9 0 25 0;
-#X connect 10 0 25 0;
-#X connect 11 0 12 0;
-#X connect 13 0 4 0;
-#X connect 14 0 11 0;
-#X connect 16 0 5 0;
-#X connect 16 0 6 0;
-#X connect 16 0 13 0;
-#X connect 16 0 14 0;
-#X connect 16 0 7 0;
-#X connect 16 0 10 0;
-#X connect 20 0 11 0;
-#X connect 21 0 31 0;
-#X connect 21 0 15 0;
-#X connect 21 0 15 1;
-#X connect 22 0 32 0;
-#X connect 23 0 33 0;
-#X connect 24 0 20 0;
-#X connect 25 0 21 0;
-#X connect 25 1 22 0;
-#X connect 25 2 23 0;
-#X connect 26 0 9 0;
-#X restore 308 518 pd lorenz equations for audition;
-#N canvas 97 36 978 656 lorenz 0;
-#X obj 176 67 v pr;
-#X obj 307 68 v r;
-#X obj 233 69 v b;
-#X floatatom 176 38 5 0 0 0 - - -;
-#X floatatom 307 40 5 0 0 0 - - -;
-#X msg 177 13 10;
-#X obj 231 10 expr 8./3;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz1 2048 float 0;
-#X coords 0 -1 2047 1 200 140 1;
-#X restore 82 357 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz2 2048 float 0;
-#X coords 0 -1 2047 1 200 140 1;
-#X restore 327 353 graph;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array lorenz3 2048 float 0;
-#X coords 0 -1 2047 1 200 140 1;
-#X restore 570 347 graph;
-#X msg 128 136 set 1.2 2.3 4.4;
-#X floatatom 233 39 7 0 0 0 - - -;
-#X msg 75 46 stop;
-#X msg 75 67 start;
-#X floatatom 399 40 5 0 0 0 - - -;
-#X obj 399 69 v dt;
-#X msg 310 12 18;
-#X msg 395 13 0.01;
-#X obj 128 -41 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1
--1;
-#X text 201 -41 <- turn audio on and bang here;
-#X text 463 42 <- experiment with these numbers;
-#X text 472 72 if you hear a buzz \, you have probably gone unstable
-bang on the top again;
-#X obj 489 15 line;
-#X obj 128 241 /~ 20;
-#X obj 234 238 /~ 20;
-#X obj 340 237 /~ 20;
-#X msg 484 -11 0.01 \, 0.04 5000;
-#X obj 14 65 loadbang;
-#X text 113 -100 This is an example of how fexpr~ could be used for
-solving differential equations \, in this case the lorenz equations
-which generate chotic signals;
-#X text 361 182 Note the following shorthands:;
-#X text 360 198 $y1 -> $y1[-1] \, $y2 -> $y2[-1] \, .....;
-#X text 248 136 the 'set' commands sets the initial previous values
-;
-#X obj 128 298 tabsend~ lorenz1;
-#X obj 234 278 tabsend~ lorenz2;
-#X obj 339 259 tabsend~ lorenz3;
-#X obj 627 280 block~ 2048;
-#X text 669 133 Lorenz Equations;
-#X obj 128 185 fexpr~ $y1+pr * ($y2-$y1)*dt \; $y2 +(-$y1*$y3 + r*$y1-$y2)*dt
-\; $y3+($y1*$y2 - b*$y3)*dt;
-#X text 672 197 dZ/dt = -bZ;
-#X text 669 167 dX/dt = pr * (X - Y);
-#X text 668 147 written with 3 state variable X \, Y \, and Z;
-#X text 670 182 dY/dt = -XZ + rX - y;
-#X connect 3 0 0 0;
-#X connect 4 0 1 0;
-#X connect 5 0 3 0;
-#X connect 6 0 11 0;
-#X connect 10 0 37 0;
-#X connect 11 0 2 0;
-#X connect 12 0 37 0;
-#X connect 13 0 37 0;
-#X connect 14 0 15 0;
-#X connect 16 0 4 0;
-#X connect 17 0 14 0;
-#X connect 18 0 5 0;
-#X connect 18 0 6 0;
-#X connect 18 0 16 0;
-#X connect 18 0 17 0;
-#X connect 18 0 10 0;
-#X connect 18 0 13 0;
-#X connect 22 0 14 0;
-#X connect 23 0 32 0;
-#X connect 24 0 33 0;
-#X connect 25 0 34 0;
-#X connect 26 0 22 0;
-#X connect 27 0 12 0;
-#X connect 37 0 23 0;
-#X connect 37 1 24 0;
-#X connect 37 2 25 0;
-#X restore 308 541 pd lorenz equations for visualization;
-#X text 68 24 by Shahrokh Yadegari;
diff --git a/externals/extra/0.43.3/expr~/LICENSE.txt b/externals/extra/0.43.3/expr~/LICENSE.txt
deleted file mode 100644
index 01469ec7..00000000
--- a/externals/extra/0.43.3/expr~/LICENSE.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/externals/extra/0.43.3/expr~/README.txt b/externals/extra/0.43.3/expr~/README.txt
deleted file mode 100644
index bf84f2ae..00000000
--- a/externals/extra/0.43.3/expr~/README.txt
+++ /dev/null
@@ -1,97 +0,0 @@
-
-You can get more information on the expr object at
-http://www.crca.ucsd.edu/~yadegari/expr.html
-
------------
-
-New if Version 0.4
-
--access to variables (made by value object)
--multiple expression separated by ;
--added the following shorthands:
- $y or $y1 = $y1[-1] and $y2 = $y2[-1]
--new functions:
- if - conditional evaluation
- cbrt - cube root
- erf - error function
- erfc - complementary error function
- expm1 - exponential minus 1,
- log1p - logarithm of 1 plus
- isinf - is the value infinite,
- finite - is the value finite
- isnan -- is the resut a nan (Not a number)
- copysign - copy sign of a number
- ldexp - multiply floating-point number by integral power of 2
- imodf - get signed integral value from floating-point number
- modf - get signed fractional value from floating-point number
- drem - floating-point remainder function
-
- Thanks to Orm Finnendahl for adding the following functions:
- fmod - floating-point remainder function
- ceil - ceiling function: smallest integral value not less than argument
- floor - largest integral value not greater than argument
-
-------------
-
-New in Version 0.3
--Full function functionality
-
-------------
-
-The object "expr" is used for expression evaluaion of control data.
-
-Expr~ and fexpr~ are extentions to the expr object to work with vectors.
-The expr~ object is designed to efficiently combine signal and control
-stream processing by vector operations on the basis of the block size of
-the environment.
-
-fexpr~ object provides a flexible mechanism for building FIR and
-IIR filters by evaluating expressions on a sample by sample basis
-and providing access to prior samples of the input and output audio
-streams. When fractional offset is used, fexpr~ uses linear interpolation
-to determine the value of the indexed sample. fexpr~ evaluates the
-expression for every single sample and at every evaluation previous
-samples (limited by the audio vector size) can be accessed. $x is used to
-denote a singnal input whose samples we would like to access. The syntax
-is $x followed by the inlet number and indexed by brackets, for example
-$x1[-1] specifies the previous sample of the first inlet. Therefore,
-if we are to build a simple filter which replaces every sample by
-the average of that sample and its previous one, we would use "fexpr~
-($x1[0]+$x1[-1])/2 ". For ease of when the brackets are omitted, the
-current sample is implied, so we can right the previous filter expression
-as follows: " fexpr~ ($x1+$x1[-1])/2". To build IIR filters $y is used
-to access the previous samples of the output stream.
-
-The three objects expr, expr~, and fexpr~ are implemented in the same object
-so the files expr~.pd_linux and fexpr~.pd_linux are links to expr.pd_linux
-This release has been compiled and tested on Linux 6.0.
-
---------
-
-Here are some syntax information: (refer to help-expr.pd for examples)
-
-Syntyax:
-The syntax is very close to how expression are written in
-C. Variables are specified as follows where the '#' stands
-for the inlet number:
-$i#: integer input variable
-$f#: float input variable
-$s#: symbol input variable
-
-Used for expr~ only:
-$v#: signal (vector) input (vector by vector evaluation)
-
-Used for fexpr~ only:
-$x#[n]: the sample from inlet # indexed by n, where n has to
- satisfy 0 => n >= -vector size,
- ($x# is a shorthand for $x#[0], specifying the current sample)
-
-$y#[n]: the output value indexed by n, where n has to
- satisfy 0 > n >= -vector size,
- $y[n] is a shorthand for $y1[n]
-
-
-I'll appreciate hearing about bugs, comments, suggestions, ...
-
-Shahrokh Yadegari (sdy@ucsd.edu)
-7/10/02
diff --git a/externals/extra/0.43.3/expr~/fts_to_pd.h b/externals/extra/0.43.3/expr~/fts_to_pd.h
deleted file mode 100644
index 9ca2fc42..00000000
--- a/externals/extra/0.43.3/expr~/fts_to_pd.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* fts_to_pd.h -- alias some fts names to compile in Pd.
-
-copyright 1999 Miller Puckette;
-permission is granted to use this file for any purpose.
-*/
-
-
-#define fts_malloc malloc
-#define fts_calloc calloc
-#define fts_free free
-#define fts_realloc realloc
-#define fts_atom_t t_atom
-#define fts_object_t t_object
-typedef t_symbol *fts_symbol_t;
-
-#ifdef MSP
-#define t_atom Atom
-#define t_symbol Symbol
-#define pd_new(x) newobject(x);
-#define pd_free(x) freeobject(x);
-#define t_outlet void
-#define t_binbuf void
-typedef t_class *t_pd;
-typedef float t_floatarg;
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <errno.h>
-
-void pd_error(void *object, char *fmt, ...);
-
-#endif /* MSP */
-
-#define post_error pd_error
-#define fts_is_floatg(x) ((x)->a_type == A_FLOAT)
-
-#define fts_new_symbol_copy gensym
-
-#define fts_symbol_name(x) ((x)->s_name)
diff --git a/externals/extra/0.43.3/expr~/vexp.c b/externals/extra/0.43.3/expr~/vexp.c
deleted file mode 100644
index 8f8ff46c..00000000
--- a/externals/extra/0.43.3/expr~/vexp.c
+++ /dev/null
@@ -1,2142 +0,0 @@
-/*
- * jMax
- * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * See file LICENSE for further informations on licensing terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Based on Max/ISPW by Miller Puckette.
- *
- * Authors: Maurizio De Cecco, Francois Dechelle, Enzo Maggi, Norbert Schnell.
- *
- */
-
-/* "expr" was written by Shahrokh Yadegari c. 1989. -msp */
-/* "expr~" and "fexpr~" conversion by Shahrokh Yadegari c. 1999,2000 */
-
-/*
- * Feb 2002 - added access to variables
- * multiple expression support
- * new short hand forms for fexpr~
- * now $y or $y1 = $y1[-1] and $y2 = $y2[-1]
- * --sdy
- *
- * July 2002
- * fixed bugs introduced in last changes in store and ET_EQ
- * --sdy
- *
- */
-
-/*
- * vexp.c -- a variable expression evaluator
- *
- * This modules implements an expression evaluator using the
- * operator-precedence parsing. It transforms an infix expression
- * to a prefix stack ready to be evaluated. The expression sysntax
- * is close to that of C. There are a few operators that are not
- * supported and functions are also recognized. Strings can be
- * passed to functions when they are quoted in '"'s. "[]" are implememted
- * as an easy way of accessing the content of tables, and the syntax
- * table_name[index].
- * Variables (inlets) are specified with the following syntax: $x#,
- * where x is either i(integers), f(floats), and s(strings); and #
- * is a digit that coresponds to the inlet number. The string variables
- * can be used as strings when they are quoted and can also be used as
- * table names when they are followed by "[]".
- *
- * signal vectors have been added to this implementation:
- * $v# denotes a signal vector
- * $x#[index] is the value of a sample at the index of a the signal vector
- * $x# is the shorthand for $x#[0]
- * $y[index] is the value of the sample output at the index of a the
- * signal output
- * "index" for $x#[index] has to have this range (0 <= index < vectorsize)
- * "index" for $y[index] has to have this range (0 < index < vectorsize)
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "vexp.h"
-#ifdef MSP
-#undef isdigit
-#define isdigit(x) (x >= '0' && x <= '9')
-#endif
-
-char *atoif(char *s, long int *value, long int *type);
-
-static struct ex_ex *ex_lex(struct expr *expr, long int *n);
-struct ex_ex *ex_match(struct ex_ex *eptr, long int op);
-struct ex_ex *ex_parse(struct expr *expr, struct ex_ex *iptr,
- struct ex_ex *optr, long int *argc);
-struct ex_ex *ex_eval(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-
-int expr_donew(struct expr *exprr, int ac, t_atom *av);
-struct ex_ex *eval_func(struct expr *expr,struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-struct ex_ex *eval_tab(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-struct ex_ex *eval_var(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-struct ex_ex *eval_store(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-struct ex_ex *eval_sigidx(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-static int cal_sigidx(struct ex_ex *optr, /* The output value */
- int i, t_float rem_i, /* integer and fractinal part of index */
- int idx, /* index of current fexpr~ processing */
- int vsize, /* vector size */
- t_float *curvec, t_float *prevec); /* current and previous table */
-t_ex_func *find_func(char *s);
-void ex_dzdetect(struct expr *expr);
-
-#define MAX_ARGS 10
-extern t_ex_func ex_funcs[];
-
-struct ex_ex nullex;
-
-void set_tokens (char *s);
-int getoken (struct expr *expr, struct ex_ex *eptr);
-void ex_print (struct ex_ex *eptr);
-#ifdef MSP
-void atom_string(t_atom *a, char *buf, unsigned int bufsize);
-
-void atom_string(t_atom *a, char *buf, unsigned int bufsize)
-{
- char tbuf[30];
- switch(a->a_type)
- {
- case A_SEMI: strcpy(buf, ";"); break;
- case A_COMMA: strcpy(buf, ","); break;
-#ifdef PD
- case A_POINTER:
- strcpy(buf, "(pointer)");
- break;
-#endif
- case A_FLOAT:
- sprintf(tbuf, "%g", a->a_w.w_float);
- if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf);
- else if (a->a_w.w_float < 0) strcpy(buf, "-");
- else strcat(buf, "+");
- break;
- case A_LONG:
- sprintf(tbuf, "%d", a->a_w.w_long);
- if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf);
- else if (a->a_w.w_float < 0) strcpy(buf, "-");
- else strcat(buf, "+");
- break;
- case A_SYMBOL:
- {
- char *sp;
- unsigned int len;
- int quote;
- for (sp = a->a_w.w_symbol->s_name, len = 0, quote = 0; *sp; sp++, len++)
- if (*sp == ';' || *sp == ',' || *sp == '\\' ||
- (*sp == '$' && sp == a->a_w.w_symbol->s_name && sp[1] >= '0'
- && sp[1] <= '9'))
- quote = 1;
- if (quote)
- {
- char *bp = buf, *ep = buf + (bufsize-2);
- sp = a->a_w.w_symbol->s_name;
- while (bp < ep && *sp)
- {
- if (*sp == ';' || *sp == ',' || *sp == '\\' ||
- (*sp == '$' && bp == buf && sp[1] >= '0' && sp[1] <= '9'))
- *bp++ = '\\';
- *bp++ = *sp++;
- }
- if (*sp) *bp++ = '*';
- *bp = 0;
- /* post("quote %s -> %s", a->a_w.w_symbol->s_name, buf); */
- }
- else
- {
- if (len < bufsize-1) strcpy(buf, a->a_w.w_symbol->s_name);
- else
- {
- strncpy(buf, a->a_w.w_symbol->s_name, bufsize - 2);
- strcpy(buf + (bufsize - 2), "*");
- }
- }
- }
- break;
-#ifdef PD
- case A_DOLLAR:
- sprintf(buf, "$%d", a->a_w.w_index);
- break;
- case A_DOLLSYM:
- sprintf(buf, "$%s", a->a_w.w_symbol->s_name);
- break;
-#else /* MAX */
- case A_DOLLAR:
- sprintf(buf, "$%s", a->a_w.w_symbol->s_name);
- break;
-#endif
- default:
- post("atom_string bug");
- }
-}
-#endif /* MSP */
-/*
- * expr_donew -- create a new "expr" object.
- * returns 1 on failure, 0 on success.
- */
-int
-expr_donew(struct expr *expr, int ac, t_atom *av)
-{
- struct ex_ex *list;
- struct ex_ex *ret;
- long max_node = 0; /* maximum number of nodes needed */
- char *exp_string;
- int exp_strlen;
- t_binbuf *b;
- int i;
-
- memset(expr->exp_var, 0, MAX_VARS * sizeof (*expr->exp_var));
-#ifdef PD
- b = binbuf_new();
- binbuf_add(b, ac, av);
- binbuf_gettext(b, &exp_string, &exp_strlen);
-
-#else /* MSP */
- {
- char *buf = getbytes(0), *newbuf;
- int length = 0;
- char string[250];
- t_atom *ap;
- int indx;
-
- for (ap = av, indx = 0; indx < ac; indx++, ap = ++av) {
- int newlength;
- if ((ap->a_type == A_SEMI || ap->a_type == A_COMMA) &&
- length && buf[length-1] == ' ') length--;
- atom_string(ap, string, 250);
- newlength = length + strlen(string) + 1;
- if (!(newbuf = t_resizebytes(buf, length, newlength))) break;
- buf = newbuf;
- strcpy(buf + length, string);
- length = newlength;
- if (ap->a_type == A_SEMI) buf[length-1] = '\n';
- else buf[length-1] = ' ';
- }
-
- if (length && buf[length-1] == ' ') {
- if (newbuf = t_resizebytes(buf, length, length-1))
- {
- buf = newbuf;
- length--;
- }
- }
- exp_string = buf;
- exp_strlen = length;
- }
-#endif
- exp_string = (char *)t_resizebytes(exp_string, exp_strlen,exp_strlen+1);
- exp_string[exp_strlen] = 0;
- expr->exp_string = exp_string;
- expr->exp_str = exp_string;
- expr->exp_nexpr = 0;
- ret = (struct ex_ex *) 0;
- /*
- * if ret == 0 it means that we have no expression
- * so we let the pass go through to build a single null stack
- */
- while (*expr->exp_str || !ret) {
- list = ex_lex(expr, &max_node);
- if (!list) { /* syntax error */
- goto error;
- }
- expr->exp_stack[expr->exp_nexpr] =
- (struct ex_ex *)fts_malloc(max_node * sizeof (struct ex_ex));
- expr->exp_nexpr++;
- ret = ex_match(list, (long)0);
- if (!ret) /* syntax error */
- goto error;
- ret = ex_parse(expr,
- list, expr->exp_stack[expr->exp_nexpr - 1], (long *)0);
- if (!ret)
- goto error;
- }
- *ret = nullex;
- t_freebytes(exp_string, exp_strlen+1);
- return (0);
-error:
- for (i = 0; i < expr->exp_nexpr; i++) {
- fts_free(expr->exp_stack[i]);
- expr->exp_stack[i] = 0;
- }
- expr->exp_nexpr = 0;
- if (list)
- fts_free(list);
- t_freebytes(exp_string, exp_strlen+1);
- return (1);
-}
-
-/*
- * ex_lex -- This routine is a bit more than a lexical parser since it will
- * also do some syntax checking. It reads the string s and will
- * return a linked list of struct ex_ex.
- * It will also put the number of the nodes in *n.
- */
-struct ex_ex *
-ex_lex(struct expr *expr, long int *n)
-{
- struct ex_ex *list_arr;
- struct ex_ex *exptr;
- long non = 0; /* number of nodes */
- long maxnode = 0;
-
- list_arr = (struct ex_ex *)fts_malloc(sizeof (struct ex_ex) * MINODES);
- if (! list_arr) {
- post("ex_lex: no mem\n");
- return ((struct ex_ex *)0);
- }
- exptr = list_arr;
- maxnode = MINODES;
-
- while (8)
- {
- if (non >= maxnode) {
- maxnode += MINODES;
-
- list_arr = fts_realloc((void *)list_arr,
- sizeof (struct ex_ex) * maxnode);
- if (!list_arr) {
- post("ex_lex: no mem\n");
- return ((struct ex_ex *)0);
- }
- exptr = &(list_arr)[non];
- }
-
- if (getoken(expr, exptr)) {
- fts_free(list_arr);
- return ((struct ex_ex *)0);
- }
- non++;
-
- if (!exptr->ex_type)
- break;
-
- exptr++;
- }
- *n = non;
-
- return list_arr;
-}
-
-/*
- * ex_match -- this routine walks through the eptr and matches the
- * perentheses and brackets, it also converts the function
- * names to a pointer to the describing structure of the
- * specified function
- */
-/* operator to match */
-struct ex_ex *
-ex_match(struct ex_ex *eptr, long int op)
-{
- int firstone = 1;
- struct ex_ex *ret;
- t_ex_func *fun;
-
- for (; 8; eptr++, firstone = 0) {
- switch (eptr->ex_type) {
- case 0:
- if (!op)
- return (eptr);
- post("expr syntax error: an open %s not matched\n",
- op == OP_RP ? "parenthesis" : "bracket");
- return (exNULL);
- case ET_INT:
- case ET_FLT:
- case ET_II:
- case ET_FI:
- case ET_SI:
- case ET_VI:
- case ET_SYM:
- case ET_VSYM:
- continue;
- case ET_YO:
- if (eptr[1].ex_type != ET_OP || eptr[1].ex_op != OP_LB)
- eptr->ex_type = ET_YOM1;
- continue;
- case ET_XI:
- if (eptr[1].ex_type != ET_OP || eptr[1].ex_op != OP_LB)
- eptr->ex_type = ET_XI0;
- continue;
- case ET_TBL:
- case ET_FUNC:
- case ET_LP:
- /* CHANGE
- case ET_RP:
- */
- case ET_LB:
- /* CHANGE
- case ET_RB:
- */
- post("ex_match: unexpected type, %ld\n", eptr->ex_type);
- return (exNULL);
- case ET_OP:
- if (op == eptr->ex_op)
- return (eptr);
- /*
- * if we are looking for a right peranthesis
- * or a right bracket and find the other kind,
- * it has to be a syntax error
- */
- if ((eptr->ex_op == OP_RP && op == OP_RB) ||
- (eptr->ex_op == OP_RB && op == OP_RP)) {
- post("expr syntax error: prenthesis or brackets not matched\n");
- return (exNULL);
- }
- /*
- * Up to now we have marked the unary minuses as
- * subrtacts. Any minus that is the first one in
- * chain or is preceeded by anything except ')' and
- * ']' is a unary minus.
- */
- if (eptr->ex_op == OP_SUB) {
- ret = eptr - 1;
- if (firstone || (ret->ex_type == ET_OP &&
- ret->ex_op != OP_RB && ret->ex_op != OP_RP))
- eptr->ex_op = OP_UMINUS;
- } else if (eptr->ex_op == OP_LP) {
- ret = ex_match(eptr + 1, OP_RP);
- if (!ret)
- return (ret);
- eptr->ex_type = ET_LP;
- eptr->ex_ptr = (char *) ret;
- eptr = ret;
- } else if (eptr->ex_op == OP_LB) {
- ret = ex_match(eptr + 1, OP_RB);
- if (!ret)
- return (ret);
- eptr->ex_type = ET_LB;
- eptr->ex_ptr = (char *) ret;
- eptr = ret;
- }
- continue;
- case ET_STR:
- if (eptr[1].ex_op == OP_LB) {
- char *tmp;
-
- eptr->ex_type = ET_TBL;
- tmp = eptr->ex_ptr;
- if (ex_getsym(tmp, (t_symbol **)&(eptr->ex_ptr))) {
- post("expr: syntax error: problms with ex_getsym\n");
- return (exNULL);
- }
- fts_free((void *)tmp);
- } else if (eptr[1].ex_op == OP_LP) {
- fun = find_func(eptr->ex_ptr);
- if (!fun) {
- post(
- "expr: error: function %s not found\n",
- eptr->ex_ptr);
- return (exNULL);
- }
- eptr->ex_type = ET_FUNC;
- eptr->ex_ptr = (char *) fun;
- } else {
- char *tmp;
-
- if (eptr[1].ex_type && eptr[1].ex_type!=ET_OP){
- post("expr: syntax error: bad string '%s'\n", eptr->ex_ptr);
- return (exNULL);
- }
- /* it is a variable */
- eptr->ex_type = ET_VAR;
- tmp = eptr->ex_ptr;
- if (ex_getsym(tmp,
- (t_symbol **)&(eptr->ex_ptr))) {
- post("expr: variable '%s' not found",tmp);
- return (exNULL);
- }
- }
- continue;
- default:
- post("ex_match: bad type\n");
- return (exNULL);
- }
- }
- /* NOTREACHED */
-}
-
-/*
- * ex_parse -- This function if called when we have already done some
- * parsing on the expression, and we have already matched
- * our brackets and parenthesis. The main job of this
- * function is to convert the infix expression to the
- * prefix form.
- * First we find the operator with the lowest precedence and
- * put it on the stack ('optr', it is really just an array), then
- * we call ourself (ex_parse()), on its arguments (unary operators
- * only have one operator.)
- * When "argc" is set it means that we are parsing the arguments
- * of a function and we will increment *argc anytime we find
- * a a segment that can qualify as an argument (counting commas).
- *
- * returns 0 on syntax error
- */
-/* number of argument separated by comma */
-struct ex_ex *
-ex_parse(struct expr *x, struct ex_ex *iptr, struct ex_ex *optr, long int *argc)
-{
- struct ex_ex *eptr;
- struct ex_ex *lowpre = 0; /* pointer to the lowest precedence */
- struct ex_ex savex;
- long pre = HI_PRE;
- long count;
-
- if (!iptr) {
- post("ex_parse: input is null, iptr = 0x%lx\n", iptr);
- return (exNULL);
- }
- if (!iptr->ex_type)
- return (exNULL);
-
- /*
- * the following loop finds the lowest precedence operator in the
- * the input token list, comma is explicitly checked here since
- * that is a special operator and is only legal in functions
- */
- for (eptr = iptr, count = 0; eptr->ex_type; eptr++, count++)
- switch (eptr->ex_type) {
- case ET_SYM:
- case ET_VSYM:
- if (!argc) {
- post("expr: syntax error: symbols allowed for functions only\n");
- ex_print(eptr);
- return (exNULL);
- }
- case ET_INT:
- case ET_FLT:
- case ET_II:
- case ET_FI:
- case ET_XI0:
- case ET_YOM1:
- case ET_VI:
- case ET_VAR:
- if (!count && !eptr[1].ex_type) {
- *optr++ = *eptr;
- return (optr);
- }
- break;
- case ET_XI:
- case ET_YO:
- case ET_SI:
- case ET_TBL:
- if (eptr[1].ex_type != ET_LB) {
- post("expr: syntax error: brackets missing\n");
- ex_print(eptr);
- return (exNULL);
- }
- /* if this table is the only token, parse the table */
- if (!count &&
- !((struct ex_ex *) eptr[1].ex_ptr)[1].ex_type) {
- savex = *((struct ex_ex *) eptr[1].ex_ptr);
- *((struct ex_ex *) eptr[1].ex_ptr) = nullex;
- *optr++ = *eptr;
- lowpre = ex_parse(x, &eptr[2], optr, (long *)0);
- *((struct ex_ex *) eptr[1].ex_ptr) = savex;
- return(lowpre);
- }
- eptr = (struct ex_ex *) eptr[1].ex_ptr;
- break;
- case ET_OP:
- if (eptr->ex_op == OP_COMMA) {
- if (!argc || !count || !eptr[1].ex_type) {
- post("expr: syntax error: illegal comma\n");
- ex_print(eptr[1].ex_type ? eptr : iptr);
- return (exNULL);
- }
- }
- if (!eptr[1].ex_type) {
- post("expr: syntax error: missing operand\n");
- ex_print(iptr);
- return (exNULL);
- }
- if ((eptr->ex_op & PRE_MASK) <= pre) {
- pre = eptr->ex_op & PRE_MASK;
- lowpre = eptr;
- }
- break;
- case ET_FUNC:
- if (eptr[1].ex_type != ET_LP) {
- post("expr: ex_parse: no parenthesis\n");
- return (exNULL);
- }
- /* if this function is the only token, parse it */
- if (!count &&
- !((struct ex_ex *) eptr[1].ex_ptr)[1].ex_type) {
- long ac;
-
- if (eptr[1].ex_ptr == (char *) &eptr[2]) {
- post("expr: syntax error: missing argument\n");
- ex_print(eptr);
- return (exNULL);
- }
- ac = 0;
- savex = *((struct ex_ex *) eptr[1].ex_ptr);
- *((struct ex_ex *) eptr[1].ex_ptr) = nullex;
- *optr++ = *eptr;
- lowpre = ex_parse(x, &eptr[2], optr, &ac);
- if (!lowpre)
- return (exNULL);
- ac++;
- if (ac !=
- ((t_ex_func *)eptr->ex_ptr)->f_argc){
- post("expr: syntax error: function '%s' needs %ld arguments\n",
- ((t_ex_func *)eptr->ex_ptr)->f_name,
- ((t_ex_func *)eptr->ex_ptr)->f_argc);
- return (exNULL);
- }
- *((struct ex_ex *) eptr[1].ex_ptr) = savex;
- return (lowpre);
- }
- eptr = (struct ex_ex *) eptr[1].ex_ptr;
- break;
- case ET_LP:
- case ET_LB:
- if (!count &&
- !((struct ex_ex *) eptr->ex_ptr)[1].ex_type) {
- if (eptr->ex_ptr == (char *)(&eptr[1])) {
- post("expr: syntax error: empty '%s'\n",
- eptr->ex_type==ET_LP?"()":"[]");
- ex_print(eptr);
- return (exNULL);
- }
- savex = *((struct ex_ex *) eptr->ex_ptr);
- *((struct ex_ex *) eptr->ex_ptr) = nullex;
- lowpre = ex_parse(x, &eptr[1], optr, (long *)0);
- *((struct ex_ex *) eptr->ex_ptr) = savex;
- return (lowpre);
- }
- eptr = (struct ex_ex *)eptr->ex_ptr;
- break;
- case ET_STR:
- default:
- ex_print(eptr);
- post("expr: ex_parse: type = 0x%lx\n", eptr->ex_type);
- return (exNULL);
- }
-
- if (pre == HI_PRE) {
- post("expr: syntax error: missing operation\n");
- ex_print(iptr);
- return (exNULL);
- }
- if (count < 2) {
- post("expr: syntax error: mission operand\n");
- ex_print(iptr);
- return (exNULL);
- }
- if (count == 2) {
- if (lowpre != iptr) {
- post("expr: ex_parse: unary operator should be first\n");
- return (exNULL);
- }
- if (!unary_op(lowpre->ex_op)) {
- post("expr: syntax error: not a uniary operator\n");
- ex_print(iptr);
- return (exNULL);
- }
- *optr++ = *lowpre;
- eptr = ex_parse(x, &lowpre[1], optr, argc);
- return (eptr);
- }
- if (lowpre == iptr) {
- post("expr: syntax error: mission operand\n");
- ex_print(iptr);
- return (exNULL);
- }
- savex = *lowpre;
- *lowpre = nullex;
- if (savex.ex_op != OP_COMMA)
- *optr++ = savex;
- else
- (*argc)++;
- eptr = ex_parse(x, iptr, optr, argc);
- if (eptr) {
- eptr = ex_parse(x, &lowpre[1], eptr, argc);
- *lowpre = savex;
- }
- return (eptr);
-}
-
-/*
- * this is the devide zero check for a a non devide operator
- */
-#define DZC(ARG1,OPR,ARG2) (ARG1 OPR ARG2)
-
-#define EVAL(OPR); \
-eptr = ex_eval(expr, ex_eval(expr, eptr, &left, idx), &right, idx); \
-switch (left.ex_type) { \
-case ET_INT: \
- switch(right.ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)DZC(left.ex_int, OPR, right.ex_int); \
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_INT; \
- optr->ex_int = DZC(left.ex_int, OPR, right.ex_int); \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = DZC(((t_float)left.ex_int), OPR, right.ex_flt);\
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = DZC(((t_float)left.ex_int), OPR, \
- right.ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- scalar = left.ex_int; \
- rp = right.ex_vec; \
- op = optr->ex_vec; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC (scalar, OPR, *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad right type %ld\n", \
- __LINE__, right.ex_type); \
- nullret = 1; \
- } \
- break; \
-case ET_FLT: \
- switch(right.ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = DZC((t_float) left.ex_flt, OPR, right.ex_int); \
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = DZC(left.ex_flt, OPR, right.ex_int); \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = DZC(left.ex_flt, OPR, right.ex_flt); \
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt= DZC(left.ex_flt, OPR, right.ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- scalar = left.ex_flt; \
- rp = right.ex_vec; \
- op = optr->ex_vec; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC(scalar, OPR, *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad right type %ld\n", \
- __LINE__, right.ex_type); \
- nullret = 1; \
- } \
- break; \
-case ET_VEC: \
-case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left.ex_vec; \
- switch(right.ex_type) { \
- case ET_INT: \
- scalar = right.ex_int; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC(*lp, OPR, scalar); \
- lp++; \
- } \
- break; \
- case ET_FLT: \
- scalar = right.ex_flt; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC(*lp, OPR, scalar); \
- lp++; \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- rp = right.ex_vec; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- /* \
- * on a RISC processor one could copy \
- * 8 times in each round to get a considerable \
- * improvement \
- */ \
- *op++ = DZC(*lp, OPR, *rp); \
- rp++; lp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad right type %ld\n", \
- __LINE__, right.ex_type); \
- nullret = 1; \
- } \
- break; \
-case ET_SYM: \
-default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad left type %ld\n", \
- __LINE__, left.ex_type); \
-} \
-break;
-
-/*
- * evaluate a unary operator, TYPE is applied to float operands
- */
-#define EVAL_UNARY(OPR, TYPE) \
- eptr = ex_eval(expr, eptr, &left, idx); \
- switch(left.ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec,(t_float)(OPR left.ex_int),\
- expr->exp_vsize);\
- break; \
- } \
- optr->ex_type = ET_INT; \
- optr->ex_int = OPR left.ex_int; \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec, OPR (TYPE left.ex_flt),\
- expr->exp_vsize);\
- break; \
- } \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = OPR (TYPE left.ex_flt); \
- break; \
- case ET_VI: \
- case ET_VEC: \
- j = expr->exp_vsize; \
- if (optr->ex_type != ET_VEC) { \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left.ex_vec; \
- j = expr->exp_vsize; \
- for (i = 0; i < j; i++) \
- *op++ = OPR (TYPE *lp++); \
- break; \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad left type %ld\n", \
- __LINE__, left.ex_type); \
- nullret++; \
- } \
- break;
-
-void
-ex_mkvector(t_float *fp, t_float x, int size)
-{
- while (size--)
- *fp++ = x;
-}
-
-/*
- * ex_dzdetect -- divide by zero detected
- */
-void
-ex_dzdetect(struct expr *expr)
-{
- char *etype;
-
- if (!expr->exp_error & EE_DZ) {
- if (IS_EXPR(expr))
- etype = "expr";
- else if (IS_EXPR_TILDE(expr))
- etype = "expr~";
- else if (IS_FEXPR_TILDE(expr))
- etype = "fexpr~";
- else {
- post ("expr -- ex_dzdetect internal error");
- etype = "";
- }
- post ("%s divide by zero detected", etype);
- expr->exp_error |= EE_DZ;
- }
-}
-
-
-/*
- * ex_eval -- evaluate the array of prefix expression
- * ex_eval returns the pointer to the first unevaluated node
- * in the array. This is a recursive routine.
- */
-
-/* SDY
-all the returns in this function need to be changed so that the code
-ends up at the end to check for newly allocated right and left vectors which
-need to be freed
-
-look into the variable nullret
-*/
-struct ex_ex *
-ex_eval(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-/* the sample numnber processed for fexpr~ */
-{
- int i, j;
- t_float *lp, *rp, *op; /* left, right, and out pointer to vectors */
- t_float scalar;
- int nullret = 0; /* did we have an error */
- struct ex_ex left, right; /* left and right operands */
-
- left.ex_type = 0;
- left.ex_int = 0;
- right.ex_type = 0;
- right.ex_int = 0;
-
- if (!eptr)
- return (exNULL);
- switch (eptr->ex_type) {
- case ET_INT:
- if (optr->ex_type == ET_VEC)
- ex_mkvector(optr->ex_vec, (t_float) eptr->ex_int,
- expr->exp_vsize);
- else
- *optr = *eptr;
- return (++eptr);
-
- case ET_FLT:
-
- if (optr->ex_type == ET_VEC)
- ex_mkvector(optr->ex_vec, eptr->ex_flt, expr->exp_vsize);
- else
- *optr = *eptr;
- return (++eptr);
-
- case ET_SYM:
- if (optr->ex_type == ET_VEC) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: cannot turn string to vector\n");
- return (exNULL);
- }
- *optr = *eptr;
- return (++eptr);
- case ET_II:
- if (eptr->ex_int == -1) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: inlet number not set\n");
- return (exNULL);
- }
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec,
- (t_float)expr->exp_var[eptr->ex_int].ex_int,
- expr->exp_vsize);
- } else {
- optr->ex_type = ET_INT;
- optr->ex_int = expr->exp_var[eptr->ex_int].ex_int;
- }
- return (++eptr);
- case ET_FI:
- if (eptr->ex_int == -1) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: inlet number not set\n");
- return (exNULL);
- }
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec,
- expr->exp_var[eptr->ex_int].ex_flt, expr->exp_vsize);
- } else {
- optr->ex_type = ET_FLT;
- optr->ex_flt = expr->exp_var[eptr->ex_int].ex_flt;
- }
- return (++eptr);
-
- case ET_VSYM:
- if (optr->ex_type == ET_VEC) {
- post_error((fts_object_t *) expr,
- "expr: IntErr. vsym in for vec out\n");
- return (exNULL);
- }
- if (eptr->ex_int == -1) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: inlet number not set\n");
- return (exNULL);
- }
- optr->ex_type = ET_SYM;
- optr->ex_ptr = expr->exp_var[eptr->ex_int].ex_ptr;
- return(++eptr);
-
- case ET_VI:
- if (optr->ex_type != ET_VEC)
- *optr = expr->exp_var[eptr->ex_int];
- else if (optr->ex_vec != expr->exp_var[eptr->ex_int].ex_vec)
- memcpy(optr->ex_vec, expr->exp_var[eptr->ex_int].ex_vec,
- expr->exp_vsize * sizeof (t_float));
- return(++eptr);
- case ET_VEC:
- if (optr->ex_type != ET_VEC) {
- optr->ex_type = ET_VEC;
- optr->ex_vec = eptr->ex_vec;
- eptr->ex_type = ET_INT;
- eptr->ex_int = 0;
- } else if (optr->ex_vec != eptr->ex_vec) {
- memcpy(optr->ex_vec, eptr->ex_vec,
- expr->exp_vsize * sizeof (t_float));
-/* do we need to free here? or can we free higher up */
-/* SDY the next lines do not make sense */
-post("calling fts_free\n");
-abort();
- fts_free(optr->ex_vec);
- optr->ex_type = ET_INT;
- eptr->ex_int = 0;
- } else { /* this should not happen */
- post("expr int. error, optr->ex_vec = %d",optr->ex_vec);
- abort();
- }
- return(++eptr);
- case ET_XI0:
- /* short hand for $x?[0] */
-
- /* SDY delete the following check */
- if (!IS_FEXPR_TILDE(expr) || optr->ex_type==ET_VEC) {
- post("%d:exp->exp_flags = %d", __LINE__,expr->exp_flags);
- abort();
- }
- optr->ex_type = ET_FLT;
- optr->ex_flt = expr->exp_var[eptr->ex_int].ex_vec[idx];
- return(++eptr);
- case ET_YOM1:
- /*
- * short hand for $y?[-1]
- * if we are calculating the first sample of the vector
- * we need to look at the previous results buffer
- */
- optr->ex_type = ET_FLT;
- if (idx == 0)
- optr->ex_flt =
- expr->exp_p_res[eptr->ex_int][expr->exp_vsize - 1];
- else
- optr->ex_flt=expr->exp_tmpres[eptr->ex_int][idx-1];
- return(++eptr);
-
- case ET_YO:
- case ET_XI:
- /* SDY delete the following */
- if (!IS_FEXPR_TILDE(expr) || optr->ex_type==ET_VEC) {
- post("%d:expr->exp_flags = %d", __LINE__,expr->exp_flags);
- abort();
- }
- return (eval_sigidx(expr, eptr, optr, idx));
-
- case ET_TBL:
- case ET_SI:
- return (eval_tab(expr, eptr, optr, idx));
- case ET_FUNC:
- return (eval_func(expr, eptr, optr, idx));
- case ET_VAR:
- return (eval_var(expr, eptr, optr, idx));
- case ET_OP:
- break;
- case ET_STR:
- case ET_LP:
- case ET_LB:
- default:
- post_error((fts_object_t *) expr,
- "expr: ex_eval: unexpected type %d\n", eptr->ex_type);
- return (exNULL);
- }
- if (!eptr[1].ex_type) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: not enough nodes 1\n");
- return (exNULL);
- }
- if (!unary_op(eptr->ex_op) && !eptr[2].ex_type) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: not enough nodes 2\n");
- return (exNULL);
- }
-
- switch((eptr++)->ex_op) {
- case OP_STORE:
- return (eval_store(expr, eptr, optr, idx));
- case OP_NOT:
- EVAL_UNARY(!, +);
- case OP_NEG:
- EVAL_UNARY(~, (long));
- case OP_UMINUS:
- EVAL_UNARY(-, +);
- case OP_MUL:
- EVAL(*);
- case OP_ADD:
- EVAL(+);
- case OP_SUB:
- EVAL(-);
- case OP_LT:
- EVAL(<);
- case OP_LE:
- EVAL(<=);
- case OP_GT:
- EVAL(>);
- case OP_GE:
- EVAL(>=);
- case OP_EQ:
- EVAL(==);
- case OP_NE:
- EVAL(!=);
-/*
- * following operators convert their argument to integer
- */
-#undef DZC
-#define DZC(ARG1,OPR,ARG2) (((int)ARG1) OPR ((int)ARG2))
- case OP_SL:
- EVAL(<<);
- case OP_SR:
- EVAL(>>);
- case OP_AND:
- EVAL(&);
- case OP_XOR:
- EVAL(^);
- case OP_OR:
- EVAL(|);
- case OP_LAND:
- EVAL(&&);
- case OP_LOR:
- EVAL(||);
-/*
- * for modulo we need to convert to integer and check for divide by zero
- */
-#undef DZC
-#define DZC(ARG1,OPR,ARG2) (((ARG2)?(((int)ARG1) OPR ((int)ARG2)) \
- : (ex_dzdetect(expr),0)))
- case OP_MOD:
- EVAL(%);
-/*
- * define the divide by zero check for divide
- */
-#undef DZC
-#define DZC(ARG1,OPR,ARG2) (((ARG2)?(ARG1 OPR ARG2):(ex_dzdetect(expr),0)))
- case OP_DIV:
- EVAL(/);
- case OP_LP:
- case OP_RP:
- case OP_LB:
- case OP_RB:
- case OP_COMMA:
- case OP_SEMI:
- default:
- post_error((fts_object_t *) expr, "expr: ex_print: bad op 0x%x\n", eptr->ex_op);
- return (exNULL);
- }
-
-
- /*
- * the left and right nodes could have been transformed to vectors
- * down the chain
- */
- if (left.ex_type == ET_VEC)
- fts_free(left.ex_vec);
- if (right.ex_type == ET_VEC)
- fts_free(right.ex_vec);
- if (nullret)
- return (exNULL);
- else
- return (eptr);
-}
-
-/*
- * eval_func -- evaluate a function, call ex_eval() on all the arguments
- * so that all of them are terminal nodes. The call the
- * appropriate function
- */
-struct ex_ex *
-eval_func(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-{
- int i;
- struct ex_ex args[MAX_ARGS];
- t_ex_func *f;
-
- f = (t_ex_func *)(eptr++)->ex_ptr;
- if (!f || !f->f_name) {
- return (exNULL);
- }
- if (f->f_argc > MAX_ARGS) {
- post_error((fts_object_t *) expr, "expr: eval_func: asking too many arguments\n");
- return (exNULL);
- }
-
- for (i = 0; i < f->f_argc; i++) {
- args[i].ex_type = 0;
- args[i].ex_int = 0;
- eptr = ex_eval(expr, eptr, &args[i], idx);
- }
- (*f->f_func)(expr, f->f_argc, args, optr);
- for (i = 0; i < f->f_argc; i++) {
- if (args[i].ex_type == ET_VEC)
- fts_free(args[i].ex_vec);
- }
- return (eptr);
-}
-
-
-/*
- * eval_store -- evaluate the '=' operator,
- * make sure the first operator is a legal left operator
- * and call ex_eval on the right operator
- */
-struct ex_ex *
-eval_store(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-{
- struct ex_ex arg;
- int isvalue;
- char *tbl = (char *) 0;
- char *var = (char *) 0;
- int badleft = 0;
-
-post("store called\n");
-ex_print(eptr);
-eptr = ex_eval(expr, ++eptr, optr, idx);
-return (eptr);
-
-#ifdef notdef /* SDY */
- arg.ex_type = ET_INT;
- arg.ex_int = 0;
- if (eptr->ex_type == ET_VAR) {
- var = (char *) eptr->ex_ptr;
-
- eptr = ex_eval(expr, ++eptr, &arg, idx);
- (void)max_ex_var_store(expr, (t_symbol *)var, &arg, optr);
- if (arg.ex_type == ET_VEC)
- fts_free(arg.ex_vec);
- }
-
-
- if (eptr->ex_type == ET_SI) {
- eptr++;
- if (eptr->ex_type =
- }
-
- /* the left operator should either be a value or a array member */
- switch (eptr->ex_type) {
- case ET_SI:
- if ((eptr + 1)->ex_type == OP_LB) {
- }
- if (!expr->exp_var[eptr->ex_int].ex_ptr) {
- if (!(expr->exp_error & EE_NOTABLE)) {
- post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
- post("expr: No more table errors will be reported");
- post("expr: till the next reset");
- expr->exp_error |= EE_NOTABLE;
- }
- badleft++;
- } else
- tbl = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
- break;
- case ET_TBL:
- }
-#endif /* SDY */
-}
-
-/*
- * eval_tab -- evaluate a table operation
- */
-struct ex_ex *
-eval_tab(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-{
- struct ex_ex arg;
- char *tbl = (char *) 0;
- int notable = 0;
-
- if (eptr->ex_type == ET_SI) {
- if (!expr->exp_var[eptr->ex_int].ex_ptr) {
-/* SDY post_error() does not work in MAX/MSP yet
- post_error((fts_object_t *) expr,
- "expr: syntax error: no string for inlet %d\n", eptr->ex_int + 1);
-*/
- if (!(expr->exp_error & EE_NOTABLE)) {
- post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
- post("expr: No more table errors will be reported");
- post("expr: till the next reset");
- expr->exp_error |= EE_NOTABLE;
- }
- notable++;
- } else
- tbl = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
- } else if (eptr->ex_type == ET_TBL)
- tbl = (char *) eptr->ex_ptr;
- else {
- post_error((fts_object_t *) expr, "expr: eval_tbl: bad type %ld\n", eptr->ex_type);
- notable++;
-
- }
- arg.ex_type = 0;
- arg.ex_int = 0;
- eptr = ex_eval(expr, ++eptr, &arg, idx);
-
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- if (!notable)
- (void)max_ex_tab(expr, (t_symbol *)tbl, &arg, optr);
- if (arg.ex_type == ET_VEC)
- fts_free(arg.ex_vec);
- return (eptr);
-}
-
-/*
- * eval_var -- evaluate a variable
- */
-struct ex_ex *
-eval_var(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-{
- struct ex_ex arg;
- char *var = (char *) 0;
- int novar = 0;
-
- if (eptr->ex_type == ET_SI) {
- if (!expr->exp_var[eptr->ex_int].ex_ptr) {
-/* SDY post_error() does not work in MAX/MSP yet
-post_error((fts_object_t *) expr,
-"expr: syntax error: no string for inlet %d\n", eptr->ex_int + 1);
-*/
- if (!(expr->exp_error & EE_NOVAR)) {
- post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
- post("expr: No more table errors will be reported");
- post("expr: till the next reset");
- expr->exp_error |= EE_NOVAR;
- }
- novar++;
- } else
- var = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
- } else if (eptr->ex_type == ET_VAR)
- var = (char *) eptr->ex_ptr;
- else {
- post_error((fts_object_t *) expr, "expr: eval_tbl: bad type %ld\n", eptr->ex_type);
- novar++;
-
- }
-
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- if (!novar)
- (void)max_ex_var(expr, (t_symbol *)var, optr);
- return (++eptr);
-}
-
-/*
- * eval_sigidx -- evaluate the value of an indexed signal for fexpr~
- */
-struct ex_ex *
-eval_sigidx(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
-/* the expr object data pointer */
-/* the operation stack */
-/* the result pointer */
-/* the index */
-{
- struct ex_ex arg;
- struct ex_ex *reteptr;
- int i = 0, j = 0;
- t_float fi = 0, /* index in float */
- rem_i = 0; /* remains of the float */
- char *tbl;
-
- arg.ex_type = 0;
- arg.ex_int = 0;
- reteptr = ex_eval(expr, eptr + 1, &arg, idx);
- if (arg.ex_type == ET_FLT) {
- fi = arg.ex_flt; /* float index */
- i = (int) arg.ex_flt; /* integer index */
- rem_i = arg.ex_flt - i; /* remains of integer */
- } else if (arg.ex_type == ET_INT) {
- fi = arg.ex_int; /* float index */
- i = arg.ex_int;
- rem_i = 0;
- } else {
- post("eval_sigidx: bad res type (%d)", arg.ex_type);
- }
- optr->ex_type = ET_FLT;
- /*
- * indexing an input vector
- */
- if (eptr->ex_type == ET_XI) {
- if (fi > 0) {
- if (!(expr->exp_error & EE_BI_INPUT)) {
- expr->exp_error |= EE_BI_INPUT;
- post("expr: input vector index > 0, (vector x%d[%f])",
- eptr->ex_int + 1, i + rem_i);
- post("fexpr~: index assumed to be = 0");
- post("fexpr~: no error report till next reset");
- ex_print(eptr);
- }
- /* just replace it with zero */
- i = 0;
- rem_i = 0;
- }
- if (cal_sigidx(optr, i, rem_i, idx, expr->exp_vsize,
- expr->exp_var[eptr->ex_int].ex_vec,
- expr->exp_p_var[eptr->ex_int])) {
- if (!(expr->exp_error & EE_BI_INPUT)) {
- expr->exp_error |= EE_BI_INPUT;
- post("expr: input vector index < -VectorSize, (vector x%d[%f])", eptr->ex_int + 1, fi);
- ex_print(eptr);
- post("fexpr~: index assumed to be = -%d",
- expr->exp_vsize);
- post("fexpr~: no error report till next reset");
- }
- }
-
- /*
- * indexing an output vector
- */
- } else if (eptr->ex_type == ET_YO) {
- /* for output vectors index of zero is not legal */
- if (fi >= 0) {
- if (!(expr->exp_error & EE_BI_OUTPUT)) {
- expr->exp_error |= EE_BI_OUTPUT;
- post("fexpr~: bad output index, (%f)", fi);
- ex_print(eptr);
- post("fexpr~: no error report till next reset");
- post("fexpr~: index assumed to be = -1");
- }
- i = -1;
- }
- if (eptr->ex_int >= expr->exp_nexpr) {
- post("fexpr~: $y%d illegal: not that many exprs",
- eptr->ex_int);
- optr->ex_flt = 0;
- return (reteptr);
- }
- if (cal_sigidx(optr, i, rem_i, idx, expr->exp_vsize,
- expr->exp_tmpres[eptr->ex_int],
- expr->exp_p_res[eptr->ex_int])) {
- if (!(expr->exp_error & EE_BI_OUTPUT)) {
- expr->exp_error |= EE_BI_OUTPUT;
- post("fexpr~: bad output index, (%f)", fi);
- ex_print(eptr);
- post("fexpr~: index assumed to be = -%d",
- expr->exp_vsize);
- }
- }
- } else {
- optr->ex_flt = 0;
- post("fexpr~:eval_sigidx: internal error - unknown vector (%d)",
- eptr->ex_type);
- }
- return (reteptr);
-}
-
-/*
- * cal_sigidx -- given two tables (one current one previous) calculate an
- * evaluation of a float index into the vectors by linear
- * interpolation
- * return 0 on success, 1 on failure (index out of bound)
- */
-static int
-cal_sigidx(struct ex_ex *optr, /* The output value */
- int i, t_float rem_i,/* integer and fractinal part of index */
- int idx, /* index of current fexpr~ processing */
- int vsize, /* vector size */
- t_float *curvec, t_float *prevec) /* current and previous table */
-{
- int n;
-
- n = i + idx;
- if (n > 0) {
- /* from the curvec */
- if (rem_i)
- optr->ex_flt = curvec[n] +
- rem_i * (curvec[n] - curvec[n - 1]);
- else
- optr->ex_flt = curvec[n];
- return (0);
- }
- if (n == 0) {
- /*
- * this is the case that the remaining float
- * is between two tables
- */
- if (rem_i)
- optr->ex_flt = *curvec +
- rem_i * (*curvec - prevec[vsize - 1]);
- else
- optr->ex_flt = *curvec;
- return (0);
- }
- /* find the index in the saved buffer */
- n = vsize + n;
- if (n > 0) {
- if (rem_i)
- optr->ex_flt = prevec[n] +
- rem_i * (prevec[n] - prevec[n - 1]);
- else
- optr->ex_flt = prevec[n];
- return (0);
- }
- /* out of bound */
- optr->ex_flt = *prevec;
- return (1);
-}
-
-/*
- * getoken -- return 1 on syntax error otherwise 0
- */
-int
-getoken(struct expr *expr, struct ex_ex *eptr)
-{
- char *p;
- long i;
-
-
- if (!expr->exp_str) {
- post("expr: getoken: expression string not set\n");
- return (0);
- }
-retry:
- if (!*expr->exp_str) {
- eptr->ex_type = 0;
- eptr->ex_int = 0;
- return (0);
- }
- if (*expr->exp_str == ';') {
- expr->exp_str++;
- eptr->ex_type = 0;
- eptr->ex_int = 0;
- return (0);
- }
- eptr->ex_type = ET_OP;
- switch (*expr->exp_str++) {
- case '\\':
- case ' ':
- case '\t':
- goto retry;
- case ';':
- post("expr: syntax error: ';' not implemented\n");
- return (1);
- case ',':
- eptr->ex_op = OP_COMMA;
- break;
- case '(':
- eptr->ex_op = OP_LP;
- break;
- case ')':
- eptr->ex_op = OP_RP;
- break;
- case ']':
- eptr->ex_op = OP_RB;
- break;
- case '~':
- eptr->ex_op = OP_NEG;
- break;
- /* we will take care of unary minus later */
- case '*':
- eptr->ex_op = OP_MUL;
- break;
- case '/':
- eptr->ex_op = OP_DIV;
- break;
- case '%':
- eptr->ex_op = OP_MOD;
- break;
- case '+':
- eptr->ex_op = OP_ADD;
- break;
- case '-':
- eptr->ex_op = OP_SUB;
- break;
- case '^':
- eptr->ex_op = OP_XOR;
- break;
- case '[':
- eptr->ex_op = OP_LB;
- break;
- case '!':
- if (*expr->exp_str == '=') {
- eptr->ex_op = OP_NE;
- expr->exp_str++;
- } else
- eptr->ex_op = OP_NOT;
- break;
- case '<':
- switch (*expr->exp_str) {
- case '<':
- eptr->ex_op = OP_SL;
- expr->exp_str++;
- break;
- case '=':
- eptr->ex_op = OP_LE;
- expr->exp_str++;
- break;
- default:
- eptr->ex_op = OP_LT;
- break;
- }
- break;
- case '>':
- switch (*expr->exp_str) {
- case '>':
- eptr->ex_op = OP_SR;
- expr->exp_str++;
- break;
- case '=':
- eptr->ex_op = OP_GE;
- expr->exp_str++;
- break;
- default:
- eptr->ex_op = OP_GT;
- break;
- }
- break;
- case '=':
- if (*expr->exp_str++ != '=') {
- post("expr: syntax error: =\n");
- return (1);
- }
- eptr->ex_op = OP_EQ;
- break;
-/* do not allow the store till the function is fixed
- if (*expr->exp_str != '=')
- eptr->ex_op = OP_STORE;
- else {
- expr->exp_str++;
- eptr->ex_op = OP_EQ;
- }
- break;
-*/
-
- case '&':
- if (*expr->exp_str == '&') {
- expr->exp_str++;
- eptr->ex_op = OP_LAND;
- } else
- eptr->ex_op = OP_AND;
- break;
-
- case '|':
- if ((*expr->exp_str == '|')) {
- expr->exp_str++;
- eptr->ex_op = OP_LOR;
- } else
- eptr->ex_op = OP_OR;
- break;
- case '$':
- switch (*expr->exp_str++) {
- case 'I':
- case 'i':
- eptr->ex_type = ET_II;
- break;
- case 'F':
- case 'f':
- eptr->ex_type = ET_FI;
- break;
- case 'S':
- case 's':
- eptr->ex_type = ET_SI;
- break;
- case 'V':
- case 'v':
- if (IS_EXPR_TILDE(expr)) {
- eptr->ex_type = ET_VI;
- break;
- }
- post("$v? works only for expr~");
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- case 'X':
- case 'x':
- if (IS_FEXPR_TILDE(expr)) {
- eptr->ex_type = ET_XI;
- if (isdigit(*expr->exp_str))
- break;
- /* for $x[] is a shorhand for $x1[] */
- eptr->ex_int = 0;
- goto noinletnum;
- }
- post("$x? works only for fexpr~");
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- case 'y':
- case 'Y':
- if (IS_FEXPR_TILDE(expr)) {
- eptr->ex_type = ET_YO;
- /*$y takes no number */
- if (isdigit(*expr->exp_str))
- break;
- /* for $y[] is a shorhand for $y1[] */
- eptr->ex_int = 0;
- goto noinletnum;
- }
- post("$y works only for fexpr~");
- default:
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- }
- p = atoif(expr->exp_str, &eptr->ex_op, &i);
- if (!p) {
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- }
- if (i != ET_INT) {
- post("expr: syntax error: %s\n", expr->exp_str);
- return (1);
- }
- /*
- * make the user inlets one based rather than zero based
- * therefore we decrement the number that user has supplied
- */
- if (!eptr->ex_op || (eptr->ex_op)-- > MAX_VARS) {
- post("expr: syntax error: inlet or outlet out of range: %s\n",
- expr->exp_str);
- return (1);
- }
-
- /*
- * until we can change the input type of inlets on
- * the fly (at pd_new()
- * time) the first input to expr~ is always a vectore
- * and $f1 or $i1 is
- * illegal for fexr~
- */
- if (eptr->ex_op == 0 &&
- (IS_FEXPR_TILDE(expr) || IS_EXPR_TILDE(expr)) &&
- (eptr->ex_type==ET_II || eptr->ex_type==ET_FI ||
- eptr->ex_type==ET_SI)) {
- post("first inlet of expr~/fexpr~ can only be a vector");
- return (1);
- }
- /* record the inlet or outlet type and check for consistency */
- if (eptr->ex_type == ET_YO ) {
- /* it is an outlet for fexpr~*/
- /* no need to do anything */
- ;
- } else if (!expr->exp_var[eptr->ex_op].ex_type)
- expr->exp_var[eptr->ex_op].ex_type = eptr->ex_type;
- else if (expr->exp_var[eptr->ex_op].ex_type != eptr->ex_type) {
- post("expr: syntax error: inlets can only have one type: %s\n", expr->exp_str);
- return (1);
- }
- expr->exp_str = p;
-noinletnum:
- break;
- case '"':
- {
- struct ex_ex ex;
-
- p = expr->exp_str;
- if (!*expr->exp_str || *expr->exp_str == '"') {
- post("expr: syntax error: empty symbol: %s\n", --expr->exp_str);
- return (1);
- }
- if (getoken(expr, &ex))
- return (1);
- switch (ex.ex_type) {
- case ET_STR:
- if (ex_getsym(ex.ex_ptr, (t_symbol **)&(eptr->ex_ptr))) {
- post("expr: syntax error: getoken: problms with ex_getsym\n");
- return (1);
- }
- eptr->ex_type = ET_SYM;
- break;
- case ET_SI:
- *eptr = ex;
- eptr->ex_type = ET_VSYM;
- break;
- default:
- post("expr: syntax error: bad symbol name: %s\n", p);
- return (1);
- }
- if (*expr->exp_str++ != '"') {
- post("expr: syntax error: missing '\"'\n");
- return (1);
- }
- break;
- }
- case '.':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- p = atoif(--expr->exp_str, &eptr->ex_int, &eptr->ex_type);
- if (!p)
- return (1);
- expr->exp_str = p;
- break;
-
- default:
- /*
- * has to be a string, it should either be a
- * function or a table
- */
- p = --expr->exp_str;
- for (i = 0; name_ok(*p); i++)
- p++;
- if (!i) {
- post("expr: syntax error: %s\n", expr->exp_str);
- return (1);
- }
- eptr->ex_ptr = (char *)fts_malloc(i + 1);
- strncpy(eptr->ex_ptr, expr->exp_str, (int) i);
- (eptr->ex_ptr)[i] = 0;
- expr->exp_str = p;
- /*
- * we mark this as a string and later we will change this
- * to either a function or a table
- */
- eptr->ex_type = ET_STR;
- break;
- }
- return (0);
-}
-
-/*
- * atoif -- ascii to float or integer (understands hex numbers also)
- */
-char *
-atoif(char *s, long int *value, long int *type)
-{
- char *p;
- long int_val = 0;
- int flt = 0;
- t_float pos = 0;
- t_float flt_val = 0;
- int base = 10;
-
- p = s;
- if (*p == '0' && (p[1] == 'x' || p[1] == 'X')) {
- base = 16;
- p += 2;
- }
- while (8) {
- switch (*p) {
- case '.':
- if (flt || base != 10) {
- post("expr: syntax error: %s\n", s);
- return ((char *) 0);
- }
- flt++;
- pos = 10;
- flt_val = int_val;
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (flt) {
- flt_val += (*p - '0') / pos;
- pos *= 10;
- } else {
- int_val *= base;
- int_val += (*p - '0');
- }
- break;
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- if (base != 16 || flt) {
- post("expr: syntax error: %s\n", s);
- return ((char *) 0);
- }
- int_val *= base;
- int_val += (*p - 'a' + 10);
- break;
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- if (base != 16 || flt) {
- post("expr: syntax error: %s\n", s);
- return ((char *) 0);
- }
- int_val *= base;
- int_val += (*p - 'A' + 10);
- break;
- default:
- if (flt) {
- *type = ET_FLT;
- *((t_float *) value) = flt_val;
- } else {
- *type = ET_INT;
- *value = int_val;
- }
- return (p);
- }
- p++;
- }
-}
-
-/*
- * find_func -- returns a pointer to the found function structure
- * otherwise it returns 0
- */
-t_ex_func *
-find_func(char *s)
-{
- t_ex_func *f;
-
- for (f = ex_funcs; f->f_name; f++)
- if (!strcmp(f->f_name, s))
- return (f);
- return ((t_ex_func *) 0);
-}
-
-
-/*
- * ex_print -- print an expression array
- */
-
-void
-ex_print(struct ex_ex *eptr)
-{
-
- while (eptr->ex_type) {
- switch (eptr->ex_type) {
- case ET_INT:
- post("%ld ", eptr->ex_int);
- break;
- case ET_FLT:
- post("%f ", eptr->ex_flt);
- break;
- case ET_STR:
- post("%s ", eptr->ex_ptr);
- break;
- case ET_TBL:
- case ET_VAR:
- post("%s ", ex_symname((fts_symbol_t )eptr->ex_ptr));
- break;
- case ET_SYM:
- post("\"%s\" ", ex_symname((fts_symbol_t )eptr->ex_ptr));
- break;
- case ET_VSYM:
- post("\"$s%ld\" ", eptr->ex_int + 1);
- break;
- case ET_FUNC:
- post("%s ",
- ((t_ex_func *)eptr->ex_ptr)->f_name);
- break;
- case ET_LP:
- post("%c", '(');
- break;
- /* CHANGE
- case ET_RP:
- post("%c ", ')');
- break;
- */
- case ET_LB:
- post("%c", '[');
- break;
- /* CHANGE
- case ET_RB:
- post("%c ", ']');
- break;
- */
- case ET_II:
- post("$i%ld ", eptr->ex_int + 1);
- break;
- case ET_FI:
- post("$f%ld ", eptr->ex_int + 1);
- break;
- case ET_SI:
- post("$s%lx ", eptr->ex_ptr);
- break;
- case ET_VI:
- post("$v%lx ", eptr->ex_vec);
- break;
- case ET_VEC:
- post("vec = %ld ", eptr->ex_vec);
- break;
- case ET_YOM1:
- case ET_YO:
- post("$y%d", eptr->ex_int + 1);
- break;
- case ET_XI:
- case ET_XI0:
- post("$x%d", eptr->ex_int + 1);
- break;
- case ET_OP:
- switch (eptr->ex_op) {
- case OP_LP:
- post("%c", '(');
- break;
- case OP_RP:
- post("%c ", ')');
- break;
- case OP_LB:
- post("%c", '[');
- break;
- case OP_RB:
- post("%c ", ']');
- break;
- case OP_NOT:
- post("%c", '!');
- break;
- case OP_NEG:
- post("%c", '~');
- break;
- case OP_UMINUS:
- post("%c", '-');
- break;
- case OP_MUL:
- post("%c", '*');
- break;
- case OP_DIV:
- post("%c", '/');
- break;
- case OP_MOD:
- post("%c", '%');
- break;
- case OP_ADD:
- post("%c", '+');
- break;
- case OP_SUB:
- post("%c", '-');
- break;
- case OP_SL:
- post("%s", "<<");
- break;
- case OP_SR:
- post("%s", ">>");
- break;
- case OP_LT:
- post("%c", '<');
- break;
- case OP_LE:
- post("%s", "<=");
- break;
- case OP_GT:
- post("%c", '>');
- break;
- case OP_GE:
- post("%s", ">=");
- break;
- case OP_EQ:
- post("%s", "==");
- break;
- case OP_STORE:
- post("%s", "=");
- break;
- case OP_NE:
- post("%s", "!=");
- break;
- case OP_AND:
- post("%c", '&');
- break;
- case OP_XOR:
- post("%c", '^');
- break;
- case OP_OR:
- post("%c", '|');
- break;
- case OP_LAND:
- post("%s", "&&");
- break;
- case OP_LOR:
- post("%s", "||");
- break;
- case OP_COMMA:
- post("%c", ',');
- break;
- case OP_SEMI:
- post("%c", ';');
- break;
- default:
- post("expr: ex_print: bad op 0x%lx\n", eptr->ex_op);
- }
- break;
- default:
- post("expr: ex_print: bad type 0x%lx\n", eptr->ex_type);
- }
- eptr++;
- }
- post("\n");
-}
-
-#ifdef _WIN32
-void ABORT( void) {bug("expr");}
-#endif
diff --git a/externals/extra/0.43.3/expr~/vexp.h b/externals/extra/0.43.3/expr~/vexp.h
deleted file mode 100644
index df5547ea..00000000
--- a/externals/extra/0.43.3/expr~/vexp.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * jMax
- * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * See file LICENSE for further informations on licensing terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Based on Max/ISPW by Miller Puckette.
- *
- * Authors: Maurizio De Cecco, Francois Dechelle, Enzo Maggi, Norbert Schnell.
- *
- */
-
-/* "expr" was written by Shahrokh Yadegari c. 1989. -msp */
-/* "expr~" and "fexpr~" conversion by Shahrokh Yadegari c. 1999,2000 */
-
-#define MSP
-#ifdef PD
-#undef MSP
-#endif
-
-#ifdef PD
-#include "m_pd.h"
-#else /* MSP */
-#include "ext.h"
-#include "z_dsp.h"
-#endif
-
-#include "fts_to_pd.h"
-/* This is put in fts_to_pd.h
-
-#ifdef MSP
-#define t_atom Atom
-#define t_symbol Symbol
-#define pd_new(x) newobject(x);
-#define t_outlet void
-#endif
-*/
-
-/*
- * Currently the maximum number of variables (inlets) that are supported
- * is 10.
- */
-
-#define MAX_VARS 9
-#define MINODES 10 /* was 200 */
-
-/* terminal defines */
-
-/*
- * operations
- * (x<<16|y) x defines the level of precedence,
- * the lower the number the lower the precedence
- * separators are defines as operators just for convenience
- */
-
-#define OP_SEMI ((long)(1<<16|1)) /* ; */
-#define OP_COMMA ((long)(2<<16|2)) /* , */
-#define OP_LOR ((long)(3<<16|3)) /* || */
-#define OP_LAND ((long)(4<<16|4)) /* && */
-#define OP_OR ((long)(5<<16|5)) /* | */
-#define OP_XOR ((long)(6<<16|6)) /* ^ */
-#define OP_AND ((long)(7<<16|7)) /* & */
-#define OP_NE ((long)(8<<16|8)) /* != */
-#define OP_EQ ((long)(8<<16|9)) /* == */
-#define OP_GE ((long)(9<<16|10)) /* >= */
-#define OP_GT ((long)(9<<16|11)) /* > */
-#define OP_LE ((long)(9<<16|12)) /* <= */
-#define OP_LT ((long)(9<<16|13)) /* < */
-#define OP_SR ((long)(10<<16|14)) /* >> */
-#define OP_SL ((long)(10<<16|15)) /* << */
-#define OP_SUB ((long)(11<<16|16)) /* - */
-#define OP_ADD ((long)(11<<16|17)) /* + */
-#define OP_MOD ((long)(12<<16|18)) /* % */
-#define OP_DIV ((long)(12<<16|19)) /* / */
-#define OP_MUL ((long)(12<<16|20)) /* * */
-#define OP_UMINUS ((long)(13<<16|21)) /* - unary minus */
-#define OP_NEG ((long)(13<<16|22)) /* ~ one complement */
-#define OP_NOT ((long)(13<<16|23)) /* ! */
-#define OP_RB ((long)(14<<16|24)) /* ] */
-#define OP_LB ((long)(14<<16|25)) /* [ */
-#define OP_RP ((long)(14<<16|26)) /* ) */
-#define OP_LP ((long)(14<<16|27)) /* ( */
-#define OP_STORE ((long)(15<<16|28)) /* = */
-#define HI_PRE ((long)(100<<16)) /* infinite precedence */
-#define PRE_MASK ((long)0xffff0000) /* precedence level mask */
-
-struct ex_ex;
-
-#define name_ok(c) (((c)=='_') || ((c)>='a' && (c)<='z') || \
- ((c)>='A' && (c)<='Z') || ((c) >= '0' && (c) <= '9'))
-#define unary_op(x) ((x) == OP_NOT || (x) == OP_NEG || (x) == OP_UMINUS)
-
-struct ex_ex {
- union {
- long v_int;
- t_float v_flt;
- t_float *v_vec; /* this is an for allocated vector */
- long op;
- char *ptr;
- } ex_cont; /* content */
-#define ex_int ex_cont.v_int
-#define ex_flt ex_cont.v_flt
-#define ex_vec ex_cont.v_vec
-#define ex_op ex_cont.op
-#define ex_ptr ex_cont.ptr
- long ex_type; /* type of the node */
-};
-#define exNULL ((struct ex_ex *)0)
-
-/* defines for ex_type */
-#define ET_INT 1 /* an int */
-#define ET_FLT 2 /* a float */
-#define ET_OP 3 /* operator */
-#define ET_STR 4 /* string */
-#define ET_TBL 5 /* a table, the content is a pointer */
-#define ET_FUNC 6 /* a function */
-#define ET_SYM 7 /* symbol ("string") */
-#define ET_VSYM 8 /* variable symbol ("$s?") */
- /* we treat parenthesis and brackets */
- /* special to keep a pointer to their */
- /* match in the content */
-#define ET_LP 9 /* left parenthesis */
-#define ET_LB 10 /* left bracket */
-#define ET_II 11 /* and integer inlet */
-#define ET_FI 12 /* float inlet */
-#define ET_SI 13 /* string inlet */
-#define ET_VI 14 /* signal inlet */
-#define ET_VEC 15 /* allocated signal vector */
- /* special types for fexpr~ */
-#define ET_YO 16 /* vector output for fexpr~ */
-#define ET_YOM1 17 /* shorthand for $y?[-1] */
-#define ET_XI 18 /* vector input for fexpr~ */
-#define ET_XI0 20 /* shorthand for $x?[0] */
-#define ET_VAR 21 /* variable */
-
-/* defines for ex_flags */
-#define EF_TYPE_MASK 0x07 /* first three bits define the type of expr */
-#define EF_EXPR 0x01 /* expr - control in and out */
-#define EF_EXPR_TILDE 0x02 /* expr~ signal and control in, signal out */
-#define EF_FEXPR_TILDE 0x04 /* fexpr~ filter expression */
-
-#define EF_STOP 0x08 /* is it stopped used for expr~ and fexpr~ */
-#define EF_VERBOSE 0x10 /* verbose mode */
-
-#define IS_EXPR(x) ((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR) == EF_EXPR)
-#define IS_EXPR_TILDE(x) \
- ((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR_TILDE)==EF_EXPR_TILDE)
-#define IS_FEXPR_TILDE(x) \
- ((((x)->exp_flags&EF_TYPE_MASK)|EF_FEXPR_TILDE)==EF_FEXPR_TILDE)
-
-#define SET_EXPR(x) (x)->exp_flags |= EF_EXPR; \
- (x)->exp_flags &= ~EF_EXPR_TILDE; \
- (x)->exp_flags &= ~EF_FEXPR_TILDE;
-
-#define SET_EXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \
- (x)->exp_flags |= EF_EXPR_TILDE; \
- (x)->exp_flags &= ~EF_FEXPR_TILDE;
-
-#define SET_FEXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \
- (x)->exp_flags &= ~EF_EXPR_TILDE; \
- (x)->exp_flags |= EF_FEXPR_TILDE;
-
-/*
- * defines for expr_error
- */
-#define EE_DZ 0x01 /* divide by zero error */
-#define EE_BI_OUTPUT 0x02 /* Bad output index */
-#define EE_BI_INPUT 0x04 /* Bad input index */
-#define EE_NOTABLE 0x08 /* NO TABLE */
-#define EE_NOVAR 0x10 /* NO VARIABLE */
-
-typedef struct expr {
-#ifdef PD
- t_object exp_ob;
-#else /* MSP */
- t_pxobject exp_ob;
-#endif
- int exp_flags; /* are we expr~, fexpr~, or expr */
- int exp_error; /* reported errors */
- int exp_nexpr; /* number of expressions */
- char *exp_string; /* the full expression string */
- char *exp_str; /* current parsing position */
- t_outlet *exp_outlet[MAX_VARS];
-#ifdef PD
- struct _exprproxy *exp_proxy;
-#else /* MAX */
- void *exp_proxy[MAX_VARS];
- long exp_proxy_id;
-#endif
- struct ex_ex *exp_stack[MAX_VARS];
- struct ex_ex exp_var[MAX_VARS];
- struct ex_ex exp_res[MAX_VARS]; /* the evluation result */
- t_float *exp_p_var[MAX_VARS];
- t_float *exp_p_res[MAX_VARS]; /* the previous evaluation result */
- t_float *exp_tmpres[MAX_VARS]; /* temporty result for fexpr~ */
- int exp_vsize; /* the size of the signal vector */
- int exp_nivec; /* # of vector inlets */
- t_float exp_f; /* control value to be transformed to signal */
-} t_expr;
-
-typedef struct ex_funcs {
- char *f_name; /* function name */
- void (*f_func)(t_expr *, long, struct ex_ex *, struct ex_ex *);
- /* the real function performing the function (void, no return!!!) */
- long f_argc; /* number of arguments */
-} t_ex_func;
-
-/* function prototypes for pd-related functions called withing vexp.h */
-
-extern int max_ex_tab(struct expr *expr, t_symbol *s, struct ex_ex *arg, struct ex_ex *optr);
-extern int max_ex_var(struct expr *expr, t_symbol *s, struct ex_ex *optr);
-extern int ex_getsym(char *p, t_symbol **s);
-extern const char *ex_symname(t_symbol *s);
-void ex_mkvector(t_float *fp, t_float x, int size);
-extern void ex_size(t_expr *expr, long int argc, struct ex_ex *argv,
- struct ex_ex *optr);
-extern void ex_sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_Sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_Avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_store(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-
-int value_getonly(t_symbol *s, t_float *f);
-
-
-/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
-#ifdef _MSC_VER
-#pragma warning (disable: 4305 4244)
-#endif
-
-#ifdef _WIN32
-#define abort ABORT
-void ABORT(void);
-#endif
diff --git a/externals/extra/0.43.3/expr~/vexp_fun.c b/externals/extra/0.43.3/expr~/vexp_fun.c
deleted file mode 100644
index 73c0b5c6..00000000
--- a/externals/extra/0.43.3/expr~/vexp_fun.c
+++ /dev/null
@@ -1,1315 +0,0 @@
-/*
- * jMax
- * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * See file LICENSE for further informations on licensing terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Based on Max/ISPW by Miller Puckette.
- *
- * Authors: Maurizio De Cecco, Francois Dechelle, Enzo Maggi, Norbert Schnell.
- *
- */
-
-/* "expr" was written by Shahrokh Yadegari c. 1989. -msp
- *
- * Nov. 2001 --sdy
- * conversion for expr~
- *
- * Jan, 2002 --sdy
- * added fmod()
- *
- * May 2002
- * added floor and ceil for expr -- Orm Finnendahl
- *
- * July 2002 --sdy
- * added the following math funtions:
- * cbrt - cube root
- * erf - error function
- * erfc - complementary error function
- * expm1 - exponential minus 1,
- * log1p - logarithm of 1 plus
- * isinf - is the value infinite,
- * finite - is the value finite
- * isnan -- is the resut a nan (Not a number)
- * copysign - copy sign of a number
- * ldexp - multiply floating-point number by integral power of 2
- * imodf - get signed integral value from floating-point number
- * modf - get signed fractional value from floating-point number
- * drem - floating-point remainder function
- *
- * The following are done but not popular enough in math libss
- * to be included yet
- * hypoth - Euclidean distance function
- * trunc
- * round
- * nearbyint -
- */
-
-
-
-/*
- * vexp_func.c -- this file include all the functions for vexp.
- * the first two arguments to the function are the number
- * of argument and an array of arguments (argc, argv)
- * the last argument is a pointer to a struct ex_ex for
- * the result. Up do this point, the content of the
- * struct ex_ex that these functions receive are either
- * ET_INT (long), ET_FLT (t_float), or ET_SYM (char **, it is
- * char ** and not char * since NewHandle of Mac returns
- * a char ** for relocatability.) The common practice in
- * these functions is that they figure out the type of their
- * result according to the type of the arguments. In general
- * the ET_SYM is used an ET_INT when we expect a value.
- * It is the users responsibility not to pass strings to the
- * function.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#define __STRICT_BSD__
-#include <math.h>
-#undef __STRICT_BSD__
-
-
-#include "vexp.h"
-
-/* forward declarations */
-
-static void ex_min(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_max(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_toint(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_rint(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_tofloat(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_pow(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_exp(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_log(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_ln(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_sin(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_cos(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_asin(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_acos(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_tan(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_atan(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_sinh(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_cosh(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_asinh(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_acosh(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_tanh(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_atanh(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_atan2(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_sqrt(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_fact(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_random(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_abs(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_fmod(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_ceil(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_floor(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_if(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_ldexp(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_imodf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_modf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-#ifndef _WIN32
-static void ex_cbrt(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_erf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_erfc(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_expm1(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_log1p(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_isinf(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_finite(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_isnan(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_copysign(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_drem(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-#endif
-#ifdef notdef
-/* the following will be added once they are more popular in math libraries */
-static void ex_round(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_trunc(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_nearbyint(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-static void ex_hypoth(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex *optr);
-#endif
-
-
-t_ex_func ex_funcs[] = {
- {"min", ex_min, 2},
- {"max", ex_max, 2},
- {"int", ex_toint, 1},
- {"rint", ex_rint, 1},
- {"float", ex_tofloat, 1},
- {"fmod", ex_fmod, 2},
- {"floor", ex_floor, 2},
- {"ceil", ex_ceil, 2},
- {"pow", ex_pow, 2},
- {"sqrt", ex_sqrt, 1},
- {"exp", ex_exp, 1},
- {"log10", ex_log, 1},
- {"ln", ex_ln, 1},
- {"log", ex_ln, 1},
- {"sin", ex_sin, 1},
- {"cos", ex_cos, 1},
- {"tan", ex_tan, 1},
- {"asin", ex_asin, 1},
- {"acos", ex_acos, 1},
- {"atan", ex_atan, 1},
- {"atan2", ex_atan2, 2},
- {"sinh", ex_sinh, 1},
- {"cosh", ex_cosh, 1},
- {"tanh", ex_tanh, 1},
- {"fact", ex_fact, 1},
- {"random", ex_random, 2}, /* random number */
- {"abs", ex_abs, 1},
- {"if", ex_if, 3},
- {"ldexp ", ex_ldexp, 1},
- {"imodf ", ex_imodf, 1},
- {"modf", ex_modf, 1},
-#ifndef _WIN32
- {"cbrt", ex_cbrt, 1},
- {"erf", ex_erf, 1},
- {"erfc", ex_erfc, 1},
- {"expm1", ex_expm1, 1},
- {"log1p", ex_log1p, 1},
- {"isinf", ex_isinf, 1},
- {"finite", ex_finite, 1},
- {"isnan", ex_isnan, 1},
- {"copysig", ex_copysign, 1},
- {"drem", ex_drem, 1},
- {"asinh", ex_asinh, 1},
- {"acosh", ex_acosh, 1},
- {"atanh", ex_atanh, 1}, /* hyperbolic atan */
-#endif
-#ifdef PD
- {"size", ex_size, 1},
- {"sum", ex_sum, 1},
- {"Sum", ex_Sum, 3},
- {"avg", ex_avg, 1},
- {"Avg", ex_Avg, 3},
- {"store", ex_store, 3},
-#endif
-#ifdef notdef
-/* the following will be added once they are more popular in math libraries */
- {"round", ex_round, 1},
- {"trunc", ex_trunc, 1},
- {"nearbyint", ex_nearbyint, 1},
- {"hypoth", ex_hypoth, 1},
-#endif
- {0, 0, 0}
-};
-
-/*
- * FUN_EVAL -- do type checking, evaluate a function,
- * if fltret is set return float
- * otherwise return value based on regular typechecking,
- */
-#define FUNC_EVAL(left, right, func, leftfuncast, rightfuncast, optr, fltret) \
-switch (left->ex_type) { \
-case ET_INT: \
- switch(right->ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)func(leftfuncast left->ex_int, \
- rightfuncast right->ex_int); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- if (fltret) { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float)func(leftfuncast \
- left->ex_int, rightfuncast right->ex_int); \
- } else { \
- optr->ex_type = ET_INT; \
- optr->ex_int = (int)func(leftfuncast \
- left->ex_int, rightfuncast right->ex_int); \
- } \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)func(leftfuncast left->ex_int, \
- rightfuncast right->ex_flt); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float)func(leftfuncast left->ex_int, \
- rightfuncast right->ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*e->exp_vsize); \
- } \
- scalar = left->ex_int; \
- rp = right->ex_vec; \
- op = optr->ex_vec; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (t_float)func(leftfuncast scalar, \
- rightfuncast *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad right type %ld\n", \
- __LINE__, right->ex_type);\
- } \
- break; \
-case ET_FLT: \
- switch(right->ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_int); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_int); \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (t_float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_flt); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float) * e->exp_vsize);\
- } \
- scalar = left->ex_flt; \
- rp = right->ex_vec; \
- op = optr->ex_vec; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (t_float)func(leftfuncast scalar, \
- rightfuncast *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad right type %ld\n", \
- __LINE__, right->ex_type);\
- } \
- break; \
-case ET_VEC: \
-case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float) * e->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left->ex_vec; \
- switch(right->ex_type) { \
- case ET_INT: \
- scalar = right->ex_int; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (t_float)func(leftfuncast *lp, \
- rightfuncast scalar); \
- lp++; \
- } \
- break; \
- case ET_FLT: \
- scalar = right->ex_flt; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (t_float)func(leftfuncast *lp, \
- rightfuncast scalar); \
- lp++; \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- rp = right->ex_vec; \
- j = e->exp_vsize; \
- while (j--) { \
- /* \
- * on a RISC processor one could copy \
- * 8 times in each round to get a considerable \
- * improvement \
- */ \
- *op++ = (t_float)func(leftfuncast *lp, \
- rightfuncast *rp); \
- rp++; lp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad right type %ld\n", \
- __LINE__, right->ex_type);\
- } \
- break; \
-case ET_SYM: \
-default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad left type %ld\n", \
- __LINE__, left->ex_type); \
-}
-
-/*
- * FUNC_EVAL_UNARY - evaluate a unary function,
- * if fltret is set return t_float
- * otherwise return value based on regular typechecking,
- */
-#define FUNC_EVAL_UNARY(left, func, leftcast, optr, fltret) \
-switch(left->ex_type) { \
-case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec, \
- (t_float)(func (leftcast left->ex_int)), e->exp_vsize);\
- break; \
- } \
- if (fltret) { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float) func(leftcast left->ex_int); \
- break; \
- } \
- optr->ex_type = ET_INT; \
- optr->ex_int = (int) func(leftcast left->ex_int); \
- break; \
-case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec, \
- (t_float)(func (leftcast left->ex_flt)), e->exp_vsize);\
- break; \
- } \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (t_float) func(leftcast left->ex_flt); \
- break; \
-case ET_VI: \
-case ET_VEC: \
- if (optr->ex_type != ET_VEC) { \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*e->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left->ex_vec; \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = (t_float)(func (leftcast *lp++)); \
- break; \
-default: \
- post_error((fts_object_t *) e, \
- "expr: FUNV_EVAL_UNARY(%d): bad left type %ld\n",\
- __LINE__, left->ex_type); \
-}
-
-#undef min
-#undef max
-#define min(x,y) (x > y ? y : x)
-#define max(x,y) (x > y ? x : y)
-
-#define FUNC_DEF(ex_func, func, castleft, castright, fltret); \
-static void \
-ex_func(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)\
-{ \
- struct ex_ex *left, *right; \
- t_float *op; /* output pointer */ \
- t_float *lp, *rp; /* left and right vector pointers */ \
- t_float scalar; \
- int j; \
- \
- left = argv++; \
- right = argv; \
- FUNC_EVAL(left, right, func, castleft, castright, optr, fltret); \
-}
-
-
-#define FUNC_DEF_UNARY(ex_func, func, cast, fltret); \
-static void \
-ex_func(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)\
-{ \
- struct ex_ex *left; \
- t_float *op; /* output pointer */ \
- t_float *lp, *rp; /* left and right vector pointers */ \
- t_float scalar; \
- int j; \
- \
- left = argv++; \
- \
- FUNC_EVAL_UNARY(left, func, cast, optr, fltret); \
-}
-
-/*
- * ex_min -- if any of the arguments are or the output are vectors, a vector
- * of floats is generated otherwise the type of the result is the
- * type of the smaller value
- */
-static void
-ex_min(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
-
- FUNC_EVAL(left, right, min, (double), (double), optr, 0);
-}
-
-/*
- * ex_max -- if any of the arguments are or the output are vectors, a vector
- * of floats is generated otherwise the type of the result is the
- * type of the larger value
- */
-static void
-ex_max(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
-
- FUNC_EVAL(left, right, max, (double), (double), optr, 0);
-}
-
-/*
- * ex_toint -- convert to integer
- */
-static void
-ex_toint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
-#define toint(x) ((int)(x))
- FUNC_EVAL_UNARY(left, toint, (int), optr, 0);
- }
-
-#ifdef _WIN32
-/* No rint in NT land ??? */
-double rint(double x);
-
-double
-rint(double x)
-{
- return (floor(x + 0.5));
-}
-#endif
-
-/*
- * ex_rint -- rint() round to the nearest int according to the common
- * rounding mechanism
- */
-static void
-ex_rint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
-
- FUNC_EVAL_UNARY(left, rint, (double), optr, 1);
-}
-
-/*
- * ex_tofloat -- convert to t_float
- */
-static void
-ex_tofloat(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
-#define tofloat(x) ((t_float)(x))
- FUNC_EVAL_UNARY(left, tofloat, (int), optr, 1);
-}
-
-
-/*
- * ex_pow -- the power of
- */
-static void
-ex_pow(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, pow, (double), (double), optr, 1);
-}
-
-/*
- * ex_sqrt -- square root
- */
-static void
-ex_sqrt(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, sqrt, (double), optr, 1);
-}
-
-/*
- * ex_exp -- e to the power of
- */
-static void
-ex_exp(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, exp, (double), optr, 1);
-}
-
-/*
- * ex_log -- 10 based logarithm
- */
-static void
-ex_log(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, log10, (double), optr, 1);
-}
-
-/*
- * ex_ln -- natural log
- */
-static void
-ex_ln(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, log, (double), optr, 1);
-}
-
-static void
-ex_sin(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, sin, (double), optr, 1);
-}
-
-static void
-ex_cos(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, cos, (double), optr, 1);
-}
-
-
-static void
-ex_tan(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, tan, (double), optr, 1);
-}
-
-static void
-ex_asin(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, asin, (double), optr, 1);
-}
-
-static void
-ex_acos(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, acos, (double), optr, 1);
-}
-
-
-static void
-ex_atan(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, atan, (double), optr, 1);
-}
-
-/*
- *ex_atan2 --
- */
-static void
-ex_atan2(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, atan2, (double), (double), optr, 1);
-}
-
-/*
- * ex_fmod -- floating point modulo
- */
-static void
-ex_fmod(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, fmod, (double), (double), optr, 1);
-}
-
-
-/*
- * ex_floor -- floor
- */
-static void
-ex_floor(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- FUNC_EVAL_UNARY(left, floor, (double), optr, 1);
-}
-
-
-/*
- * ex_ceil -- ceil
- */
-static void
-ex_ceil(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- FUNC_EVAL_UNARY(left, ceil, (double), optr, 1);
-}
-
-static void
-ex_sinh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, sinh, (double), optr, 1);
-}
-
-static void
-ex_cosh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, cosh, (double), optr, 1);
-}
-
-
-static void
-ex_tanh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, tanh, (double), optr, 1);
-}
-
-
-#ifndef _WIN32
-static void
-ex_asinh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, asinh, (double), optr, 1);
-}
-
-static void
-ex_acosh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, acosh, (double), optr, 1);
-}
-
-static void
-ex_atanh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, atanh, (double), optr, 1);
-}
-#endif
-
-static int
-ex_dofact(int i)
-{
- int ret = 0;
-
- if (i)
- ret = 1;
- else
- return (0);
-
- do {
- ret *= i;
- } while (--i);
-
- return(ret);
-}
-
-static void
-ex_fact(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, ex_dofact, (int), optr, 0);
-}
-
-static int
-ex_dorandom(int i1, int i2)
-{
- return(i1 + (((i2 - i1) * (rand() & 0x7fffL)) >> 15));
-}
-/*
- * ex_random -- return a random number
- */
-static void
-ex_random(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, ex_dorandom, (int), (int), optr, 0);
-}
-
-
-static void
-ex_abs(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float scalar;
- int j;
-
- left = argv++;
-
- FUNC_EVAL_UNARY(left, fabs, (double), optr, 0);
-}
-
-/*
- *ex_if -- floating point modulo
- */
-static void
-ex_if(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- struct ex_ex *left, *right, *cond, *res;
- t_float *op; /* output pointer */
- t_float *lp, *rp; /* left and right vector pointers */
- t_float *cp; /* condition pointer */
- t_float leftvalue, rightvalue;
- int j;
-
- cond = argv++;
- left = argv++;
- right = argv;
-
- switch (cond->ex_type) {
- case ET_VEC:
- case ET_VI:
- if (optr->ex_type != ET_VEC) {
- if (optr->ex_type == ET_VI) {
- /* SDY remove this test */
- post("expr~: Int. error %d", __LINE__);
- return;
- }
- optr->ex_type = ET_VEC;
- optr->ex_vec = (t_float *)
- fts_malloc(sizeof (t_float) * e->exp_vsize);
- }
- op = optr->ex_vec;
- j = e->exp_vsize;
- cp = cond->ex_vec;
- switch (left->ex_type) {
- case ET_INT:
- leftvalue = left->ex_int;
- switch (right->ex_type) {
- case ET_INT:
- rightvalue = right->ex_int;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_FLT:
- rightvalue = right->ex_flt;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_VEC:
- case ET_VI:
- rp = right->ex_vec;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = *rp;
- rp++;
- }
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad right type %ld\n",
- __LINE__, right->ex_type);
- return;
- }
- case ET_FLT:
- leftvalue = left->ex_flt;
- switch (right->ex_type) {
- case ET_INT:
- rightvalue = right->ex_int;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_FLT:
- rightvalue = right->ex_flt;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_VEC:
- case ET_VI:
- rp = right->ex_vec;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = *rp;
- rp++;
- }
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad right type %ld\n",
- __LINE__, right->ex_type);
- return;
- }
- case ET_VEC:
- case ET_VI:
- lp = left->ex_vec;
- switch (right->ex_type) {
- case ET_INT:
- rightvalue = right->ex_int;
- while (j--) {
- if (*cp++)
- *op++ = *lp;
- else
- *op++ = rightvalue;
- lp++;
- }
- return;
- case ET_FLT:
- rightvalue = right->ex_flt;
- while (j--) {
- if (*cp++)
- *op++ = *lp;
- else
- *op++ = rightvalue;
- lp++;
- }
- return;
- case ET_VEC:
- case ET_VI:
- rp = right->ex_vec;
- while (j--) {
- if (*cp++)
- *op++ = *lp;
- else
- *op++ = *rp;
- lp++; rp++;
- }
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad right type %ld\n",
- __LINE__, right->ex_type);
- return;
- }
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad left type %ld\n",
- __LINE__, left->ex_type);
- return;
- }
- case ET_INT:
- if (cond->ex_int)
- res = left;
- else
- res = right;
- break;
- case ET_FLT:
- if (cond->ex_flt)
- res = left;
- else
- res = right;
- break;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad condition type %ld\n",
- __LINE__, cond->ex_type);
- return;
- }
- switch(res->ex_type) {
- case ET_INT:
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec, (t_float)res->ex_int,
- e->exp_vsize);
- return;
- }
- *optr = *res;
- return;
- case ET_FLT:
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec, (t_float)res->ex_flt,
- e->exp_vsize);
- return;
- }
- *optr = *res;
- return;
- case ET_VEC:
- case ET_VI:
- if (optr->ex_type != ET_VEC) {
- if (optr->ex_type == ET_VI) {
- /* SDY remove this test */
- post("expr~: Int. error %d", __LINE__);
- return;
- }
- optr->ex_type = ET_VEC;
- optr->ex_vec = (t_float *)
- fts_malloc(sizeof (t_float) * e->exp_vsize);
- }
- memcpy(optr->ex_vec, res->ex_vec, e->exp_vsize*sizeof(t_float));
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad res type %ld\n",
- __LINE__, res->ex_type);
- return;
- }
-
-}
-
-/*
- * ex_imodf - extract signed integral value from floating-point number
- */
-static double
-imodf(double x)
-{
- double xx;
-
- modf(x, &xx);
- return (xx);
-}
-FUNC_DEF_UNARY(ex_imodf, imodf, (double), 1);
-
-/*
- * ex_modf - extract signed fractional value from floating-point number
- *
- * using fracmodf because fmodf() is alrady defined in a .h file
- */
-static double
-fracmodf(double x)
-{
- double xx;
-
- return(modf(x, &xx));
-}
-FUNC_DEF_UNARY(ex_modf, fracmodf, (double), 1);
-
-/*
- * ex_ldexp - multiply floating-point number by integral power of 2
- */
-FUNC_DEF(ex_ldexp, ldexp, (double), (int), 1);
-
-#ifndef _WIN32
-/*
- * ex_cbrt - cube root
- */
-FUNC_DEF_UNARY(ex_cbrt, cbrt, (double), 1);
-
-/*
- * ex_erf - error function
- */
-FUNC_DEF_UNARY(ex_erf, erf, (double), 1);
-
-/*
- * ex_erfc - complementary error function
- */
-FUNC_DEF_UNARY(ex_erfc, erfc, (double), 1);
-
-/*
- * ex_expm1 - exponential minus 1,
- */
-FUNC_DEF_UNARY(ex_expm1, expm1, (double), 1);
-
-/*
- * ex_log1p - logarithm of 1 plus
- */
-FUNC_DEF_UNARY(ex_log1p, log1p, (double), 1);
-
-/*
- * ex_isinf - is the value infinite,
- */
-FUNC_DEF_UNARY(ex_isinf, isinf, (double), 0);
-
-/*
- * ex_finite - is the value finite
- */
-FUNC_DEF_UNARY(ex_finite, finite, (double), 0);
-
-/*
- * ex_isnan -- is the resut a nan (Not a number)
- */
-FUNC_DEF_UNARY(ex_isnan, isnan, (double), 0);
-
-/*
- * ex_copysign - copy sign of a number
- */
-FUNC_DEF(ex_copysign, copysign, (double), (double), 1);
-
-/*
- * ex_drem - floating-point remainder function
- */
-FUNC_DEF(ex_drem, drem, (double), (double), 1);
-#endif
-
-#ifdef notdef
-/* the following will be added once they are more popular in math libraries */
-/*
- * ex_hypoth - Euclidean distance function
- */
-FUNC_DEF(ex_hypoth, hypoth, (double), (double), 1);
-
-/*
- * ex_round - round to nearest integer, away from zero
- */
-FUNC_DEF_UNARY(ex_round, round, (double), 1);
-
-/*
- * ex_trunc - round to interger, towards zero
- */
-FUNC_DEF_UNARY(ex_trunc, trunc, (double), 1);
-
-/*
- * ex_nearbyint - round to nearest integer
- */
-FUNC_DEF_UNARY(ex_nearbyint, nearbyint, (double), 1);
-#endif
diff --git a/externals/extra/0.43.3/expr~/vexp_if.c b/externals/extra/0.43.3/expr~/vexp_if.c
deleted file mode 100644
index 3028ff82..00000000
--- a/externals/extra/0.43.3/expr~/vexp_if.c
+++ /dev/null
@@ -1,1225 +0,0 @@
-/*
- * jMax
- * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * See file LICENSE for further informations on licensing terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Based on Max/ISPW by Miller Puckette.
- *
- * Authors: Maurizio De Cecco, Francois Dechelle, Enzo Maggi, Norbert Schnell.
- *
- */
-
-/* "expr" was written by Shahrokh Yadegari c. 1989. -msp */
-/* "expr~" and "fexpr~" conversion by Shahrokh Yadegari c. 1999,2000 */
-
-/*
- * Feb 2002 - added access to variables
- * multiple expression support
- * new short hand forms for fexpr~
- * now $y or $y1 = $y1[-1] and $y2 = $y2[-1]
- * --sdy
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "vexp.h"
-
-static char *exp_version = "0.4";
-
-extern struct ex_ex *ex_eval(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int n);
-
-#ifdef PD
-static t_class *expr_class;
-static t_class *expr_tilde_class;
-static t_class *fexpr_tilde_class;
-#else /* MSP */
-void *expr_tilde_class;
-#endif
-
-
-/*------------------------- expr class -------------------------------------*/
-
-extern int expr_donew(struct expr *expr, int ac, t_atom *av);
-
-/*#define EXPR_DEBUG*/
-
-static void expr_bang(t_expr *x);
-t_int *expr_perform(t_int *w);
-
-
-static void
-expr_list(t_expr *x, t_symbol *s, int argc, const fts_atom_t *argv)
-{
- int i;
-
- if (argc > MAX_VARS) argc = MAX_VARS;
-
- for (i = 0; i < argc; i++)
- {
- if (argv[i].a_type == A_FLOAT)
- {
- if (x->exp_var[i].ex_type == ET_FI)
- x->exp_var[i].ex_flt = argv[i].a_w.w_float;
- else if (x->exp_var[i].ex_type == ET_II)
- x->exp_var[i].ex_int = argv[i].a_w.w_float;
- else if (x->exp_var[i].ex_type)
- pd_error(x, "expr: type mismatch");
- }
- else if (argv[i].a_type == A_SYMBOL)
- {
- if (x->exp_var[i].ex_type == ET_SI)
- x->exp_var[i].ex_ptr = (char *)argv[i].a_w.w_symbol;
- else if (x->exp_var[i].ex_type)
- pd_error(x, "expr: type mismatch");
- }
- }
- expr_bang(x);
-}
-
-static void
-expr_flt(t_expr *x, t_float f, int in)
-{
- if (in > MAX_VARS)
- return;
-
- if (x->exp_var[in].ex_type == ET_FI)
- x->exp_var[in].ex_flt = f;
- else if (x->exp_var[in].ex_type == ET_II)
- x->exp_var[in].ex_int = f;
-}
-
-static t_class *exprproxy_class;
-
-typedef struct _exprproxy {
- t_pd p_pd;
- int p_index;
- t_expr *p_owner;
- struct _exprproxy *p_next;
-} t_exprproxy;
-
-t_exprproxy *exprproxy_new(t_expr *owner, int indx);
-void exprproxy_float(t_exprproxy *p, t_floatarg f);
-
-t_exprproxy *
-exprproxy_new(t_expr *owner, int indx)
-{
- t_exprproxy *x = (t_exprproxy *)pd_new(exprproxy_class);
- x->p_owner = owner;
- x->p_index = indx;
- x->p_next = owner->exp_proxy;
- owner->exp_proxy = x;
- return (x);
-}
-
-void
-exprproxy_float(t_exprproxy *p, t_floatarg f)
-{
- t_expr *x = p->p_owner;
- int in = p->p_index;
-
- if (in > MAX_VARS)
- return;
-
- if (x->exp_var[in].ex_type == ET_FI)
- x->exp_var[in].ex_flt = f;
- else if (x->exp_var[in].ex_type == ET_II)
- x->exp_var[in].ex_int = f;
-}
-
-/* method definitions */
-static void
-expr_ff(t_expr *x)
-{
- t_exprproxy *y;
- int i;
-
- y = x->exp_proxy;
- while (y)
- {
- x->exp_proxy = y->p_next;
-#ifdef PD
- pd_free(&y->p_pd);
-#else /*MSP */
- /* SDY find out what needs to be called for MSP */
-
-#endif
- y = x->exp_proxy;
- }
- for (i = 0 ; i < x->exp_nexpr; i++);
- if (x->exp_stack[i])
- fts_free(x->exp_stack[i]);
-/*
- * SDY free all the allocated buffers here for expr~ and fexpr~
- * check to see if there are others
- */
- for (i = 0; i < MAX_VARS; i++) {
- if (x->exp_p_var[i])
- fts_free(x->exp_p_var[i]);
- if (x->exp_p_res[i])
- fts_free(x->exp_p_res[i]);
- if (x->exp_tmpres[i])
- fts_free(x->exp_tmpres[i]);
- }
-
-
-}
-
-static void
-expr_bang(t_expr *x)
-{
- int i;
-
-#ifdef EXPR_DEBUG
- {
- struct ex_ex *eptr;
-
- for (i = 0, eptr = x->exp_var; ; eptr++, i++)
- {
- if (!eptr->ex_type)
- break;
- switch (eptr->ex_type)
- {
- case ET_II:
- fprintf(stderr,"ET_II: %d \n", eptr->ex_int);
- break;
-
- case ET_FI:
- fprintf(stderr,"ET_FT: %f \n", eptr->ex_flt);
- break;
-
- default:
- fprintf(stderr,"oups\n");
- }
- }
- }
-#endif
- /* banging a signal or filter object means nothing */
- if (!IS_EXPR(x))
- return;
-
- for (i = x->exp_nexpr - 1; i > -1 ; i--) {
- if (!ex_eval(x, x->exp_stack[i], &x->exp_res[i], 0)) {
- /*fprintf(stderr,"expr_bang(error evaluation)\n"); */
- /* SDY now that we have mutiple ones, on error we should
- * continue
- return;
- */
- }
- switch(x->exp_res[i].ex_type) {
- case ET_INT:
- outlet_float(x->exp_outlet[i],
- (t_float) x->exp_res[i].ex_int);
- break;
-
- case ET_FLT:
- outlet_float(x->exp_outlet[i], x->exp_res[i].ex_flt);
- break;
-
- case ET_SYM:
- /* CHANGE this will have to be taken care of */
-
- default:
- post("expr: bang: unrecognized result %ld\n", x->exp_res[i].ex_type);
- }
- }
-}
-
-static t_expr *
-#ifdef PD
-expr_new(t_symbol *s, int ac, t_atom *av)
-#else /* MSP */
-Nexpr_new(t_symbol *s, int ac, t_atom *av)
-#endif
-{
- struct expr *x;
- int i, ninlet;
- struct ex_ex *eptr;
- t_atom fakearg;
- int dsp_index; /* keeping track of the dsp inlets */
-
-
-/*
- * SDY - we may need to call dsp_setup() in this function
- */
-
- if (!ac)
- {
- ac = 1;
- av = &fakearg;
- SETFLOAT(&fakearg, 0);
- }
-
-#ifdef PD
- /*
- * figure out if we are expr, expr~, or fexpr~
- */
- if (!strcmp("expr", s->s_name)) {
- x = (t_expr *)pd_new(expr_class);
- SET_EXPR(x);
- } else if (!strcmp("expr~", s->s_name)) {
- x = (t_expr *)pd_new(expr_tilde_class);
- SET_EXPR_TILDE(x);
- } else if (!strcmp("fexpr~", s->s_name)) {
- x = (t_expr *)pd_new(fexpr_tilde_class);
- SET_FEXPR_TILDE(x);
- } else {
- post("expr_new: bad object name '%s'");
- /* assume expr */
- x = (t_expr *)pd_new(expr_class);
- SET_EXPR(x);
- }
-#else /* MSP */
- /* for now assume an expr~ */
- x = (t_expr *)pd_new(expr_tilde_class);
- SET_EXPR_TILDE(x);
-#endif
-
- /*
- * initialize the newly allocated object
- */
- x->exp_proxy = 0;
- x->exp_nivec = 0;
- x->exp_nexpr = 0;
- x->exp_error = 0;
- for (i = 0; i < MAX_VARS; i++) {
- x->exp_stack[i] = (struct ex_ex *)0;
- x->exp_outlet[i] = (t_outlet *)0;
- x->exp_res[i].ex_type = 0;
- x->exp_res[i].ex_int = 0;
- x->exp_p_res[i] = (t_float *)0;
- x->exp_var[i].ex_type = 0;
- x->exp_var[i].ex_int = 0;
- x->exp_p_var[i] = (t_float *)0;
- x->exp_tmpres[i] = (t_float *)0;
- x->exp_vsize = 0;
- }
- x->exp_f = 0; /* save the control value to be transformed to signal */
-
-
- if (expr_donew(x, ac, av))
- {
- pd_error(x, "expr: syntax error");
-/*
-SDY the following coredumps why?
- pd_free(&x->exp_ob.ob_pd);
-*/
- return (0);
- }
-
- ninlet = 1;
- for (i = 0, eptr = x->exp_var; i < MAX_VARS ; i++, eptr++)
- if (eptr->ex_type) {
- ninlet = i + 1;
- }
-
- /*
- * create the new inlets
- */
- for (i = 1, eptr = x->exp_var + 1, dsp_index=1; i<ninlet ; i++, eptr++)
- {
- t_exprproxy *p;
- switch (eptr->ex_type)
- {
- case 0:
- /* nothing is using this inlet */
- if (i < ninlet)
-#ifdef PD
- floatinlet_new(&x->exp_ob, &eptr->ex_flt);
-#else /* MSP */
- inlet_new(&x->exp_ob, "float");
-#endif
- break;
-
- case ET_II:
- case ET_FI:
- p = exprproxy_new(x, i);
-#ifdef PD
- inlet_new(&x->exp_ob, &p->p_pd, &s_float, &s_float);
-#else /* MSP */
- inlet_new(&x->exp_ob, "float");
-#endif
- break;
-
- case ET_SI:
-#ifdef PD
- symbolinlet_new(&x->exp_ob, (t_symbol **)&eptr->ex_ptr);
-#else /* MSP */
- inlet_new(&x->exp_ob, "symbol");
-#endif
- break;
-
- case ET_XI:
- case ET_VI:
- if (!IS_EXPR(x)) {
- dsp_index++;
-#ifdef PD
- inlet_new(&x->exp_ob, &x->exp_ob.ob_pd,
- &s_signal, &s_signal);
-#else /* MSP */
- inlet_new(&x->exp_ob, "signal");
-#endif
- break;
- } else
- post("expr: internal error expr_new");
- default:
- pd_error(x, "expr: bad type (%lx) inlet = %d\n",
- eptr->ex_type, i + 1);
- break;
- }
- }
- if (IS_EXPR(x)) {
- for (i = 0; i < x->exp_nexpr; i++)
- x->exp_outlet[i] = outlet_new(&x->exp_ob, 0);
- } else {
- for (i = 0; i < x->exp_nexpr; i++)
- x->exp_outlet[i] = outlet_new(&x->exp_ob,
- gensym("signal"));
- x->exp_nivec = dsp_index;
- }
- /*
- * for now assume a 64 sample size block but this may change once
- * expr_dsp is called
- */
- x->exp_vsize = 64;
- for (i = 0; i < x->exp_nexpr; i++) {
- x->exp_p_res[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- x->exp_tmpres[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- }
- for (i = 0; i < MAX_VARS; i++)
- x->exp_p_var[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
-
- return (x);
-}
-
-t_int *
-expr_perform(t_int *w)
-{
- int i, j;
- t_expr *x = (t_expr *)w[1];
- struct ex_ex res;
- int n;
-
- /* sanity check */
- if (IS_EXPR(x)) {
- post("expr_perform: bad x->exp_flags = %d", x->exp_flags);
- abort();
- }
-
- if (x->exp_flags & EF_STOP) {
- for (i = 0; i < x->exp_nexpr; i++)
- memset(x->exp_res[i].ex_vec, 0,
- x->exp_vsize * sizeof (t_float));
- return (w + 2);
- }
-
- if (IS_EXPR_TILDE(x)) {
- /*
- * if we have only one expression, we can right on
- * on the output directly, otherwise we have to copy
- * the data because, outputs could be the same buffer as
- * inputs
- */
- if ( x->exp_nexpr == 1)
- ex_eval(x, x->exp_stack[0], &x->exp_res[0], 0);
- else {
- res.ex_type = ET_VEC;
- for (i = 0; i < x->exp_nexpr; i++) {
- res.ex_vec = x->exp_tmpres[i];
- ex_eval(x, x->exp_stack[i], &res, 0);
- }
- n = x->exp_vsize * sizeof(t_float);
- for (i = 0; i < x->exp_nexpr; i++)
- memcpy(x->exp_res[i].ex_vec, x->exp_tmpres[i],
- n);
- }
- return (w + 2);
- }
-
- if (!IS_FEXPR_TILDE(x)) {
- post("expr_perform: bad x->exp_flags = %d - expecting fexpr",
- x->exp_flags);
- return (w + 2);
- }
- /*
- * since the output buffer could be the same as one of the inputs
- * we need to keep the output in a different buffer
- */
- for (i = 0; i < x->exp_vsize; i++) for (j = 0; j < x->exp_nexpr; j++) {
- res.ex_type = 0;
- res.ex_int = 0;
- ex_eval(x, x->exp_stack[j], &res, i);
- switch (res.ex_type) {
- case ET_INT:
- x->exp_tmpres[j][i] = (t_float) res.ex_int;
- break;
- case ET_FLT:
- x->exp_tmpres[j][i] = res.ex_flt;
- break;
- default:
- post("expr_perform: bad result type %d", res.ex_type);
- }
- }
- /*
- * copy inputs and results to the save buffers
- * inputs need to be copied first as the output buffer can be
- * same as an input buffer
- */
- n = x->exp_vsize * sizeof(t_float);
- for (i = 0; i < MAX_VARS; i++)
- if (x->exp_var[i].ex_type == ET_XI)
- memcpy(x->exp_p_var[i], x->exp_var[i].ex_vec, n);
- for (i = 0; i < x->exp_nexpr; i++) {
- memcpy(x->exp_p_res[i], x->exp_tmpres[i], n);
- memcpy(x->exp_res[i].ex_vec, x->exp_tmpres[i], n);
- }
- return (w + 2);
-}
-
-static void
-expr_dsp(t_expr *x, t_signal **sp)
-{
- int i, nv;
- int newsize;
-
- x->exp_error = 0; /* reset all errors */
- newsize = (x->exp_vsize != sp[0]->s_n);
- x->exp_vsize = sp[0]->s_n; /* record the vector size */
- for (i = 0; i < x->exp_nexpr; i++) {
- x->exp_res[i].ex_type = ET_VEC;
- x->exp_res[i].ex_vec = sp[x->exp_nivec + i]->s_vec;
- }
- for (i = 0, nv = 0; i < MAX_VARS; i++)
- /*
- * the first inlet is always a signal
- *
- * SDY We are warning the user till this limitation
- * is taken away from pd
- */
- if (!i || x->exp_var[i].ex_type == ET_VI ||
- x->exp_var[i].ex_type == ET_XI) {
- if (nv >= x->exp_nivec) {
- post("expr_dsp int. err nv = %d, x->exp_nive = %d",
- nv, x->exp_nivec);
- abort();
- }
- x->exp_var[i].ex_vec = sp[nv]->s_vec;
- nv++;
- }
- /* we always have one inlet but we may not use it */
- if (nv != x->exp_nivec && (nv != 0 || x->exp_nivec != 1)) {
- post("expr_dsp internal error 2 nv = %d, x->exp_nive = %d",
- nv, x->exp_nivec);
- abort();
- }
-
- dsp_add(expr_perform, 1, (t_int *) x);
-
- /*
- * The buffer are now being allocated for expr~ and fexpr~
- * because if we have more than one expression we need the
- * temporary buffers, The save buffers are not really needed
- if (!IS_FEXPR_TILDE(x))
- return;
- */
- /*
- * if we have already allocated the buffers and we have a
- * new size free all the buffers
- */
- if (x->exp_p_res[0]) {
- if (!newsize)
- return;
- /*
- * if new size, reallocate all the previous buffers for fexpr~
- */
- for (i = 0; i < x->exp_nexpr; i++) {
- fts_free(x->exp_p_res[i]);
- fts_free(x->exp_tmpres[i]);
- }
- for (i = 0; i < MAX_VARS; i++)
- fts_free(x->exp_p_var[i]);
-
- }
- for (i = 0; i < x->exp_nexpr; i++) {
- x->exp_p_res[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- x->exp_tmpres[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- }
- for (i = 0; i < MAX_VARS; i++)
- x->exp_p_var[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
-}
-
-/*
- * expr_verbose -- toggle the verbose switch
- */
-static void
-expr_verbose(t_expr *x)
-{
- if (x->exp_flags & EF_VERBOSE) {
- x->exp_flags &= ~EF_VERBOSE;
- post ("verbose off");
- } else {
- x->exp_flags |= EF_VERBOSE;
- post ("verbose on");
- }
-}
-
-/*
- * expr_start -- turn on expr processing for now only used for fexpr~
- */
-static void
-expr_start(t_expr *x)
-{
- x->exp_flags &= ~EF_STOP;
-}
-
-/*
- * expr_stop -- turn on expr processing for now only used for fexpr~
- */
-static void
-expr_stop(t_expr *x)
-{
- x->exp_flags |= EF_STOP;
-}
-static void
-fexpr_set_usage(void)
-{
- post("fexpr~: set val ...");
- post("fexpr~: set {xy}[#] val ...");
-}
-
-/*
- * fexpr_tilde_set -- set previous values of the buffers
- * set val val ... - sets the first elements of output buffers
- * set x val ... - sets the elements of the first input buffer
- * set x# val ... - sets the elements of the #th input buffers
- * set y val ... - sets the elements of the first output buffer
- * set y# val ... - sets the elements of the #th output buffers
- */
-static void
-fexpr_tilde_set(t_expr *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_symbol *sx;
- int vecno;
- int i, nargs;
-
- if (!argc)
- return;
- sx = atom_getsymbolarg(0, argc, argv);
- switch(sx->s_name[0]) {
- case 'x':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.set: bad set x vector number");
- fexpr_set_usage();
- return;
- }
- if (vecno >= MAX_VARS) {
- post("fexpr~.set: no more than %d inlets",
- MAX_VARS);
- return;
- }
- vecno--;
- }
- if (x->exp_var[vecno].ex_type != ET_XI) {
- post("fexpr~-set: no signal at inlet %d", vecno + 1);
- return;
- }
- nargs = argc - 1;
- if (!nargs) {
- post("fexpr~-set: no argument to set");
- return;
- }
- if (nargs > x->exp_vsize) {
- post("fexpr~.set: %d set values larger than vector size(%d)",
- nargs, x->exp_vsize);
- post("fexpr~.set: only the first %d values will be set",
- x->exp_vsize);
- nargs = x->exp_vsize;
- }
- for (i = 0; i < nargs; i++) {
- x->exp_p_var[vecno][x->exp_vsize - i - 1] =
- atom_getfloatarg(i + 1, argc, argv);
- }
- return;
- case 'y':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.set: bad set y vector number");
- fexpr_set_usage();
- return;
- }
- vecno--;
- }
- if (vecno >= x->exp_nexpr) {
- post("fexpr~.set: only %d outlets", x->exp_nexpr);
- return;
- }
- nargs = argc - 1;
- if (!nargs) {
- post("fexpr~-set: no argument to set");
- return;
- }
- if (nargs > x->exp_vsize) {
- post("fexpr~-set: %d set values larger than vector size(%d)",
- nargs, x->exp_vsize);
- post("fexpr~.set: only the first %d values will be set",
- x->exp_vsize);
- nargs = x->exp_vsize;
- }
- for (i = 0; i < nargs; i++) {
- x->exp_p_res[vecno][x->exp_vsize - i - 1] =
- atom_getfloatarg(i + 1, argc, argv);
- }
- return;
- case 0:
- if (argc > x->exp_nexpr) {
- post("fexpr~.set: only %d outlets available",
- x->exp_nexpr);
- post("fexpr~.set: the extra set values are ignored");
- }
- for (i = 0; i < x->exp_nexpr && i < argc; i++)
- x->exp_p_res[i][x->exp_vsize - 1] =
- atom_getfloatarg(i, argc, argv);
- return;
- default:
- fexpr_set_usage();
- return;
- }
- return;
-}
-
-/*
- * fexpr_tilde_clear - clear the past buffers
- */
-static void
-fexpr_tilde_clear(t_expr *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_symbol *sx;
- int vecno;
- int i, nargs;
-
- /*
- * if no arguement clear all input and output buffers
- */
- if (!argc) {
- for (i = 0; i < x->exp_nexpr; i++)
- memset(x->exp_p_res[i], 0, x->exp_vsize*sizeof(t_float));
- for (i = 0; i < MAX_VARS; i++)
- if (x->exp_var[i].ex_type == ET_XI)
- memset(x->exp_p_var[i], 0,
- x->exp_vsize*sizeof(t_float));
- return;
- }
- if (argc > 1) {
- post("fexpr~ usage: 'clear' or 'clear {xy}[#]'");
- return;
- }
-
- sx = atom_getsymbolarg(0, argc, argv);
- switch(sx->s_name[0]) {
- case 'x':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.clear: bad clear x vector number");
- return;
- }
- if (vecno >= MAX_VARS) {
- post("fexpr~.clear: no more than %d inlets",
- MAX_VARS);
- return;
- }
- vecno--;
- }
- if (x->exp_var[vecno].ex_type != ET_XI) {
- post("fexpr~-clear: no signal at inlet %d", vecno + 1);
- return;
- }
- memset(x->exp_p_var[vecno], 0, x->exp_vsize*sizeof(t_float));
- return;
- case 'y':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.clear: bad clear y vector number");
- return;
- }
- vecno--;
- }
- if (vecno >= x->exp_nexpr) {
- post("fexpr~.clear: only %d outlets", x->exp_nexpr);
- return;
- }
- memset(x->exp_p_res[vecno], 0, x->exp_vsize*sizeof(t_float));
- return;
- return;
- default:
- post("fexpr~ usage: 'clear' or 'clear {xy}[#]'");
- return;
- }
- return;
-}
-
-#ifdef PD
-
-void
-expr_setup(void)
-{
- /*
- * expr initialization
- */
- expr_class = class_new(gensym("expr"), (t_newmethod)expr_new,
- (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
- class_addlist(expr_class, expr_list);
- exprproxy_class = class_new(gensym("exprproxy"), 0,
- 0, sizeof(t_exprproxy), CLASS_PD, 0);
- class_addfloat(exprproxy_class, exprproxy_float);
-
- /*
- * expr~ initialization
- */
- expr_tilde_class = class_new(gensym("expr~"), (t_newmethod)expr_new,
- (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
- class_addmethod(expr_tilde_class, nullfn, gensym("signal"), 0);
- CLASS_MAINSIGNALIN(expr_tilde_class, t_expr, exp_f);
- class_addmethod(expr_tilde_class,(t_method)expr_dsp, gensym("dsp"), 0);
- class_sethelpsymbol(expr_tilde_class, gensym("expr"));
- /*
- * fexpr~ initialization
- */
- fexpr_tilde_class = class_new(gensym("fexpr~"), (t_newmethod)expr_new,
- (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
- class_addmethod(fexpr_tilde_class, nullfn, gensym("signal"), 0);
- class_addmethod(fexpr_tilde_class,(t_method)expr_start,
- gensym("start"), 0);
- class_addmethod(fexpr_tilde_class,(t_method)expr_stop,
- gensym("stop"), 0);
-
- class_addmethod(fexpr_tilde_class,(t_method)expr_dsp,gensym("dsp"), 0);
- class_addmethod(fexpr_tilde_class, (t_method)fexpr_tilde_set,
- gensym("set"), A_GIMME, 0);
- class_addmethod(fexpr_tilde_class, (t_method)fexpr_tilde_clear,
- gensym("clear"), A_GIMME, 0);
- class_addmethod(fexpr_tilde_class,(t_method)expr_verbose,
- gensym("verbose"), 0);
- class_sethelpsymbol(fexpr_tilde_class, gensym("expr"));
-
-
-
- post("expr, expr~, fexpr~ version %s under GNU General Public License ", exp_version);
-
-}
-
-void
-expr_tilde_setup(void)
-{
- expr_setup();
-}
-
-void
-fexpr_tilde_setup(void)
-{
- expr_setup();
-}
-#else /* MSP */
-void
-main(void)
-{
- setup((t_messlist **)&expr_tilde_class, (method)Nexpr_new,
- (method)expr_ff, (short)sizeof(t_expr), 0L, A_GIMME, 0);
- addmess((method)expr_dsp, "dsp", A_CANT, 0); // dsp method
- dsp_initclass();
-}
-#endif
-
-
-/* -- the following functions use Pd internals and so are in the "if" file. */
-
-
-int
-ex_getsym(char *p, fts_symbol_t *s)
-{
- *s = gensym(p);
- return (0);
-}
-
-const char *
-ex_symname(fts_symbol_t s)
-{
- return (fts_symbol_name(s));
-}
-
-/*
- * max_ex_tab -- evaluate this table access
- * eptr is the name of the table and arg is the index we
- * have to put the result in optr
- * return 1 on error and 0 otherwise
- *
- * Arguments:
- * the expr object
- * table
- * the argument
- * the result pointer
- */
-int
-max_ex_tab(struct expr *expr, fts_symbol_t s, struct ex_ex *arg,
- struct ex_ex *optr)
-{
-#ifdef PD
- t_garray *garray;
- int size, indx;
- t_word *wvec;
-
- if (!s || !(garray = (t_garray *)pd_findbyclass(s, garray_class)) ||
- !garray_getfloatwords(garray, &size, &wvec))
- {
- optr->ex_type = ET_FLT;
- optr->ex_flt = 0;
- pd_error(expr, "no such table '%s'", s->s_name);
- return (1);
- }
- optr->ex_type = ET_FLT;
-
- switch (arg->ex_type) {
- case ET_INT:
- indx = arg->ex_int;
- break;
- case ET_FLT:
- /* strange interpolation code deleted here -msp */
- indx = arg->ex_flt;
- break;
-
- default: /* do something with strings */
- pd_error(expr, "expr: bad argument for table '%s'\n", fts_symbol_name(s));
- indx = 0;
- }
- if (indx < 0) indx = 0;
- else if (indx >= size) indx = size - 1;
- optr->ex_flt = wvec[indx].w_float;
-#else /* MSP */
- /*
- * table lookup not done for MSP yet
- */
- post("max_ex_tab: not complete for MSP yet!");
- optr->ex_type = ET_FLT;
- optr->ex_flt = 0;
-#endif
- return (0);
-}
-
-int
-max_ex_var(struct expr *expr, fts_symbol_t var, struct ex_ex *optr)
-{
- optr->ex_type = ET_FLT;
- if (value_getfloat(var, &(optr->ex_flt))) {
- optr->ex_type = ET_FLT;
- optr->ex_flt = 0;
- pd_error(expr, "no such var '%s'", var->s_name);
- return (1);
- }
- return (0);
-}
-
-#ifdef PD /* this goes to the end of this file as the following functions
- * should be defined in the expr object in MSP
- */
-#define ISTABLE(sym, garray, size, vec) \
-if (!sym || !(garray = (t_garray *)pd_findbyclass(sym, garray_class)) || \
- !garray_getfloatwords(garray, &size, &vec)) { \
- optr->ex_type = ET_FLT; \
- optr->ex_int = 0; \
- error("no such table '%s'", sym?(sym->s_name):"(null)"); \
- return; \
-}
-
-/*
- * ex_size -- find the size of a table
- */
-void
-ex_size(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- t_symbol *s;
- t_garray *garray;
- int size;
- t_word *wvec;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: size: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- ISTABLE(s, garray, size, wvec);
-
- optr->ex_type = ET_INT;
- optr->ex_int = size;
-}
-
-/*
- * ex_sum -- calculate the sum of all elements of a table
- */
-
-void
-ex_sum(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- t_symbol *s;
- t_garray *garray;
- int size;
- t_word *wvec;
- t_float sum;
- int indx;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: sum: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- ISTABLE(s, garray, size, wvec);
-
- for (indx = 0, sum = 0; indx < size; indx++)
- sum += wvec[indx].w_float;
-
- optr->ex_type = ET_FLT;
- optr->ex_flt = sum;
-}
-
-
-/*
- * ex_Sum -- calculate the sum of table with the given boundries
- */
-
-void
-ex_Sum(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
- t_symbol *s;
- t_garray *garray;
- int size;
- t_word *wvec;
- t_float sum;
- int indx, n1, n2;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: sum: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- ISTABLE(s, garray, size, wvec);
-
- if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
- {
- post("expr: Sum: boundries have to be fix values\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
- n1 = argv->ex_int;
- n2 = argv[1].ex_int;
-
- for (indx = n1, sum = 0; indx < n2; indx++)
- if (indx >= 0 && indx < size)
- sum += wvec[indx].w_float;
-
- optr->ex_type = ET_FLT;
- optr->ex_flt = sum;
-}
-
-/*
- * ex_avg -- calculate the avarage of a table
- */
-
-void
-ex_avg(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
-/* SDY - look into this function */
-#if 0
- fts_symbol_t s;
- fts_integer_vector_t *tw = 0;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: avg: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- tw = table_integer_vector_get_by_name(s);
-
- if (tw)
- {
- optr->ex_type = ET_INT;
-
- if (! fts_integer_vector_get_size(tw))
- optr->ex_int = 0;
- else
- optr->ex_int = fts_integer_vector_get_sum(tw) / fts_integer_vector_get_size(tw);
- }
- else
- {
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- post("expr: avg: no such table %s\n", fts_symbol_name(s));
- }
-#endif
-}
-
-
-/*
- * ex_Avg -- calculate the avarage of table with the given boundries
- */
-
-void
-ex_Avg(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
-/* SDY - look into this function */
-#if 0
- fts_symbol_t s;
- fts_integer_vector_t *tw = 0;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: Avg: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- }
-
- s = (fts_symbol_t ) (argv++)->ex_ptr;
-
- tw = table_integer_vector_get_by_name(s);
-
- if (! tw)
- {
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- post("expr: Avg: no such table %s\n", fts_symbol_name(s));
- return;
- }
-
- if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
- {
- post("expr: Avg: boundries have to be fix values\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- optr->ex_type = ET_INT;
-
- if (argv[1].ex_int - argv->ex_int <= 0)
- optr->ex_int = 0;
- else
- optr->ex_int = (fts_integer_vector_get_sub_sum(tw, argv->ex_int, argv[1].ex_int) /
- (argv[1].ex_int - argv->ex_int));
-#endif
-}
-
-/*
- * ex_store -- store a value in a table
- * if the index is greater the size of the table,
- * we will make a modulo the size of the table
- */
-
-void
-ex_store(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
-{
-/* SDY - look into this function */
-#if 0
- fts_symbol_t s;
- fts_integer_vector_t *tw = 0;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: store: need a table name\n");
- }
-
- s = (fts_symbol_t ) (argv++)->ex_ptr;
-
- tw = table_integer_vector_get_by_name(s);
-
- if (! tw)
- {
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- post("expr: store: no such table %s\n", fts_symbol_name(s));
- return;
- }
-
- if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
- {
- post("expr: store: arguments have to be integer\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- }
-
- fts_integer_vector_set_element(tw, argv->ex_int < 0 ? 0 : argv->ex_int % fts_integer_vector_get_size(tw), argv[1].ex_int);
- *optr = argv[1];
-#endif
-}
-
-#else /* MSP */
-
-void
-pd_error(void *object, char *fmt, ...)
-{
- va_list ap;
- t_int arg[8];
- int i;
- static int saidit = 0;
- va_start(ap, fmt);
-/* SDY
- vsprintf(error_string, fmt, ap);
- */ post(fmt, ap);
- va_end(ap);
-/* SDY
- fprintf(stderr, "error: %s\n", error_string);
- error_object = object;
-*/
- if (!saidit)
- {
- post("... you might be able to track this down from the Find menu.");
- saidit = 1;
- }
-}
-#endif
diff --git a/externals/extra/0.43.3/extra-meta.pd b/externals/extra/0.43.3/extra-meta.pd
deleted file mode 100644
index ca069f0e..00000000
--- a/externals/extra/0.43.3/extra-meta.pd
+++ /dev/null
@@ -1,7 +0,0 @@
-#N canvas 15 49 200 200 10;
-#N canvas 25 49 420 300 META 1;
-#X text 13 10 NAME extra;
-#X text 10 30 VERSION 0.43.3;
-#X text 10 50 AUTHOR Miller Puckette and others;
-#X text 10 50 LICENSE GPLv2 for expr and BSD for the rest;
-#X restore 10 10 pd META;
diff --git a/externals/extra/0.43.3/fiddle~/fiddle~-help.pd b/externals/extra/0.43.3/fiddle~/fiddle~-help.pd
deleted file mode 100644
index f396725a..00000000
--- a/externals/extra/0.43.3/fiddle~/fiddle~-help.pd
+++ /dev/null
@@ -1,142 +0,0 @@
-#N canvas 93 26 980 745 10;
-#X obj 262 522 phasor~;
-#X obj 531 616 unpack;
-#X floatatom 531 666 0 0 0 0 - - -;
-#X msg 437 449 print;
-#X obj 262 500 sig~;
-#X floatatom 262 478 0 0 0 0 - - -;
-#X obj 262 456 mtof;
-#X floatatom 262 434 0 0 0 0 - - -;
-#X floatatom 545 643 0 0 0 0 - - -;
-#X obj 531 576 route 1 2 3 4;
-#X obj 614 616 unpack;
-#X floatatom 614 666 0 0 0 0 - - -;
-#X floatatom 628 643 0 0 0 0 - - -;
-#X obj 698 616 unpack;
-#X floatatom 698 666 0 0 0 0 - - -;
-#X floatatom 712 643 0 0 0 0 - - -;
-#X obj 389 616 unpack;
-#X floatatom 389 666 0 0 0 0 - - -;
-#X floatatom 403 643 0 0 0 0 - - -;
-#X obj 334 545 *~;
-#X obj 322 394 loadbang;
-#X obj 353 522 sig~;
-#X floatatom 353 500 0 0 0 0 - - -;
-#X msg 322 478 1;
-#X msg 353 478 0;
-#X floatatom 466 666 0 0 0 0 - - -;
-#X obj 281 666 print attack;
-#X obj 190 666 print pitch;
-#X msg 555 45 \; pd dsp 1;
-#X text 460 39 click here;
-#X text 460 61 to start DSP;
-#X text 226 4 FIDDLE - pitch estimator and sinusoidal peak finder;
-#X text 8 70 The Fiddle object estimates the pitch and amplitude of
-an incoming sound \, both continuously and as a stream of discrete
-"note" events. Fiddle optionally outputs a list of detected sinusoidal
-peaks used to make the pitch determination. Fiddle is described theoretically
-in the 1998 ICMC proceedings \, reprinted on http://man104nfs.ucsd.edu/~mpuckett.
-;
-#X text 8 170 Fiddle's creation arguments specify an analysis window
-size \, the maximum polyphony (i.e. \, the number of simultaneous "pitches"
-to try to find) \, the number of peaks in the spectrum to consider
-\, and the number of peaks \, if any \, to output "raw." The outlets
-give discrete pitch (a number) \, detected attacks in the amplitude
-envelope (a bang) \, one or more voices of continuous pitch and amplitude
-\, overall amplitude \, and optionally a sequence of messages with
-the peaks.;
-#X text 8 296 The analysis hop size is half the window size so in the
-example shown here \, one analysis is done every 512 samples (11.6
-msec at 44K1) \, and the analysis uses the most recent 1024 samples
-(23.2 msec at 44K1). The minimum frequency that Fiddle will report
-is 2-1/2 cycles per analysis windows \, or about 108 Hz. (just below
-MIDI 45.);
-#X text 669 535 number of pitch outlets (1-3 \, default 1);
-#X text 669 557 number of peaks to find (1-100 \, default 20);
-#X text 669 579 number of peaks to output (default 0.);
-#X msg 441 107 amp-range 40 50;
-#X msg 439 227 reattack 100 10;
-#X msg 438 282 npartial 7;
-#X msg 438 170 vibrato 50 0.5;
-#X text 560 91 a low and high amplitude threshold: if signal amplitude
-is below the low threshold \, no pitches or peaks are output. The high
-threshold is a minimum at which "cooked" outputs may appear.;
-#X text 560 152 A period in milliseconds (50) over which the raw pitch
-may not deviate more than an interval in half-tones (0.5) from the
-average pitch to report it as a note to the "cooked" pitch outlet.
-;
-#X text 560 213 A period in milliseconds (100) over which a re-attack
-is reported if the amplitude rises more than (1) dB. The re-attack
-will result in a "bang" in the attack outlet and may give rise to repeated
-notes in the cooked pitch output.;
-#X text 142 432 test input pitch;
-#X text 330 444 test input;
-#X text 330 457 amplitude;
-#X obj 410 545 fiddle~ 1024 1 20 3;
-#X text 538 690 individual sinusoidal components;
-#X text 466 688 amplitude;
-#X text 476 703 (dB);
-#X text 389 688 raw pitch;
-#X text 376 712 and amplitude;
-#X text 364 729 (up to 3 outputs);
-#X text 287 686 bang on;
-#X text 287 708 attack;
-#X text 185 686 cooked pitch;
-#X text 202 703 output;
-#X text 545 545 ------ arguments:;
-#X msg 262 412 57;
-#X msg 440 331 auto 1;
-#X msg 440 353 auto 0;
-#X msg 439 418 bang;
-#X text 561 416 poll current values --- useful if not in auto mode
-\,;
-#X text 560 274 Higher partials are weighed less strongly than lower
-ones in determining the pitch. This specifies the number of the partial
-(7) which will be weighted half as strongly as the fundamental.;
-#X text 560 335 start and stop "auto" mode (on by default.) If off
-\, output only appears on "bang" (poll mode).;
-#X text 561 448 print out all settings;
-#X text 669 513 window size (128-2048 \, default 1024);
-#X msg 440 375 npoints 2048;
-#X text 562 384 number of points in analysis window (power of 2 \,
-128-2048);
-#X msg 439 396 npoints 1024;
-#X connect 0 0 19 0;
-#X connect 1 0 2 0;
-#X connect 1 1 8 0;
-#X connect 3 0 48 0;
-#X connect 4 0 0 0;
-#X connect 5 0 4 0;
-#X connect 6 0 5 0;
-#X connect 7 0 6 0;
-#X connect 9 0 1 0;
-#X connect 9 1 10 0;
-#X connect 9 2 13 0;
-#X connect 10 0 11 0;
-#X connect 10 1 12 0;
-#X connect 13 0 14 0;
-#X connect 13 1 15 0;
-#X connect 16 0 17 0;
-#X connect 16 1 18 0;
-#X connect 19 0 48 0;
-#X connect 20 0 60 0;
-#X connect 20 0 23 0;
-#X connect 21 0 19 1;
-#X connect 22 0 21 0;
-#X connect 23 0 22 0;
-#X connect 24 0 22 0;
-#X connect 38 0 48 0;
-#X connect 39 0 48 0;
-#X connect 40 0 48 0;
-#X connect 41 0 48 0;
-#X connect 48 0 27 0;
-#X connect 48 1 26 0;
-#X connect 48 2 16 0;
-#X connect 48 3 25 0;
-#X connect 48 4 9 0;
-#X connect 60 0 7 0;
-#X connect 61 0 48 0;
-#X connect 62 0 48 0;
-#X connect 63 0 48 0;
-#X connect 69 0 48 0;
-#X connect 71 0 48 0;
diff --git a/externals/extra/0.43.3/fiddle~/fiddle~.c b/externals/extra/0.43.3/fiddle~/fiddle~.c
deleted file mode 100644
index ea676784..00000000
--- a/externals/extra/0.43.3/fiddle~/fiddle~.c
+++ /dev/null
@@ -1,1851 +0,0 @@
-/* Copyright (c) 1997-1999 Miller Puckette and Ted Apel.
-* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-
-/*
- * Fiddle is a pitch tracker hardwired to have hop size ("H") equal to
- * half its window size ("N").
- *
- * This version should compile for Max "0.26," JMAX, Pd, or Max/MSP.
- *
- * The "lastanalysis" field holds the shifted FT of the previous H
- * samples. The buffer contains in effect points 1/2, 3/2, ..., (N-1)/2
- * of the DTFT of a real vector of length N, half of whose points are zero,
- * i.e., only the first H points are used. Put another way, we get the
- * the odd-numbered points of the FFT of the H points, zero padded to 4*H in
- * length. The integer points 0, 1, ..., H-1
- * are found by interpolating these others, using the fact that the
- * half-integer points are band-limited (they only have positive frequencies.)
- * To facilitate the interpolation the "lastanalysis" buffer contains
- * FILTSIZE extra points (1/2-FILTSIZE, ..., -1/2) at the beginning and
- * FILTSIZE again at the end ((N+1)/2, ..., FILTSIZE+(N-1)/2). The buffer
- * therefore has N+4*FILTSIZE floating-point numbers in it.
- *
- * after doing this I found out that you can just do a real FFT
- * of the H new points, zero-padded to contain N points, and using a similar
- * but simpler interpolation scheme you can still get 2N points of the DTFT
- * of the N points. Jean Laroche is a big fat hen.
- *
- */
-
-
-/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
-#ifdef _MSC_VER
-#pragma warning (disable: 4305 4244)
-#endif
-
-/* this #ifdef does nothing, but its there... */
-#ifdef _WIN32
-#define flog log
-#define fexp exp
-#define fsqrt sqrt
-#else
-#define flog log
-#define fexp exp
-#define fsqrt sqrt
-#endif
-
-char fiddle_version[] = "fiddle version 1.1 TEST4";
-
-#ifdef JMAX
-#include "fts.h"
-#include <stdio.h>
-#include <stdlib.h>
-typedef float t_float;
-typedef float t_floatarg;
-typedef fts_symbol_t t_symbol;
-
-static void *getbytes(size_t nbytes)
-{
- void *ret;
- if (nbytes < 1) nbytes = 1;
- ret = (void *)malloc(nbytes);
- return (ret);
-}
-
-static void *resizebytes(void *old, size_t oldsize, size_t newsize)
-{
- void *ret;
- if (newsize < 1) newsize = 1;
- ret = (void *)realloc((char *)old, newsize);
- return (ret);
-}
-
-static void freebytes(void *fatso, size_t nbytes)
-{
- free(fatso);
-}
-
-#define CLASSNAME "fiddle"
-
-#define OUTLETpower 5
-#define OUTLETmicropitch1 4
-#define OUTLETmicropitch2 3
-#define OUTLETmicropitch3 2
-#define OUTLETattack 1
-#define OUTLETpitch 0
-
-static fts_symbol_t *dsp_symbol = 0;
-#define error post
-
-#endif /* FTS */
-
-#ifdef MAX26
-#define t_floatarg double
-#include "m_extern.h"
-#include "d_graph.h"
-#include "d_ugen.h"
-#endif /* MAX26 */
-
-#ifdef PD
-#include "m_pd.h"
-#endif /* PD */
-
-#ifdef MSP
-#define flog log
-#define fexp exp
-#define fsqrt sqrt
-#endif /* MSP */
-
-#ifdef MSP
-#define t_floatarg double
-#include "ext.h"
-#include "z_dsp.h"
-#include "fft_mayer.proto.h"
-
-#endif /* MSP */
-
-#include <math.h>
-
-
-#define MINBIN 3
-#define DEFAMPLO 40
-#define DEFAMPHI 50
-#define DEFATTACKTIME 100
-#define DEFATTACKTHRESH 10
-#define DEFVIBTIME 50
-#define DEFVIBDEPTH 0.5
-#define GLISS 0.7f
-#define DBFUDGE 30.8f
-#define MINFREQINBINS 5 /* minimum frequency in bins for reliable output */
-
-#define MAXNPITCH 3
-#define MAXHIST 3 /* find N hottest peaks in histogram */
-
-#define MAXPOINTS 8192
-#define MINPOINTS 128
-#define DEFAULTPOINTS 1024
-
-#define HISTORY 20
-#define MAXPEAK 100 /* maximum number of peaks */
-#define DEFNPEAK 20 /* default number of peaks */
-
-#define MAXNPEAK (MAXLOWPEAK + MAXSTRONGPEAK)
-#define MINBW (0.03f) /* consider BW >= 0.03 FFT bins */
-
-#define BINPEROCT 48 /* bins per octave */
-#define BPERO_OVER_LOG2 69.24936196f /* BINSPEROCT/log(2) */
-#define FACTORTOBINS (t_float)(4/0.0145453) /* 4 / (pow(2.,1/48.) - 1) */
-#define BINGUARD 10 /* extra bins to throw in front */
-#define PARTIALDEVIANCE 0.023f /* acceptable partial detuning in % */
-#define LOGTODB 4.34294481903f /* 20/log(10) */
-
-#define KNOCKTHRESH 10.f /* don't know how to describe this */
-
-
-static t_float sigfiddle_partialonset[] =
-{
-0,
-48,
-76.0782000346154967102,
-96,
-111.45254855459339269887,
-124.07820003461549671089,
-134.75303625876499715823,
-144,
-152.15640006923099342109,
-159.45254855459339269887,
-166.05271769459026829915,
-172.07820003461549671088,
-177.62110647077242370064,
-182.75303625876499715892,
-187.53074858920888940907,
-192,
-};
-
-#define NPARTIALONSET ((int)(sizeof(sigfiddle_partialonset)/sizeof(t_float)))
-
-static int sigfiddle_intpartialonset[] =
-{
-0,
-48,
-76,
-96,
-111,
-124,
-135,
-144,
-152,
-159,
-166,
-172,
-178,
-183,
-188,
-192,
-};
-
-/* these coefficients, which come from the "upsamp" subdirectory,
-are a filter kernel for upsampling by a factor of two, assuming
-the sound to be upsampled has no energy above half the Nyquist, i.e.,
-that it's already 2x oversampled compared to the theoretically possible
-sample rate. I got these by trial and error. */
-
-#define FILT1 ((t_float)(.5 * 1.227054))
-#define FILT2 ((t_float)(.5 * -0.302385))
-#define FILT3 ((t_float)(.5 * 0.095326))
-#define FILT4 ((t_float)(.5 * -0.022748))
-#define FILT5 ((t_float)(.5 * 0.002533))
-#define FILTSIZE 5
-
-typedef struct peakout /* a peak for output */
-{
- t_float po_freq; /* frequency in hz */
- t_float po_amp; /* amplitude */
-} t_peakout;
-
-typedef struct peak /* a peak for analysis */
-{
- t_float p_freq; /* frequency in bins */
- t_float p_width; /* peak width in bins */
- t_float p_pow; /* peak power */
- t_float p_loudness; /* 4th root of power */
- t_float *p_fp; /* pointer back to spectrum */
-} t_peak;
-
-typedef struct histopeak
-{
- t_float h_pitch; /* estimated pitch */
- t_float h_value; /* value of peak */
- t_float h_loud; /* combined strength of found partials */
- int h_index; /* index of bin holding peak */
- int h_used; /* true if an x_hist entry points here */
-} t_histopeak;
-
-typedef struct pitchhist /* struct for keeping history by pitch */
-{
- t_float h_pitch; /* pitch to output */
- t_float h_amps[HISTORY]; /* past amplitudes */
- t_float h_pitches[HISTORY]; /* past pitches */
- t_float h_noted; /* last pitch output */
- int h_age; /* number of frames pitch has been there */
- t_histopeak *h_wherefrom; /* new histogram peak to incorporate */
- void *h_outlet;
-} t_pitchhist;
-
-typedef struct sigfiddle /* instance struct */
-{
-#ifdef JMAX
- fts_object_t x_h; /* object header */
- fts_alarm_t x_clock; /* callback for timeouts */
-#endif
-#ifdef MAX26
- t_head x_h; /* header for tilde objects */
- t_sig *x_io[IN1+OUT0]; /* number of signal inputs and outputs */
- void *x_clock; /* a "clock" object */
-#endif
-#ifdef PD
- t_object x_ob; /* object header */
- t_clock *x_clock; /* callback for timeouts */
-#endif
-#ifdef MSP
- t_pxobject x_obj;
- void *x_clock;
- long x_downsample; /* downsample feature because of
- MSP's large sig vector sizes */
-#endif
- t_float *x_inbuf; /* buffer to analyze, npoints/2 elems */
- t_float *x_lastanalysis; /* FT of last buffer (see main comment) */
- t_float *x_spiral; /* 1/4-wave complex exponential */
- t_peakout *x_peakbuf; /* spectral peaks for output */
- int x_npeakout; /* number of spectral peaks to output */
- int x_npeakanal; /* number of spectral peaks to analyze */
- int x_phase; /* number of points since last output */
- int x_histphase; /* phase into amplitude history vector */
- int x_hop; /* period of output, npoints/2 */
- t_float x_sr; /* sample rate */
- t_pitchhist x_hist[MAXNPITCH]; /* history of current pitches */
- int x_nprint; /* how many periods to print */
- int x_npitch; /* number of simultaneous pitches */
- t_float x_dbs[HISTORY]; /* DB history, indexed by "histphase" */
- t_float x_peaked; /* peak since last attack */
- int x_dbage; /* number of bins DB has met threshold */
- int x_auto; /* true if generating continuous output */
-/* parameters */
- t_float x_amplo;
- t_float x_amphi;
- int x_attacktime;
- int x_attackbins;
- t_float x_attackthresh;
- int x_vibtime;
- int x_vibbins;
- t_float x_vibdepth;
- t_float x_npartial;
-/* outlets & clock */
- void *x_envout;
- int x_attackvalue;
- void *x_attackout;
- void *x_noteout;
- void *x_peakout;
-} t_sigfiddle;
-
-#if CHECKER
-t_float fiddle_checker[1024];
-#endif
-
-#ifdef MSP
-/* Mac compiler requires prototypes for everything */
-
-int sigfiddle_ilog2(int n);
-t_float fiddle_mtof(t_float f);
-t_float fiddle_ftom(t_float f);
-void sigfiddle_doit(t_sigfiddle *x);
-void sigfiddle_debug(t_sigfiddle *x);
-void sigfiddle_print(t_sigfiddle *x);
-void sigfiddle_assist(t_sigfiddle *x, void *b, long m, long a, char *s);
-void sigfiddle_amprange(t_sigfiddle *x, double amplo, double amphi);
-void sigfiddle_reattack(t_sigfiddle *x, t_floatarg attacktime, t_floatarg
-attackthresh);
-void sigfiddle_vibrato(t_sigfiddle *x, t_floatarg vibtime, t_floatarg
-vibdepth);
-void sigfiddle_npartial(t_sigfiddle *x, double npartial);
-void sigfiddle_auto(t_sigfiddle *x, t_floatarg f);
-void sigfiddle_setnpoints(t_sigfiddle *x, t_floatarg f);
-int sigfiddle_doinit(t_sigfiddle *x, long npoints, long npitch, long
-npeakanal, long npeakout);
-static t_int *fiddle_perform(t_int *w);
-void sigfiddle_dsp(t_sigfiddle *x, t_signal **sp);
-void sigfiddle_tick(t_sigfiddle *x);
-void sigfiddle_bang(t_sigfiddle *x);
-void sigfiddle_ff(t_sigfiddle *x);
-void *sigfiddle_new(long npoints, long npitch,
- long npeakanal, long npeakout);
-void msp_fft(t_float *buf, long np, long inv);
-t_float msp_ffttemp[MAXPOINTS*2];
-int errno;
-#endif
-
-int sigfiddle_ilog2(int n)
-{
- int ret = -1;
- while (n)
- {
- n >>= 1;
- ret++;
- }
- return (ret);
-}
-
-t_float fiddle_mtof(t_float f)
-{
- return (8.17579891564 * exp(.0577622650 * f));
-}
-
-t_float fiddle_ftom(t_float f)
-{
- return (17.3123405046 * log(.12231220585 * f));
-}
-#define ftom fiddle_ftom
-#define mtof fiddle_mtof
-
-void sigfiddle_doit(t_sigfiddle *x)
-{
-#ifdef MSP
- /* prevents interrupt-level stack overflow crash with Netscape. */
- static t_float spect1[4*MAXPOINTS];
- static t_float spect2[MAXPOINTS + 4*FILTSIZE];
-#else
- t_float spect1[4*MAXPOINTS];
- t_float spect2[MAXPOINTS + 4*FILTSIZE];
-#endif
-#if CHECKER
- t_float checker3[4*MAXPOINTS];
-#endif
-
- t_peak peaklist[MAXPEAK + 1], *pk1;
- t_peakout *pk2;
- t_histopeak histvec[MAXHIST], *hp1;
- int i, j, k, hop = x->x_hop, n = 2*hop, npeak, npitch,
- logn = sigfiddle_ilog2(n), newphase, oldphase;
- t_float *fp, *fp1, *fp2, *fp3, total_power, total_loudness, total_db;
- t_float maxbin = BINPEROCT * (logn-2), *histogram = spect2 + BINGUARD;
- t_pitchhist *phist;
- t_float hzperbin = x->x_sr / (2.0f * n);
- int npeakout = x->x_npeakout, npeakanal = x->x_npeakanal;
- int npeaktot = (npeakout > npeakanal ? npeakout : npeakanal);
-
- oldphase = x->x_histphase;
- newphase = x->x_histphase + 1;
- if (newphase == HISTORY) newphase = 0;
- x->x_histphase = newphase;
-
- /*
- * multiply the H points by a 1/4-wave complex exponential,
- * and take FFT of the result.
- */
- for (i = 0, fp1 = x->x_inbuf, fp2 = x->x_spiral, fp3 = spect1;
- i < hop; i++, fp1++, fp2 += 2, fp3 += 2)
- fp3[0] = fp1[0] * fp2[0], fp3[1] = fp1[0] * fp2[1];
-
-#ifdef MAX26
- fft(spect1, hop, 0);
-#endif
-#ifdef PD
- pd_fft(spect1, hop, 0);
-#endif
-#ifdef JMAX
- fts_cfft_inplc((complex *)spect1, hop);
-#endif
-#ifdef MSP
- msp_fft(spect1,hop,0);
-#endif
- /*
- * now redistribute the points to get in effect the odd-numbered
- * points of the FFT of the H points, zero padded to 4*H in length.
- */
- for (i = 0, fp1 = spect1, fp2 = spect2 + (2*FILTSIZE);
- i < (hop>>1); i++, fp1 += 2, fp2 += 4)
- fp2[0] = fp1[0], fp2[1] = fp1[1];
- for (i = 0, fp1 = spect1 + n - 2, fp2 = spect2 + (2*FILTSIZE+2);
- i < (hop>>1); i++, fp1 -= 2, fp2 += 4)
- fp2[0] = fp1[0], fp2[1] = -fp1[1];
- for (i = 0, fp1 = spect2 + (2*FILTSIZE), fp2 = spect2 + (2*FILTSIZE-2);
- i<FILTSIZE; i++, fp1+=2, fp2-=2)
- fp2[0] = fp1[0], fp2[1] = -fp1[1];
- for (i = 0, fp1 = spect2 + (2*FILTSIZE+n-2), fp2 = spect2 + (2*FILTSIZE+n);
- i<FILTSIZE; i++, fp1-=2, fp2+=2)
- fp2[0] = fp1[0], fp2[1] = -fp1[1];
-#if 0
- {
- fp = spect2 + 2*FILTSIZE;
- post("x1 re %12.4f %12.4f %12.4f %12.4f %12.4f",
- fp[0], fp[2], fp[4], fp[6], fp[8]);
- post("x1 im %12.4f %12.4f %12.4f %12.4f %12.4f",
- fp[1], fp[3], fp[5], fp[7], fp[9]);
- }
-#endif
- /* spect2 is now prepared; now combine spect2 and lastanalysis into
- * spect1. Odd-numbered points of spect1 are the points of "last"
- * plus (-i, i, -i, ...) times spect1. Even-numbered points are
- * the interpolated points of "last" plus (1, -1, 1, ...) times the
- * interpolated points of spect1.
- *
- * To interpolate, take FILT1 exp(-pi/4) times
- * the previous point, FILT2*exp(-3*pi/4) times 3 bins before,
- * etc, and FILT1 exp(pi/4), FILT2 exp(3pi/4), etc., to weight
- * the +1, +3, etc., points.
- *
- * In this calculation, we take (1, i, -1, -i, 1) times the
- * -9, -7, ..., -1 points, and (i, -1, -i, 1, i) times the 1, 3,..., 9
- * points of the OLD spectrum, alternately adding and subtracting
- * the new spectrum to the old; then we multiply the whole thing
- * by exp(-i pi/4).
- */
- for (i = 0, fp1 = spect1, fp2 = x->x_lastanalysis + 2*FILTSIZE,
- fp3 = spect2 + 2*FILTSIZE;
- i < (hop>>1); i++)
- {
- t_float re, im;
-
- re= FILT1 * ( fp2[ -2] -fp2[ 1] +fp3[ -2] -fp3[ 1]) +
- FILT2 * ( fp2[ -3] -fp2[ 2] +fp3[ -3] -fp3[ 2]) +
- FILT3 * (-fp2[ -6] +fp2[ 5] -fp3[ -6] +fp3[ 5]) +
- FILT4 * (-fp2[ -7] +fp2[ 6] -fp3[ -7] +fp3[ 6]) +
- FILT5 * ( fp2[-10] -fp2[ 9] +fp3[-10] -fp3[ 9]);
-
- im= FILT1 * ( fp2[ -1] +fp2[ 0] +fp3[ -1] +fp3[ 0]) +
- FILT2 * (-fp2[ -4] -fp2[ 3] -fp3[ -4] -fp3[ 3]) +
- FILT3 * (-fp2[ -5] -fp2[ 4] -fp3[ -5] -fp3[ 4]) +
- FILT4 * ( fp2[ -8] +fp2[ 7] +fp3[ -8] +fp3[ 7]) +
- FILT5 * ( fp2[ -9] +fp2[ 8] +fp3[ -9] +fp3[ 8]);
-
- fp1[0] = 0.7071f * (re + im);
- fp1[1] = 0.7071f * (im - re);
- fp1[4] = fp2[0] + fp3[1];
- fp1[5] = fp2[1] - fp3[0];
-
- fp1 += 8, fp2 += 2, fp3 += 2;
- re= FILT1 * ( fp2[ -2] -fp2[ 1] -fp3[ -2] +fp3[ 1]) +
- FILT2 * ( fp2[ -3] -fp2[ 2] -fp3[ -3] +fp3[ 2]) +
- FILT3 * (-fp2[ -6] +fp2[ 5] +fp3[ -6] -fp3[ 5]) +
- FILT4 * (-fp2[ -7] +fp2[ 6] +fp3[ -7] -fp3[ 6]) +
- FILT5 * ( fp2[-10] -fp2[ 9] -fp3[-10] +fp3[ 9]);
-
- im= FILT1 * ( fp2[ -1] +fp2[ 0] -fp3[ -1] -fp3[ 0]) +
- FILT2 * (-fp2[ -4] -fp2[ 3] +fp3[ -4] +fp3[ 3]) +
- FILT3 * (-fp2[ -5] -fp2[ 4] +fp3[ -5] +fp3[ 4]) +
- FILT4 * ( fp2[ -8] +fp2[ 7] -fp3[ -8] -fp3[ 7]) +
- FILT5 * ( fp2[ -9] +fp2[ 8] -fp3[ -9] -fp3[ 8]);
-
- fp1[0] = 0.7071f * (re + im);
- fp1[1] = 0.7071f * (im - re);
- fp1[4] = fp2[0] - fp3[1];
- fp1[5] = fp2[1] + fp3[0];
-
- fp1 += 8, fp2 += 2, fp3 += 2;
- }
-#if 0
- if (x->x_nprint)
- {
- for (i = 0, fp = spect1; i < 16; i++, fp+= 4)
- post("spect %d %f %f --> %f", i, fp[0], fp[1],
- sqrt(fp[0] * fp[0] + fp[1] * fp[1]));
- }
-#endif
- /* copy new spectrum out */
- for (i = 0, fp1 = spect2, fp2 = x->x_lastanalysis;
- i < n + 4*FILTSIZE; i++) *fp2++ = *fp1++;
-
- for (i = 0; i < MINBIN; i++) spect1[4*i + 2] = spect1[4*i + 3] = 0;
- /* starting at bin MINBIN, compute hanning windowed power spectrum */
- for (i = MINBIN, fp1 = spect1+4*MINBIN, total_power = 0;
- i < n-2; i++, fp1 += 4)
- {
- t_float re = fp1[0] - 0.5 * (fp1[-8] + fp1[8]);
- t_float im = fp1[1] - 0.5 * (fp1[-7] + fp1[9]);
- fp1[3] = (total_power += (fp1[2] = re * re + im * im));
- }
-
- if (total_power > 1e-9f)
- {
- total_db = (100.f - DBFUDGE) + LOGTODB * log(total_power/n);
- total_loudness = fsqrt(fsqrt(total_power));
- if (total_db < 0) total_db = 0;
- }
- else total_db = total_loudness = 0;
- /* store new db in history vector */
- x->x_dbs[newphase] = total_db;
- if (total_db < x->x_amplo) goto nopow;
-#if 1
- if (x->x_nprint) post("power %f", total_power);
-#endif
-
-#if CHECKER
- /* verify that our FFT resampling thing is putting out good results */
- for (i = 0; i < hop; i++)
- {
- checker3[2*i] = fiddle_checker[i];
- checker3[2*i + 1] = 0;
- checker3[n + 2*i] = fiddle_checker[i] = x->x_inbuf[i];
- checker3[n + 2*i + 1] = 0;
- }
- for (i = 2*n; i < 4*n; i++) checker3[i] = 0;
- fft(checker3, 2*n, 0);
- if (x->x_nprint)
- {
- for (i = 0, fp = checker3; i < 16; i++, fp += 2)
- post("spect %d %f %f --> %f", i, fp[0], fp[1],
- sqrt(fp[0] * fp[0] + fp[1] * fp[1]));
- }
-
-#endif
- npeak = 0;
-
- /* search for peaks */
- for (i = MINBIN, fp = spect1+4*MINBIN, pk1 = peaklist;
- i < n-2 && npeak < npeaktot; i++, fp += 4)
- {
- t_float height = fp[2], h1 = fp[-2], h2 = fp[6];
- t_float totalfreq, pfreq, f1, f2, m, var, stdev;
-
- if (height < h1 || height < h2 ||
- h1 < 0.00001f*total_power || h2 < 0.00001f*total_power)
- continue;
-
- /* use an informal phase vocoder to estimate the frequency.
- Do this for the two adjacent bins too. */
- pfreq= ((fp[-8] - fp[8]) * (2.0f * fp[0] - fp[8] - fp[-8]) +
- (fp[-7] - fp[9]) * (2.0f * fp[1] - fp[9] - fp[-7])) /
- (2.0f * height);
- f1= ((fp[-12] - fp[4]) * (2.0f * fp[-4] - fp[4] - fp[-12]) +
- (fp[-11] - fp[5]) * (2.0f * fp[-3] - fp[5] - fp[-11])) /
- (2.0f * h1) - 1;
- f2= ((fp[-4] - fp[12]) * (2.0f * fp[4] - fp[12] - fp[-4]) +
- (fp[-3] - fp[13]) * (2.0f * fp[5] - fp[13] - fp[-3])) /
- (2.0f * h2) + 1;
-
- /* get sample mean and variance of the three */
- m = 0.333333f * (pfreq + f1 + f2);
- var = 0.5f * ((pfreq-m)*(pfreq-m) + (f1-m)*(f1-m) + (f2-m)*(f2-m));
-
- totalfreq = i + m;
- if (var * total_power > KNOCKTHRESH * height || var < 1e-30)
- {
-#if 0
- if (x->x_nprint)
- post("cancel: %.2f hz, index %.1f, power %.5f, stdev=%.2f",
- totalfreq * hzperbin, BPERO_OVER_LOG2 * log(totalfreq) - 96,
- height, sqrt(var));
-#endif
- continue;
- }
- stdev = fsqrt(var);
- if (totalfreq < 4)
- {
- if (x->x_nprint) post("oops: was %d, freq %f, m %f, stdev %f h %f",
- i, totalfreq, m, stdev, height);
- totalfreq = 4;
- }
- pk1->p_width = stdev;
-
- pk1->p_pow = height;
- pk1->p_loudness = fsqrt(fsqrt(height));
- pk1->p_fp = fp;
- pk1->p_freq = totalfreq;
- npeak++;
-#if 1
- if (x->x_nprint)
- {
- post("peak: %.2f hz. index %.1f, power %.5f, stdev=%.2f",
- pk1->p_freq * hzperbin,
- BPERO_OVER_LOG2 * log(pk1->p_freq) - 96,
- height, stdev);
- }
-#endif
- pk1++;
- }
-
- /* prepare the raw peaks for output */
- for (i = 0, pk1 = peaklist, pk2 = x->x_peakbuf; i < npeak;
- i++, pk1++, pk2++)
- {
- t_float loudness = pk1->p_loudness;
- if (i >= npeakout) break;
- pk2->po_freq = hzperbin * pk1->p_freq;
- pk2->po_amp = (2. / (t_float)n) * (loudness * loudness);
- }
- for (; i < npeakout; i++, pk2++) pk2->po_amp = pk2->po_freq = 0;
-
- /* now, working back into spect2, make a sort of "liklihood"
- * spectrum. Proceeding in 48ths of an octave, from 2 to
- * n/2 (in bins), the likelihood of each pitch range is contributed
- * to by every peak in peaklist that's an integer multiple of it
- * in frequency.
- */
-
- if (npeak > npeakanal) npeak = npeakanal; /* max # peaks to analyze */
- for (i = 0, fp1 = histogram; i < maxbin; i++) *fp1++ = 0;
- for (i = 0, pk1 = peaklist; i < npeak; i++, pk1++)
- {
- t_float pit = BPERO_OVER_LOG2 * flog(pk1->p_freq) - 96.0;
- t_float binbandwidth = FACTORTOBINS * pk1->p_width/pk1->p_freq;
- t_float putbandwidth = (binbandwidth < 2 ? 2 : binbandwidth);
- t_float weightbandwidth = (binbandwidth < 1.0 ? 1.0 : binbandwidth);
- /* t_float weightamp = 1.0f + 3.0f * pk1->p_pow / pow; */
- t_float weightamp = 4. * pk1->p_loudness / total_loudness;
- for (j = 0, fp2 = sigfiddle_partialonset; j < NPARTIALONSET; j++, fp2++)
- {
- t_float bin = pit - *fp2;
- if (bin < maxbin)
- {
- t_float para, pphase, score = 30.0 * weightamp /
- ((j+x->x_npartial) * weightbandwidth);
- int firstbin = bin + 0.5f - 0.5f * putbandwidth;
- int lastbin = bin + 0.5f + 0.5f * putbandwidth;
- int ibw = lastbin - firstbin;
- if (firstbin < -BINGUARD) break;
- para = 1.0f / (putbandwidth * putbandwidth);
- for (k = 0, fp3 = histogram + firstbin,
- pphase = firstbin-bin; k <= ibw;
- k++, fp3++, pphase += 1.0f)
- {
- *fp3 += score * (1.0f - para * pphase * pphase);
- }
- }
- }
- }
-#if 1
- if (x->x_nprint)
- {
- for (i = 0; i < 6*5; i++)
- {
- t_float fhz = hzperbin * exp ((8*i + 96) * (1./BPERO_OVER_LOG2));
- if (!(i % 6)) post("-- bin %d pitch %f freq %f----", 8*i,
- ftom(fhz), fhz);;
- post("%3d %3d %3d %3d %3d %3d %3d %3d",
- (int)(histogram[8*i]),
- (int)(histogram[8*i+1]),
- (int)(histogram[8*i+2]),
- (int)(histogram[8*i+3]),
- (int)(histogram[8*i+4]),
- (int)(histogram[8*i+5]),
- (int)(histogram[8*i+6]),
- (int)(histogram[8*i+7]));
- }
- }
-
-#endif
-
- /*
- * Next we find up to NPITCH strongest peaks in the histogram.
- * if a peak is related to a stronger one via an interval in
- * the sigfiddle_partialonset array, we suppress it.
- */
-
- for (npitch = 0; npitch < x->x_npitch; npitch++)
- {
- int indx;
- t_float best;
- if (npitch)
- {
- for (best = 0, indx = -1, j=1; j < maxbin-1; j++)
- {
- if (histogram[j] > best && histogram[j] > histogram[j-1] &&
- histogram[j] > histogram[j+1])
- {
- for (k = 0; k < npitch; k++)
- if (histvec[k].h_index == j)
- goto peaknogood;
- for (k = 0; k < NPARTIALONSET; k++)
- {
- if (j - sigfiddle_intpartialonset[k] < 0) break;
- if (histogram[j - sigfiddle_intpartialonset[k]]
- > histogram[j]) goto peaknogood;
- }
- for (k = 0; k < NPARTIALONSET; k++)
- {
- if (j + sigfiddle_intpartialonset[k] >= maxbin) break;
- if (histogram[j + sigfiddle_intpartialonset[k]]
- > histogram[j]) goto peaknogood;
- }
- indx = j;
- best = histogram[j];
- }
- peaknogood: ;
- }
- }
- else
- {
- for (best = 0, indx = -1, j=0; j < maxbin; j++)
- if (histogram[j] > best)
- indx = j, best = histogram[j];
- }
- if (indx < 0) break;
- histvec[npitch].h_value = best;
- histvec[npitch].h_index = indx;
- }
-#if 1
- if (x->x_nprint)
- {
- for (i = 0; i < npitch; i++)
- {
- post("index %d freq %f --> value %f", histvec[i].h_index,
- exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 96)),
- histvec[i].h_value);
- post("next %f , prev %f",
- exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 97)),
- exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 95)) );
- }
- }
-#endif
-
- /* for each histogram peak, we now search back through the
- * FFT peaks. A peak is a pitch if either there are several
- * harmonics that match it, or else if (a) the fundamental is
- * present, and (b) the sum of the powers of the contributing peaks
- * is at least 1/100 of the total power.
- *
- * A peak is a contributor if its frequency is within 25 cents of
- * a partial from 1 to 16.
- *
- * Finally, we have to be at least 5 bins in frequency, which
- * corresponds to 2-1/5 periods fitting in the analysis window.
- */
-
- for (i = 0; i < npitch; i++)
- {
- t_float cumpow = 0, cumstrength = 0, freqnum = 0, freqden = 0;
- int npartials = 0, nbelow8 = 0;
- /* guessed-at frequency in bins */
- t_float putfreq = fexp((1.0 / BPERO_OVER_LOG2) *
- (histvec[i].h_index + 96.0f));
- for (j = 0; j < npeak; j++)
- {
- t_float fpnum = peaklist[j].p_freq/putfreq;
- int pnum = fpnum + 0.5f;
- t_float fipnum = pnum;
- t_float deviation;
- if (pnum > 16 || pnum < 1) continue;
- deviation = 1.0f - fpnum/fipnum;
- if (deviation > -PARTIALDEVIANCE && deviation < PARTIALDEVIANCE)
- {
- /*
- * we figure this is a partial since it's within 1/4 of
- * a halftone of a multiple of the putative frequency.
- */
-
- t_float stdev, weight;
- npartials++;
- if (pnum < 8) nbelow8++;
- cumpow += peaklist[j].p_pow;
- cumstrength += fsqrt(fsqrt(peaklist[j].p_pow));
- stdev = (peaklist[j].p_width > MINBW ?
- peaklist[j].p_width : MINBW);
- weight = 1.0f / ((stdev*fipnum) * (stdev*fipnum));
- freqden += weight;
- freqnum += weight * peaklist[j].p_freq/fipnum;
-#if 1
- if (x->x_nprint)
- {
- post("peak %d partial %d f=%f w=%f",
- j, pnum, peaklist[j].p_freq/fipnum, weight);
- }
-#endif
- }
-#if 1
- else if (x->x_nprint) post("peak %d partial %d dev %f",
- j, pnum, deviation);
-#endif
- }
- if ((nbelow8 < 4 || npartials < 7) && cumpow < 0.01f * total_power)
- histvec[i].h_value = 0;
- else
- {
- t_float pitchpow = (cumstrength * cumstrength) *
- (cumstrength * cumstrength);
- t_float freqinbins = freqnum/freqden;
- /* check for minimum output frequency */
-
- if (freqinbins < MINFREQINBINS)
- histvec[i].h_value = 0;
- else
- {
- /* we passed all tests... save the values we got */
- histvec[i].h_pitch = ftom(hzperbin * freqnum/freqden);
- histvec[i].h_loud = (100.0f -DBFUDGE) +
- (LOGTODB) * log(pitchpow/n);
- }
- }
- }
-#if 1
- if (x->x_nprint)
- {
- for (i = 0; i < npitch; i++)
- {
- if (histvec[i].h_value > 0)
- post("index %d pit %f loud %f", histvec[i].h_index,
- histvec[i].h_pitch, histvec[i].h_loud);
- else post("-- cancelled --");
- }
- }
-#endif
-
- /* now try to find continuous pitch tracks that match the new
- * pitches. First mark each peak unmatched.
- */
- for (i = 0, hp1 = histvec; i < npitch; i++, hp1++)
- hp1->h_used = 0;
-
- /* for each old pitch, try to match a new one to it. */
- for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
- {
- t_float thispitch = phist->h_pitches[oldphase];
- phist->h_pitch = 0; /* no output, thanks */
- phist->h_wherefrom = 0;
- if (thispitch == 0.0f) continue;
- for (j = 0, hp1 = histvec; j < npitch; j++, hp1++)
- if ((hp1->h_value > 0) && hp1->h_pitch > thispitch - GLISS
- && hp1->h_pitch < thispitch + GLISS)
- {
- phist->h_wherefrom = hp1;
- hp1->h_used = 1;
- }
- }
- for (i = 0, hp1 = histvec; i < npitch; i++, hp1++)
- if ((hp1->h_value > 0) && !hp1->h_used)
- {
- for (j = 0, phist = x->x_hist; j < x->x_npitch; j++, phist++)
- if (!phist->h_wherefrom)
- {
- phist->h_wherefrom = hp1;
- phist->h_age = 0;
- phist->h_noted = 0;
- hp1->h_used = 1;
- goto happy;
- }
- break;
- happy: ;
- }
- /* copy the pitch info into the history vector */
- for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
- {
- if (phist->h_wherefrom)
- {
- phist->h_amps[newphase] = phist->h_wherefrom->h_loud;
- phist->h_pitches[newphase] =
- phist->h_wherefrom->h_pitch;
- (phist->h_age)++;
- }
- else
- {
- phist->h_age = 0;
- phist->h_amps[newphase] = phist->h_pitches[newphase] = 0;
- }
- }
-#if 1
- if (x->x_nprint)
- {
- post("vibrato %d %f", x->x_vibbins, x->x_vibdepth);
- for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
- {
- post("noted %f, age %d", phist->h_noted, phist->h_age);
-#ifndef I860
- post("values %f %f %f %f %f",
- phist->h_pitches[newphase],
- phist->h_pitches[(newphase + HISTORY-1)%HISTORY],
- phist->h_pitches[(newphase + HISTORY-2)%HISTORY],
- phist->h_pitches[(newphase + HISTORY-3)%HISTORY],
- phist->h_pitches[(newphase + HISTORY-4)%HISTORY]);
-#endif
- }
- }
-#endif
- /* look for envelope attacks */
-
- x->x_attackvalue = 0;
-
- if (x->x_peaked)
- {
- if (total_db > x->x_amphi)
- {
- int binlook = newphase - x->x_attackbins;
- if (binlook < 0) binlook += HISTORY;
- if (total_db > x->x_dbs[binlook] + x->x_attackthresh)
- {
- x->x_attackvalue = 1;
- x->x_peaked = 0;
- }
- }
- }
- else
- {
- int binlook = newphase - x->x_attackbins;
- if (binlook < 0) binlook += HISTORY;
- if (x->x_dbs[binlook] > x->x_amphi && x->x_dbs[binlook] > total_db)
- x->x_peaked = 1;
- }
-
- /* for each current frequency track, test for a new note using a
- * stability criterion. Later perhaps we should also do as in
- * pitch~ and check for unstable notes a posteriori when
- * there's a new attack with no note found since the last onset;
- * but what's an attack &/or onset when we're polyphonic?
- */
-
- for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
- {
- /*
- * if we've found a pitch but we've now strayed from it turn
- * it off.
- */
- if (phist->h_noted)
- {
- if (phist->h_pitches[newphase] > phist->h_noted + x->x_vibdepth
- || phist->h_pitches[newphase] < phist->h_noted - x->x_vibdepth)
- phist->h_noted = 0;
- }
- else
- {
- if (phist->h_wherefrom && phist->h_age >= x->x_vibbins)
- {
- t_float centroid = 0;
- int not = 0;
- for (j = 0, k = newphase; j < x->x_vibbins; j++)
- {
- centroid += phist->h_pitches[k];
- k--;
- if (k < 0) k = HISTORY-1;
- }
- centroid /= x->x_vibbins;
- for (j = 0, k = newphase; j < x->x_vibbins; j++)
- {
- /* calculate deviation from norm */
- t_float dev = centroid - phist->h_pitches[k];
- k--;
- if (k < 0) k = HISTORY-1;
- if (dev > x->x_vibdepth ||
- -dev > x->x_vibdepth) not = 1;
- }
- if (!not)
- {
- phist->h_pitch = phist->h_noted = centroid;
- }
- }
- }
- }
- return;
-
-nopow:
- for (i = 0; i < x->x_npitch; i++)
- {
- x->x_hist[i].h_pitch = x->x_hist[i].h_noted =
- x->x_hist[i].h_pitches[newphase] =
- x->x_hist[i].h_amps[newphase] = 0;
- x->x_hist[i].h_age = 0;
- }
- x->x_peaked = 1;
- x->x_dbage = 0;
-}
-
-void sigfiddle_debug(t_sigfiddle *x)
-{
- x->x_nprint = 1;
-}
-
-void sigfiddle_print(t_sigfiddle *x)
-{
- post("npoints %d,", 2 * x->x_hop);
- post("amp-range %f %f,", x->x_amplo, x->x_amphi);
- post("reattack %d %f,", x->x_attacktime, x->x_attackthresh);
- post("vibrato %d %f", x->x_vibtime, x->x_vibdepth);
- post("npartial %f", x->x_npartial);
- post("auto %d", x->x_auto);
-}
-
-void sigfiddle_amprange(t_sigfiddle *x, t_floatarg amplo, t_floatarg amphi)
-{
- if (amplo < 0) amplo = 0;
- if (amphi < amplo) amphi = amplo + 1;
- x->x_amplo = amplo;
- x->x_amphi = amphi;
-}
-
-void sigfiddle_reattack(t_sigfiddle *x,
- t_floatarg attacktime, t_floatarg attackthresh)
-{
- if (attacktime < 0) attacktime = 0;
- if (attackthresh <= 0) attackthresh = 1000;
- x->x_attacktime = attacktime;
- x->x_attackthresh = attackthresh;
- x->x_attackbins = (x->x_sr * 0.001 * attacktime) / x->x_hop;
- if (x->x_attackbins >= HISTORY) x->x_attackbins = HISTORY - 1;
-}
-
-void sigfiddle_vibrato(t_sigfiddle *x, t_floatarg vibtime, t_floatarg vibdepth)
-{
- if (vibtime < 0) vibtime = 0;
- if (vibdepth <= 0) vibdepth = 1000;
- x->x_vibtime = vibtime;
- x->x_vibdepth = vibdepth;
- x->x_vibbins = (x->x_sr * 0.001 * vibtime) / x->x_hop;
- if (x->x_vibbins >= HISTORY) x->x_vibbins = HISTORY - 1;
- if (x->x_vibbins < 1) x->x_vibbins = 1;
-}
-
-void sigfiddle_npartial(t_sigfiddle *x, t_floatarg npartial)
-{
- if (npartial < 0.1) npartial = 0.1;
- x->x_npartial = npartial;
-}
-
-void sigfiddle_auto(t_sigfiddle *x, t_floatarg f)
-{
- x->x_auto = (f != 0);
-}
-
-static void sigfiddle_freebird(t_sigfiddle *x)
-{
- if (x->x_inbuf)
- {
- freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
- x->x_inbuf = 0;
- }
- if (x->x_lastanalysis)
- {
- freebytes(x->x_lastanalysis,
- sizeof(t_float) * (2 * x->x_hop + 4 * FILTSIZE));
- x->x_lastanalysis = 0;
- }
- if (x->x_spiral)
- {
- freebytes(x->x_spiral, sizeof(t_float) * 2 * x->x_hop);
- x->x_spiral = 0;
- }
- x->x_hop = 0;
-}
-
-int sigfiddle_setnpoints(t_sigfiddle *x, t_floatarg fnpoints)
-{
- int i, npoints = fnpoints;
- sigfiddle_freebird(x);
- if (npoints < MINPOINTS || npoints > MAXPOINTS)
- {
- error("fiddle~: npoints out of range; using %d",
- npoints = DEFAULTPOINTS);
- }
- if (npoints != (1 << sigfiddle_ilog2(npoints)))
- {
- error("fiddle~: npoints not a power of 2; using %d",
- npoints = (1 << sigfiddle_ilog2(npoints)));
- }
- x->x_hop = npoints >> 1;
- if (!(x->x_inbuf = (t_float *)getbytes(sizeof(t_float) * x->x_hop)))
- goto fail;
- if (!(x->x_lastanalysis = (t_float *)getbytes(
- sizeof(t_float) * (2 * x->x_hop + 4 * FILTSIZE))))
- goto fail;
- if (!(x->x_spiral = (t_float *)getbytes(sizeof(t_float) * 2 * x->x_hop)))
- goto fail;
- for (i = 0; i < x->x_hop; i++)
- x->x_inbuf[i] = 0;
- for (i = 0; i < npoints + 4 * FILTSIZE; i++)
- x->x_lastanalysis[i] = 0;
- for (i = 0; i < x->x_hop; i++)
- x->x_spiral[2*i] = cos((3.14159*i)/(npoints)),
- x->x_spiral[2*i+1] = -sin((3.14159*i)/(npoints));
- x->x_phase = 0;
- return (1);
-fail:
- sigfiddle_freebird(x);
- return (0);
-}
-
-int sigfiddle_doinit(t_sigfiddle *x, long npoints, long npitch,
- long npeakanal, long npeakout)
-{
- t_float *buf1, *buf2, *buf3;
- t_peakout *buf4;
- int i;
-
- if (!npeakanal && !npeakout) npeakanal = DEFNPEAK, npeakout = 0;
- if (!npeakanal < 0) npeakanal = 0;
- else if (npeakanal > MAXPEAK) npeakanal = MAXPEAK;
- if (!npeakout < 0) npeakout = 0;
- else if (npeakout > MAXPEAK) npeakout = MAXPEAK;
- if (npitch <= 0) npitch = 0;
- else if (npitch > MAXNPITCH) npitch = MAXNPITCH;
- if (npeakanal && !npitch) npitch = 1;
- if (!npoints)
- npoints = DEFAULTPOINTS;
- if (!sigfiddle_setnpoints(x, npoints))
- {
- error("fiddle~: out of memory");
- return (0);
- }
- if (!(buf4 = (t_peakout *)getbytes(sizeof(*buf4) * npeakout)))
- {
- sigfiddle_freebird(x);
- error("fiddle~: out of memory");
- return (0);
- }
- for (i = 0; i < npeakout; i++)
- buf4[i].po_freq = buf4[i].po_amp = 0;
- x->x_peakbuf = buf4;
-
- x->x_npeakout = npeakout;
- x->x_npeakanal = npeakanal;
- x->x_phase = 0;
- x->x_histphase = 0;
- x->x_sr = 44100; /* this and the next are filled in later */
- for (i = 0; i < MAXNPITCH; i++)
- {
- int j;
- x->x_hist[i].h_pitch = x->x_hist[i].h_noted = 0;
- x->x_hist[i].h_age = 0;
- x->x_hist[i].h_wherefrom = 0;
- x->x_hist[i].h_outlet = 0;
- for (j = 0; j < HISTORY; j++)
- x->x_hist[i].h_amps[j] = x->x_hist[i].h_pitches[j] = 0;
- }
- x->x_nprint = 0;
- x->x_npitch = npitch;
- for (i = 0; i < HISTORY; i++) x->x_dbs[i] = 0;
- x->x_dbage = 0;
- x->x_peaked = 0;
- x->x_auto = 1;
- x->x_amplo = DEFAMPLO;
- x->x_amphi = DEFAMPHI;
- x->x_attacktime = DEFATTACKTIME;
- x->x_attackbins = 1; /* real value calculated afterward */
- x->x_attackthresh = DEFATTACKTHRESH;
- x->x_vibtime = DEFVIBTIME;
- x->x_vibbins = 1; /* real value calculated afterward */
- x->x_vibdepth = DEFVIBDEPTH;
- x->x_npartial = 7;
- x->x_attackvalue = 0;
- return (1);
-}
-
- /* formalities for JMAX */
-
-#ifdef JMAX
-
-void sigfiddle_debug13(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- sigfiddle_debug(x);
-}
-
-void sigfiddle_print13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- sigfiddle_print(x);
-}
-
-void sigfiddle_amprange13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- t_float lo = (t_float) fts_get_float_arg(ac, at, 0, 0);
- t_float hi = (t_float) fts_get_float_arg(ac, at, 1, 0);
- sigfiddle_amprange(x, lo, hi);
-}
-
-void sigfiddle_reattack13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- long msec = fts_get_float_arg(ac, at, 0, 0);
- t_float db = (t_float) fts_get_float_arg(ac, at, 1, 0);
- sigfiddle_reattack(x, msec, db);
-}
-
-void sigfiddle_vibrato13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- long msec = fts_get_float_arg(ac, at, 0, 0);
- t_float halftones = (t_float) fts_get_float_arg(ac, at, 1, 0);
- sigfiddle_vibrato(x, msec, halftones);
-}
-
-void sigfiddle_npartial13(fts_object_t *o, int winlet, fts_symbol_t s,
- int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- t_float npartial = (t_float) fts_get_float_arg(ac, at, 0, 0);
- sigfiddle_npartial(x, npartial);
-}
-
-
-void ftl_sigfiddle(fts_word_t *a)
-{
- t_sigfiddle *x = (t_sigfiddle *)fts_word_get_long(a);
- t_float *in = (t_float *)fts_word_get_long(a + 1);
- long n_tick = fts_word_get_long(a + 2);
-
- int count;
- t_float *fp, *fp2;
- for (count = 0, fp = x->x_inbuf + x->x_phase;
- count < n_tick; count++) *fp++ = *in++;
- if (fp == x->x_inbuf + x->x_hop)
- {
- sigfiddle_doit(x);
- x->x_phase = 0;
- fts_alarm_set_delay(&x->x_clock, 0L); /* output bang */
- fts_alarm_arm(&x->x_clock);
-
- if (x->x_nprint) x->x_nprint--;
- }
- else x->x_phase += n_tick;
-}
-
-void sigfiddle_put(fts_object_t *o, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- fts_dsp_descr_t *dsp = (fts_dsp_descr_t *)fts_get_long_arg(ac, at, 0, 0);
- fts_atom_t a[3];
-
- x->x_sr = fts_dsp_get_input_srate(dsp, 0);
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
- sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
-
- fts_set_long(a, (long)x);
- fts_set_symbol(a+1, fts_dsp_get_input_name(dsp, 0));
- fts_set_long(a+2, fts_dsp_get_input_size(dsp, 0));
- dsp_add_funcall(dsp_symbol, 3, a);
-}
-
-void sigfiddle_tick(fts_alarm_t *alarm, void *p)
-{
- fts_object_t *o = (fts_object_t *)p;
- t_sigfiddle *x = (t_sigfiddle *)p;
-
- int i;
- t_pitchhist *ph;
- fts_outlet_float(o, OUTLETpower, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- fts_atom_t at[2];
- fts_set_float(at, ph->h_pitches[x->x_histphase]);
- fts_set_float(at+1, ph->h_amps[x->x_histphase]);
- fts_outlet_list(o, OUTLETmicropitch3 - i, 2, at);
- }
- if (x->x_attackvalue) fts_outlet_bang(o, OUTLETattack);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) fts_outlet_float(o, OUTLETpitch, ph->h_pitch);
-}
-
-static void sigfiddle_delete(fts_object_t *o, int winlet, fts_symbol_t *s, int ac,
- const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
-
- fts_free(x->x_inbuf);
- fts_free(x->x_lastanalysis);
- fts_free(x->x_spiral);
- dsp_list_remove(o);
-}
-
-static void sigfiddle_init(fts_object_t *o, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at)
-{
- t_sigfiddle *x = (t_sigfiddle *)o;
- t_float *buf1, *buf2, *buf3;
- int i, hop;
- long npoints = fts_get_long_arg(ac, at, 1, 0);
- long npitch = fts_get_long_arg(ac, at, 2, 0);
- long npeakanal = fts_get_long_arg(ac, at, 3, 0);
- long npeakout = fts_get_long_arg(ac, at, 4, 0);
-
- if (!sigfiddle_doinit(x, npoints, npitch, npeakanal, npeakout))
- {
- post("fiddle~: initialization failed");
- return;
- }
- hop = npoints>>1;
- if (fts_fft_declaresize(hop) != fts_Success)
- post("fiddle~: bad FFT size");
-
- fts_alarm_init(&(x->x_clock), 0, sigfiddle_tick, x);
- dsp_list_insert(o);
-}
-
-static fts_status_t sigfiddle_instantiate(fts_class_t *cl, int ac,
- const fts_atom_t *at)
-{
- int i;
- fts_type_t a[5];
-
- fts_class_init(cl, sizeof(t_sigfiddle), 1, 6, 0); /* 1 inlet + 6 outlets */
-
- /* the system methods */
-
- a[0] = fts_Symbol;
- a[1] = fts_Long | fts_OptArg;
- a[2] = fts_Long | fts_OptArg;
- fts_method_define(cl, fts_SystemInlet, fts_s_init, sigfiddle_init, 3, a);
-
- fts_method_define(cl, fts_SystemInlet, fts_s_delete, sigfiddle_delete, 0, a);
- a[0] = fts_Object;
- fts_method_define(cl, fts_SystemInlet, fts_s_put, sigfiddle_put, 1, a);
-
- /* class' own methods */
- fts_method_define(cl, 0, fts_new_symbol("print"), sigfiddle_print13, 0, a);
- fts_method_define(cl, 0, fts_new_symbol("debug"), sigfiddle_debug13, 0, a);
- fts_method_define(cl, 0, fts_new_symbol("amp-range"), sigfiddle_amprange13,
- 0, a);
- fts_method_define(cl, 0, fts_new_symbol("reattack"), sigfiddle_reattack13,
- 0, a);
- fts_method_define(cl, 0, fts_new_symbol("vibrato"), sigfiddle_vibrato13,
- 0, a);
- fts_method_define(cl, 0, fts_new_symbol("npartial"), sigfiddle_npartial13,
- 0, a);
-
- /* classes signal inlets */
- dsp_sig_inlet(cl, 0); /* declare signal input #0 */
-
- /* classes outlets */
- a[0] = fts_Float;
- fts_outlet_type_define(cl, OUTLETpitch, fts_s_float, 1, a); /* declare outlet #0 */
- fts_outlet_type_define(cl, OUTLETattack, fts_s_bang, 0, a); /* declare outlet #1 */
- a[0] = fts_VarArgs;
- fts_outlet_type_define(cl, OUTLETmicropitch1, fts_s_list, 1, a); /* declare outlet #2 */
- fts_outlet_type_define(cl, OUTLETmicropitch2, fts_s_list, 1, a); /* declare outlet #3 */
- fts_outlet_type_define(cl, OUTLETmicropitch3, fts_s_list, 1, a); /* declare outlet #4 */
- a[0] = fts_Float;
- fts_outlet_type_define(cl, OUTLETpower, fts_s_float, 1, a); /* declare outlet #5 */
-
- dsp_symbol = fts_new_symbol("fiddle");
- dsp_declare_function(dsp_symbol, ftl_sigfiddle);
-
- /* DSP properties */
-
- fts_class_put_prop(cl, fts_s_dsp_is_sink, fts_true);
-
- return(fts_Success);
-}
-
-void fiddle_config(void)
-{
- sys_log(fiddle_version);
- fts_metaclass_create(fts_new_symbol(CLASSNAME), sigfiddle_instantiate, fts_always_equiv);
-}
-
-fts_module_t fiddle_module =
- {"fiddle", "sonic meat fiddle", fiddle_config, 0};
-
-#endif /* JMAX */
-
-#ifdef PD
-
-static t_int *fiddle_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_sigfiddle *x = (t_sigfiddle *)(w[2]);
- int n = (int)(w[3]);
- int count;
- t_float *fp;
- if (!x->x_hop)
- goto nono;
- for (count = 0, fp = x->x_inbuf + x->x_phase; count < n; count++)
- *fp++ = *in++;
- if (fp == x->x_inbuf + x->x_hop)
- {
- sigfiddle_doit(x);
- x->x_phase = 0;
- if (x->x_auto) clock_delay(x->x_clock, 0L);
- if (x->x_nprint) x->x_nprint--;
- }
- else x->x_phase += n;
-nono:
- return (w+4);
-}
-
-void sigfiddle_dsp(t_sigfiddle *x, t_signal **sp)
-{
- x->x_sr = sp[0]->s_sr;
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
- sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
- dsp_add(fiddle_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
-}
-
- /* This is the callback function for the clock, but also acts as
- the "bang" method; you can leave "auto" on to get this called
- automatically (the default) or turn auto off and bang it yourself. */
-
-void sigfiddle_bang(t_sigfiddle *x)
-{
- int i;
- t_pitchhist *ph;
- if (x->x_npeakout)
- {
- int npeakout = x->x_npeakout;
- t_peakout *po;
- for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
- {
- t_atom at[3];
- SETFLOAT(at, i+1);
- SETFLOAT(at+1, po->po_freq);
- SETFLOAT(at+2, po->po_amp);
- outlet_list(x->x_peakout, 0, 3, at);
- }
- }
- outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, 0, 2, at);
- }
- if (x->x_attackvalue) outlet_bang(x->x_attackout);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
-}
-
-void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free */
-{
- if (x->x_inbuf)
- {
- freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
- freebytes(x->x_lastanalysis, sizeof(t_float) * (2*x->x_hop + 4 * FILTSIZE));
- freebytes(x->x_spiral, sizeof(t_float) * 2*x->x_hop);
- freebytes(x->x_peakbuf, sizeof(*x->x_peakbuf) * x->x_npeakout);
- clock_free(x->x_clock);
- }
-}
-
-static t_class *sigfiddle_class;
-
-void *sigfiddle_new(t_floatarg npoints, t_floatarg npitch,
- t_floatarg fnpeakanal, t_floatarg fnpeakout)
-{
- t_sigfiddle *x = (t_sigfiddle *)pd_new(sigfiddle_class);
- int i;
- int npeakanal = fnpeakanal, npeakout = fnpeakout;
-
-
- if (!sigfiddle_doinit(x, npoints, npitch,
- npeakanal, npeakout))
- {
- x->x_inbuf = 0; /* prevent the free routine from cleaning up */
- pd_free(&x->x_ob.ob_pd);
- return (0);
- }
- x->x_noteout = outlet_new(&x->x_ob, gensym("float"));
- x->x_attackout = outlet_new(&x->x_ob, gensym("bang"));
- for (i = 0; i < x->x_npitch; i++)
- x->x_hist[i].h_outlet = outlet_new(&x->x_ob, gensym("list"));
- x->x_envout = outlet_new(&x->x_ob, gensym("float"));
- if (x->x_npeakout)
- x->x_peakout = outlet_new(&x->x_ob, gensym("list"));
- else x->x_peakout = 0;
- x->x_clock = clock_new(&x->x_ob.ob_pd, (t_method)sigfiddle_bang);
- return (x);
-}
-
-void fiddle_tilde_setup(void)
-{
- sigfiddle_class = class_new(gensym("fiddle~"), (t_newmethod)sigfiddle_new,
- (t_method)sigfiddle_ff, sizeof(t_sigfiddle), 0,
- A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_dsp,
- gensym("dsp"), 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_debug,
- gensym("debug"), 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_setnpoints,
- gensym("npoints"), A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_amprange,
- gensym("amp-range"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_reattack,
- gensym("reattack"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_vibrato,
- gensym("vibrato"), A_FLOAT, A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_npartial,
- gensym("npartial"), A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_auto,
- gensym("auto"), A_FLOAT, 0);
- class_addmethod(sigfiddle_class, (t_method)sigfiddle_print,
- gensym("print"), 0);
- class_addmethod(sigfiddle_class, nullfn, gensym("signal"), 0);
- class_addbang(sigfiddle_class, sigfiddle_bang);
- class_addcreator((t_newmethod)sigfiddle_new, gensym("fiddle"),
- A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- post(fiddle_version);
-}
-
-void fiddle_setup(void)
-{
- fiddle_tilde_setup();
-}
-#endif /* PD */
-
-#ifdef MAX26
-
-void cu_fiddle(t_float *in1, t_sigfiddle *x, int n)
-{
- int count;
- t_float *fp, *fp2;
- for (count = 0, fp = x->x_inbuf + x->x_phase;
- count < n; count++) *fp++ = *in1++;
- if (fp == x->x_inbuf + x->x_hop)
- {
- sigfiddle_doit(x);
- x->x_phase = 0;
- if (x->x_auto) clock_delay(x->x_clock, 0L);
- if (x->x_nprint) x->x_nprint--;
- }
- else x->x_phase += n;
-}
-
-void sigfiddle_put(t_sigfiddle *x, long whether)
-{
- if (whether)
- {
- u_stdout(x);
- x->x_sr = x->x_io[0]->s_sr;
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
- sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
- dspchain_addc(cu_fiddle, 3,
- x->x_io[0]->s_shit, x, x->x_io[0]->s_n);
- }
-}
-
-void sigfiddle_tick(t_sigfiddle *x) /* callback function for the clock */
-{
- int i;
- t_pitchhist *ph;
- outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, NIL, 2, at);
- }
- if (x->x_attackvalue) outlet_bang(x->x_attackout);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
-}
-
-void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free */
-{
- if (x->x_inbuf)
- {
- freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
- freebytes(x->x_lastanalysis, sizeof(t_float) * (2*x->x_hop + 4 * FILTSIZE));
- freebytes(x->x_spiral, sizeof(t_float) * 2*x->x_hop);
- clock_free(x->x_clock);
- u_clean(x);
- }
-}
-
-t_externclass *sigfiddle_class;
-
-void *sigfiddle_new(long npoints, long npitch,
- long npeakanal, long npeakout)
-{
- t_sigfiddle *x = (t_sigfiddle *)obj_new(&sigfiddle_class, 0);
- int i;
-
- if (!sigfiddle_doinit(x, npoints, npitch, npeakanal, npeakout))
- {
- x->x_inbuf = 0; /* prevent the free routine from cleaning up */
- obj_free(x);
- return (0);
- }
- u_setup(x, IN1, OUT0);
- x->x_envout = outlet_new(x, gensym("float"));
- for (i = 0; i < x->x_npitch; i++)
- x->x_hist[i].h_outlet = outlet_new(x, gensym("list"));
- x->x_attackout = outlet_new(x, gensym("bang"));
- x->x_noteout = outlet_new(x, gensym("float"));
- x->x_clock = clock_new(x, sigfiddle_tick);
- return (x);
-}
-
-void fiddle_setup()
-{
- c_extern(&sigfiddle_class, sigfiddle_new, sigfiddle_ff,
- gensym("fiddle"), sizeof(t_sigfiddle), 0, A_DEFLONG, A_DEFLONG,
- A_DEFLONG, A_DEFLONG, 0);
- c_addmess(sigfiddle_put, gensym("put"), A_CANT, 0);
- c_addmess(sigfiddle_debug, gensym("debug"), 0);
- c_addmess(sigfiddle_amprange, gensym("amp-range"), A_FLOAT, A_FLOAT, 0);
- c_addmess(sigfiddle_reattack, gensym("reattack"), A_FLOAT, A_FLOAT, 0);
- c_addmess(sigfiddle_vibrato, gensym("vibrato"), A_LONG, A_FLOAT, 0);
- c_addmess(sigfiddle_npartial, gensym("npartial"), A_FLOAT, 0);
- c_addmess(sigfiddle_print, gensym("print"), 0);
- u_inletmethod(0); /* one signal input */
-#ifdef MAX
- post(fiddle_version);
-#endif
-}
-
-#endif /* MAX26 */
-
-/************* Beginning of MSP Code ******************************/
-
-#ifdef MSP
-
-static t_int *fiddle_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_sigfiddle *x = (t_sigfiddle *)(w[2]);
- int n = (int)(w[3]);
- int count,inc = x->x_downsample;
- t_float *fp;
-
- if (x->x_obj.z_disabled)
- goto skip;
- for (count = 0, fp = x->x_inbuf + x->x_phase; count < n; count+=inc) {
- *fp++ = *in;
- in += inc;
- }
- if (fp == x->x_inbuf + x->x_hop)
- {
- sigfiddle_doit(x);
- x->x_phase = 0;
- if (x->x_auto) clock_delay(x->x_clock, 0L);
- if (x->x_nprint) x->x_nprint--;
- }
- else x->x_phase += n;
-skip:
- return (w+4);
-}
-
-void sigfiddle_dsp(t_sigfiddle *x, t_signal **sp)
-{
- if (sp[0]->s_n > x->x_hop) {
- x->x_downsample = sp[0]->s_n / x->x_hop;
- post("* warning: fiddle~: will downsample input by %ld",x->x_downsample);
- x->x_sr = sp[0]->s_sr / x->x_downsample;
- } else {
- x->x_downsample = 1;
- x->x_sr = sp[0]->s_sr;
- }
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
- sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
- dsp_add(fiddle_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
-}
-
-void sigfiddle_tick(t_sigfiddle *x) /* callback function for the clock MSP*/
-{
- int i;
- t_pitchhist *ph;
- if (x->x_npeakout)
- {
- int npeakout = x->x_npeakout;
- t_peakout *po;
- for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
- {
- t_atom at[3];
- SETINT(at, i+1);
- SETFLOAT(at+1, po->po_freq);
- SETFLOAT(at+2, po->po_amp);
- outlet_list(x->x_peakout, 0, 3, at);
- }
- }
- outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, 0, 2, at);
- }
- if (x->x_attackvalue) outlet_bang(x->x_attackout);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
-}
-
-void sigfiddle_bang(t_sigfiddle *x)
-{
- int i;
- t_pitchhist *ph;
- if (x->x_npeakout)
- {
- int npeakout = x->x_npeakout;
- t_peakout *po;
- for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
- {
- t_atom at[3];
- SETLONG(at, i+1);
- SETFLOAT(at+1, po->po_freq);
- SETFLOAT(at+2, po->po_amp);
- outlet_list(x->x_peakout, 0, 3, at);
- }
- }
- outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- {
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, 0, 2, at);
- }
- if (x->x_attackvalue) outlet_bang(x->x_attackout);
- for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
-}
-
-
-void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free MSP */
-{
-
- if (x->x_inbuf)
- {
- t_freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
- t_freebytes(x->x_lastanalysis, sizeof(t_float) * (2*x->x_hop + 4 *
-FILTSIZE));
- t_freebytes(x->x_spiral, sizeof(t_float) * 2*x->x_hop);
- t_freebytes(x->x_peakbuf, sizeof(*x->x_peakbuf) * x->x_npeakout);
- }
- dsp_free((t_pxobject *)x);
-}
-
-void *sigfiddle_class;
-
-void *sigfiddle_new(long npoints, long npitch,
- long npeakanal, long npeakout)
-{
- t_sigfiddle *x = (t_sigfiddle *)newobject(sigfiddle_class);
- int i;
-
- if (!sigfiddle_doinit(x, npoints, npitch, npeakanal, npeakout))
- {
- x->x_inbuf = 0; /* prevent the free routine from cleaning up */
- return (0);
- }
- dsp_setup((t_pxobject *)x,1);
-
- x->x_clock = clock_new(x, (method)sigfiddle_tick);
- if (x->x_npeakout)
- x->x_peakout = listout((t_object *)x);
- else x->x_peakout = 0;
- x->x_envout = floatout((t_object *)x);
- for (i = 0; i < x->x_npitch; i++)
- x->x_hist[i].h_outlet = listout((t_object *)x);
- x->x_attackout = bangout((t_object *)x);
- x->x_noteout = floatout((t_object *)x);
- return (x);
-
-
-}
-
-void main()
-{
- setup(&sigfiddle_class, sigfiddle_new, (method)sigfiddle_ff,
- (short)sizeof(t_sigfiddle), 0L, A_DEFLONG, A_DEFLONG,
-A_DEFLONG, A_DEFLONG, 0);
- addmess((method)sigfiddle_dsp, "dsp",
- A_CANT, 0);
- addmess((method)sigfiddle_debug, "debug", 0);
- addmess((method)sigfiddle_setnpoints, "npoints", A_FLOAT, 0);
- addmess((method)sigfiddle_amprange, "amp-range", A_FLOAT, A_FLOAT, 0);
- addmess((method)sigfiddle_reattack, "reattack", A_FLOAT, A_FLOAT, 0);
- addmess((method)sigfiddle_vibrato, "vibrato", A_FLOAT,
-A_FLOAT, 0);
- addmess((method)sigfiddle_npartial, "npartial", A_FLOAT, 0);
- addmess((method)sigfiddle_auto, "auto",
- A_FLOAT, 0);
- addmess((method)sigfiddle_print, "print", 0);
- addmess((method)sigfiddle_assist, "assist",
- A_CANT, 0);
- addbang((method)sigfiddle_bang);
- dsp_initclass();
- rescopy('STR#',3748);
- post(fiddle_version);
-}
-
-void sigfiddle_assist(t_sigfiddle *x, void *b, long m, long a, char *s)
-{
- assist_string(3748,m,a,1,2,s);
-}
-
-void msp_fft(t_float *buf, long np, long inv)
-{
- t_float *src,*real,*rp,*imag,*ip;
- long i;
-
- /*
- // because this fft algorithm uses separate real and imaginary
- // buffers
- // we must split the real and imaginary parts into two buffers,
- // then do the opposite on output
- // a more ambitious person would either do an in-place conversion
- // or rewrite the fft algorithm
- */
-
- real = rp = msp_ffttemp;
- imag = ip = real + MAXPOINTS;
- src = buf;
- for (i = 0; i < np; i++) {
- *rp++ = *src++;
- *ip++ = *src++;
- }
- if (inv)
- ifft(np,real,imag);
- else
- fft(np,real,imag);
- rp = real;
- ip = imag;
- src = buf;
- for (i = 0; i < np; i++) {
- *src++ = *rp++;
- *src++ = *ip++;
- }
-}
-
-#endif /* MSP */
diff --git a/externals/extra/0.43.3/hilbert~-help.pd b/externals/extra/0.43.3/hilbert~-help.pd
deleted file mode 100644
index 130ec750..00000000
--- a/externals/extra/0.43.3/hilbert~-help.pd
+++ /dev/null
@@ -1,18 +0,0 @@
-#N canvas 156 234 600 488 12;
-#X obj 67 124 hilbert~;
-#X obj 66 85 osc~ 440;
-#X graph graph1 0 -1 882 1 279 209 579 39;
-#X array out-left 882 float;
-#X array out-right 882 float;
-#X pop;
-#X obj 67 274 tabwrite~ out-left;
-#X obj 118 248 tabwrite~ out-right;
-#X msg 137 188 bang \; pd dsp 1;
-#X floatatom 66 57;
-#X text 71 319 The Hilbert transform (the name is abused here according to computer music tradition) puts out a phase quadrature version of the input signal suitable for signal sideband modulation via complex-mod~.;
-#X connect 0 0 3 0;
-#X connect 0 1 4 0;
-#X connect 1 0 0 0;
-#X connect 5 0 3 0;
-#X connect 5 0 4 0;
-#X connect 6 0 1 0;
diff --git a/externals/extra/0.43.3/hilbert~.pd b/externals/extra/0.43.3/hilbert~.pd
deleted file mode 100644
index 152c2082..00000000
--- a/externals/extra/0.43.3/hilbert~.pd
+++ /dev/null
@@ -1,27 +0,0 @@
-#N canvas 269 0 593 306 12;
-#X obj 105 92 biquad~ 0.83774 -0.06338 0.06338 -0.83774 1;
-#X obj 105 66 biquad~ 1.94632 -0.94657 0.94657 -1.94632 1;
-#X obj 86 149 biquad~ -0.02569 0.260502 -0.260502 0.02569 1;
-#X obj 86 175 biquad~ 1.8685 -0.870686 0.870686 -1.8685 1;
-#X obj 86 39 inlet~;
-#X obj 105 121 outlet~;
-#X obj 86 202 outlet~;
-#X text 34 232 This is a pair of 4th-order all-pass filters whose outputs
-somehow manage to be about 90 degrees out of phase from each other.
-Both have different phases from the original. Adapted from a 4X patch
-by Emmanuel Favreau \, circa 1982;
-#X obj 502 39 inlet;
-#X text 461 13 bang to clear;
-#X text 80 16 signal in;
-#X msg 502 112 clear;
-#X connect 0 0 5 0;
-#X connect 1 0 0 0;
-#X connect 2 0 3 0;
-#X connect 3 0 6 0;
-#X connect 4 0 1 0;
-#X connect 4 0 2 0;
-#X connect 8 0 11 0;
-#X connect 11 0 1 0;
-#X connect 11 0 0 0;
-#X connect 11 0 2 0;
-#X connect 11 0 3 0;
diff --git a/externals/extra/0.43.3/loop~/loop~-help.pd b/externals/extra/0.43.3/loop~/loop~-help.pd
deleted file mode 100644
index ff3d3a63..00000000
--- a/externals/extra/0.43.3/loop~/loop~-help.pd
+++ /dev/null
@@ -1,74 +0,0 @@
-#N canvas 234 90 647 662 12;
-#X floatatom 41 204 0 0 0 0 - - -;
-#X obj 254 382 print~;
-#X msg 254 347 bang;
-#X obj 41 338 loop~;
-#X floatatom 66 279 0 0 0 0 - - -;
-#X msg 55 252 bang;
-#X obj 183 382 print~;
-#X msg 183 347 bang;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array array2 150000 float 0;
-#X coords 0 1 150000 -1 200 150 1;
-#X restore 393 464 graph;
-#X msg 393 622 \; array2 resize 150000;
-#X obj 25 613 soundfiler;
-#X obj 16 453 tabread4~ array2;
-#X obj 16 407 *~;
-#X obj 16 522 dac~;
-#X obj 16 499 hip~ 5;
-#X obj 62 411 samphold~;
-#X obj 16 430 +~;
-#X floatatom 96 303 0 0 0 0 - - -;
-#X obj 96 326 *~ 1000;
-#X msg 43 568 read ../doc/sound/bell.aiff array2;
-#X msg 47 229 set 0.5;
-#X text 95 196 left signal input is transposition (1 is normal \, 2
-is up an octave \, etc);
-#X text 82 4 loop~ - phase generator for looping samplers;
-#X text 116 228 set phase (0 to 1);
-#X text 104 253 reset phase to 0;
-#X text 104 278 right signal input is window size in samples;
-#X text 134 302 here's how to handle onsets;
-#X obj 16 476 *~;
-#X floatatom 167 432 0 0 0 0 - - -;
-#X obj 167 501 line~;
-#X obj 167 455 dbtorms;
-#X obj 167 478 pack 0 50;
-#X text 201 431 output level 0-100;
-#X text 187 326 print outputs;
-#X text 33 32 loop~ takes input signals to set a window size and transposition
-\, and outputs a phase and a sampled window size. The window size only
-changes at phase zero crossings and the phase output is adjusted so
-that changing window size doesn't change the transposition.;
-#X text 33 112 You can send "bang" or "set" message to force the phase
-to zero--you should mute the output before doing so. This may be desirable
-if you've set a large window size but then want to decrease it without
-waiting for the next phase crossing.;
-#X msg 43 591 read ../doc/sound/voice.wav array2;
-#X connect 0 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 6 0;
-#X connect 3 0 12 0;
-#X connect 3 0 15 1;
-#X connect 3 1 1 0;
-#X connect 3 1 12 1;
-#X connect 4 0 3 1;
-#X connect 5 0 3 0;
-#X connect 7 0 6 0;
-#X connect 11 0 27 0;
-#X connect 12 0 16 0;
-#X connect 14 0 13 0;
-#X connect 14 0 13 1;
-#X connect 15 0 16 1;
-#X connect 16 0 11 0;
-#X connect 17 0 18 0;
-#X connect 18 0 15 0;
-#X connect 19 0 10 0;
-#X connect 20 0 3 0;
-#X connect 27 0 14 0;
-#X connect 28 0 30 0;
-#X connect 29 0 27 1;
-#X connect 30 0 31 0;
-#X connect 31 0 29 0;
-#X connect 36 0 10 0;
diff --git a/externals/extra/0.43.3/loop~/loop~.c b/externals/extra/0.43.3/loop~/loop~.c
deleted file mode 100644
index ebe3d9d5..00000000
--- a/externals/extra/0.43.3/loop~/loop~.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* loop~ -- loop generator for sampling */
-
-/* Copyright 1997-1999 Miller Puckette.
-Permission is granted to use this software for any purpose provided you
-keep this copyright notice intact.
-
-THE AUTHOR AND HIS EMPLOYERS MAKE NO WARRANTY, EXPRESS OR IMPLIED,
-IN CONNECTION WITH THIS SOFTWARE.
-
-This file is downloadable from http://www.crca.ucsd.edu/~msp .
-
-*/
-
-#ifdef PD
-#include "m_pd.h"
-#else
-#define t_sample float
-#define t_float float
-#endif
-
-
-
-typedef struct _loopctl
-{
- double l_phase;
- t_sample l_invwindow;
- t_sample l_window;
- int l_resync;
-} t_loopctl;
-
-static void loopctl_run(t_loopctl *x, t_sample *transposein,
- t_sample *windowin, t_sample *rawout, t_sample *windowout, int n)
-{
- t_sample window, invwindow;
- double phase = x->l_phase;
- if (x->l_resync)
- {
- window = *windowin;
- if (window < 0)
- {
- if (window > -1)
- window = -1;
- invwindow = -1/window;
- }
- else
- {
- if (window < 1)
- window = 1;
- invwindow = 1/window;
- }
- x->l_resync = 0;
- }
- else
- {
- window = x->l_window;
- phase = x->l_phase;
- invwindow = x->l_invwindow;
- }
- while (n--)
- {
- double phaseinc = invwindow * *transposein++;
- double newphase;
- t_sample nwind = *windowin++;
- if (phaseinc >= 1 || phaseinc < 0)
- phaseinc = 0;
- newphase = phase + phaseinc;
- if (newphase >= 1)
- {
- window = nwind;
- if (window < 0)
- {
- if (window > -1)
- window = -1;
- invwindow = -1/window;
- }
- else
- {
- if (window < 1)
- window = 1;
- invwindow = 1/window;
- }
- newphase -= 1.;
- }
- phase = newphase;
- *rawout++ = (t_sample)phase;
- *windowout++ = window;
- }
- x->l_invwindow = invwindow;
- x->l_window = window;
- x->l_phase = phase;
-}
-
-static void loopctl_init(t_loopctl *x)
-{
- x->l_window = 1;
- x->l_invwindow = 1;
- x->l_phase = 0;
-}
-
-static void loopctl_set(t_loopctl *x, t_float val)
-{
- if (val < 0 || val > 1)
- val = 0;
- x->l_phase = val;
- x->l_resync = 1;
-}
-
-#ifdef PD
-
-typedef struct _loop
-{
- t_object x_obj;
- t_float x_f;
- t_loopctl x_loopctl;
-} t_loop;
-
-static t_class *loop_class;
-
-static void *loop_new(void)
-{
- t_loop *x = (t_loop *)pd_new(loop_class);
- loopctl_init(&x->x_loopctl);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- outlet_new(&x->x_obj, gensym("signal"));
- outlet_new(&x->x_obj, gensym("signal"));
- return (x);
-}
-
-static t_int *loop_perform(t_int *w)
-{
- t_loopctl *ctl = (t_loopctl *)(w[1]);
- t_sample *in1 = (t_sample *)(w[2]);
- t_sample *in2 = (t_sample *)(w[3]);
- t_sample *out1 = (t_sample *)(w[4]);
- t_sample *out2 = (t_sample *)(w[5]);
- int n = (int)(w[6]);
- loopctl_run(ctl, in1, in2, out1, out2, n);
- return (w+7);
-}
-
-static void loop_dsp(t_loop *x, t_signal **sp)
-{
- dsp_add(loop_perform, 6,
- &x->x_loopctl, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,
- sp[0]->s_n);
-}
-
-static void loop_set(t_loop *x, t_floatarg val)
-{
- loopctl_set(&x->x_loopctl, val);
-}
-
-static void loop_bang(t_loop *x)
-{
- loopctl_set(&x->x_loopctl, 0);
-}
-
-void loop_tilde_setup(void)
-{
- loop_class = class_new(gensym("loop~"), (t_newmethod)loop_new, 0,
- sizeof(t_loop), 0, 0);
- class_addmethod(loop_class, (t_method)loop_dsp, gensym("dsp"), A_CANT, 0);
- CLASS_MAINSIGNALIN(loop_class, t_loop, x_f);
- class_addmethod(loop_class, (t_method)loop_set, gensym("set"),
- A_DEFFLOAT, 0);
- class_addbang(loop_class, loop_bang);
-}
-
-#endif /* PD */
diff --git a/externals/extra/0.43.3/loop~/test-loop~.pd b/externals/extra/0.43.3/loop~/test-loop~.pd
deleted file mode 100644
index 9966483d..00000000
--- a/externals/extra/0.43.3/loop~/test-loop~.pd
+++ /dev/null
@@ -1,58 +0,0 @@
-#N canvas 33 0 680 609 12;
-#X floatatom 52 262 0 0 0 0 - - -;
-#X obj 261 346 print~;
-#X msg 47 373 bang;
-#X msg 274 313 bang;
-#X obj 52 306 loop~;
-#X floatatom 102 245 0 0 0 0 - - -;
-#N canvas 0 0 450 300 graph1 0;
-#X array array1 44100 float 0;
-#X coords 0 10 44100 0 200 150 1;
-#X restore 65 17 graph;
-#X msg 43 204 \; array1 resize 44100;
-#X obj 25 401 tabwrite~ array1;
-#X msg 208 371 bang;
-#X obj 176 402 tabwrite~ array1;
-#X msg 194 261 bang;
-#X obj 204 347 print~;
-#X msg 217 314 bang;
-#N canvas 0 0 450 300 graph1 0;
-#X array array2 150000 float 0;
-#X coords 0 1 150000 -1 200 150 1;
-#X restore 332 398 graph;
-#X msg 326 274 \; array2 resize 150000;
-#X obj 103 529 tabread4~ array2;
-#X obj 64 481 *~;
-#X obj 107 581 dac~;
-#X obj 105 552 hip~ 5;
-#X obj 123 482 samphold~;
-#X obj 102 506 +~;
-#X floatatom 106 430 0 0 0 0 - - -;
-#X obj 108 453 *~ 1000;
-#X obj 312 215 soundfiler;
-#X msg 330 170 read ../doc/sound/bell.aiff array2;
-#X msg 330 193 read ../doc/sound/vocal.aiff array2;
-#X connect 0 0 4 0;
-#X connect 2 0 8 0;
-#X connect 3 0 1 0;
-#X connect 4 0 12 0;
-#X connect 4 0 17 0;
-#X connect 4 0 8 0;
-#X connect 4 0 20 1;
-#X connect 4 1 10 0;
-#X connect 4 1 1 0;
-#X connect 4 1 17 1;
-#X connect 5 0 4 1;
-#X connect 9 0 10 0;
-#X connect 11 0 4 0;
-#X connect 13 0 12 0;
-#X connect 16 0 19 0;
-#X connect 17 0 21 0;
-#X connect 19 0 18 0;
-#X connect 19 0 18 1;
-#X connect 20 0 21 1;
-#X connect 21 0 16 0;
-#X connect 22 0 23 0;
-#X connect 23 0 20 0;
-#X connect 25 0 24 0;
-#X connect 26 0 24 0;
diff --git a/externals/extra/0.43.3/lrshift~/lrshift~-help.pd b/externals/extra/0.43.3/lrshift~/lrshift~-help.pd
deleted file mode 100644
index fdf7b0c5..00000000
--- a/externals/extra/0.43.3/lrshift~/lrshift~-help.pd
+++ /dev/null
@@ -1,33 +0,0 @@
-#N canvas 143 0 673 325 12;
-#X msg 268 277 bang;
-#X obj 244 303 print~;
-#X msg 185 278 bang;
-#X obj 161 304 print~;
-#X text 53 117 click here first;
-#X msg 72 270 bang;
-#X obj 48 296 print~;
-#X text 162 222 shift left;
-#X text 243 224 shift right;
-#X obj 161 252 lrshift~ 1;
-#X obj 244 251 lrshift~ -1;
-#X text 39 37 Acting at whatever vector size the window is running
-at \, lrshift~ shifts samples to the left (toward the beginning sample)
-or to the right. The argument gives the direction and the amount of
-the shift. The rightmost (or leftmost) samples are set to zero.;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array shiftin 64 float 0;
-#X coords 0 1 63 0 200 140 1;
-#X restore 448 118 graph;
-#X text 115 11 -- shift signal vector elements left or right;
-#X msg 54 138 \; pd dsp 1 \; shiftin 1 1;
-#X obj 48 204 tabreceive~ shiftin;
-#X text 525 308 Updated for Pd 0.31.;
-#X obj 47 11 lrshift~;
-#X connect 0 0 1 0;
-#X connect 2 0 3 0;
-#X connect 5 0 6 0;
-#X connect 9 0 3 0;
-#X connect 10 0 1 0;
-#X connect 15 0 6 0;
-#X connect 15 0 9 0;
-#X connect 15 0 10 0;
diff --git a/externals/extra/0.43.3/lrshift~/lrshift~.c b/externals/extra/0.43.3/lrshift~/lrshift~.c
deleted file mode 100644
index 19dcb93d..00000000
--- a/externals/extra/0.43.3/lrshift~/lrshift~.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "m_pd.h"
-
-/* ------------------------ lrshift~ ----------------------------- */
-
-static t_class *lrshift_tilde_class;
-
-typedef struct _lrshift_tilde
-{
- t_object x_obj;
- int x_n;
- t_float x_f;
-} t_lrshift_tilde;
-
-static t_int *leftshift_perform(t_int *w)
-{
- t_sample *in = (t_sample *)(w[1]);
- t_sample *out= (t_sample *)(w[2]);
- int n = (int)(w[3]);
- int shift = (int)(w[4]);
- in += shift;
- n -= shift;
- while (n--)
- *out++ = *in++;
- while (shift--)
- *out++ = 0;
- return (w+5);
-}
-
-static t_int *rightshift_perform(t_int *w)
-{
- t_sample *in = (t_sample *)(w[1]);
- t_sample *out= (t_sample *)(w[2]);
- int n = (int)(w[3]);
- int shift = (int)(w[4]);
- n -= shift;
- in -= shift;
- while (n--)
- *--out = *--in;
- while (shift--)
- *--out = 0;
- return (w+5);
-}
-
-static void lrshift_tilde_dsp(t_lrshift_tilde *x, t_signal **sp)
-{
- int n = sp[0]->s_n;
- int shift = x->x_n;
- if (shift > n)
- shift = n;
- if (shift < -n)
- shift = -n;
- if (shift < 0)
- dsp_add(rightshift_perform, 4,
- sp[0]->s_vec + n, sp[1]->s_vec + n, n, -shift);
- else dsp_add(leftshift_perform, 4,
- sp[0]->s_vec, sp[1]->s_vec, n, shift);
-}
-
-static void *lrshift_tilde_new(t_floatarg f)
-{
- t_lrshift_tilde *x = (t_lrshift_tilde *)pd_new(lrshift_tilde_class);
- x->x_n = f;
- x->x_f = 0;
- outlet_new(&x->x_obj, gensym("signal"));
- return (x);
-}
-
-void lrshift_tilde_setup(void)
-{
- lrshift_tilde_class = class_new(gensym("lrshift~"),
- (t_newmethod)lrshift_tilde_new, 0, sizeof(t_lrshift_tilde), 0,
- A_DEFFLOAT, 0);
- CLASS_MAINSIGNALIN(lrshift_tilde_class, t_lrshift_tilde, x_f);
- class_addmethod(lrshift_tilde_class, (t_method)lrshift_tilde_dsp,
- gensym("dsp"), 0);
-}
diff --git a/externals/extra/0.43.3/pd~/notes.txt b/externals/extra/0.43.3/pd~/notes.txt
deleted file mode 100644
index 59129d5a..00000000
--- a/externals/extra/0.43.3/pd~/notes.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-pd -schedlib `pwd`/pdsched
-
-dolist:
-pd~ to delay starting subproc until asked
-figure out about setting nchannels from command line
-fix maximum nchannels in and out
-
-
diff --git a/externals/extra/0.43.3/pd~/pdsched.c b/externals/extra/0.43.3/pd~/pdsched.c
deleted file mode 100644
index 43a5ccf1..00000000
--- a/externals/extra/0.43.3/pd~/pdsched.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright 2008 Miller Puckette. Berkeley license; see the
-file LICENSE.txt in this distribution. */
-
-/* A plug-in scheduler that turns Pd into a filter that inputs and
-outputs audio and messages. */
-
-/* todo:
- fix schedlib code to use extent2
- figure out about if (sys_externalschedlib) { return; } in s_audio.c
- make buffer size ynamically growable
-
-*/
-#include "m_pd.h"
-#include "s_stuff.h"
-#include <stdio.h>
-
-#define BUFSIZE 65536
-static char inbuf[BUFSIZE];
-
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
-void glob_watchdog(t_pd *dummy);
-
-static void pollwatchdog( void)
-{
- static int sched_diddsp, sched_nextpingtime;
- sched_diddsp++;
- if (sys_nogui && sys_hipriority && (sched_diddsp - sched_nextpingtime > 0))
- {
- glob_watchdog(0);
- /* ping every 2 seconds */
- sched_nextpingtime = sched_diddsp +
- 2 * (int)(sys_dacsr /(double)sys_schedblocksize);
- }
-}
-#endif
-
-int pd_extern_sched(char *flags)
-{
- int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV];
- int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV];
- int i, j, rate, advance, callback, chin, chout, fill = 0, c, blocksize;
- t_binbuf *b = binbuf_new();
-
- sys_get_audio_params(&naudioindev, audioindev, chindev,
- &naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback,
- &blocksize);
-
- chin = (naudioindev < 1 ? 0 : chindev[0]);
- chout = (naudiooutdev < 1 ? 0 : choutdev[0]);
-
- /* fprintf(stderr, "Pd plug-in scheduler called, chans %d %d, sr %d\n",
- chin, chout, (int)rate); */
- sys_setchsr(chin, chout, rate);
- sys_audioapi = API_NONE;
- while ((c = getchar()) != EOF)
- {
- if (c == ';')
- {
- int n;
- t_atom *ap;
- binbuf_text(b, inbuf, fill);
- n = binbuf_getnatom(b);
- ap = binbuf_getvec(b);
- fill = 0;
- if (n > 0 && ap[0].a_type == A_FLOAT)
- {
- /* a list -- take it as incoming signals. */
- int chan, nchan = n/DEFDACBLKSIZE;
- t_sample *fp;
- for (i = chan = 0, fp = sys_soundin; chan < nchan; chan++)
- for (j = 0; j < DEFDACBLKSIZE; j++)
- *fp++ = atom_getfloat(ap++);
- for (; chan < chin; chan++)
- for (j = 0; j < DEFDACBLKSIZE; j++)
- *fp++ = 0;
- sched_tick(sys_time+sys_time_per_dsp_tick);
- sys_pollgui();
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
- pollwatchdog();
-#endif
- printf(";\n");
- for (i = chout*DEFDACBLKSIZE, fp = sys_soundout; i--; fp++)
- {
- printf("%g\n", *fp);
- *fp = 0;
- }
- printf(";\n");
- fflush(stdout);
- }
- else if (n > 1 && ap[0].a_type == A_SYMBOL)
- {
- t_pd *whom = ap[0].a_w.w_symbol->s_thing;
- if (!whom)
- error("%s: no such object", ap[0].a_w.w_symbol->s_name);
- else if (ap[1].a_type == A_SYMBOL)
- typedmess(whom, ap[1].a_w.w_symbol, n-2, ap+2);
- else pd_list(whom, 0, n-1, ap+1);
- }
- }
- else if (fill < BUFSIZE)
- inbuf[fill++] = c;
- else if (fill == BUFSIZE)
- fprintf(stderr, "pd-extern: input buffer overflow\n");
- }
- return (0);
-}
diff --git a/externals/extra/0.43.3/pd~/pd~-help.pd b/externals/extra/0.43.3/pd~/pd~-help.pd
deleted file mode 100644
index 8bc357e0..00000000
--- a/externals/extra/0.43.3/pd~/pd~-help.pd
+++ /dev/null
@@ -1,75 +0,0 @@
-#N canvas 12 0 566 872 12;
-#X msg 31 406 foo bar baz;
-#X obj 189 466 osc~ 440;
-#X obj 127 645 env~ 8192;
-#X floatatom 127 694 5 0 0 0 - - -;
-#X msg 434 807 \; pd dsp 1;
-#X msg 24 332 pd~ stop;
-#X obj 127 670 i;
-#X obj 241 643 env~ 8192;
-#X floatatom 241 693 5 0 0 0 - - -;
-#X obj 241 669 i;
-#X obj 123 489 *~;
-#X obj 158 490 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X obj 189 490 *~;
-#X obj 224 491 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X obj 434 781 loadbang;
-#X obj 14 691 print x;
-#X msg 15 309 pd~ start pd~-subprocess.pd;
-#X obj 14 532 pd~ -ninsig 2 -noutsig 2 -fifo 20;
-#X obj 37 20 pd~;
-#X text 69 22 - run a pd sub-process;
-#X text 27 57 The pd~ object starts and manages a Pd sub-process that
-can communicate with the super-process (this one) via audio channels
-and/or Pd messages. In this way you can take advantage of multi-core
-CPUs \, and/or use Pd features from within Max (if you're using the
-Max version of pd~).;
-#X text 24 251 Sending a new "start" message will stop the sub-process
-and start a new one. If you just want to stop the sub-process \, send
-"stop".;
-#X text 33 353 Any message besides "pd~" is sent to the sub-process.
-For instance \, the message below sends "bar baz" to any object in
-the sub-process named "foo" \, such as a "receive" object.;
-#X text 43 430 Audio signals appear in adc~ objects in the sub-process.
-The sub-process doesn't open real audio devices.;
-#X text 281 473 Creation args:;
-#X text 265 490 -insig <n> sets input audio channels;
-#X text 266 508 -outsig <n> sets output channels;
-#X text 269 542 -fifo <n> sets round-trip delay in blocks;
-#X text 272 559 -pddir <s> sets Pd directory \, e.g. \,;
-#X text 299 574 .../Pd-0.42.app/Contents/Resources;
-#X text 272 590 -scheddir <s> sets scheduler dir \, e.g. \,;
-#X text 297 607 .../.../Resources/extra/pd~;
-#X text 267 524 -sr <n> sets sample rate;
-#X text 20 716 The first outlet reports messages the sub-process sends
-us via "stdout" objects. Any other outlets are signals corresponding
-to "dac~" objects in the sub-process.;
-#X text 10 784 ATTENTION: DSP must be running in this process for the
-sub-process to run. This is because its clock is slaved to audio I/O
-it gets from us!;
-#X text 359 849 Updated for Pd version 0.42.;
-#X text 24 138 Messages with "pd~" selector control the sub-process.
-"pd~ start" takes as arguments any startup arguments you wish to send
-the sub-process. For example \, specify "-nogui" to stop the sub-process's
-GUI from appearing. You don't have to specify the number of channels
-in and out \, since that's set by creation arguments below. Audio config
-arguments arguments (-audiobuf \, -audiodev \, etc.) are ignored.;
-#X connect 0 0 17 0;
-#X connect 1 0 10 0;
-#X connect 1 0 12 0;
-#X connect 2 0 6 0;
-#X connect 5 0 17 0;
-#X connect 6 0 3 0;
-#X connect 7 0 9 0;
-#X connect 9 0 8 0;
-#X connect 10 0 17 0;
-#X connect 11 0 10 1;
-#X connect 12 0 17 1;
-#X connect 13 0 12 1;
-#X connect 14 0 4 0;
-#X connect 16 0 17 0;
-#X connect 17 0 15 0;
-#X connect 17 1 2 0;
-#X connect 17 2 7 0;
diff --git a/externals/extra/0.43.3/pd~/pd~-subprocess.pd b/externals/extra/0.43.3/pd~/pd~-subprocess.pd
deleted file mode 100644
index 1d883ab1..00000000
--- a/externals/extra/0.43.3/pd~/pd~-subprocess.pd
+++ /dev/null
@@ -1,60 +0,0 @@
-#N canvas 577 21 563 559 12;
-#X obj 202 395 r foo;
-#X obj 202 423 print foo;
-#X obj 87 174 adc~;
-#X obj 72 442 stdout;
-#X msg 72 364 a b c;
-#X msg 455 441 \; pd dsp 1;
-#X obj 87 201 env~ 8192;
-#X floatatom 87 250 5 0 0 0 - - -;
-#X obj 87 226 i;
-#X obj 263 253 dac~;
-#X obj 262 185 osc~ 440;
-#X obj 262 219 *~;
-#X obj 297 220 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X obj 332 186 osc~ 440;
-#X obj 332 220 *~;
-#X obj 367 221 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X msg 86 411 bang;
-#X obj 455 417 loadbang;
-#X obj 160 201 env~ 8192;
-#X floatatom 160 250 5 0 0 0 - - -;
-#X obj 160 226 i;
-#X msg 86 388 4;
-#X text 62 8 This is a test patch to demonstrate the Pd~ object. It's
-intended as the patch to run in the sub-process. The sub-process (which
-is a separate instance of Pd) can be called from a Max or Pd super-process.
-;
-#X text 63 73 Audio inlets and outlets on the Pd~ object (in the super-process)
-talk to adc~ and dac~ objects here - so \, for instance \, the first
-adc~ here is the first inlet of the pd~ object \, and the first chanel
-of dac~ goes to the second outlet of pd~ (because the first one is
-for messages \, as shown further below.);
-#X text 58 283 Any message sent to a stdout object in this sub-process
-(below) appears on the first \, message outlet of the pd~ object in
-the super-process. The super-process can send messages to any "receive"
-object in this sub-process.;
-#X text 137 478 We turn DSP on at load for convenience - control objects
-in this patch will still work without it (unlike in the super-process
-\, where DSP must be on for time to move forward in the sub-process.)
-;
-#X text 351 538 Updated for Pd version 0.42.;
-#X connect 0 0 1 0;
-#X connect 2 0 6 0;
-#X connect 2 1 18 0;
-#X connect 4 0 3 0;
-#X connect 6 0 8 0;
-#X connect 8 0 7 0;
-#X connect 10 0 11 0;
-#X connect 11 0 9 0;
-#X connect 12 0 11 1;
-#X connect 13 0 14 0;
-#X connect 14 0 9 1;
-#X connect 15 0 14 1;
-#X connect 16 0 3 0;
-#X connect 17 0 5 0;
-#X connect 18 0 20 0;
-#X connect 20 0 19 0;
-#X connect 21 0 3 0;
diff --git a/externals/extra/0.43.3/pd~/pd~.c b/externals/extra/0.43.3/pd~/pd~.c
deleted file mode 100644
index 9c9d335e..00000000
--- a/externals/extra/0.43.3/pd~/pd~.c
+++ /dev/null
@@ -1,771 +0,0 @@
-/*
- pd~.c - embed a Pd process within Pd or Max.
-
- Copyright 2008 Miller Puckette
- BSD license; see README.txt in this distribution for details.
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-
-#ifdef _MSC_VER
-#pragma warning (disable: 4305 4244)
-#endif
-
-#ifdef MSP
-#include "ext.h"
-#include "z_dsp.h"
-#include "math.h"
-#include "ext_support.h"
-#include "ext_proto.h"
-#include "ext_obex.h"
-
-typedef double t_floatarg;
-#define w_symbol w_sym
-#define A_SYMBOL A_SYM
-#define getbytes t_getbytes
-#define freebytes t_freebytes
-#define ERROR error(
-void *pd_tilde_class;
-#define MAXPDSTRING 4096
-#define DEFDACBLKSIZE 64
-#endif /* MSP */
-
-#ifdef PD
-#include "m_pd.h"
-#include "s_stuff.h"
-static t_class *pd_tilde_class;
-char *class_gethelpdir(t_class *c);
-#define ERROR pd_error(x,
-
-#endif
-
-#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
-#ifdef __x86_64__
-static char pd_tilde_dllextent[] = ".l_ia64",
- pd_tilde_dllextent2[] = ".pd_linux";
-#else
-static char pd_tilde_dllextent[] = ".l_i386",
- pd_tilde_dllextent2[] = ".pd_linux";
-#endif
-#endif
-#ifdef __APPLE__
-static char pd_tilde_dllextent[] = ".d_fat",
- pd_tilde_dllextent2[] = ".pd_darwin";
-#endif
-#if defined(_WIN32) || defined(__CYGWIN__)
-static char pd_tilde_dllextent[] = ".m_i386", pd_tilde_dllextent2[] = ".dll";
-#endif
-
-/* ------------------------ pd_tilde~ ----------------------------- */
-
-#define MSGBUFSIZE 65536
-
-typedef struct _pd_tilde
-{
-#ifdef PD
- t_object x_obj;
- t_clock *x_clock;
- t_outlet *x_outlet1; /* for messages back from subproc */
- t_canvas *x_canvas;
-#endif /* PD */
-#ifdef MSP
- t_pxobject x_obj;
- void *x_outlet1;
- void *x_clock;
-#endif /* MSP */
- FILE *x_infd;
- FILE *x_outfd;
- char *x_msgbuf;
- int x_msgbufsize;
- int x_infill;
- int x_childpid;
- int x_ninsig;
- int x_noutsig;
- int x_fifo;
- t_float x_sr;
- t_symbol *x_pddir;
- t_symbol *x_schedlibdir;
- t_sample **x_insig;
- t_sample **x_outsig;
-} t_pd_tilde;
-
-#ifdef MSP
-static void *pd_tilde_new(t_symbol *s, long ac, t_atom *av);
-static void pd_tilde_tick(t_pd_tilde *x);
-static t_int *pd_tilde_perform(t_int *w);
-static void pd_tilde_dsp(t_pd_tilde *x, t_signal **sp);
-void pd_tilde_assist(t_pd_tilde *x, void *b, long m, long a, char *s);
-static void pd_tilde_free(t_pd_tilde *x);
-void pd_tilde_setup(void);
-int main();
-void pd_tilde_minvel_set(t_pd_tilde *x, void *attr, long ac, t_atom *av);
-char *strcpy(char *s1, const char *s2);
-#endif
-
-static void pd_tilde_tick(t_pd_tilde *x);
-static void pd_tilde_close(t_pd_tilde *x)
-{
- if (x->x_outfd)
- fclose(x->x_outfd);
- if (x->x_infd)
- fclose(x->x_infd);
- if (x->x_childpid > 0)
- waitpid(x->x_childpid, 0, 0);
- if (x->x_msgbuf)
- free(x->x_msgbuf);
- x->x_infd = x->x_outfd = 0;
- x->x_childpid = -1;
- x->x_msgbuf = 0;
- x->x_msgbufsize = 0;
-}
-
-static void pd_tilde_readmessages(t_pd_tilde *x)
-{
- int gotsomething = 0, setclock = 0, wasempty = (x->x_infill == 0);
- FILE *infd = x->x_infd;
- while (1)
- {
- int c = getc(infd);
- if (c == EOF)
- {
- ERROR "pd~: %s", strerror(errno));
- pd_tilde_close(x);
- break;
- }
- if (x->x_infill >= x->x_msgbufsize)
- {
- char *z = realloc(x->x_msgbuf, x->x_msgbufsize+MSGBUFSIZE);
- if (!z)
- {
- ERROR "pd~: failed to grow input buffer");
- pd_tilde_close(x);
- break;
- }
- x->x_msgbuf = z;
- x->x_msgbufsize += MSGBUFSIZE;
- }
- x->x_msgbuf[x->x_infill++] = c;
- if (c == ';')
- {
- if (!gotsomething)
- break;
- gotsomething = 0;
- }
- else if (!isspace(c))
- gotsomething = setclock = 1;
- }
- if (setclock)
- clock_delay(x->x_clock, 0);
- else if (wasempty)
- x->x_infill = 0;
-}
-
-static void pd_tilde_donew(t_pd_tilde *x, char *pddir, char *schedlibdir,
- char *patchdir, char *pdargs, int ninsig, int noutsig, int fifo,
- t_float samplerate)
-{
- int i, pid, pipe1[2], pipe2[2];
- char cmdbuf[MAXPDSTRING], pdexecbuf[MAXPDSTRING], schedbuf[MAXPDSTRING];
- struct stat statbuf;
- x->x_infd = x->x_outfd = 0;
- x->x_childpid = -1;
- snprintf(pdexecbuf, MAXPDSTRING, "%s/bin/pd", pddir);
- if (stat(pdexecbuf, &statbuf) < 0)
- {
- snprintf(pdexecbuf, MAXPDSTRING, "%s/../../../bin/pd", pddir);
- if (stat(pdexecbuf, &statbuf) < 0)
- {
- snprintf(pdexecbuf, MAXPDSTRING, "%s/pd", pddir);
- if (stat(pdexecbuf, &statbuf) < 0)
- {
- ERROR "pd~: can't stat %s", pdexecbuf);
- goto fail1;
- }
- }
- }
- snprintf(schedbuf, MAXPDSTRING, "%s/pdsched%s", schedlibdir,
- pd_tilde_dllextent);
- if (stat(schedbuf, &statbuf) < 0)
- {
- snprintf(schedbuf, MAXPDSTRING, "%s/pdsched%s", schedlibdir,
- pd_tilde_dllextent2);
- if (stat(schedbuf, &statbuf) < 0)
- {
- ERROR "pd~: can't stat %s", schedbuf);
- goto fail1;
- }
- }
- snprintf(cmdbuf, MAXPDSTRING,
-"'%s' -schedlib '%s'/pdsched -path '%s' -inchannels %d -outchannels %d -r %g %s\n",
- pdexecbuf, schedlibdir, patchdir, ninsig, noutsig, samplerate, pdargs);
-#if 0
-#ifdef PD
- fprintf(stderr, "%s", cmdbuf);
-#endif
- post("cmd: %s", cmdbuf);
-#endif
- if (pipe(pipe1) < 0)
- {
- ERROR "pd~: can't create pipe");
- goto fail1;
- }
- if (pipe(pipe2) < 0)
- {
- ERROR "pd~: can't create pipe");
- goto fail2;
- }
- if ((pid = fork()) < 0)
- {
- ERROR "pd~: can't fork");
- goto fail3;
- }
- else if (pid == 0)
- {
- /* child process */
- if (pipe2[1] == 0)
- {
- dup2(pipe2[1], 20);
- close(pipe2[1]);
- pipe2[1] = 20;
- }
- dup2(pipe1[0], 0);
- dup2(pipe2[1], 1);
- if (pipe1[0] >= 2)
- close(pipe1[0]);
- if (pipe1[1] >= 2)
- close(pipe1[1]);
- if (pipe2[0] >= 2)
- close(pipe2[0]);
- if (pipe2[1] >= 2)
- close(pipe2[1]);
- execl("/bin/sh", "sh", "-c", cmdbuf, (char*)0);
- _exit(1);
- }
- /* OK, we're parent */
- close(pipe1[0]);
- close(pipe2[1]);
- fcntl(pipe1[1], F_SETFD, FD_CLOEXEC);
- fcntl(pipe2[0], F_SETFD, FD_CLOEXEC);
- x->x_outfd = fdopen(pipe1[1], "w");
- x->x_infd = fdopen(pipe2[0], "r");
- x->x_childpid = pid;
- for (i = 0; i < fifo; i++)
- fprintf(x->x_outfd, "%s", ";\n0;\n");
- fflush(x->x_outfd);
- if (!(x->x_msgbuf = calloc(MSGBUFSIZE, 1)))
- {
- ERROR "pd~: can't allocate message buffer");
- goto fail3;
- }
- x->x_msgbufsize = MSGBUFSIZE;
- x->x_infill = 0;
- /* fprintf(stderr, "read...\n"); */
- pd_tilde_readmessages(x);
- /* fprintf(stderr, "... done.\n"); */
- return;
-fail3:
- close(pipe2[0]);
- close(pipe2[1]);
- if (x->x_childpid > 0)
- waitpid(x->x_childpid, 0, 0);
-fail2:
- close(pipe1[0]);
- close(pipe1[1]);
-fail1:
- x->x_infd = x->x_outfd = 0;
- x->x_childpid = -1;
- return;
-}
-
-static t_int *pd_tilde_perform(t_int *w)
-{
- t_pd_tilde *x = (t_pd_tilde *)(w[1]);
- int n = (int)(w[2]), i, j, numbuffill = 0, c;
- char numbuf[80];
- FILE *infd = x->x_infd;
- if (!infd)
- goto zeroit;
- fprintf(x->x_outfd, ";\n");
- if (!x->x_ninsig)
- fprintf(x->x_outfd, "0\n");
- else for (i = 0; i < x->x_ninsig; i++)
- {
- t_sample *fp = x->x_insig[i];
- for (j = 0; j < n; j++)
- fprintf(x->x_outfd, "%g\n", *fp++);
- for (; j < DEFDACBLKSIZE; j++)
- fprintf(x->x_outfd, "0\n");
- }
- fprintf(x->x_outfd, ";\n");
- fflush(x->x_outfd);
- i = j = 0;
- while (1)
- {
- while (1)
- {
- c = getc(infd);
- if (c == EOF)
- {
- if (errno)
- ERROR "pd~: %s", strerror(errno));
- else ERROR "pd~: subprocess exited");
- pd_tilde_close(x);
- goto zeroit;
- }
- else if (!isspace(c) && c != ';')
- {
- if (numbuffill < (80-1))
- numbuf[numbuffill++] = c;
- }
- else
- {
- t_sample z;
- if (numbuffill)
- {
- numbuf[numbuffill] = 0;
- if (sscanf(numbuf, "%f", &z) < 1)
- continue;
- if (i < x->x_noutsig)
- x->x_outsig[i][j] = z;
- if (++j >= DEFDACBLKSIZE)
- j = 0, i++;
- }
- numbuffill = 0;
- break;
- }
- }
- /* message terminated */
- if (c == ';')
- break;
- }
- for (; i < x->x_noutsig; i++, j = 0)
- {
- for (; j < DEFDACBLKSIZE; j++)
- x->x_outsig[i][j] = 0;
- }
- pd_tilde_readmessages(x);
- return (w+3);
-zeroit:
- for (i = 0; i < x->x_noutsig; i++)
- {
- for (j = 0; j < DEFDACBLKSIZE; j++)
- x->x_outsig[i][j] = 0;
- }
- return (w+3);
-}
-
-static void pd_tilde_dsp(t_pd_tilde *x, t_signal **sp)
-{
- int i, n = (x->x_ninsig || x->x_noutsig ? sp[0]->s_n : 1);
- t_sample **g;
-
- for (i = 0, g = x->x_insig; i < x->x_ninsig; i++, g++)
- *g = (*(sp++))->s_vec;
-
- for (i = 0, g = x->x_outsig; i < x->x_noutsig; i++, g++)
- *g = (*(sp++))->s_vec;
-
- dsp_add(pd_tilde_perform, 2, x, n);
-}
-
-static void pd_tilde_pdtilde(t_pd_tilde *x, t_symbol *s,
- int argc, t_atom *argv)
-{
- t_symbol *sel = ((argc > 0 && argv->a_type == A_SYMBOL) ?
- argv->a_w.w_symbol : gensym("?")), *schedlibdir;
- char *patchdir;
- if (sel == gensym("start"))
- {
- char pdargstring[MAXPDSTRING];
- if (x->x_infd)
- pd_tilde_close(x);
- pdargstring[0] = 0;
- argc--; argv++;
-#ifdef PD
- while (argc--)
- {
- atom_string(argv++, pdargstring + strlen(pdargstring),
- MAXPDSTRING - strlen(pdargstring));
- if (strlen(pdargstring) < MAXPDSTRING-1)
- strcat(pdargstring, " ");
- }
- patchdir = canvas_getdir(x->x_canvas)->s_name;
-#endif
-#ifdef MSP
- while (argc--)
- {
- /* because Mac pathnames sometimes have an evil preceeding
- colon character, we test for and silently eat them */
- if (argv->a_type == A_SYM)
- strncat(pdargstring, (*argv->a_w.w_sym->s_name == ':'?
- argv->a_w.w_sym->s_name+1 : argv->a_w.w_sym->s_name),
- MAXPDSTRING - strlen(pdargstring)-3);
- else if (argv->a_type == A_LONG)
- snprintf(pdargstring+strlen(pdargstring),
- MAXPDSTRING - strlen(pdargstring)-3, "%ld",
- argv->a_w.w_long);
- else if (argv->a_type == A_FLOAT)
- snprintf(pdargstring+strlen(pdargstring),
- MAXPDSTRING - strlen(pdargstring)-3, "%f",
- argv->a_w.w_float);
- strcat(pdargstring, " ");
- argv++;
- }
- patchdir = ".";
-#endif
- schedlibdir = x->x_schedlibdir;
- if (schedlibdir == gensym(".") && x->x_pddir != gensym("."))
- {
- char *pds = x->x_pddir->s_name, scheddirstring[MAXPDSTRING];
- int l = strlen(pds);
- if (l >= 4 && (!strcmp(pds+l-3, "bin") || !strcmp(pds+l-4, "bin/")))
- snprintf(scheddirstring, MAXPDSTRING, "%s/../extra/pd~", pds);
- else snprintf(scheddirstring, MAXPDSTRING, "%s/extra/pd~", pds);
- schedlibdir = gensym(scheddirstring);
- }
- pd_tilde_donew(x, x->x_pddir->s_name, schedlibdir->s_name,
- patchdir, pdargstring, x->x_ninsig, x->x_noutsig, x->x_fifo,
- x->x_sr);
- }
- else if (sel == gensym("stop"))
- {
- if (x->x_infd)
- pd_tilde_close(x);
- }
- else if (sel == gensym("pddir"))
- {
- if ((argc > 1) && argv[1].a_type == A_SYMBOL)
- {
- t_symbol *sym = argv[1].a_w.w_symbol;
-#ifdef MSP
- if (sym->s_name[0] == ':')
- sym = gensym(s->s_name+1);
-#endif
- x->x_pddir = sym;
- }
- else ERROR "pd~ pddir: needs symbol argument");
- }
- else ERROR "pd~: unknown control message: %s", sel->s_name);
-}
-
-static void pd_tilde_free(t_pd_tilde *x)
-{
-#ifdef MSP
- dsp_free((t_pxobject *)x);
-#endif
- pd_tilde_close(x);
- clock_free(x->x_clock);
-}
-
-/* -------------------------- Pd glue ------------------------- */
-#ifdef PD
-
-static void pd_tilde_tick(t_pd_tilde *x)
-{
- int messstart = 0, i, n;
- t_atom *vec;
- t_binbuf *b;
- if (!x->x_msgbuf)
- return;
- b = binbuf_new();
- binbuf_text(b, x->x_msgbuf, x->x_infill);
- /* binbuf_print(b); */
- n = binbuf_getnatom(b);
- vec = binbuf_getvec(b);
- for (i = 0; i < n; i++)
- {
- if (vec[i].a_type == A_SEMI)
- {
- if (i > messstart && vec[messstart].a_type == A_SYMBOL)
- outlet_anything(x->x_outlet1, vec[messstart].a_w.w_symbol,
- i-(messstart+1), vec+(messstart+1));
- else if (i > messstart)
- outlet_list(x->x_outlet1, 0, i-messstart, vec+messstart);
- messstart = i+1;
- }
- }
- binbuf_free(b);
- x->x_infill = 0;
-}
-
-static void pd_tilde_anything(t_pd_tilde *x, t_symbol *s,
- int argc, t_atom *argv)
-{
- char msgbuf[MAXPDSTRING];
- if (!x->x_outfd)
- return;
- fprintf(x->x_outfd, "%s ", s->s_name);
- while (argc--)
- {
- atom_string(argv++, msgbuf, MAXPDSTRING);
- fprintf(x->x_outfd, "%s ", msgbuf);
- }
- fprintf(x->x_outfd, ";\n");
-}
-
-static void *pd_tilde_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_pd_tilde *x = (t_pd_tilde *)pd_new(pd_tilde_class);
- int ninsig = 2, noutsig = 2, j, fifo = 5;
- t_float sr = sys_getsr();
- t_sample **g;
- t_symbol *pddir = sys_libdir,
- *scheddir = gensym(class_gethelpdir(pd_tilde_class));
- /* fprintf(stderr, "pd %s, sched %s\n", pddir->s_name, scheddir->s_name); */
- while (argc > 0)
- {
- t_symbol *firstarg = atom_getsymbolarg(0, argc, argv);
- if (!strcmp(firstarg->s_name, "-sr") && argc > 1)
- {
- sr = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-ninsig") && argc > 1)
- {
- ninsig = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-noutsig") && argc > 1)
- {
- noutsig = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-fifo") && argc > 1)
- {
- fifo = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-pddir") && argc > 1)
- {
- pddir = atom_getsymbolarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-scheddir") && argc > 1)
- {
- scheddir = atom_getsymbolarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else break;
- }
-
- if (argc)
- {
- pd_error(x,
-"usage: pd~ [-sr #] [-ninsig #] [-noutsig #] [-fifo #] [-pddir <>]");
- post(
-"... [-scheddir <>]");
- }
-
- x->x_clock = clock_new(x, (t_method)pd_tilde_tick);
- x->x_insig = (t_sample **)getbytes(ninsig * sizeof(*x->x_insig));
- x->x_outsig = (t_sample **)getbytes(noutsig * sizeof(*x->x_outsig));
- x->x_ninsig = ninsig;
- x->x_noutsig = noutsig;
- x->x_fifo = fifo;
- x->x_sr = sr;
- x->x_pddir = pddir;
- x->x_schedlibdir = scheddir;
- x->x_infd = 0;
- x->x_outfd = 0;
- x->x_outfd = 0;
- x->x_childpid = -1;
- x->x_msgbuf = 0;
- x->x_canvas = canvas_getcurrent();
- for (j = 1, g = x->x_insig; j < ninsig; j++, g++)
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
- x->x_outlet1 = outlet_new(&x->x_obj, 0);
- for (j = 0, g = x->x_outsig; j < noutsig; j++, g++)
- outlet_new(&x->x_obj, &s_signal);
- signal(SIGPIPE, SIG_IGN);
-
- return (x);
-}
-
-void pd_tilde_setup(void)
-{
- pd_tilde_class = class_new(gensym("pd~"), (t_newmethod)pd_tilde_new,
- (t_method)pd_tilde_free, sizeof(t_pd_tilde), 0, A_GIMME, 0);
- class_addmethod(pd_tilde_class, nullfn, gensym("signal"), 0);
- class_addmethod(pd_tilde_class, (t_method)pd_tilde_dsp, gensym("dsp"), 0);
- class_addmethod(pd_tilde_class, (t_method)pd_tilde_pdtilde, gensym("pd~"), A_GIMME, 0);
- class_addanything(pd_tilde_class, pd_tilde_anything);
- post("pd~ version 0.2");
-}
-#endif
-
-/* -------------------------- MSP glue ------------------------- */
-#ifdef MSP
-
-#define LOTS 10000
-
-static void pd_tilde_tick(t_pd_tilde *x)
-{
- int messstart = 0, i, n = 0;
- t_atom vec[LOTS];
- long z1 = 0, z2 = 0;
- void *b;
- if (!x->x_msgbuf)
- return;
- b = binbuf_new();
- binbuf_text(b, &x->x_msgbuf, x->x_infill);
- /* binbuf_print(b); */
- while (!binbuf_getatom(b, &z1, &z2, vec+n))
- if (++n >= LOTS)
- break;
- for (i = 0; i < n; i++)
- {
- if (vec[i].a_type == A_SEMI)
- {
- if (i > messstart + 1)
- {
- void *whom;
- if (vec[messstart].a_type == A_SYM)
- outlet_anything(x->x_outlet1, vec[messstart].a_w.w_sym,
- i-messstart-1, vec+(messstart+1));
- else if (vec[messstart].a_type == A_FLOAT && i == messstart+1)
- outlet_float(x->x_outlet1, vec[messstart].a_w.w_float);
- else if (vec[messstart].a_type == A_LONG && i == messstart+1)
- outlet_int(x->x_outlet1, vec[messstart].a_w.w_long);
- else outlet_list(x->x_outlet1, gensym("list"),
- i-messstart, vec+(messstart));
- }
- messstart = i+1;
- }
- }
- binbuf_free(b);
- x->x_infill = 0;
-}
-
-static void pd_tilde_anything(t_pd_tilde *x, t_symbol *s,
- long ac, t_atom *av)
-{
- char msgbuf[MAXPDSTRING], *sp, *ep = msgbuf+MAXPDSTRING;
- if (!x->x_outfd)
- return;
- msgbuf[0] = 0;
- strncpy(msgbuf, s->s_name, MAXPDSTRING);
- msgbuf[MAXPDSTRING-1] = 0;
- sp = msgbuf + strlen(msgbuf);
- while (ac--)
- {
- if (sp < ep-1)
- sp[0] = ' ', sp[1] = 0, sp++;
- if (sp < ep - 80)
- {
- if (av->a_type == A_SYM && strlen(av->a_w.w_sym->s_name) < ep - sp-20)
- strcpy(sp, av->a_w.w_sym->s_name);
- else if (av->a_type == A_LONG)
- sprintf(sp, "%ld" ,av->a_w.w_long);
- else if (av->a_type == A_FLOAT)
- sprintf(sp, "%g" ,av->a_w.w_float);
- }
- sp += strlen(sp);
- av++;
- }
- fprintf(x->x_outfd, "%s;\n", msgbuf);
-}
-
-int main()
-{
- t_class *c;
-
- c = class_new("pd_tilde~", (method)pd_tilde_new, (method)pd_tilde_free, sizeof(t_pd_tilde), (method)0L, A_GIMME, 0);
-
- class_addmethod(c, (method)pd_tilde_dsp, "dsp", A_CANT, 0);
- class_addmethod(c, (method)pd_tilde_assist, "assist", A_CANT, 0);
- class_addmethod(c, (method)pd_tilde_pdtilde, "pd~", A_GIMME, 0);
- class_addmethod(c, (method)pd_tilde_anything, "anything", A_GIMME, 0);
- class_dspinit(c);
-
- class_register(CLASS_BOX, c);
- pd_tilde_class = c;
- post("pd~ version 0.2");
- return (0);
-}
-
-static void *pd_tilde_new(t_symbol *s, long ac, t_atom *av)
-{
- int ninsig = 2, noutsig = 2, fifo = 5, j;
- t_float sr = sys_getsr();
- t_symbol *pddir = gensym("."), *scheddir = gensym(".");
- t_pd_tilde *x;
-
- if (x = (t_pd_tilde *)object_alloc(pd_tilde_class))
- {
- while (ac > 0 && av[0].a_type == A_SYM)
- {
- char *flag = av[0].a_w.w_sym->s_name;
- if (!strcmp(flag, "-sr") && ac > 1)
- {
- sr = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float :
- (av[1].a_type == A_LONG ? av[1].a_w.w_long : 0));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-ninsig") && ac > 1)
- {
- ninsig = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float :
- (av[1].a_type == A_LONG ? av[1].a_w.w_long : 0));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-noutsig") && ac > 1)
- {
- noutsig = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float :
- (av[1].a_type == A_LONG ? av[1].a_w.w_long : 0));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-fifo") && ac > 1)
- {
- fifo = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float :
- (av[1].a_type == A_LONG ? av[1].a_w.w_long : 0));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-pddir") && ac > 1)
- {
- pddir = (av[1].a_type == A_SYM ? av[1].a_w.w_sym : gensym("."));
- ac -= 2; av += 2;
- }
- else if (!strcmp(flag, "-scheddir") && ac > 1)
- {
- scheddir = (av[1].a_type == A_SYM ? av[1].a_w.w_sym : gensym("."));
- ac -= 2; av += 2;
- }
- else break;
- }
- if (ac)
- post("pd~: warning: ignoring extra arguments");
- dsp_setup((t_pxobject *)x, ninsig);
- x->x_outlet1 = outlet_new(&x->x_obj, 0);
- for (j = 0; j < noutsig; j++)
- outlet_new((t_pxobject *)x, "signal");
- x->x_clock = clock_new(x, (method)pd_tilde_tick);
- x->x_insig = (t_sample **)getbytes(ninsig * sizeof(*x->x_insig));
- x->x_outsig = (t_sample **)getbytes(noutsig * sizeof(*x->x_outsig));
- x->x_ninsig = ninsig;
- x->x_noutsig = noutsig;
- x->x_fifo = fifo;
- x->x_sr = sr;
- x->x_pddir = pddir;
- x->x_schedlibdir = scheddir;
- x->x_infd = 0;
- x->x_outfd = 0;
- x->x_outfd = 0;
- x->x_childpid = -1;
- x->x_msgbuf = 0;
- }
- return (x);
-}
-
-void pd_tilde_assist(t_pd_tilde *x, void *b, long m, long a, char *s)
-{
-}
-
-#endif /* MSP */
diff --git a/externals/extra/0.43.3/pd~/z.pd b/externals/extra/0.43.3/pd~/z.pd
deleted file mode 100644
index 373201da..00000000
--- a/externals/extra/0.43.3/pd~/z.pd
+++ /dev/null
@@ -1,15 +0,0 @@
-#N canvas 686 241 450 300 10;
-#X obj 65 58 r foo;
-#X obj 62 100 print foo;
-#X obj 244 59 adc~;
-#X obj 238 102 env~ 8192;
-#X floatatom 236 140 5 0 0 0 - - -;
-#X obj 155 234 dac~;
-#X obj 155 191 osc~ 440;
-#X obj 287 204 stdout;
-#X msg 307 153 a b c;
-#X connect 0 0 1 0;
-#X connect 2 0 3 0;
-#X connect 3 0 4 0;
-#X connect 6 0 5 0;
-#X connect 8 0 7 0;
diff --git a/externals/extra/0.43.3/pique/pique-help.pd b/externals/extra/0.43.3/pique/pique-help.pd
deleted file mode 100644
index 1689c95b..00000000
--- a/externals/extra/0.43.3/pique/pique-help.pd
+++ /dev/null
@@ -1,33 +0,0 @@
-#N canvas 143 0 729 407 12;
-#X obj 47 11 pique;
-#X text 105 12 -- find peaks in an FFT spectrum;
-#X obj 214 174 rfft~;
-#X obj 131 129 osc~ 2000;
-#X graph graph2 0 -64 63 64 519 179 719 39;
-#X array fft-real 64 float;
-#X pop;
-#X graph graph3 0 -64 63 64 519 327 719 187;
-#X array fft-imag 64 float;
-#X pop;
-#X obj 214 215 tabwrite~ fft-real;
-#X obj 245 240 tabwrite~ fft-imag;
-#X obj 315 158 metro 1000;
-#X obj 315 116 loadbang;
-#X msg 315 138 1;
-#X obj 91 349 pique;
-#X msg 91 322 64 fft-real fft-imag 10;
-#X obj 91 376 print;
-#X obj 205 132 osc~ 5000;
-#X text 25 37 pique takes unwindowed FFT analyses as input (they should be stored in arrays) and outputs a list of peaks \, giving their peak number \, frequency \, amplitude \, and phase (as a cosine/sine pair.);
-#X text 13 289 message argumnets: number of FFT points \, fft real part \, fft imaginary part \, maximum number of peaks to report.;
-#X text 578 387 updated for Pd 0.31.;
-#X connect 2 0 6 0;
-#X connect 2 1 7 0;
-#X connect 3 0 2 0;
-#X connect 8 0 6 0;
-#X connect 8 0 7 0;
-#X connect 9 0 10 0;
-#X connect 10 0 8 0;
-#X connect 11 0 13 0;
-#X connect 12 0 11 0;
-#X connect 14 0 2 0;
diff --git a/externals/extra/0.43.3/pique/pique.c b/externals/extra/0.43.3/pique/pique.c
deleted file mode 100644
index 7c8b899b..00000000
--- a/externals/extra/0.43.3/pique/pique.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/* Copyright (c) 1999 Miller Puckette. The
-contents of this file are free for any use, but BOTH THE AUTHOR AND UCSD
-DISCLAIM ALL WARRANTIES related to it. Although not written in Java, this
-still should not be used to control any machinery containing a sharp blade or
-combustible materiel, or as part of any life support system or weapon. */
-
-#include "m_pd.h"
-#include <math.h>
-#include <stdio.h>
-/* These pragmas are only used for MSVC, not MinGW or Cygwin <hans@at.or.at> */
-#ifdef _MSC_VER
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-static t_class *pique_class;
-
-typedef struct _pique
-{
- t_object x_obj;
- int x_n;
- t_float x_errthresh;
- t_float *x_freq;
- t_float *x_amp;
- t_float *x_ampre;
- t_float *x_ampim;
-} t_pique;
-
-static void *pique_new(t_floatarg f)
-{
- int n = f;
- t_pique *x = (t_pique *)pd_new(pique_class);
- if (n < 1) n = 100;
- x->x_n = n;
- x->x_errthresh = 0;
- x->x_freq = t_getbytes(n * sizeof(*x->x_freq));
- x->x_amp = t_getbytes(n * sizeof(*x->x_amp));
- x->x_ampre = t_getbytes(n * sizeof(*x->x_ampre));
- x->x_ampim = t_getbytes(n * sizeof(*x->x_ampim));
- outlet_new(&x->x_obj, &s_list);
- return (x);
-}
-
-static t_float hanning(t_float pidetune, t_float sinpidetune)
-{
- t_float pi = 3.141592653589793;
- if (pidetune < 0.01 && pidetune > -0.01) return (1);
- else if (pidetune > 3.14 && pidetune < 3.143) return (0.5);
- else if (pidetune < -3.14 && pidetune > -3.143) return (0.5);
- else return (sinpidetune/pidetune - 0.5 *
- (sinpidetune/(pidetune+pi) + sinpidetune/(pidetune-pi)));
-}
-
-static t_float peakerror(t_word *fpreal, t_word *fpimag, t_float pidetune,
- t_float norm, t_float peakreal, t_float peakimag)
-{
- t_float sinpidetune = sin(pidetune);
- t_float cospidetune = cos(pidetune);
- t_float windowshould = hanning(pidetune, sinpidetune);
- t_float realshould = windowshould * (
- peakreal * cospidetune + peakimag * sinpidetune);
- t_float imagshould = windowshould * (
- peakimag * cospidetune - peakreal * sinpidetune);
- t_float realgot = norm * (fpreal[0].w_float -
- 0.5 * (fpreal[1].w_float + fpreal[-1].w_float));
- t_float imaggot = norm * (fpimag[0].w_float -
- 0.5 * (fpimag[1].w_float + fpimag[-1].w_float));
- t_float realdev = realshould - realgot, imagdev = imagshould - imaggot;
-
- /* post("real %f->%f; imag %f->%f", realshould, realgot,
- imagshould, imaggot); */
- return (realdev * realdev + imagdev * imagdev);
-}
-
-static void pique_doit(int npts, t_word *fpreal, t_word *fpimag,
- int npeak, int *nfound, t_float *fpfreq, t_float *fpamp,
- t_float *fpampre, t_float *fpampim, t_float errthresh)
-{
- t_float srate = sys_getsr(); /* not sure how to get this correctly */
- t_float oneovern = 1.0/ (t_float)npts;
- t_float fperbin = srate * oneovern;
- t_float pow1, pow2 = 0, pow3 = 0, pow4 = 0, pow5 = 0;
- t_float re1, re2 = 0, re3 = fpreal->w_float;
- t_float im1, im2 = 0, im3 = 0, powthresh, relativeerror;
- int count, peakcount = 0, n2 = (npts >> 1);
- t_float *fp1, *fp2;
- t_word *wp1, *wp2;
- for (count = n2, wp1 = fpreal, wp2 = fpimag, powthresh = 0;
- count--; wp1++, wp2++)
- powthresh += (wp1->w_float) * (wp1->w_float) +
- (wp2->w_float) * (wp2->w_float) ;
- powthresh *= 0.00001;
- for (count = 1; count < n2; count++)
- {
- t_float windreal, windimag, pi = 3.141592653589793;
- t_float detune, pidetune, sinpidetune, cospidetune,
- ampcorrect, freqout, ampout, ampoutreal, ampoutimag;
- t_float rpeak, rpeaknext, rpeakprev;
- t_float ipeak, ipeaknext, ipeakprev;
- t_float errleft, errright;
- fpreal++;
- fpimag++;
- re1 = re2;
- re2 = re3;
- re3 = fpreal->w_float;
- im1 = im2;
- im2 = im3;
- im3 = fpimag->w_float;
- if (count < 2) continue;
- pow1 = pow2;
- pow2 = pow3;
- pow3 = pow4;
- pow4 = pow5;
- /* get Hanning-windowed spectrum by convolution */
- windreal = re2 - 0.5 * (re1 + re3);
- windimag = im2 - 0.5 * (im1 + im3);
- pow5 = windreal * windreal + windimag * windimag;
- /* if (count < 30) post("power %f", pow5); */
- if (count < 5) continue;
- /* check for a peak. The actual bin is count-3. */
- if (pow3 <= pow2 || pow3 <= pow4 || pow3 <= pow1 || pow3 <= pow5
- || pow3 < powthresh)
- continue;
- /* go back for the raw FFT values around the peak. */
- rpeak = fpreal[-3].w_float;
- rpeaknext = fpreal[-2].w_float;
- rpeakprev = fpreal[-4].w_float;
- ipeak = fpimag[-3].w_float;
- ipeaknext = fpimag[-2].w_float;
- ipeakprev = fpimag[-4].w_float;
- /* recalculate Hanning-windowed spectrum by convolution */
- windreal = rpeak - 0.5 * (rpeaknext + rpeakprev);
- windimag = ipeak - 0.5 * (ipeaknext + ipeakprev);
-
- detune = ((rpeakprev - rpeaknext) *
- (2.0 * rpeak - rpeakprev - rpeaknext) +
- (ipeakprev - ipeaknext) *
- (2.0 * ipeak - ipeakprev - ipeaknext)) /
- (4.0 * pow3);
- /* if (count < 30) post("detune %f", detune); */
- if (detune > 0.7 || detune < -0.7) continue;
- /* the frequency is the sum of the bin frequency and detuning */
- freqout = fperbin * ((t_float)(count-3) + detune);
- pidetune = pi * detune;
- sinpidetune = sin(pidetune);
- cospidetune = cos(pidetune);
- ampcorrect = 1.0 / hanning(pidetune, sinpidetune);
- /* Multiply by 2 to get real-sinusoid peak amplitude
- and divide by N to normalize FFT */
- ampcorrect *= 2. * oneovern;
- /* amplitude is peak height, corrected for Hanning window shape */
-
- ampout = ampcorrect * sqrt(pow3);
- ampoutreal = ampcorrect *
- (windreal * cospidetune - windimag * sinpidetune);
- ampoutimag = ampcorrect *
- (windreal * sinpidetune + windimag * cospidetune);
- if (errthresh > 0)
- {
- /* post("peak %f %f", freqout, ampout); */
- errleft = peakerror(fpreal-4, fpimag-4, pidetune+pi,
- 2. * oneovern, ampoutreal, ampoutimag);
- errright = peakerror(fpreal-2, fpimag-2, pidetune-pi,
- 2. * oneovern, ampoutreal, ampoutimag);
- relativeerror = (errleft + errright)/(ampout * ampout);
- if (relativeerror > errthresh) continue;
- }
- /* post("power %f, error %f, relative %f",
- pow3, errleft + errright, relativeerror); */
- *fpfreq++ = freqout;
- *fpamp++ = ampout;
- *fpampre++ = ampoutreal;
- *fpampim++ = ampoutimag;
- if (++peakcount == npeak) break;
- }
- *nfound = peakcount;
-}
-
-static void pique_list(t_pique *x, t_symbol *s, int argc, t_atom *argv)
-{
- int npts = atom_getintarg(0, argc, argv);
- t_symbol *symreal = atom_getsymbolarg(1, argc, argv);
- t_symbol *symimag = atom_getsymbolarg(2, argc, argv);
- int npeak = atom_getintarg(3, argc, argv);
- int n;
- t_garray *a;
- t_word *fpreal, *fpimag;
- if (npts < 8 || npeak < 1) error("pique: bad npoints or npeak");
- if (npeak > x->x_n) npeak = x->x_n;
- if (!(a = (t_garray *)pd_findbyclass(symreal, garray_class)) ||
- !garray_getfloatwords(a, &n, &fpreal) ||
- n < npts)
- error("%s: missing or bad array", symreal->s_name);
- else if (!(a = (t_garray *)pd_findbyclass(symimag, garray_class)) ||
- !garray_getfloatwords(a, &n, &fpimag) ||
- n < npts)
- error("%s: missing or bad array", symimag->s_name);
- else
- {
- int nfound, i;
- t_float *fpfreq = x->x_freq;
- t_float *fpamp = x->x_amp;
- t_float *fpampre = x->x_ampre;
- t_float *fpampim = x->x_ampim;
- pique_doit(npts, fpreal, fpimag, npeak,
- &nfound, fpfreq, fpamp, fpampre, fpampim, x->x_errthresh);
- for (i = 0; i < nfound; i++, fpamp++, fpfreq++, fpampre++, fpampim++)
- {
- t_atom at[5];
- SETFLOAT(at, (t_float)i);
- SETFLOAT(at+1, *fpfreq);
- SETFLOAT(at+2, *fpamp);
- SETFLOAT(at+3, *fpampre);
- SETFLOAT(at+4, *fpampim);
- outlet_list(x->x_obj.ob_outlet, &s_list, 5, at);
- }
- }
-}
-
-static void pique_errthresh(t_pique *x, t_floatarg f)
-{
- x->x_errthresh = f;
-}
-
-static void pique_free(t_pique *x)
-{
- int n = x->x_n;
- t_freebytes(x->x_freq, n * sizeof(*x->x_freq));
- t_freebytes(x->x_amp, n * sizeof(*x->x_amp));
- t_freebytes(x->x_ampre, n * sizeof(*x->x_ampre));
- t_freebytes(x->x_ampim, n * sizeof(*x->x_ampim));
-}
-
-void pique_setup(void)
-{
- pique_class = class_new(gensym("pique"), (t_newmethod)pique_new,
- (t_method)pique_free, sizeof(t_pique),0, A_DEFFLOAT, 0);
- class_addlist(pique_class, pique_list);
- class_addmethod(pique_class, (t_method)pique_errthresh,
- gensym("errthresh"), A_FLOAT, 0);
- post("pique 0.1 for PD version 23");
-}
-
diff --git a/externals/extra/0.43.3/rev1-final.pd b/externals/extra/0.43.3/rev1-final.pd
deleted file mode 100644
index 0ed091c4..00000000
--- a/externals/extra/0.43.3/rev1-final.pd
+++ /dev/null
@@ -1,106 +0,0 @@
-#N canvas 133 53 729 468 10;
-#X obj 72 240 inlet~;
-#X obj 347 28 loadbang;
-#X obj 90 376 +~;
-#X obj 52 408 +~;
-#X obj 52 437 outlet~;
-#X obj 409 96 pow;
-#X obj 372 118 *;
-#X floatatom 372 159;
-#X obj 82 264 *~ 0;
-#X obj 177 175 pow;
-#X text 386 140 delay \, msec;
-#X floatatom 201 237;
-#X obj 190 150 * 0.001;
-#X text 206 220 gain for this stage;
-#X obj 103 327 *~ 0;
-#X obj 201 202 *;
-#X text 25 13 Allpass filter for mono reverberator. Arg 1 = delay name \, arg2 = stage number \, arg 3 = delay time;
-#X obj 373 76 8;
-#X obj 409 75 1.79;
-#X obj 114 175 0.7;
-#X obj 363 50 t b b b b;
-#X obj 177 108 0;
-#X obj 372 207 abs;
-#X obj 372 229 moses 0.01;
-#X obj 443 229 print wrong-delay-time;
-#X obj 233 391 inlet~;
-#X obj 219 419 +~;
-#X obj 219 443 outlet~;
-#X text 74 83 decay after;
-#X text 85 98 1 second;
-#X obj 83 119 r \$1-decay;
-#X obj 327 262 r \$1-clear;
-#X obj 240 298 0;
-#X obj 327 281 t b;
-#X obj 327 344 delay;
-#X obj 327 322 + 5;
-#X obj 158 279 delread~ \$2 \$4;
-#X obj 90 397 delwrite~ \$2 \$4;
-#X obj 327 302 f \$4;
-#X obj 371 184 - \$4;
-#X obj 446 75 float \$3;
-#X obj 241 318 1;
-#X obj 158 300 *~ 1;
-#X obj 52 298 *~ 0;
-#X obj 10 209 t b f f;
-#X obj 28 233 *;
-#X obj 10 256 -;
-#X obj 41 258 * -1;
-#X obj 11 297 *~ 0;
-#X obj 214 181 sqrt;
-#X connect 0 0 8 0;
-#X connect 1 0 20 0;
-#X connect 2 0 37 0;
-#X connect 3 0 4 0;
-#X connect 3 0 26 0;
-#X connect 5 0 6 1;
-#X connect 6 0 7 0;
-#X connect 6 0 12 0;
-#X connect 7 0 39 0;
-#X connect 8 0 43 0;
-#X connect 8 0 48 0;
-#X connect 9 0 15 0;
-#X connect 9 0 14 1;
-#X connect 12 0 9 1;
-#X connect 14 0 2 1;
-#X connect 14 0 3 1;
-#X connect 15 0 11 0;
-#X connect 15 0 8 1;
-#X connect 17 0 6 0;
-#X connect 18 0 5 0;
-#X connect 18 0 49 0;
-#X connect 19 0 44 0;
-#X connect 19 0 47 0;
-#X connect 20 0 21 0;
-#X connect 20 0 19 0;
-#X connect 20 1 17 0;
-#X connect 20 2 18 0;
-#X connect 20 3 40 0;
-#X connect 21 0 9 0;
-#X connect 22 0 23 0;
-#X connect 23 1 24 0;
-#X connect 25 0 26 1;
-#X connect 26 0 27 0;
-#X connect 30 0 9 0;
-#X connect 31 0 33 0;
-#X connect 32 0 42 1;
-#X connect 33 0 32 0;
-#X connect 33 0 38 0;
-#X connect 34 0 41 0;
-#X connect 35 0 34 0;
-#X connect 36 0 42 0;
-#X connect 38 0 35 0;
-#X connect 39 0 22 0;
-#X connect 40 0 5 1;
-#X connect 41 0 42 1;
-#X connect 42 0 14 0;
-#X connect 43 0 3 0;
-#X connect 44 0 46 0;
-#X connect 44 1 45 0;
-#X connect 44 2 45 1;
-#X connect 45 0 46 1;
-#X connect 46 0 48 1;
-#X connect 47 0 43 1;
-#X connect 48 0 2 0;
-#X connect 49 0 15 1;
diff --git a/externals/extra/0.43.3/rev1-stage.pd b/externals/extra/0.43.3/rev1-stage.pd
deleted file mode 100644
index c1ee6574..00000000
--- a/externals/extra/0.43.3/rev1-stage.pd
+++ /dev/null
@@ -1,99 +0,0 @@
-#N canvas 86 133 729 452 10;
-#X obj 27 238 inlet~;
-#X obj 347 28 loadbang;
-#X obj 171 281 * -1;
-#X obj 36 353 +~;
-#X obj 69 395 +~;
-#X obj 69 424 outlet~;
-#X obj 409 96 pow;
-#X obj 372 118 *;
-#X floatatom 372 159;
-#X obj 37 262 *~ 0;
-#X obj 177 175 pow;
-#X text 408 162 delay \, msec;
-#X floatatom 177 238;
-#X obj 190 150 * 0.001;
-#X text 182 221 gain for this stage;
-#X obj 49 332 *~ 0;
-#X obj 47 375 *~ 0;
-#X obj 177 203 *;
-#X floatatom 409 119;
-#X text 25 13 Allpass filter for mono reverberator. Arg 1 = delay name \, arg2 = stage number \, arg 3 = delay time;
-#X obj 373 76 8;
-#X obj 409 75 1.79;
-#X obj 68 185 0.7;
-#X obj 363 50 t b b b b;
-#X obj 177 108 0;
-#X obj 372 207 abs;
-#X obj 372 229 moses 0.01;
-#X obj 443 229 print wrong-delay-time;
-#X obj 233 391 inlet~;
-#X obj 219 419 +~;
-#X obj 219 443 outlet~;
-#X text 74 83 decay after;
-#X text 85 98 1 second;
-#X obj 83 119 r \$1-decay;
-#X obj 259 256 r \$1-clear;
-#X obj 206 301 0;
-#X obj 259 275 t b;
-#X obj 259 338 delay;
-#X obj 259 316 + 5;
-#X obj 79 280 delread~ \$2 \$4;
-#X obj 36 447 delwrite~ \$2 \$4;
-#X obj 259 296 f \$4;
-#X obj 371 184 - \$4;
-#X obj 446 75 float \$3;
-#X obj 207 321 1;
-#X obj 79 301 *~ 1;
-#X obj 207 188 sqrt;
-#X floatatom 35 148;
-#X connect 0 0 9 0;
-#X connect 1 0 23 0;
-#X connect 2 0 16 1;
-#X connect 3 0 16 0;
-#X connect 3 0 40 0;
-#X connect 4 0 5 0;
-#X connect 4 0 29 0;
-#X connect 6 0 7 1;
-#X connect 6 0 18 0;
-#X connect 7 0 8 0;
-#X connect 7 0 13 0;
-#X connect 8 0 42 0;
-#X connect 9 0 3 0;
-#X connect 10 0 17 0;
-#X connect 13 0 10 1;
-#X connect 15 0 3 1;
-#X connect 16 0 4 0;
-#X connect 17 0 12 0;
-#X connect 17 0 9 1;
-#X connect 20 0 7 0;
-#X connect 21 0 6 0;
-#X connect 21 0 46 0;
-#X connect 22 0 2 0;
-#X connect 22 0 15 1;
-#X connect 23 0 24 0;
-#X connect 23 0 22 0;
-#X connect 23 1 20 0;
-#X connect 23 2 21 0;
-#X connect 23 3 43 0;
-#X connect 24 0 10 0;
-#X connect 25 0 26 0;
-#X connect 26 1 27 0;
-#X connect 28 0 29 1;
-#X connect 29 0 30 0;
-#X connect 33 0 10 0;
-#X connect 33 0 47 0;
-#X connect 34 0 36 0;
-#X connect 35 0 45 1;
-#X connect 36 0 35 0;
-#X connect 36 0 41 0;
-#X connect 37 0 44 0;
-#X connect 38 0 37 0;
-#X connect 39 0 45 0;
-#X connect 41 0 38 0;
-#X connect 42 0 25 0;
-#X connect 43 0 6 1;
-#X connect 44 0 45 1;
-#X connect 45 0 15 0;
-#X connect 45 0 4 1;
-#X connect 46 0 17 1;
diff --git a/externals/extra/0.43.3/rev1~-help.pd b/externals/extra/0.43.3/rev1~-help.pd
deleted file mode 100644
index 55580bd5..00000000
--- a/externals/extra/0.43.3/rev1~-help.pd
+++ /dev/null
@@ -1,119 +0,0 @@
-#N canvas 55 21 1008 526 12;
-#X obj 148 439 dac~;
-#X obj 58 72 line~;
-#X msg 58 49 0 \, 10000 5;
-#X obj 58 118 cos~;
-#X msg 146 70 1;
-#X obj 146 47 loadbang;
-#X obj 58 95 clip~ 0 0.25;
-#X floatatom 173 264 0 0 0;
-#X obj 251 134 line~;
-#X obj 251 157 cos~;
-#X msg 324 54 -0.25 \, 0.25 100;
-#X obj 251 8 loadbang;
-#X msg 251 31 -0.25;
-#X obj 251 203 *~;
-#X obj 58 140 hip~ 5;
-#X floatatom 162 328 0 0 0;
-#X obj 162 373 pack 0 100;
-#X obj 162 396 line~;
-#X obj 148 416 *~;
-#X obj 162 350 dbtorms;
-#X msg 324 77 -0.25 \, 0.25 400;
-#X floatatom 324 145 0 0 0;
-#X obj 324 191 osc~ 440;
-#X obj 324 168 mtof;
-#X msg 324 31 -0.25 \, 0.25 20;
-#X obj 251 180 *~ 0.1;
-#X msg 324 100 -0.25 \, 0.25 1000;
-#X msg 324 122 -0.25 \, 0.25 2000;
-#X obj 324 226 *~;
-#X obj 342 252 *~;
-#X obj 58 439 dac~;
-#X floatatom 68 323 0 0 0;
-#X obj 68 368 pack 0 100;
-#X obj 68 391 line~;
-#X obj 58 416 *~;
-#X obj 68 346 dbtorms;
-#X msg 324 8 0;
-#X obj 308 257 *~;
-#X obj 58 26 metro 2000;
-#X floatatom 58 4 0 0 0;
-#X msg 220 265 bang;
-#X obj 284 322 env~ 32768;
-#X floatatom 284 344 0 0 0;
-#X text 166 244 1 sec;
-#X text 143 226 dB after;
-#X text 220 245 clear;
-#X text 1 51 impulse;
-#X text 362 7 tone;
-#X text 484 31 beeps;
-#X text 428 167 This is an experimental reverberator design composed
-of a series of allpass filters with exponentially growing delay times.
-Each allpass filter has a gain of 0.7. The reverb time is adjusted
-by adjusting the input gains of the allpass filters. The last unit
-is modified so that its first two "echos" mimic those of an allpass
-but its loop gain depends on reverb time.;
-#X text 430 299 Reverb time is controlled by specifying the dB gain
-(100 normal) after one second \, so that 100 corresponds to infinite
-reverb time \, 70 to two seconds \, 40 to one second \, and 0 to 0
-;
-#X text 671 499 modified for Pd version 0.30.;
-#X msg 560 34 \; pd dsp 1;
-#X text 427 475 The rev1~ module eats about 18% of my 300mHz P2 machine.
-;
-#X obj 148 289 rev1~;
-#X text 428 381 The "clear" button impolitely clears out all the delay
-lines \, You may immediately resume pumping the reverberator \, but
-the input signal should be cleanly enveloped. The output \, too \,
-must be enveloped and may not be opened until 5 msec after the "clear"
-message is sent.;
-#X connect 1 0 6 0;
-#X connect 2 0 1 0;
-#X connect 3 0 14 0;
-#X connect 4 0 1 0;
-#X connect 5 0 4 0;
-#X connect 6 0 3 0;
-#X connect 7 0 54 1;
-#X connect 8 0 9 0;
-#X connect 9 0 25 0;
-#X connect 10 0 8 0;
-#X connect 11 0 12 0;
-#X connect 12 0 8 0;
-#X connect 13 0 14 0;
-#X connect 14 0 34 0;
-#X connect 14 0 54 0;
-#X connect 15 0 19 0;
-#X connect 16 0 17 0;
-#X connect 17 0 18 1;
-#X connect 18 0 0 0;
-#X connect 19 0 16 0;
-#X connect 20 0 8 0;
-#X connect 21 0 23 0;
-#X connect 22 0 13 1;
-#X connect 22 0 28 0;
-#X connect 22 0 28 1;
-#X connect 22 0 29 0;
-#X connect 23 0 22 0;
-#X connect 24 0 8 0;
-#X connect 25 0 13 0;
-#X connect 26 0 8 0;
-#X connect 27 0 8 0;
-#X connect 28 0 29 1;
-#X connect 28 0 13 1;
-#X connect 28 0 37 0;
-#X connect 28 0 37 1;
-#X connect 29 0 13 1;
-#X connect 31 0 35 0;
-#X connect 32 0 33 0;
-#X connect 33 0 34 1;
-#X connect 34 0 30 0;
-#X connect 35 0 32 0;
-#X connect 36 0 8 0;
-#X connect 37 0 13 1;
-#X connect 38 0 2 0;
-#X connect 39 0 38 0;
-#X connect 40 0 54 2;
-#X connect 41 0 42 0;
-#X connect 54 0 18 0;
-#X connect 54 0 41 0;
diff --git a/externals/extra/0.43.3/rev1~.pd b/externals/extra/0.43.3/rev1~.pd
deleted file mode 100644
index 83fd6d20..00000000
--- a/externals/extra/0.43.3/rev1~.pd
+++ /dev/null
@@ -1,64 +0,0 @@
-#N canvas 66 116 512 312 10;
-#X obj 345 154 dbtorms;
-#X obj 316 120 min 100;
-#X obj 316 100 inlet;
-#X obj 45 16 inlet~;
-#X obj 254 298 outlet~;
-#X obj 432 106 inlet;
-#X obj 432 130 t b;
-#X obj 269 145 t b f;
-#X obj 281 185 -;
-#X obj 282 254 line~;
-#X obj 282 233 pack 0 100;
-#X obj 269 166 105;
-#X obj 256 276 *~;
-#X obj 282 210 * 0.01;
-#X text 282 65 reverb decay speed;
-#X text 278 79 (dB left after 1 sec);
-#X text 425 84 bang to clear;
-#X obj 44 41 rev1-stage \$0 \$0-del1 0 8;
-#X obj 44 64 rev1-stage \$0 \$0-del2 1 14.32;
-#X obj 44 87 rev1-stage \$0 \$0-del3 2 25.6328;
-#X obj 44 110 rev1-stage \$0 \$0-del4 3 45.8827;
-#X obj 44 133 rev1-stage \$0 \$0-del5 4 82.1301;
-#X obj 44 156 rev1-stage \$0 \$0-del6 5 147.013;
-#X obj 44 179 rev1-stage \$0 \$0-del7 6 263.153;
-#X obj 44 202 rev1-stage \$0 \$0-del8 7 471.044;
-#X obj 44 225 rev1-stage \$0 \$0-del9 8 843.168;
-#X obj 44 248 rev1-final \$0 \$0-del10 9 1509.27;
-#X obj 346 177 s \$0-decay;
-#X obj 432 153 s \$0-clear;
-#X connect 0 0 27 0;
-#X connect 1 0 0 0;
-#X connect 1 0 7 0;
-#X connect 2 0 1 0;
-#X connect 3 0 17 0;
-#X connect 5 0 6 0;
-#X connect 6 0 28 0;
-#X connect 7 0 11 0;
-#X connect 7 1 8 1;
-#X connect 8 0 13 0;
-#X connect 9 0 12 1;
-#X connect 10 0 9 0;
-#X connect 11 0 8 0;
-#X connect 12 0 4 0;
-#X connect 13 0 10 0;
-#X connect 17 0 18 0;
-#X connect 17 1 18 1;
-#X connect 18 0 19 0;
-#X connect 18 1 19 1;
-#X connect 19 0 20 0;
-#X connect 19 1 20 1;
-#X connect 20 0 21 0;
-#X connect 20 1 21 1;
-#X connect 21 0 22 0;
-#X connect 21 1 22 1;
-#X connect 22 0 23 0;
-#X connect 22 1 23 1;
-#X connect 23 0 24 0;
-#X connect 23 1 24 1;
-#X connect 24 0 25 0;
-#X connect 24 1 25 1;
-#X connect 25 0 26 0;
-#X connect 25 1 26 1;
-#X connect 26 1 12 0;
diff --git a/externals/extra/0.43.3/rev2~-help.pd b/externals/extra/0.43.3/rev2~-help.pd
deleted file mode 100644
index 8f9fbaaf..00000000
--- a/externals/extra/0.43.3/rev2~-help.pd
+++ /dev/null
@@ -1,134 +0,0 @@
-#N canvas 167 160 766 354 12;
-#X floatatom 73 185 0 0 120 0 - - -;
-#X floatatom 106 323 0 0 120 0 - - -;
-#N canvas 0 0 539 448 tests 0;
-#X obj 67 33 inlet;
-#X obj 309 189 inlet;
-#X obj 235 207 line~;
-#X obj 235 230 cos~;
-#X obj 235 68 loadbang;
-#X msg 235 91 -0.25;
-#X obj 235 276 *~;
-#X obj 186 309 hip~ 5;
-#X floatatom 308 218 0 0 0 0 - - -;
-#X obj 308 264 osc~ 440;
-#X obj 308 241 mtof;
-#X obj 235 253 *~ 0.1;
-#X obj 308 299 *~;
-#X obj 326 325 *~;
-#X obj 292 330 *~;
-#X msg 279 150 -0.25 \, 0.25 \$1;
-#X obj 41 148 biquad~ 0 0 1 -1 0;
-#X obj 63 70 t b;
-#X obj 104 72 del 3;
-#X obj 57 101 1;
-#X obj 96 101 0;
-#X obj 41 355 outlet~;
-#X obj 279 126 inlet;
-#X obj 40 175 *~;
-#X connect 0 0 17 0;
-#X connect 1 0 8 0;
-#X connect 2 0 3 0;
-#X connect 3 0 11 0;
-#X connect 4 0 5 0;
-#X connect 5 0 2 0;
-#X connect 6 0 7 0;
-#X connect 7 0 21 0;
-#X connect 8 0 10 0;
-#X connect 9 0 6 1;
-#X connect 9 0 12 0;
-#X connect 9 0 12 1;
-#X connect 9 0 13 0;
-#X connect 10 0 9 0;
-#X connect 11 0 6 0;
-#X connect 12 0 13 1;
-#X connect 12 0 6 1;
-#X connect 12 0 14 0;
-#X connect 12 0 14 1;
-#X connect 13 0 6 1;
-#X connect 14 0 6 1;
-#X connect 15 0 2 0;
-#X connect 16 0 23 0;
-#X connect 17 0 18 0;
-#X connect 17 0 19 0;
-#X connect 18 0 20 0;
-#X connect 19 0 16 0;
-#X connect 19 0 23 1;
-#X connect 20 0 16 0;
-#X connect 20 0 23 1;
-#X connect 22 0 15 0;
-#X connect 23 0 21 0;
-#X restore 17 154 pd tests;
-#X msg 56 35 10;
-#X msg 54 62 20;
-#X msg 53 90 100;
-#X msg 52 115 500;
-#X obj 17 15 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X text 37 9 impulse;
-#N canvas 0 0 450 300 output 0;
-#X obj 54 202 dac~;
-#X obj 132 119 pack 0 100;
-#X obj 132 142 line~;
-#X obj 54 165 *~;
-#X obj 132 97 dbtorms;
-#X obj 33 42 inlet~;
-#X obj 177 42 inlet;
-#X obj 177 74 clip 0 120;
-#X msg 257 133 \; pd dsp 1;
-#X obj 98 42 inlet~;
-#X obj 94 168 *~;
-#X connect 1 0 2 0;
-#X connect 2 0 3 1;
-#X connect 2 0 10 1;
-#X connect 3 0 0 0;
-#X connect 4 0 1 0;
-#X connect 5 0 3 0;
-#X connect 6 0 7 0;
-#X connect 6 0 8 0;
-#X connect 7 0 4 0;
-#X connect 9 0 10 0;
-#X connect 10 0 0 1;
-#X restore 18 324 pd output;
-#X floatatom 97 127 0 0 0 0 - - -;
-#X text 136 96 tone;
-#X text 135 112 pitch;
-#X text 114 185 level \, dB;
-#X floatatom 117 209 0 0 100 0 - - -;
-#X text 158 209 liveness \, 0-100;
-#X text 505 330 modified for Pd version 0.37;
-#X floatatom 161 235 0 0 120 0 - - -;
-#X floatatom 205 259 0 0 120 0 - - -;
-#X text 192 235 crossover frequency \, Hz.;
-#X text 238 260 HF damping \, percent;
-#X obj 30 290 rev2~ 100 90 3000 20;
-#X text 141 324 output level \, dB;
-#X text 281 8 REV2~ - a simple 1-in \, 4-out reverberator;
-#X text 95 35 tone;
-#X text 96 52 bursts;
-#X text 231 37 The creation arguments (level \, liveness \, crossover
-frequency \, HF damping) may also be supplied in four inlets as shown.
-The "liveness" (actually the internal feedback percentage) should be
-100 for infinite reverb \, 90 for longish \, and 80 for short. The
-crossover frequency and HF damping work together: at frequencies above
-crossover \, the feedback is diminished by the "damping" as a percentage.
-So zero HF damping means equal reverb time at all frequencies \, and
-100% damping means almost nothing above the crossover frequency gets
-through.;
-#X text 132 130 (60 for;
-#X text 115 150 middle C);
-#X connect 0 0 21 1;
-#X connect 1 0 9 2;
-#X connect 2 0 9 0;
-#X connect 2 0 21 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 1;
-#X connect 6 0 2 1;
-#X connect 7 0 2 0;
-#X connect 10 0 2 2;
-#X connect 14 0 21 2;
-#X connect 17 0 21 3;
-#X connect 18 0 21 4;
-#X connect 21 0 9 0;
-#X connect 21 1 9 1;
diff --git a/externals/extra/0.43.3/rev2~.pd b/externals/extra/0.43.3/rev2~.pd
deleted file mode 100644
index 5b87faa7..00000000
--- a/externals/extra/0.43.3/rev2~.pd
+++ /dev/null
@@ -1,237 +0,0 @@
-#N canvas 333 147 832 664 12;
-#X obj 161 497 +~;
-#X obj 520 105 inlet;
-#X obj 184 407 *~;
-#X obj 486 412 *~;
-#X obj 285 412 *~;
-#X obj 387 412 *~;
-#X obj 443 546 -~;
-#X obj 364 545 -~;
-#X obj 239 537 +~;
-#X obj 161 534 +~;
-#X obj 162 444 +~;
-#X obj 262 440 +~;
-#X obj 464 501 -~;
-#X obj 387 499 +~;
-#X obj 239 500 -~;
-#X obj 452 105 inlet;
-#X obj 609 429 line~;
-#X obj 509 374 line~;
-#X obj 16 121 delread~ \$0-del1 58.6435;
-#X obj 94 143 delread~ \$0-del2 69.4325;
-#X obj 176 165 delread~ \$0-del3 74.5234;
-#X obj 258 189 delread~ \$0-del4 86.1244;
-#X obj 530 500 *~;
-#X obj 599 501 *~;
-#X obj 161 641 delwrite~ \$0-del1 58.6435;
-#X obj 240 617 delwrite~ \$0-del2 69.4325;
-#X obj 365 595 delwrite~ \$0-del3 74.5234;
-#X obj 444 573 delwrite~ \$0-del4 86.1244;
-#X obj 609 357 dbtorms;
-#X obj 609 403 pack 0 30;
-#X obj 520 211 pack 0 50;
-#X obj 9 390 inlet~;
-#X obj 530 525 outlet~;
-#X obj 599 525 outlet~;
-#X obj 520 187 / 200;
-#X obj 520 162 clip 0 100;
-#X obj 52 236 lop~;
-#X obj 452 137 f \$1;
-#X obj 520 138 f \$2;
-#X obj 625 143 f \$3;
-#X obj 696 143 f \$4;
-#X obj 367 106 loadbang;
-#X obj 667 500 *~;
-#X obj 735 501 *~;
-#X obj 667 525 outlet~;
-#X obj 735 525 outlet~;
-#X obj 625 167 moses 1;
-#X msg 631 193 3000;
-#X obj 705 193 clip 0 100;
-#N canvas 345 88 355 597 early-reflect 0;
-#X obj 119 477 delread~ \$0-ref6 13.645;
-#X obj 119 453 delwrite~ \$0-ref6 13.645;
-#X obj 106 400 delread~ \$0-ref5 16.364;
-#X obj 106 376 delwrite~ \$0-ref5 16.364;
-#X obj 102 324 delread~ \$0-ref4 19.392;
-#X obj 102 300 delwrite~ \$0-ref4 19.392;
-#X obj 106 247 delread~ \$0-ref3 25.796;
-#X obj 106 223 delwrite~ \$0-ref3 25.796;
-#X obj 107 169 delread~ \$0-ref2 43.5337;
-#X obj 107 145 delwrite~ \$0-ref2 43.5337;
-#X obj 110 90 delread~ \$0-ref1 75.2546;
-#X obj 84 119 -~;
-#X obj 49 119 +~;
-#X obj 50 195 +~;
-#X obj 85 196 -~;
-#X obj 84 275 -~;
-#X obj 49 274 +~;
-#X obj 82 349 -~;
-#X obj 48 350 +~;
-#X obj 83 428 -~;
-#X obj 49 428 +~;
-#X obj 65 7 inlet~;
-#X obj 110 66 delwrite~ \$0-ref1 75.2546;
-#X obj 49 508 outlet~;
-#X obj 119 507 outlet~;
-#X connect 0 0 24 0;
-#X connect 2 0 20 1;
-#X connect 2 0 19 1;
-#X connect 4 0 18 1;
-#X connect 4 0 17 1;
-#X connect 6 0 16 1;
-#X connect 6 0 15 1;
-#X connect 8 0 13 1;
-#X connect 8 0 14 1;
-#X connect 10 0 12 1;
-#X connect 10 0 11 1;
-#X connect 11 0 9 0;
-#X connect 12 0 14 0;
-#X connect 12 0 13 0;
-#X connect 13 0 16 0;
-#X connect 13 0 15 0;
-#X connect 14 0 7 0;
-#X connect 15 0 5 0;
-#X connect 16 0 18 0;
-#X connect 16 0 17 0;
-#X connect 17 0 3 0;
-#X connect 18 0 20 0;
-#X connect 18 0 19 0;
-#X connect 19 0 1 0;
-#X connect 20 0 23 0;
-#X connect 21 0 12 0;
-#X connect 21 0 11 0;
-#X connect 21 0 22 0;
-#X restore 9 416 pd early-reflect;
-#X obj 618 216 f;
-#X obj 618 105 inlet;
-#X obj 696 109 inlet;
-#X obj 705 216 f;
-#X obj 705 239 * 0.01;
-#X obj 705 263 pack 0 50;
-#X obj 705 287 line~;
-#X obj 29 269 -~;
-#X obj 28 300 *~;
-#X obj 16 331 +~;
-#X obj 132 240 lop~;
-#X obj 106 274 -~;
-#X obj 105 309 *~;
-#X obj 95 333 +~;
-#X obj 214 245 lop~;
-#X obj 188 273 -~;
-#X obj 187 314 *~;
-#X obj 176 339 +~;
-#X obj 308 249 lop~;
-#X obj 281 274 -~;
-#X obj 281 318 *~;
-#X obj 258 342 +~;
-#X obj 609 379 * 0.125;
-#X text 403 10 control inlets:;
-#X text 9 9 rev2 - simple \, cheap reverberator with;
-#X text 400 29 1: output level \, dB \, 0-100;
-#X text 8 30 one signal inlet and four signal outlets.;
-#X text 399 79 4: high frequency damping \, 0-100;
-#X text 400 62 3: crossover frequency in Hz. (3000 default);
-#X text 400 45 2: liveness \, 0-100 \, usually between 85 and 100;
-#X connect 0 0 9 0;
-#X connect 0 0 7 0;
-#X connect 1 0 38 0;
-#X connect 2 0 10 1;
-#X connect 3 0 12 1;
-#X connect 3 0 13 1;
-#X connect 3 0 43 0;
-#X connect 4 0 11 1;
-#X connect 5 0 13 0;
-#X connect 5 0 12 0;
-#X connect 5 0 42 0;
-#X connect 6 0 27 0;
-#X connect 7 0 26 0;
-#X connect 8 0 25 0;
-#X connect 9 0 24 0;
-#X connect 10 0 14 0;
-#X connect 10 0 0 0;
-#X connect 10 0 22 0;
-#X connect 11 0 0 1;
-#X connect 11 0 14 1;
-#X connect 11 0 23 0;
-#X connect 12 0 8 1;
-#X connect 12 0 6 1;
-#X connect 13 0 9 1;
-#X connect 13 0 7 1;
-#X connect 14 0 8 0;
-#X connect 14 0 6 0;
-#X connect 15 0 37 0;
-#X connect 16 0 22 1;
-#X connect 16 0 23 1;
-#X connect 16 0 42 1;
-#X connect 16 0 43 1;
-#X connect 17 0 4 1;
-#X connect 17 0 2 1;
-#X connect 17 0 5 1;
-#X connect 17 0 3 1;
-#X connect 18 0 36 0;
-#X connect 18 0 57 1;
-#X connect 18 0 59 0;
-#X connect 19 0 60 0;
-#X connect 19 0 61 1;
-#X connect 19 0 63 0;
-#X connect 20 0 67 0;
-#X connect 20 0 64 0;
-#X connect 20 0 65 1;
-#X connect 21 0 71 0;
-#X connect 21 0 69 1;
-#X connect 21 0 68 0;
-#X connect 22 0 32 0;
-#X connect 23 0 33 0;
-#X connect 28 0 72 0;
-#X connect 29 0 16 0;
-#X connect 30 0 17 0;
-#X connect 31 0 49 0;
-#X connect 34 0 30 0;
-#X connect 35 0 34 0;
-#X connect 36 0 57 0;
-#X connect 37 0 28 0;
-#X connect 38 0 35 0;
-#X connect 39 0 46 0;
-#X connect 40 0 48 0;
-#X connect 41 0 37 0;
-#X connect 41 0 38 0;
-#X connect 41 0 39 0;
-#X connect 41 0 40 0;
-#X connect 42 0 44 0;
-#X connect 43 0 45 0;
-#X connect 46 0 47 0;
-#X connect 46 1 50 0;
-#X connect 47 0 50 0;
-#X connect 48 0 53 0;
-#X connect 49 0 10 0;
-#X connect 49 1 11 0;
-#X connect 50 0 36 1;
-#X connect 50 0 60 1;
-#X connect 50 0 64 1;
-#X connect 50 0 68 1;
-#X connect 51 0 50 0;
-#X connect 52 0 40 0;
-#X connect 53 0 54 0;
-#X connect 54 0 55 0;
-#X connect 55 0 56 0;
-#X connect 56 0 58 1;
-#X connect 56 0 62 1;
-#X connect 56 0 66 1;
-#X connect 56 0 70 1;
-#X connect 57 0 58 0;
-#X connect 58 0 59 1;
-#X connect 59 0 2 0;
-#X connect 60 0 61 0;
-#X connect 61 0 62 0;
-#X connect 62 0 63 1;
-#X connect 63 0 4 0;
-#X connect 64 0 65 0;
-#X connect 65 0 66 0;
-#X connect 66 0 67 1;
-#X connect 67 0 5 0;
-#X connect 68 0 69 0;
-#X connect 69 0 70 0;
-#X connect 70 0 71 1;
-#X connect 71 0 3 0;
-#X connect 72 0 29 0;
diff --git a/externals/extra/0.43.3/rev3~-help.pd b/externals/extra/0.43.3/rev3~-help.pd
deleted file mode 100644
index 78ef15f5..00000000
--- a/externals/extra/0.43.3/rev3~-help.pd
+++ /dev/null
@@ -1,136 +0,0 @@
-#N canvas 70 263 765 380 12;
-#X floatatom 99 212 0 0 120 0 - - -;
-#X floatatom 105 340 0 0 120 0 - - -;
-#N canvas 0 0 539 448 tests 0;
-#X obj 67 33 inlet;
-#X obj 309 189 inlet;
-#X obj 235 207 line~;
-#X obj 235 230 cos~;
-#X obj 235 68 loadbang;
-#X msg 235 91 -0.25;
-#X obj 235 276 *~;
-#X obj 186 309 hip~ 5;
-#X floatatom 308 218 0 0 0 0 - - -;
-#X obj 308 264 osc~ 440;
-#X obj 308 241 mtof;
-#X obj 235 253 *~ 0.1;
-#X obj 308 299 *~;
-#X obj 326 325 *~;
-#X obj 292 330 *~;
-#X msg 279 150 -0.25 \, 0.25 \$1;
-#X obj 41 148 biquad~ 0 0 1 -1 0;
-#X obj 63 70 t b;
-#X obj 104 72 del 3;
-#X obj 57 101 1;
-#X obj 96 101 0;
-#X obj 41 355 outlet~;
-#X obj 279 126 inlet;
-#X obj 51 192 *~;
-#X connect 0 0 17 0;
-#X connect 1 0 8 0;
-#X connect 2 0 3 0;
-#X connect 3 0 11 0;
-#X connect 4 0 5 0;
-#X connect 5 0 2 0;
-#X connect 6 0 7 0;
-#X connect 7 0 21 0;
-#X connect 8 0 10 0;
-#X connect 9 0 6 1;
-#X connect 9 0 12 0;
-#X connect 9 0 12 1;
-#X connect 9 0 13 0;
-#X connect 10 0 9 0;
-#X connect 11 0 6 0;
-#X connect 12 0 13 1;
-#X connect 12 0 6 1;
-#X connect 12 0 14 0;
-#X connect 12 0 14 1;
-#X connect 13 0 6 1;
-#X connect 14 0 6 1;
-#X connect 15 0 2 0;
-#X connect 16 0 23 0;
-#X connect 17 0 18 0;
-#X connect 17 0 19 0;
-#X connect 18 0 20 0;
-#X connect 19 0 16 0;
-#X connect 19 0 23 1;
-#X connect 20 0 16 0;
-#X connect 20 0 23 1;
-#X connect 22 0 15 0;
-#X connect 23 0 21 0;
-#X restore 16 171 pd tests;
-#X msg 55 52 10;
-#X msg 53 79 20;
-#X msg 52 107 100;
-#X msg 51 132 500;
-#X obj 16 32 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X text 36 26 impulse;
-#N canvas 0 0 450 300 output 0;
-#X obj 54 202 dac~;
-#X obj 132 119 pack 0 100;
-#X obj 132 142 line~;
-#X obj 54 165 *~;
-#X obj 132 97 dbtorms;
-#X obj 33 42 inlet~;
-#X obj 177 42 inlet;
-#X obj 177 74 clip 0 120;
-#X msg 257 133 \; pd dsp 1;
-#X obj 98 42 inlet~;
-#X obj 94 168 *~;
-#X connect 1 0 2 0;
-#X connect 2 0 3 1;
-#X connect 2 0 10 1;
-#X connect 3 0 0 0;
-#X connect 4 0 1 0;
-#X connect 5 0 3 0;
-#X connect 6 0 7 0;
-#X connect 6 0 8 0;
-#X connect 7 0 4 0;
-#X connect 9 0 10 0;
-#X connect 10 0 0 1;
-#X restore 17 340 pd output;
-#X floatatom 96 144 0 0 0 0 - - -;
-#X text 135 113 tone;
-#X text 134 129 pitch;
-#X text 140 212 level \, dB;
-#X floatatom 134 234 0 0 100 0 - - -;
-#X text 175 234 liveness \, 0-100;
-#X floatatom 169 258 4 0 5000 0 - - -;
-#X floatatom 204 281 0 0 100 0 - - -;
-#X text 217 256 crossover frequency \, Hz.;
-#X text 240 283 HF damping \, percent;
-#X text 140 341 output level \, dB;
-#X text 94 52 tone;
-#X text 95 69 bursts;
-#X text 131 147 (60 for;
-#X text 114 167 middle C);
-#X obj 29 307 rev3~ 100 90 3000 20;
-#X text 263 4 REV3~ - hard-core \, 2-in \, 4-out reverberator;
-#X text 236 56 The creation arguments (level \, liveness \, crossover
-frequency \, HF damping) may also be supplied in four inlets as shown.
-The "liveness" (actually the internal feedback percentage) should be
-100 for infinite reverb \, 90 for longish \, and 80 for short. The
-crossover frequency and HF damping work together: at frequencies above
-crossover \, the feedback is diminished by the "damping" as a percentage.
-So zero HF damping means equal reverb time at all frequencies \, and
-100% damping means almost nothing above the crossover frequency gets
-through.;
-#X text 236 29 (A more expensive \, presumably better \, one than rev2~.)
-;
-#X text 470 352 modified for Pd version 0.37-1;
-#X connect 0 0 25 2;
-#X connect 1 0 9 2;
-#X connect 2 0 9 0;
-#X connect 2 0 25 0;
-#X connect 3 0 2 1;
-#X connect 4 0 2 1;
-#X connect 5 0 2 1;
-#X connect 6 0 2 1;
-#X connect 7 0 2 0;
-#X connect 10 0 2 2;
-#X connect 14 0 25 3;
-#X connect 16 0 25 4;
-#X connect 17 0 25 5;
-#X connect 25 0 9 0;
-#X connect 25 1 9 1;
diff --git a/externals/extra/0.43.3/rev3~.pd b/externals/extra/0.43.3/rev3~.pd
deleted file mode 100644
index 0d8ea472..00000000
--- a/externals/extra/0.43.3/rev3~.pd
+++ /dev/null
@@ -1,439 +0,0 @@
-#N canvas 220 79 810 570 12;
-#X obj 520 105 inlet;
-#X obj 452 105 inlet;
-#X obj 370 335 line~;
-#X obj 232 394 *~;
-#X obj 301 395 *~;
-#X obj 370 284 dbtorms;
-#X obj 370 309 pack 0 30;
-#X obj 520 211 pack 0 50;
-#X obj 232 419 outlet~;
-#X obj 301 419 outlet~;
-#X obj 520 162 clip 0 100;
-#X obj 452 137 f \$1;
-#X obj 520 138 f \$2;
-#X obj 625 143 f \$3;
-#X obj 696 143 f \$4;
-#X obj 367 106 loadbang;
-#X obj 369 394 *~;
-#X obj 437 395 *~;
-#X obj 369 419 outlet~;
-#X obj 437 419 outlet~;
-#X obj 625 167 moses 1;
-#X msg 631 193 3000;
-#X obj 705 193 clip 0 100;
-#X obj 616 218 f;
-#X obj 618 105 inlet;
-#X obj 696 109 inlet;
-#X obj 705 216 f;
-#X obj 705 239 * 0.01;
-#X obj 705 263 pack 0 50;
-#X text 403 10 control inlets:;
-#X text 400 29 1: output level \, dB \, 0-100;
-#X text 399 79 4: high frequency damping \, 0-100;
-#X text 400 62 3: crossover frequency in Hz. (3000 default);
-#X text 400 45 2: liveness \, 0-100 \, usually between 85 and 100;
-#X obj 616 242 s \$0-lop;
-#N canvas 169 94 919 805 doit 0;
-#X obj 218 386 *~;
-#X obj 341 396 *~;
-#X obj 267 389 *~;
-#X obj 305 392 *~;
-#X obj 28 175 lop~;
-#X obj 27 204 -~;
-#X obj 27 291 *~;
-#X obj 16 319 +~;
-#X obj 75 182 lop~;
-#X obj 76 214 -~;
-#X obj 77 294 *~;
-#X obj 67 318 +~;
-#X obj 124 187 lop~;
-#X obj 124 214 -~;
-#X obj 125 297 *~;
-#X obj 116 322 +~;
-#X obj 176 191 lop~;
-#X obj 175 218 -~;
-#X obj 175 301 *~;
-#X obj 168 326 +~;
-#X obj 15 372 *~;
-#X obj 169 383 *~;
-#X obj 67 376 *~;
-#X obj 115 380 *~;
-#X obj 207 160 r \$0-lop;
-#X obj 183 246 r \$0-damp;
-#X obj 183 271 line~;
-#X obj 17 14 delread~ \$0-del1 10;
-#X obj 117 56 delread~ \$0-del3 13.4567;
-#X obj 68 35 delread~ \$0-del2 11.6356;
-#X obj 171 77 delread~ \$0-del4 16.7345;
-#X obj 524 407 *~;
-#X obj 631 409 *~;
-#X obj 560 408 *~;
-#X obj 595 409 *~;
-#X obj 377 399 *~;
-#X obj 488 406 *~;
-#X obj 414 402 *~;
-#X obj 451 405 *~;
-#X obj 654 354 line~;
-#X obj 708 387 r \$0-fb;
-#X obj 218 100 delread~ \$0-del5 20.1862;
-#X obj 267 121 delread~ \$0-del6 25.7417;
-#X obj 304 142 delread~ \$0-del7 31.4693;
-#X obj 341 163 delread~ \$0-del8 38.2944;
-#X obj 376 184 delread~ \$0-del9 46.6838;
-#X obj 414 205 delread~ \$0-del10 55.4567;
-#X obj 488 247 delread~ \$0-del12 76.8243;
-#X obj 524 268 delread~ \$0-del13 88.5623;
-#X obj 561 289 delread~ \$0-del14 101.278;
-#X obj 595 310 delread~ \$0-del15 115.397;
-#X obj 632 331 delread~ \$0-del16 130.502;
-#X obj 25 346 inlet~;
-#X obj 87 346 inlet~;
-#X obj 69 440 +~;
-#X obj 105 440 -~;
-#X obj 141 440 +~;
-#X obj 177 440 -~;
-#X obj 214 440 +~;
-#X obj 250 440 -~;
-#X obj 286 440 +~;
-#X obj 322 440 -~;
-#X obj 359 440 +~;
-#X obj 395 440 -~;
-#X obj 431 440 +~;
-#X obj 467 440 -~;
-#X obj 504 440 +~;
-#X obj 540 440 -~;
-#X obj 576 440 +~;
-#X obj 612 440 -~;
-#X obj 69 474 +~;
-#X obj 177 474 -~;
-#X obj 105 474 +~;
-#X obj 141 474 -~;
-#X obj 214 474 +~;
-#X obj 322 474 -~;
-#X obj 250 474 +~;
-#X obj 286 474 -~;
-#X obj 359 474 +~;
-#X obj 467 474 -~;
-#X obj 395 474 +~;
-#X obj 431 474 -~;
-#X obj 504 474 +~;
-#X obj 612 474 -~;
-#X obj 540 474 +~;
-#X obj 576 474 -~;
-#X obj 69 518 +~;
-#X obj 105 518 +~;
-#X obj 322 518 -~;
-#X obj 286 518 -~;
-#X obj 141 518 +~;
-#X obj 177 518 +~;
-#X obj 214 518 -~;
-#X obj 250 518 -~;
-#X obj 360 518 +~;
-#X obj 396 518 +~;
-#X obj 613 518 -~;
-#X obj 577 518 -~;
-#X obj 432 518 +~;
-#X obj 468 518 +~;
-#X obj 505 518 -~;
-#X obj 541 518 -~;
-#X obj 70 575 +~;
-#X obj 106 575 +~;
-#X obj 469 575 -~;
-#X obj 433 575 -~;
-#X obj 142 575 +~;
-#X obj 178 575 +~;
-#X obj 361 575 -~;
-#X obj 397 575 -~;
-#X obj 215 575 +~;
-#X obj 251 575 +~;
-#X obj 287 575 +~;
-#X obj 323 575 +~;
-#X obj 614 575 -~;
-#X obj 578 575 -~;
-#X obj 506 575 -~;
-#X obj 542 575 -~;
-#X obj 628 606 outlet~;
-#X obj 698 606 outlet~;
-#X obj 768 607 outlet~;
-#X obj 838 607 outlet~;
-#X obj 451 226 delread~ \$0-del11 65.1755;
-#X obj 614 629 delwrite~ \$0-del16 130.502;
-#X obj 361 776 delwrite~ \$0-del9 46.6838;
-#X obj 398 755 delwrite~ \$0-del10 55.4567;
-#X obj 434 734 delwrite~ \$0-del11 65.1755;
-#X obj 470 713 delwrite~ \$0-del12 76.8243;
-#X obj 506 692 delwrite~ \$0-del13 88.5623;
-#X obj 542 671 delwrite~ \$0-del14 101.278;
-#X obj 579 650 delwrite~ \$0-del15 115.397;
-#X obj 323 606 delwrite~ \$0-del8 38.2944;
-#X obj 287 628 delwrite~ \$0-del7 31.4693;
-#X obj 252 650 delwrite~ \$0-del6 25.7417;
-#X obj 215 672 delwrite~ \$0-del5 20.1862;
-#X obj 71 761 delwrite~ \$0-del1 10;
-#X obj 106 737 delwrite~ \$0-del2 11.6356;
-#X obj 141 715 delwrite~ \$0-del3 13.4567;
-#X obj 179 693 delwrite~ \$0-del4 16.7345;
-#X connect 0 0 58 0;
-#X connect 0 0 59 0;
-#X connect 1 0 60 1;
-#X connect 1 0 61 1;
-#X connect 2 0 58 1;
-#X connect 2 0 59 1;
-#X connect 3 0 60 0;
-#X connect 3 0 61 0;
-#X connect 4 0 5 0;
-#X connect 5 0 6 0;
-#X connect 6 0 7 1;
-#X connect 7 0 20 0;
-#X connect 8 0 9 0;
-#X connect 9 0 10 0;
-#X connect 10 0 11 1;
-#X connect 11 0 22 0;
-#X connect 12 0 13 0;
-#X connect 13 0 14 0;
-#X connect 14 0 15 1;
-#X connect 15 0 23 0;
-#X connect 16 0 17 0;
-#X connect 17 0 18 0;
-#X connect 18 0 19 1;
-#X connect 19 0 21 0;
-#X connect 20 0 54 0;
-#X connect 20 0 55 0;
-#X connect 21 0 56 1;
-#X connect 21 0 57 1;
-#X connect 22 0 55 1;
-#X connect 22 0 54 1;
-#X connect 23 0 56 0;
-#X connect 23 0 57 0;
-#X connect 24 0 16 1;
-#X connect 24 0 12 1;
-#X connect 24 0 8 1;
-#X connect 24 0 4 1;
-#X connect 25 0 26 0;
-#X connect 26 0 18 1;
-#X connect 26 0 14 1;
-#X connect 26 0 10 1;
-#X connect 26 0 6 1;
-#X connect 27 0 4 0;
-#X connect 27 0 5 1;
-#X connect 27 0 7 0;
-#X connect 28 0 15 0;
-#X connect 28 0 12 0;
-#X connect 28 0 13 1;
-#X connect 29 0 8 0;
-#X connect 29 0 9 1;
-#X connect 29 0 11 0;
-#X connect 30 0 19 0;
-#X connect 30 0 17 1;
-#X connect 30 0 16 0;
-#X connect 31 0 66 0;
-#X connect 31 0 67 0;
-#X connect 32 0 68 1;
-#X connect 32 0 69 1;
-#X connect 33 0 66 1;
-#X connect 33 0 67 1;
-#X connect 34 0 68 0;
-#X connect 34 0 69 0;
-#X connect 35 0 62 0;
-#X connect 35 0 63 0;
-#X connect 36 0 64 1;
-#X connect 36 0 65 1;
-#X connect 37 0 62 1;
-#X connect 37 0 63 1;
-#X connect 38 0 64 0;
-#X connect 38 0 65 0;
-#X connect 39 0 2 1;
-#X connect 39 0 0 1;
-#X connect 39 0 3 1;
-#X connect 39 0 1 1;
-#X connect 39 0 21 1;
-#X connect 39 0 23 1;
-#X connect 39 0 22 1;
-#X connect 39 0 20 1;
-#X connect 39 0 35 1;
-#X connect 39 0 38 1;
-#X connect 39 0 36 1;
-#X connect 39 0 31 1;
-#X connect 39 0 33 1;
-#X connect 39 0 34 1;
-#X connect 39 0 32 1;
-#X connect 39 0 37 1;
-#X connect 40 0 39 0;
-#X connect 41 0 0 0;
-#X connect 42 0 2 0;
-#X connect 43 0 3 0;
-#X connect 44 0 1 0;
-#X connect 45 0 35 0;
-#X connect 46 0 37 0;
-#X connect 47 0 36 0;
-#X connect 48 0 31 0;
-#X connect 49 0 33 0;
-#X connect 50 0 34 0;
-#X connect 51 0 32 0;
-#X connect 52 0 20 0;
-#X connect 53 0 22 0;
-#X connect 54 0 70 0;
-#X connect 54 0 73 0;
-#X connect 55 0 72 0;
-#X connect 55 0 71 0;
-#X connect 56 0 70 1;
-#X connect 56 0 73 1;
-#X connect 57 0 72 1;
-#X connect 57 0 71 1;
-#X connect 58 0 74 0;
-#X connect 58 0 77 0;
-#X connect 59 0 76 0;
-#X connect 59 0 75 0;
-#X connect 60 0 74 1;
-#X connect 60 0 77 1;
-#X connect 61 0 76 1;
-#X connect 61 0 75 1;
-#X connect 62 0 78 0;
-#X connect 62 0 81 0;
-#X connect 63 0 80 0;
-#X connect 63 0 79 0;
-#X connect 64 0 78 1;
-#X connect 64 0 81 1;
-#X connect 65 0 80 1;
-#X connect 65 0 79 1;
-#X connect 66 0 82 0;
-#X connect 66 0 85 0;
-#X connect 67 0 84 0;
-#X connect 67 0 83 0;
-#X connect 68 0 82 1;
-#X connect 68 0 85 1;
-#X connect 69 0 84 1;
-#X connect 69 0 83 1;
-#X connect 70 0 86 0;
-#X connect 70 0 92 0;
-#X connect 71 0 91 0;
-#X connect 71 0 88 0;
-#X connect 72 0 87 0;
-#X connect 72 0 93 0;
-#X connect 73 0 90 0;
-#X connect 73 0 89 0;
-#X connect 74 0 86 1;
-#X connect 74 0 92 1;
-#X connect 75 0 91 1;
-#X connect 75 0 88 1;
-#X connect 76 0 87 1;
-#X connect 76 0 93 1;
-#X connect 77 0 90 1;
-#X connect 77 0 89 1;
-#X connect 78 0 94 0;
-#X connect 78 0 100 0;
-#X connect 79 0 99 0;
-#X connect 79 0 96 0;
-#X connect 80 0 95 0;
-#X connect 80 0 101 0;
-#X connect 81 0 98 0;
-#X connect 81 0 97 0;
-#X connect 82 0 94 1;
-#X connect 82 0 100 1;
-#X connect 83 0 99 1;
-#X connect 83 0 96 1;
-#X connect 84 0 95 1;
-#X connect 84 0 101 1;
-#X connect 85 0 98 1;
-#X connect 85 0 97 1;
-#X connect 86 0 102 0;
-#X connect 86 0 108 0;
-#X connect 87 0 103 0;
-#X connect 87 0 109 0;
-#X connect 88 0 113 0;
-#X connect 88 0 114 0;
-#X connect 89 0 112 0;
-#X connect 89 0 115 0;
-#X connect 90 0 106 0;
-#X connect 90 0 105 0;
-#X connect 91 0 107 0;
-#X connect 91 0 104 0;
-#X connect 92 0 110 0;
-#X connect 92 0 116 0;
-#X connect 93 0 111 0;
-#X connect 93 0 117 0;
-#X connect 94 0 108 1;
-#X connect 94 0 102 1;
-#X connect 95 0 109 1;
-#X connect 95 0 103 1;
-#X connect 96 0 114 1;
-#X connect 96 0 113 1;
-#X connect 97 0 115 1;
-#X connect 97 0 112 1;
-#X connect 98 0 105 1;
-#X connect 98 0 106 1;
-#X connect 99 0 104 1;
-#X connect 99 0 107 1;
-#X connect 100 0 116 1;
-#X connect 100 0 110 1;
-#X connect 101 0 117 1;
-#X connect 101 0 111 1;
-#X connect 102 0 135 0;
-#X connect 103 0 136 0;
-#X connect 104 0 127 0;
-#X connect 105 0 126 0;
-#X connect 106 0 137 0;
-#X connect 107 0 138 0;
-#X connect 108 0 124 0;
-#X connect 109 0 125 0;
-#X connect 110 0 134 0;
-#X connect 111 0 133 0;
-#X connect 112 0 132 0;
-#X connect 113 0 131 0;
-#X connect 114 0 121 0;
-#X connect 114 0 123 0;
-#X connect 115 0 120 0;
-#X connect 115 0 130 0;
-#X connect 116 0 118 0;
-#X connect 116 0 128 0;
-#X connect 117 0 119 0;
-#X connect 117 0 129 0;
-#X connect 122 0 38 0;
-#X restore 164 317 pd doit;
-#X obj 165 255 inlet~;
-#X obj 222 255 inlet~;
-#X obj 520 241 s \$0-fb;
-#X obj 705 290 s \$0-damp;
-#X text 57 490 rev3 - 16-delay reverberator. Like rev2~ but presumably
-higher-quality and takes two audio inputs.;
-#X obj 520 187 / 400;
-#X connect 0 0 12 0;
-#X connect 1 0 11 0;
-#X connect 2 0 3 1;
-#X connect 2 0 4 1;
-#X connect 2 0 16 1;
-#X connect 2 0 17 1;
-#X connect 3 0 8 0;
-#X connect 4 0 9 0;
-#X connect 5 0 6 0;
-#X connect 6 0 2 0;
-#X connect 7 0 38 0;
-#X connect 10 0 41 0;
-#X connect 11 0 5 0;
-#X connect 12 0 10 0;
-#X connect 13 0 20 0;
-#X connect 14 0 22 0;
-#X connect 15 0 11 0;
-#X connect 15 0 12 0;
-#X connect 15 0 13 0;
-#X connect 15 0 14 0;
-#X connect 16 0 18 0;
-#X connect 17 0 19 0;
-#X connect 20 0 21 0;
-#X connect 20 1 23 0;
-#X connect 21 0 23 0;
-#X connect 22 0 26 0;
-#X connect 23 0 34 0;
-#X connect 24 0 23 0;
-#X connect 25 0 14 0;
-#X connect 26 0 27 0;
-#X connect 27 0 28 0;
-#X connect 28 0 39 0;
-#X connect 35 0 3 0;
-#X connect 35 1 4 0;
-#X connect 35 2 16 0;
-#X connect 35 3 17 0;
-#X connect 36 0 35 0;
-#X connect 37 0 35 1;
-#X connect 41 0 7 0;
diff --git a/externals/extra/0.43.3/sigmund~/sigmund~-help.pd b/externals/extra/0.43.3/sigmund~/sigmund~-help.pd
deleted file mode 100644
index 5ddbf6d1..00000000
--- a/externals/extra/0.43.3/sigmund~/sigmund~-help.pd
+++ /dev/null
@@ -1,194 +0,0 @@
-#N canvas 167 -7 580 617 12;
-#X text 42 4 sigmund~ - sinusoidal analysis and pitch tracking;
-#N canvas 432 117 573 597 using-with-tables 0;
-#X obj 29 368 print peak;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array insignal 1024 float 2;
-#X coords 0 1 1023 -1 200 140 1;
-#X restore 83 426 graph;
-#X obj 314 513 phasor~;
-#X obj 294 429 loadbang;
-#X obj 314 461 440;
-#X floatatom 313 488 5 0 0 0 - - -;
-#X obj 305 544 tabwrite~ insignal;
-#X obj 290 516 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
--1 -1;
-#X text 114 11 Using sigmund~ on arrays;
-#X text 42 33 If invoked with the "-t" flag (as a creation argument)
-\, sigmund~ analyzes waveforms stored in arrays. Instead of an incoming
-signal \, feed it "list" messages with the following arguments:;
-#X text 37 118 table name (a symbol);
-#X text 38 137 number of points;
-#X obj 29 342 sigmund~ -t -npeak 10 -maxfreq 5000 peaks;
-#X msg 29 316 list insignal 1024 0 44100 0;
-#X text 37 158 index of first point;
-#X text 39 179 sample rate;
-#X text 38 200 debug flag (print debugging info if nonzero);
-#X text 23 232 In this mode \, only the "env" \, "pitch" \, and "peaks"
-outputs are meaningful.;
-#X text 31 294 click here to test:;
-#X connect 2 0 6 0;
-#X connect 3 0 4 0;
-#X connect 4 0 5 0;
-#X connect 5 0 2 0;
-#X connect 5 0 7 0;
-#X connect 7 0 6 0;
-#X connect 12 0 0 0;
-#X connect 13 0 12 0;
-#X restore 330 553 pd using-with-tables;
-#X obj 40 512 phasor~;
-#X obj 40 425 loadbang;
-#X floatatom 40 471 5 0 120 0 - - -;
-#X floatatom 39 561 5 0 0 0 - - -;
-#X floatatom 245 563 5 0 0 0 - - -;
-#X obj 40 490 mtof;
-#X obj 40 448 69;
-#X text 38 579 pitch;
-#X text 222 582 envelope;
-#X text 13 28 Sigmund~ analyzes an incoming sound into sinusoidal components
-\, which may be reported individually or combined to form a pitch estimate.
-Possible outputs are specified as creation arguments:;
-#X text 56 95 pitch - output pitch continuously;
-#N canvas 518 74 588 728 setting-parameters 0;
-#X msg 182 66 print;
-#X floatatom 192 92 5 0 0 0 - - -;
-#X msg 192 113 minpower \$1;
-#X obj 182 139 sigmund~ -minpower 40;
-#X text 39 14 You can set parameters either by creation arguments \,
-or else using messages. The "print" message gives you the current values
-of all the parameters:;
-#X text 28 169 npts: number of points used in an analysis. Must be
-a power of two \, at least 128 The minimum frequency that can be tracked
-is about 2(sample_rate)/npts.;
-#X text 26 219 hop: number of points between analyses. Must be a power
-of two \, at least the DSP vector size (usually 64). This regulates
-the number of analyses done per unit of time.;
-#X text 28 271 npeak: maximum number of sinusoidal peaks to look for.
-The computation time is quadratic in the number of peaks actually found
-(this number only sets an upper limit). Use it to balance CPU time
-with quality of results.;
-#X text 30 336 maxfreq: maximum frequency of sinusoidal peaks to look
-for. This can be useful in situations where background noise creates
-high-frequency \, spurious peaks..;
-#X text 37 388 vibrato: maximum deviation from "pitch" to accept as
-normal vibrato (affects "notes" output only). If the value is too small.
-vibratos will appear as trills. If too large \, very small melodic
-intervals may not be reported as new notes.;
-#X text 33 457 stabletime: time period to wait before reporting a note
-(affects "notes" output only). The "pitch" must be present and must
-not vary more than "vibrato" for this entire period to report a note.
-If too large \, the "notes" will be unnecessarily delayed. If too small
-\, spurious notes get output.;
-#X text 31 551 minpower: minimum measured RMS level to report a pitch
-(affects "pitch" and "notes" output only). Signals quieter than this
-will be assumed to be crosstalk and ignored.;
-#X text 32 602 growth: minimum measured RMS growth to report a new
-note (affects "notes" output only). The RMS level must rise by this
-many dB (within a time period given by "stabletime") to report a repetition
-of a note at or near the previously output pitch.;
-#X connect 0 0 3 0;
-#X connect 1 0 2 0;
-#X connect 2 0 3 0;
-#X restore 330 531 pd setting-parameters;
-#N canvas 67 29 641 815 sinusoid-tracking 0;
-#X obj 124 267 sigmund~ -npeak 10 peaks;
-#X obj 124 214 phasor~;
-#X obj 124 144 loadbang;
-#X floatatom 124 190 5 0 120 0 - - -;
-#X obj 124 295 route 0 1 2 3 4 5 6 7 8 9;
-#X obj 82 339 unpack 0 0 0 0;
-#X floatatom 82 461 5 0 0 0 - - -;
-#X floatatom 122 431 5 0 0 0 - - -;
-#X floatatom 162 406 5 0 0 0 - - -;
-#X obj 124 167 440;
-#X floatatom 203 380 5 0 0 0 - - -;
-#X obj 322 349 unpack 0 0 0 0;
-#X floatatom 322 471 5 0 0 0 - - -;
-#X floatatom 362 441 5 0 0 0 - - -;
-#X floatatom 402 416 5 0 0 0 - - -;
-#X floatatom 443 390 5 0 0 0 - - -;
-#X text 385 475 frequency (Hz.);
-#X text 419 442 peak amplitude (linear);
-#X text 464 416 cosine component;
-#X text 499 390 sine component;
-#X text 79 505 loudest partial;
-#X text 332 508 quietest partial;
-#X text 36 4 You can ask for sinusoidal peaks in decreasing order of
-amplitude or arranged into maximally continuous tracks for resynthesis.
-(Or you can ask for both.) If you ask for peaks \, out come lists of
-five numbers \, one for each sinusoid at each analysis period. The
-first is the index number of the sinusoid (so you can use "route" to
-claw them apart). The other four are as shown:;
-#X obj 204 611 osc~ 440;
-#X obj 204 635 *~;
-#X obj 205 689 unpack 0 0 0 0;
-#X floatatom 205 782 5 0 0 0 - - -;
-#X floatatom 245 760 5 0 0 0 - - -;
-#X floatatom 285 737 5 0 0 0 - - -;
-#X floatatom 326 713 5 0 0 0 - - -;
-#X obj 246 638 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X text 43 535 If you ask for "tracks" \, the output is four numbers:
-index \, frequency \, and amplitude as before \, and finally a flag
-which is one for a new track \, zero for a continuation \, minus one
-for an empty track.;
-#X obj 205 662 sigmund~ -npts 16384 -hop 8192 -npeak 1 tracks;
-#X connect 0 0 4 0;
-#X connect 1 0 0 0;
-#X connect 2 0 9 0;
-#X connect 3 0 1 0;
-#X connect 4 0 5 0;
-#X connect 4 9 11 0;
-#X connect 5 0 6 0;
-#X connect 5 1 7 0;
-#X connect 5 2 8 0;
-#X connect 5 3 10 0;
-#X connect 9 0 3 0;
-#X connect 11 0 12 0;
-#X connect 11 1 13 0;
-#X connect 11 2 14 0;
-#X connect 11 3 15 0;
-#X connect 23 0 24 0;
-#X connect 24 0 32 0;
-#X connect 25 0 26 0;
-#X connect 25 1 27 0;
-#X connect 25 2 28 0;
-#X connect 25 3 29 0;
-#X connect 30 0 24 1;
-#X connect 32 0 25 0;
-#X restore 330 508 pd sinusoid-tracking;
-#X text 52 165 tracks - output sinusoidal peaks organized into tracks
-;
-#X text 56 111 notes - output pitch at the beginning of notes;
-#X text 339 485 more details:;
-#X text 10 184 Parameters you may set (in creation arguments or messages):
-;
-#X text 60 207 npts - number of points in each analysis window (1024)
-;
-#X text 60 225 hop - number of points between each analysis (512);
-#X text 60 242 npeak - number of sinusoidal peaks (20);
-#X text 61 279 vibrato - depth of vibrato to expect in 1/2-tones (1)
-;
-#X text 60 298 stabletime - time (msec) to wait to report notes (50)
-;
-#X obj 39 535 sigmund~ -hop 4096 pitch env;
-#X text 62 316 minpower - minimum power (dB) to report a pitch (50)
-;
-#X text 62 335 growth - growth (dB) to report a new note (7);
-#X text 54 147 peaks - output all sinusoidal peaks in order of amplitude
-;
-#X text 11 356 The npts and hop parameters are in samples \, and are
-powers of two. The example below specifies a huge hop of 4096 (to slow
-the output down) and to output "pitch" and "env". (Those are the default
-outputs.);
-#X text 61 260 maxfreq - maximum sinusoid frequency in Hz. (1000000)
-;
-#X text 55 128 env - output amplitude continuously;
-#X text 380 596 updated for Pd v0.41;
-#X connect 2 0 24 0;
-#X connect 3 0 8 0;
-#X connect 4 0 7 0;
-#X connect 7 0 2 0;
-#X connect 8 0 4 0;
-#X connect 24 0 5 0;
-#X connect 24 1 6 0;
diff --git a/externals/extra/0.43.3/sigmund~/sigmund~.c b/externals/extra/0.43.3/sigmund~/sigmund~.c
deleted file mode 100644
index 5d1d72f6..00000000
--- a/externals/extra/0.43.3/sigmund~/sigmund~.c
+++ /dev/null
@@ -1,1655 +0,0 @@
-/* Copyright (c) 2005 Miller Puckette. BSD licensed. No warranties. */
-
-/*
- fix parameter settings
- not to report pitch if evidence too scanty?
- note-on detection triggered by falling envelope (a posteriori)
- reentrancy bug setting loud flag (other parameters too?)
- tweaked freqs still not stable enough
- implement block ("-b") mode
-*/
-
-#ifdef PD
-#include "m_pd.h"
-#endif
-#ifdef MSP
-#include "ext.h"
-#include "z_dsp.h"
-#include "ext_support.h"
-#include "ext_proto.h"
-#include "ext_obex.h"
-typedef double t_floatarg;
-#define t_resizebytes(a, b, c) t_resizebytes((char *)(a), (b), (c))
-#endif
-
-/* From here to the next "#ifdef PD" or "#ifdef Max" should be extractable
-and usable in other contexts. The one external requirement is a real
-single-precision FFT, invoked as in the Mayer one: */
-
-#ifdef _MSC_VER /* this is only needed with Microsoft's compiler */
-__declspec(dllimport) extern
-#endif
-void mayer_realfft(int npoints, t_sample *buf);
-
-/* this routine is passed a buffer of npoints values, and returns the
-N/2+1 real parts of the DFT (frequency zero through Nyquist), followed
-by the N/2-1 imaginary points, in order of decreasing frequency. Pd 0.41,
-for example, defines this in the file d_fft_mayer.c or d_fft_fftsg.c. */
-
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef _WIN32
-#include <malloc.h>
-#elif ! defined(_MSC_VER)
-#include <alloca.h>
-#endif
-#include <stdlib.h>
-#ifdef _MSC_VER
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-typedef struct peak
-{
- t_float p_freq;
- t_float p_amp;
- t_float p_ampreal;
- t_float p_ampimag;
- t_float p_pit;
- t_float p_db;
- t_float p_salience;
- t_float p_tmp;
-} t_peak;
-
-/********************** service routines **************************/
-
-/* these three are dapted from elsewhere in Pd but included here for
-cmolpeteness */
-static int sigmund_ilog2(int n)
-{
- int ret = -1;
- while (n)
- {
- n >>= 1;
- ret++;
- }
- return (ret);
-}
-
-static t_float sigmund_ftom(t_float f)
-{
- return (f > 0 ? 17.3123405046 * log(.12231220585 * f) : -1500);
-}
-
-#define LOGTEN 2.302585092994
-static t_float sigmund_powtodb(t_float f)
-{
- if (f <= 0) return (0);
- else
- {
- t_float val = 100 + 10./LOGTEN * log(f);
- return (val < 0 ? 0 : val);
- }
-}
-
-/* parameters for von Hann window (change these to get Hamming if desired) */
-#define W_ALPHA 0.5
-#define W_BETA 0.5
-#define NEGBINS 4 /* number of bins of negative frequency we'll need */
-
-#define PI 3.141592653589793
-#define LOG2 0.693147180559945
-#define LOG10 2.302585092994046
-
-static t_float sinx(t_float theta, t_float sintheta)
-{
- if (theta > -0.003 && theta < 0.003)
- return (1);
- else return (sintheta/theta);
-}
-
-static t_float window_hann_mag(t_float pidetune, t_float sinpidetune)
-{
- return (W_ALPHA * sinx(pidetune, sinpidetune)
- - 0.5 * W_BETA *
- (sinx(pidetune+PI, sinpidetune) + sinx(pidetune-PI, sinpidetune)));
-}
-
-static t_float window_mag(t_float pidetune, t_float cospidetune)
-{
- return (sinx(pidetune + (PI/2), cospidetune)
- + sinx(pidetune - (PI/2), -cospidetune));
-}
-
-/*********** Routines to analyze a window into sinusoidal peaks *************/
-
-static int sigmund_cmp_freq(const void *p1, const void *p2)
-{
- if ((*(t_peak **)p1)->p_freq > (*(t_peak **)p2)->p_freq)
- return (1);
- else if ((*(t_peak **)p1)->p_freq < (*(t_peak **)p2)->p_freq)
- return (-1);
- else return (0);
-}
-
-static void sigmund_tweak(int npts, t_float *ftreal, t_float *ftimag,
- int npeak, t_peak *peaks, t_float fperbin, int loud)
-{
- t_peak **peakptrs = (t_peak **)alloca(sizeof (*peakptrs) * (npeak+1));
- t_peak negpeak;
- int peaki, j, k;
- t_float ampreal[3], ampimag[3];
- t_float binperf = 1./fperbin;
- t_float phaseperbin = (npts-0.5)/npts, oneovern = 1./npts;
- if (npeak < 1)
- return;
- for (peaki = 0; peaki < npeak; peaki++)
- peakptrs[peaki+1] = &peaks[peaki];
- qsort(peakptrs+1, npeak, sizeof (*peakptrs), sigmund_cmp_freq);
- peakptrs[0] = &negpeak;
- negpeak.p_ampreal = peakptrs[1]->p_ampreal;
- negpeak.p_ampimag = -peakptrs[1]->p_ampimag;
- negpeak.p_freq = -peakptrs[1]->p_freq;
- for (peaki = 1; peaki <= npeak; peaki++)
- {
- int cbin = peakptrs[peaki]->p_freq*binperf + 0.5;
- int nsub = (peaki == npeak ? 1:2);
- t_float windreal, windimag, windpower, detune, pidetune, sinpidetune,
- cospidetune, ampcorrect, ampout, ampoutreal, ampoutimag, freqout;
- /* post("3 nsub %d amp %f freq %f", nsub,
- peakptrs[peaki]->p_amp, peakptrs[peaki]->p_freq); */
- if (cbin < 0 || cbin > 2*npts - 3)
- continue;
- for (j = 0; j < 3; j++)
- ampreal[j] = ftreal[cbin+2*j-2], ampimag[j] = ftimag[cbin+2*j-2];
- /* post("a %f %f", ampreal[1], ampimag[1]); */
- for (j = 0; j < nsub; j++)
- {
- t_peak *neighbor = peakptrs[(peaki-1) + 2*j];
- t_float neighborreal = npts * neighbor->p_ampreal;
- t_float neighborimag = npts * neighbor->p_ampimag;
- for (k = 0; k < 3; k++)
- {
- t_float freqdiff = (0.5*PI) * ((cbin + 2*k-2)
- -binperf * neighbor->p_freq);
- t_float sx = sinx(freqdiff, sin(freqdiff));
- t_float phasere = cos(freqdiff * phaseperbin);
- t_float phaseim = sin(freqdiff * phaseperbin);
- ampreal[k] -=
- sx * (phasere * neighborreal - phaseim * neighborimag);
- ampimag[k] -=
- sx * (phaseim * neighborreal + phasere * neighborimag);
- }
- /* post("b %f %f", ampreal[1], ampimag[1]); */
- }
-
- windreal = W_ALPHA * ampreal[1] -
- (0.5 * W_BETA) * (ampreal[0] + ampreal[2]);
- windimag = W_ALPHA * ampimag[1] -
- (0.5 * W_BETA) * (ampimag[0] + ampimag[2]);
- windpower = windreal * windreal + windimag * windimag;
- detune = (
- W_BETA*(ampreal[0] - ampreal[2]) *
- (2.0*W_ALPHA * ampreal[1] - W_BETA * (ampreal[0] + ampreal[2]))
- +
- W_BETA*(ampimag[0] - ampimag[2]) *
- (2.0*W_ALPHA * ampimag[1] - W_BETA * (ampimag[0] + ampimag[2]))
- ) / (4.0 * windpower);
- if (detune > 0.5)
- detune = 0.5;
- else if (detune < -0.5)
- detune = -0.5;
- /* if (loud > 0)
- post("tweak: windpower %f, bin %d, detune %f",
- windpower, cbin, detune); */
- pidetune = PI * detune;
- sinpidetune = sin(pidetune);
- cospidetune = cos(pidetune);
-
- ampcorrect = 1.0 / window_hann_mag(pidetune, sinpidetune);
-
- ampout = oneovern * ampcorrect *sqrt(windpower);
- ampoutreal = oneovern * ampcorrect *
- (windreal * cospidetune - windimag * sinpidetune);
- ampoutimag = oneovern * ampcorrect *
- (windreal * sinpidetune + windimag * cospidetune);
- freqout = (cbin + 2*detune) * fperbin;
- /* if (loud > 1)
- post("amp %f, freq %f", ampout, freqout); */
-
- peakptrs[peaki]->p_freq = freqout;
- peakptrs[peaki]->p_amp = ampout;
- peakptrs[peaki]->p_ampreal = ampoutreal;
- peakptrs[peaki]->p_ampimag = ampoutimag;
- }
-}
-
-static void sigmund_remask(int maxbin, int bestindex, t_float powmask,
- t_float maxpower, t_float *maskbuf)
-{
- int bin;
- int bin1 = (bestindex > 52 ? bestindex-50:2);
- int bin2 = (maxbin < bestindex + 50 ? bestindex + 50 : maxbin);
- for (bin = bin1; bin < bin2; bin++)
- {
- t_float bindiff = bin - bestindex;
- t_float mymask;
- mymask = powmask/ (1. + bindiff * bindiff * bindiff * bindiff);
- if (bindiff < 2 && bindiff > -2)
- mymask = 2*maxpower;
- if (mymask > maskbuf[bin])
- maskbuf[bin] = mymask;
- }
-}
-
-#define PEAKMASKFACTOR 1.
-#define PEAKTHRESHFACTOR 0.6
-
-static void sigmund_getrawpeaks(int npts, t_float *insamps,
- int npeak, t_peak *peakv, int *nfound, t_float *power, t_float srate, int loud,
- t_float hifreq)
-{
- t_float oneovern = 1.0/ (t_float)npts;
- t_float fperbin = 0.5 * srate * oneovern, totalpower = 0;
- int npts2 = 2*npts, i, bin;
- int peakcount = 0;
- t_float *fp1, *fp2;
- t_float *rawreal, *rawimag, *maskbuf, *powbuf;
- t_float *bigbuf = alloca(sizeof (t_float ) * (2*NEGBINS + 6*npts));
- int maxbin = hifreq/fperbin;
- if (maxbin > npts - NEGBINS)
- maxbin = npts - NEGBINS;
- /* if (loud) post("tweak %d", tweak); */
- maskbuf = bigbuf + npts2;
- powbuf = maskbuf + npts;
- rawreal = powbuf + npts+NEGBINS;
- rawimag = rawreal+npts+NEGBINS;
- for (i = 0; i < npts; i++)
- maskbuf[i] = 0;
-
- for (i = 0; i < npts; i++)
- bigbuf[i] = insamps[i];
- for (i = npts; i < 2*npts; i++)
- bigbuf[i] = 0;
- mayer_realfft(npts2, bigbuf);
- for (i = 0; i < npts; i++)
- rawreal[i] = bigbuf[i];
- for (i = 1; i < npts-1; i++)
- rawimag[i] = bigbuf[npts2-i];
- rawreal[-1] = rawreal[1];
- rawreal[-2] = rawreal[2];
- rawreal[-3] = rawreal[3];
- rawreal[-4] = rawreal[4];
- rawimag[0] = rawimag[npts-1] = 0;
- rawimag[-1] = -rawimag[1];
- rawimag[-2] = -rawimag[2];
- rawimag[-3] = -rawimag[3];
- rawimag[-4] = -rawimag[4];
-#if 1
- for (i = 0, fp1 = rawreal, fp2 = rawimag; i < maxbin; i++, fp1++, fp2++)
- {
- t_float x1 = fp1[1] - fp1[-1], x2 = fp2[1] - fp2[-1], p = powbuf[i] = x1*x1+x2*x2;
- if (i >= 2)
- totalpower += p;
- }
- powbuf[maxbin] = powbuf[maxbin+1] = 0;
- *power = 0.5 * totalpower *oneovern * oneovern;
-#endif
- for (peakcount = 0; peakcount < npeak; peakcount++)
- {
- t_float pow1, maxpower = 0, windreal, windimag, windpower,
- detune, pidetune, sinpidetune, cospidetune, ampcorrect, ampout,
- ampoutreal, ampoutimag, freqout, powmask;
- int bestindex = -1;
-
- for (bin = 2, fp1 = rawreal+2, fp2 = rawimag+2;
- bin < maxbin; bin++, fp1++, fp2++)
- {
- pow1 = powbuf[bin];
- if (pow1 > maxpower && pow1 > maskbuf[bin])
- {
- t_float thresh = PEAKTHRESHFACTOR * (powbuf[bin-2]+powbuf[bin+2]);
- if (pow1 > thresh)
- maxpower = pow1, bestindex = bin;
- }
- }
-
- if (totalpower <= 0 || maxpower < 1e-10*totalpower || bestindex < 0)
- break;
- fp1 = rawreal+bestindex;
- fp2 = rawimag+bestindex;
- powmask = maxpower * PEAKMASKFACTOR;
- /* if (loud > 2)
- post("maxpower %f, powmask %f, param1 %f",
- maxpower, powmask, param1); */
- sigmund_remask(maxbin, bestindex, powmask, maxpower, maskbuf);
-
- /* if (loud > 1)
- post("best index %d, total power %f", bestindex, totalpower); */
-
- windreal = fp1[1] - fp1[-1];
- windimag = fp2[1] - fp2[-1];
- windpower = windreal * windreal + windimag * windimag;
- detune = ((fp1[1] * fp1[1] - fp1[-1]*fp1[-1])
- + (fp2[1] * fp2[1] - fp2[-1]*fp2[-1])) / (2 * windpower);
-
- if (detune > 0.5)
- detune = 0.5;
- else if (detune < -0.5)
- detune = -0.5;
- /* if (loud > 1)
- post("windpower %f, index %d, detune %f",
- windpower, bestindex, detune); */
- pidetune = PI * detune;
- sinpidetune = sin(pidetune);
- cospidetune = cos(pidetune);
- ampcorrect = 1.0 / window_mag(pidetune, cospidetune);
-
- ampout = ampcorrect *sqrt(windpower);
- ampoutreal = ampcorrect *
- (windreal * cospidetune - windimag * sinpidetune);
- ampoutimag = ampcorrect *
- (windreal * sinpidetune + windimag * cospidetune);
-
- /* the frequency is the sum of the bin frequency and detuning */
-
- peakv[peakcount].p_freq = (freqout = (bestindex + 2*detune)) * fperbin;
- peakv[peakcount].p_amp = oneovern * ampout;
- peakv[peakcount].p_ampreal = oneovern * ampoutreal;
- peakv[peakcount].p_ampimag = oneovern * ampoutimag;
- }
- sigmund_tweak(npts, rawreal, rawimag, peakcount, peakv, fperbin, loud);
- sigmund_tweak(npts, rawreal, rawimag, peakcount, peakv, fperbin, loud);
- for (i = 0; i < peakcount; i++)
- {
- peakv[i].p_pit = sigmund_ftom(peakv[i].p_freq);
- peakv[i].p_db = sigmund_powtodb(peakv[i].p_amp);
- }
- *nfound = peakcount;
-}
-
-/*************** Routines for finding fundamental pitch *************/
-
-#define PITCHNPEAK 12
-#define HALFTONEINC 0.059
-#define SUBHARMONICS 16
-#define DBPERHALFTONE 0.0
-
-static void sigmund_getpitch(int npeak, t_peak *peakv, t_float *freqp,
- t_float npts, t_float srate, t_float nharmonics, t_float amppower, int loud)
-{
- t_float fperbin = 0.5 * srate / npts;
- int npit = 48 * sigmund_ilog2(npts), i, j, k, nsalient;
- t_float bestbin, bestweight, sumamp, sumweight, sumfreq, freq;
- t_float *weights = (t_float *)alloca(sizeof(t_float) * npit);
- t_peak *bigpeaks[PITCHNPEAK];
- if (npeak < 1)
- {
- freq = 0;
- goto done;
- }
- for (i = 0; i < npit; i++)
- weights[i] = 0;
- for (i = 0; i < npeak; i++)
- {
- peakv[i].p_tmp = 0;
- peakv[i].p_salience = peakv[i].p_db - DBPERHALFTONE * peakv[i].p_pit;
- }
- for (nsalient = 0; nsalient < PITCHNPEAK; nsalient++)
- {
- t_peak *bestpeak = 0;
- t_float bestsalience = -1e20;
- for (j = 0; j < npeak; j++)
- if (peakv[j].p_tmp == 0 && peakv[j].p_salience > bestsalience)
- {
- bestsalience = peakv[j].p_salience;
- bestpeak = &peakv[j];
- }
- if (!bestpeak)
- break;
- bigpeaks[nsalient] = bestpeak;
- bestpeak->p_tmp = 1;
- /* post("peak f=%f a=%f", bestpeak->p_freq, bestpeak->p_amp); */
- }
- sumweight = 0;
- for (i = 0; i < nsalient; i++)
- {
- t_peak *thispeak = bigpeaks[i];
- t_float weightindex = (48./LOG2) *
- log(thispeak->p_freq/(2.*fperbin));
- t_float loudness = pow(thispeak->p_amp, amppower);
- /* post("index %f, uncertainty %f", weightindex, pitchuncertainty); */
- for (j = 0; j < SUBHARMONICS; j++)
- {
- t_float subindex = weightindex -
- (48./LOG2) * log(j + 1.);
- int loindex = subindex - 0.5;
- int hiindex = loindex+2;
- if (hiindex < 0)
- break;
- if (hiindex >= npit)
- continue;
- if (loindex < 0)
- loindex = 0;
- for (k = loindex; k <= hiindex; k++)
- weights[k] += loudness * nharmonics / (nharmonics + j);
- }
- sumweight += loudness;
- }
- bestbin = -1;
- bestweight = -1e20;
- for (i = 0; i < npit; i++)
- if (weights[i] > bestweight)
- bestweight = weights[i], bestbin = i;
- if (bestweight < sumweight * 0.4)
- bestbin = -1;
-
- if (bestbin < 0)
- {
- freq = 0;
- goto done;
- }
- if (bestbin > 0 && bestbin < npit-1)
- {
- int ibest = bestbin;
- bestbin += (weights[ibest+1] - weights[ibest-1]) /
- (weights[ibest+1] + weights[ibest] + weights[ibest-1]);
- }
- freq = 2*fperbin * exp((LOG2/48.)*bestbin);
- for (sumamp = sumweight = sumfreq = 0, i = 0; i < nsalient; i++)
- {
- t_peak *thispeak = bigpeaks[i];
- t_float thisloudness = thispeak->p_amp;
- t_float thisfreq = thispeak->p_freq;
- t_float harmonic = thisfreq/freq;
- t_float intpart = (int)(0.5 + harmonic);
- t_float inharm = harmonic - intpart;
-#if 0
- if (loud)
- post("freq %f intpart %f inharm %f", freq, intpart, inharm);
-#endif
- if (intpart >= 1 && intpart <= 16 &&
- inharm < 0.015 * intpart && inharm > - (0.015 * intpart))
- {
- t_float weight = thisloudness * intpart;
- sumweight += weight;
- sumfreq += weight*thisfreq/intpart;
-#if 0
- if (loud)
- post("weight %f freq %f", weight, thisfreq);
-#endif
- }
- }
- if (sumweight > 0)
- freq = sumfreq / sumweight;
-done:
- if (!(freq >= 0 || freq <= 0))
- {
- /* post("freq nan cancelled"); */
- freq = 0;
- }
- *freqp = freq;
-}
-
-/*************** gather peak lists into sinusoidal tracks *************/
-
-static void sigmund_peaktrack(int ninpeak, t_peak *inpeakv,
- int noutpeak, t_peak *outpeakv, int loud)
-{
- int incnt, outcnt;
- for (outcnt = 0; outcnt < noutpeak; outcnt++)
- outpeakv[outcnt].p_tmp = -1;
-
- /* first pass. Match each "in" peak with the closest previous
- "out" peak, but no two to the same one. */
- for (incnt = 0; incnt < ninpeak; incnt++)
- {
- t_float besterror = 1e20;
- int bestcnt = -1;
- inpeakv[incnt].p_tmp = -1;
- for (outcnt = 0; outcnt < noutpeak; outcnt++)
- {
- t_float thiserror =
- inpeakv[incnt].p_freq - outpeakv[outcnt].p_freq;
- if (thiserror < 0)
- thiserror = -thiserror;
- if (thiserror < besterror)
- {
- besterror = thiserror;
- bestcnt = outcnt;
- }
- }
- if (outpeakv[bestcnt].p_tmp < 0)
- {
- outpeakv[bestcnt] = inpeakv[incnt];
- inpeakv[incnt].p_tmp = 0;
- outpeakv[bestcnt].p_tmp = 0;
- }
- }
- /* second pass. Unmatched "in" peaks assigned to free "out"
- peaks */
- for (incnt = 0; incnt < ninpeak; incnt++)
- if (inpeakv[incnt].p_tmp < 0)
- {
- for (outcnt = 0; outcnt < noutpeak; outcnt++)
- if (outpeakv[outcnt].p_tmp < 0)
- {
- outpeakv[outcnt] = inpeakv[incnt];
- inpeakv[incnt].p_tmp = 0;
- outpeakv[outcnt].p_tmp = 1;
- break;
- }
- }
- for (outcnt = 0; outcnt < noutpeak; outcnt++)
- if (outpeakv[outcnt].p_tmp == -1)
- outpeakv[outcnt].p_amp = 0;
-}
-
-/**************** parse continuous pitch into note starts ***************/
-
-#define NHISTPOINT 100
-
-typedef struct _histpoint
-{
- t_float h_freq;
- t_float h_power;
-} t_histpoint;
-
-typedef struct _notefinder
-{
- t_float n_age;
- t_float n_hifreq;
- t_float n_lofreq;
- int n_peaked;
- t_histpoint n_hist[NHISTPOINT];
- int n_histphase;
-} t_notefinder;
-
-
-static void notefinder_init(t_notefinder *x)
-{
- int i;
- x->n_peaked = x->n_age = 0;
- x->n_hifreq = x->n_lofreq = 0;
- x->n_histphase = 0;
- for (i = 0; i < NHISTPOINT; i++)
- x->n_hist[i].h_freq =x->n_hist[i].h_power = 0;
-}
-
-static void notefinder_doit(t_notefinder *x, t_float freq, t_float power,
- t_float *note, t_float vibrato, int stableperiod, t_float powerthresh,
- t_float growththresh, int loud)
-{
- /* calculate frequency ratio between allowable vibrato extremes
- (equal to twice the vibrato deviation from center) */
- t_float vibmultiple = exp((2*LOG2/12) * vibrato);
- int oldhistphase, i, k;
- if (stableperiod > NHISTPOINT - 1)
- stableperiod = NHISTPOINT - 1;
- else if (stableperiod < 1)
- stableperiod = 1;
- if (++x->n_histphase == NHISTPOINT)
- x->n_histphase = 0;
- x->n_hist[x->n_histphase].h_freq = freq;
- x->n_hist[x->n_histphase].h_power = power;
- x->n_age++;
- *note = 0;
-#if 0
- if (loud)
- {
- post("stable %d, age %d, vibmultiple %f, powerthresh %f, hifreq %f",
- stableperiod, (int)x->n_age ,vibmultiple, powerthresh, x->n_hifreq);
- post("histfreq %f %f %f %f",
- x->n_hist[x->n_histphase].h_freq,
- x->n_hist[(x->n_histphase+NHISTPOINT-1)%NHISTPOINT].h_freq,
- x->n_hist[(x->n_histphase+NHISTPOINT-2)%NHISTPOINT].h_freq,
- x->n_hist[(x->n_histphase+NHISTPOINT-3)%NHISTPOINT].h_freq);
- post("power %f %f %f %f",
- x->n_hist[x->n_histphase].h_power,
- x->n_hist[(x->n_histphase+NHISTPOINT-1)%NHISTPOINT].h_power,
- x->n_hist[(x->n_histphase+NHISTPOINT-2)%NHISTPOINT].h_power,
- x->n_hist[(x->n_histphase+NHISTPOINT-3)%NHISTPOINT].h_power);
- for (i = 0, k = x->n_histphase; i < stableperiod; i++)
- {
- post("pit %5.1f pow %f", sigmund_ftom(x->n_hist[k].h_freq),
- x->n_hist[k].h_power);
- if (--k < 0)
- k = NHISTPOINT - 1;
- }
- }
-#endif
- /* look for shorter notes than "stableperiod" in length.
- The amplitude must rise and then fall while the pitch holds
- steady. */
- if (x->n_hifreq <= 0 && x->n_age > stableperiod)
- {
- t_float maxpow = 0, freqatmaxpow = 0,
- localhifreq = -1e20, locallofreq = 1e20;
- int startphase = x->n_histphase - stableperiod + 1;
- if (startphase < 0)
- startphase += NHISTPOINT;
- for (i = 0, k = startphase; i < stableperiod; i++)
- {
- if (x->n_hist[k].h_freq <= 0)
- break;
- if (x->n_hist[k].h_power > maxpow)
- maxpow = x->n_hist[k].h_power,
- freqatmaxpow = x->n_hist[k].h_freq;
- if (x->n_hist[k].h_freq > localhifreq)
- localhifreq = x->n_hist[k].h_freq;
- if (x->n_hist[k].h_freq < locallofreq)
- locallofreq = x->n_hist[k].h_freq;
- if (localhifreq > locallofreq * vibmultiple)
- break;
- if (maxpow > power * growththresh &&
- maxpow > x->n_hist[startphase].h_power * growththresh &&
- localhifreq < vibmultiple * locallofreq
- && freqatmaxpow > 0 && maxpow > powerthresh)
- {
- x->n_hifreq = x->n_lofreq = *note = freqatmaxpow;
- x->n_age = 0;
- x->n_peaked = 0;
- /* post("got short note"); */
- return;
- }
- if (++k >= NHISTPOINT)
- k = 0;
- }
-
- }
- if (x->n_hifreq > 0)
- {
- /* test if we're within "vibrato" range, and if so update range */
- if (freq * vibmultiple >= x->n_hifreq &&
- x->n_lofreq * vibmultiple >= freq)
- {
- if (freq > x->n_hifreq)
- x->n_hifreq = freq;
- if (freq < x->n_lofreq)
- x->n_lofreq = freq;
- }
- else if (x->n_hifreq > 0 && x->n_age > stableperiod)
- {
- /* if we've been out of range at least 1/2 the
- last "stableperiod+1" analyses, clear the note */
- int nbad = 0;
- for (i = 0, k = x->n_histphase; i < stableperiod + 1; i++)
- {
- if (--k < 0)
- k = NHISTPOINT - 1;
- if (x->n_hist[k].h_freq * vibmultiple <= x->n_hifreq ||
- x->n_lofreq * vibmultiple <= x->n_hist[k].h_freq)
- nbad++;
- }
- if (2 * nbad >= stableperiod + 1)
- {
- x->n_hifreq = x->n_lofreq = 0;
- x->n_age = 0;
- }
- }
- }
-
- oldhistphase = x->n_histphase - stableperiod;
- if (oldhistphase < 0)
- oldhistphase += NHISTPOINT;
-
- /* look for envelope attacks */
-
- if (x->n_hifreq > 0 && x->n_peaked)
- {
- if (freq > 0 && power > powerthresh &&
- power > x->n_hist[oldhistphase].h_power *
- exp((LOG10*0.1)*growththresh))
- {
- /* clear it and fall through for new stable-note test */
- x->n_peaked = 0;
- x->n_hifreq = x->n_lofreq = 0;
- x->n_age = 0;
- }
- }
- else if (!x->n_peaked)
- {
- if (x->n_hist[oldhistphase].h_power > powerthresh &&
- x->n_hist[oldhistphase].h_power > power)
- x->n_peaked = 1;
- }
-
- /* test for a new note using a stability criterion. */
-
- if (freq >= 0 &&
- (x->n_hifreq <= 0 || freq > x->n_hifreq || freq < x->n_lofreq))
- {
- t_float testfhi = freq, testflo = freq,
- maxpow = x->n_hist[x->n_histphase].h_freq;
- for (i = 0, k = x->n_histphase; i < stableperiod-1; i++)
- {
- if (--k < 0)
- k = NHISTPOINT - 1;
- if (x->n_hist[k].h_freq > testfhi)
- testfhi = x->n_hist[k].h_freq;
- if (x->n_hist[k].h_freq < testflo)
- testflo = x->n_hist[k].h_freq;
- if (x->n_hist[k].h_power > maxpow)
- maxpow = x->n_hist[k].h_power;
- }
-#if 0
- if (loud)
- post("freq %.2g testfhi %.2g testflo %.2g maxpow %.2g",
- freq, testfhi, testflo, maxpow);
-#endif
- if (testflo > 0 && testfhi <= vibmultiple * testflo
- && maxpow > powerthresh)
- {
- /* report new note */
- t_float sumf = 0, sumw = 0, thisw;
- for (i = 0, k = x->n_histphase; i < stableperiod; i++)
- {
- thisw = x->n_hist[k].h_power;
- sumw += thisw;
- sumf += thisw*x->n_hist[k].h_freq;
- if (--k < 0)
- k = NHISTPOINT - 1;
- }
- x->n_hifreq = x->n_lofreq = *note = (sumw > 0 ? sumf/sumw : 0);
-#if 0
- /* debugging printout */
- for (i = 0; i < stableperiod; i++)
- {
- int k3 = x->n_histphase - i;
- if (k3 < 0)
- k3 += NHISTPOINT;
- startpost("%5.1f ", sigmund_ftom(x->n_hist[k3].h_freq));
- }
- post("");
-#endif
- x->n_age = 0;
- x->n_peaked = 0;
- return;
- }
- }
- *note = 0;
- return;
-}
-
-/**************** object structure for Pd and Max. *********************/
-
-/* From here onward, the code is specific to eithr Pd, Max, or both. If
-neither "PD 'nor "MSP" is defined, none of this is compiled, so that the
-whole file can be included in other, non-PD and non-Max projects. */
-
-#if (defined(PD) || defined (MSP))
-
-#define NHIST 100
-
-#define MODE_STREAM 1
-#define MODE_BLOCK 2 /* unimplemented */
-#define MODE_TABLE 3
-
-#define NPOINTS_DEF 1024
-#define NPOINTS_MIN 128
-
-#define HOP_DEF 512
-#define NPEAK_DEF 20
-
-#define VIBRATO_DEF 1
-#define STABLETIME_DEF 50
-#define MINPOWER_DEF 50
-#define GROWTH_DEF 7
-
-#define OUT_PITCH 0
-#define OUT_ENV 1
-#define OUT_NOTE 2
-#define OUT_PEAKS 3
-#define OUT_TRACKS 4
-#define OUT_SMSPITCH 5
-#define OUT_SMSNONPITCH 6
-
-typedef struct _varout
-{
-#ifdef PD
- t_outlet *v_outlet;
-#endif /* PD */
-#ifdef MSP
- void *v_outlet;
-#endif /* MSP */
- int v_what;
-} t_varout;
-
-typedef struct _sigmund
-{
-#ifdef PD
- t_object x_obj;
- t_clock *x_clock;
- t_float x_f; /* for main signal inlet */
-#endif /* PD */
-#ifdef MSP
- t_pxobject x_obj;
- void *obex;
- void *x_clock;
- t_sample *x_inbuf2; /* extra input buffer to eat clock/DSP jitter */
-#endif /* MSP */
- t_varout *x_varoutv;
- int x_nvarout;
- t_float x_sr; /* sample rate */
- int x_mode; /* MODE_STREAM, etc. */
- int x_npts; /* number of points in analysis window */
- int x_npeak; /* number of peaks to find */
- int x_loud; /* debug level */
- t_sample *x_inbuf; /* input buffer */
- int x_infill; /* number of points filled */
- int x_countdown; /* countdown to start filling buffer */
- int x_hop; /* samples between analyses */
- t_float x_maxfreq; /* highest-frequency peak to report */
- t_float x_vibrato; /* vibrato depth in half tones */
- t_float x_stabletime; /* period of stability needed for note */
- t_float x_growth; /* growth to set off a new note */
- t_float x_minpower; /* minimum power, in DB, for a note */
- t_float x_param1; /* three parameters for temporary use */
- t_float x_param2;
- t_float x_param3;
- t_notefinder x_notefinder; /* note parsing state */
- t_peak *x_trackv; /* peak tracking state */
- int x_ntrack; /* number of peaks tracked */
- unsigned int x_dopitch:1; /* which things to calculate */
- unsigned int x_donote:1;
- unsigned int x_dotracks:1;
-} t_sigmund;
-
-static void sigmund_preinit(t_sigmund *x)
-{
- x->x_npts = NPOINTS_DEF;
- x->x_param1 = 6;
- x->x_param2 = 0.5;
- x->x_param3 = 0;
- x->x_hop = HOP_DEF;
- x->x_mode = MODE_STREAM;
- x->x_npeak = NPEAK_DEF;
- x->x_vibrato = VIBRATO_DEF;
- x->x_stabletime = STABLETIME_DEF;
- x->x_growth = GROWTH_DEF;
- x->x_minpower = MINPOWER_DEF;
- x->x_maxfreq = 1000000;
- x->x_loud = 0;
- x->x_sr = 1;
- x->x_nvarout = 0;
- x->x_varoutv = (t_varout *)getbytes(0);
- x->x_trackv = 0;
- x->x_ntrack = 0;
- x->x_dopitch = x->x_donote = x->x_dotracks = 0;
- x->x_inbuf = 0;
-#ifdef MSP
- x->x_inbuf2 = 0;
-#endif
-}
-
-static void sigmund_npts(t_sigmund *x, t_floatarg f)
-{
- int nwas = x->x_npts, npts = f;
- /* check parameter ranges */
- if (npts < NPOINTS_MIN)
- post("sigmund~: minimum points %d", NPOINTS_MIN),
- npts = NPOINTS_MIN;
- if (npts != (1 << sigmund_ilog2(npts)))
- post("sigmund~: adjusting analysis size to %d points",
- (npts = (1 << sigmund_ilog2(npts))));
- if (npts != nwas)
- x->x_countdown = x->x_infill = 0;
- if (x->x_mode == MODE_STREAM)
- {
- if (x->x_inbuf)
- {
- x->x_inbuf = (t_sample *)t_resizebytes(x->x_inbuf,
- sizeof(*x->x_inbuf) * nwas, sizeof(*x->x_inbuf) * npts);
-#ifdef MSP
- x->x_inbuf2 = (t_sample *)t_resizebytes(x->x_inbuf2,
- sizeof(*x->x_inbuf2) * nwas, sizeof(*x->x_inbuf2) * npts);
-#endif
- }
- else
- {
- x->x_inbuf = (t_sample *)getbytes(sizeof(*x->x_inbuf) * npts);
- memset((char *)(x->x_inbuf), 0, sizeof(*x->x_inbuf) * npts);
-#ifdef MSP
- x->x_inbuf2 = (t_sample *)getbytes(sizeof(*x->x_inbuf2) * npts);
- memset((char *)(x->x_inbuf2), 0, sizeof(*x->x_inbuf2) * npts);
-#endif
- }
- }
- else x->x_inbuf = 0;
- x->x_npts = npts;
-}
-
-static void sigmund_hop(t_sigmund *x, t_floatarg f)
-{
- x->x_hop = f;
- /* check parameter ranges */
- if (x->x_hop != (1 << sigmund_ilog2(x->x_hop)))
- post("sigmund~: adjusting analysis size to %d points",
- (x->x_hop = (1 << sigmund_ilog2(x->x_hop))));
-}
-
-static void sigmund_npeak(t_sigmund *x, t_floatarg f)
-{
- if (f < 1)
- f = 1;
- x->x_npeak = f;
-}
-
-static void sigmund_maxfreq(t_sigmund *x, t_floatarg f)
-{
- x->x_maxfreq = f;
-}
-
-static void sigmund_vibrato(t_sigmund *x, t_floatarg f)
-{
- if (f < 0)
- f = 0;
- x->x_vibrato = f;
-}
-
-static void sigmund_stabletime(t_sigmund *x, t_floatarg f)
-{
- if (f < 0)
- f = 0;
- x->x_stabletime = f;
-}
-
-static void sigmund_growth(t_sigmund *x, t_floatarg f)
-{
- if (f < 0)
- f = 0;
- x->x_growth = f;
-}
-
-static void sigmund_minpower(t_sigmund *x, t_floatarg f)
-{
- if (f < 0)
- f = 0;
- x->x_minpower = f;
-}
-
-static void sigmund_doit(t_sigmund *x, int npts, t_float *arraypoints,
- int loud, t_float srate)
-{
- t_peak *peakv = (t_peak *)alloca(sizeof(t_peak) * x->x_npeak);
- int nfound, i, cnt;
- t_float freq = 0, power, note = 0;
- sigmund_getrawpeaks(npts, arraypoints, x->x_npeak, peakv,
- &nfound, &power, srate, loud, x->x_maxfreq);
- if (x->x_dopitch)
- sigmund_getpitch(nfound, peakv, &freq, npts, srate,
- x->x_param1, x->x_param2, loud);
- if (x->x_donote)
- notefinder_doit(&x->x_notefinder, freq, power, &note, x->x_vibrato,
- 1 + x->x_stabletime * 0.001 * x->x_sr / (t_float)x->x_hop,
- exp(LOG10*0.1*(x->x_minpower - 100)), x->x_growth, loud);
- if (x->x_dotracks)
- sigmund_peaktrack(nfound, peakv, x->x_ntrack, x->x_trackv, loud);
-
- for (cnt = x->x_nvarout; cnt--;)
- {
- t_varout *v = &x->x_varoutv[cnt];
- switch (v->v_what)
- {
- case OUT_PITCH:
- outlet_float(v->v_outlet, sigmund_ftom(freq));
- break;
- case OUT_ENV:
- outlet_float(v->v_outlet, sigmund_powtodb(power));
- break;
- case OUT_NOTE:
- if (note > 0)
- outlet_float(v->v_outlet, sigmund_ftom(note));
- break;
- case OUT_PEAKS:
- for (i = 0; i < nfound; i++)
- {
- t_atom at[5];
- SETFLOAT(at, (t_float)i);
- SETFLOAT(at+1, peakv[i].p_freq);
- SETFLOAT(at+2, 2*peakv[i].p_amp);
- SETFLOAT(at+3, 2*peakv[i].p_ampreal);
- SETFLOAT(at+4, 2*peakv[i].p_ampimag);
- outlet_list(v->v_outlet, 0, 5, at);
- }
- break;
- case OUT_TRACKS:
- for (i = 0; i < x->x_ntrack; i++)
- {
- t_atom at[4];
- SETFLOAT(at, (t_float)i);
- SETFLOAT(at+1, x->x_trackv[i].p_freq);
- SETFLOAT(at+2, 2*x->x_trackv[i].p_amp);
- SETFLOAT(at+3, x->x_trackv[i].p_tmp);
- outlet_list(v->v_outlet, 0, 4, at);
- }
- break;
- }
- }
-}
-
-static t_int *sigmund_perform(t_int *w);
-static void sigmund_dsp(t_sigmund *x, t_signal **sp)
-{
- if (x->x_mode == MODE_STREAM)
- {
- if (x->x_hop % sp[0]->s_n)
- post("sigmund: adjusting hop size to %d",
- (x->x_hop = sp[0]->s_n * (x->x_hop / sp[0]->s_n)));
- x->x_sr = sp[0]->s_sr;
- dsp_add(sigmund_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
- }
-}
-
-static void sigmund_print(t_sigmund *x)
-{
- post("sigmund~ settings:");
- post("npts %d", (int)x->x_npts);
- post("hop %d", (int)x->x_hop);
- post("npeak %d", (int)x->x_npeak);
- post("maxfreq %g", x->x_maxfreq);
- post("vibrato %g", x->x_vibrato);
- post("stabletime %g", x->x_stabletime);
- post("growth %g", x->x_growth);
- post("minpower %g", x->x_minpower);
- x->x_loud = 1;
-}
-
-static void sigmund_free(t_sigmund *x)
-{
- if (x->x_inbuf)
- {
- freebytes(x->x_inbuf, x->x_npts * sizeof(*x->x_inbuf));
-#ifdef MSP
- freebytes(x->x_inbuf2, x->x_npts * sizeof(*x->x_inbuf2));
-#endif
- }
- if (x->x_trackv)
- freebytes(x->x_trackv, x->x_ntrack * sizeof(*x->x_trackv));
- clock_free(x->x_clock);
-}
-
-#endif /* PD or MSP */
-/*************************** Glue for Pd ************************/
-#ifdef PD
-
-static t_class *sigmund_class;
-
-static void sigmund_tick(t_sigmund *x);
-static void sigmund_clear(t_sigmund *x);
-static void sigmund_npts(t_sigmund *x, t_floatarg f);
-static void sigmund_hop(t_sigmund *x, t_floatarg f);
-static void sigmund_npeak(t_sigmund *x, t_floatarg f);
-static void sigmund_maxfreq(t_sigmund *x, t_floatarg f);
-static void sigmund_vibrato(t_sigmund *x, t_floatarg f);
-static void sigmund_stabletime(t_sigmund *x, t_floatarg f);
-static void sigmund_growth(t_sigmund *x, t_floatarg f);
-static void sigmund_minpower(t_sigmund *x, t_floatarg f);
-
-static void sigmund_tick(t_sigmund *x)
-{
- if (x->x_infill == x->x_npts)
- {
- sigmund_doit(x, x->x_npts, x->x_inbuf, x->x_loud, x->x_sr);
- if (x->x_hop >= x->x_npts)
- {
- x->x_infill = 0;
- x->x_countdown = x->x_hop - x->x_npts;
- }
- else
- {
- memmove(x->x_inbuf, x->x_inbuf + x->x_hop,
- (x->x_infill = x->x_npts - x->x_hop) * sizeof(*x->x_inbuf));
- x->x_countdown = 0;
- }
- if (x->x_loud)
- x->x_loud--;
- }
-}
-
-static t_int *sigmund_perform(t_int *w)
-{
- t_sigmund *x = (t_sigmund *)(w[1]);
- t_sample *in = (t_sample *)(w[2]);
- int n = (int)(w[3]);
-
- if (x->x_hop % n)
- return (w+4);
- if (x->x_countdown > 0)
- x->x_countdown -= n;
- else if (x->x_infill != x->x_npts)
- {
- int j;
- t_float *fp = x->x_inbuf + x->x_infill;
- for (j = 0; j < n; j++)
- *fp++ = *in++;
- x->x_infill += n;
- if (x->x_infill == x->x_npts)
- clock_delay(x->x_clock, 0);
- }
- return (w+4);
-}
-
-static void *sigmund_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_sigmund *x = (t_sigmund *)pd_new(sigmund_class);
- sigmund_preinit(x);
-
- while (argc > 0)
- {
- t_symbol *firstarg = atom_getsymbolarg(0, argc, argv);
- if (!strcmp(firstarg->s_name, "-t"))
- {
- x->x_mode = MODE_TABLE;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "-s"))
- {
- x->x_mode = MODE_STREAM;
- argc--, argv++;
- }
-#if 0
- else if (!strcmp(firstarg->s_name, "-b"))
- {
- x->x_mode = MODE_BLOCK;
- argc--, argv++;
- }
-#endif
- else if (!strcmp(firstarg->s_name, "-npts") && argc > 1)
- {
- x->x_npts = atom_getfloatarg(1, argc, argv);
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-hop") && argc > 1)
- {
- sigmund_hop(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-npeak") && argc > 1)
- {
- sigmund_npeak(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-maxfreq") && argc > 1)
- {
- sigmund_maxfreq(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-vibrato") && argc > 1)
- {
- sigmund_vibrato(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-stabletime") && argc > 1)
- {
- sigmund_stabletime(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-growth") && argc > 1)
- {
- sigmund_growth(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "-minpower") && argc > 1)
- {
- sigmund_minpower(x, atom_getfloatarg(1, argc, argv));
- argc -= 2; argv += 2;
- }
- else if (!strcmp(firstarg->s_name, "pitch"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[x->x_nvarout].v_what = OUT_PITCH;
- x->x_nvarout = n2;
- x->x_dopitch = 1;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "env"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[x->x_nvarout].v_what = OUT_ENV;
- x->x_nvarout = n2;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "note")
- || !strcmp(firstarg->s_name, "notes"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[x->x_nvarout].v_what = OUT_NOTE;
- x->x_nvarout = n2;
- x->x_dopitch = x->x_donote = 1;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "peaks"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_list);
- x->x_varoutv[x->x_nvarout].v_what = OUT_PEAKS;
- x->x_nvarout = n2;
- argc--, argv++;
- }
- else if (!strcmp(firstarg->s_name, "tracks"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_outlet =
- outlet_new(&x->x_obj, &s_list);
- x->x_varoutv[x->x_nvarout].v_what = OUT_TRACKS;
- x->x_nvarout = n2;
- x->x_dotracks = 1;
- argc--, argv++;
- }
- else
- {
- pd_error(x, "sigmund: %s: unknown flag or argument missing",
- firstarg->s_name);
- argc--, argv++;
- }
- }
- if (!x->x_nvarout)
- {
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- 0, 2*sizeof(t_varout));
- x->x_varoutv[0].v_outlet = outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[0].v_what = OUT_PITCH;
- x->x_varoutv[1].v_outlet = outlet_new(&x->x_obj, &s_float);
- x->x_varoutv[1].v_what = OUT_ENV;
- x->x_nvarout = 2;
- x->x_dopitch = 1;
- }
- if (x->x_dotracks)
- {
- x->x_ntrack = x->x_npeak;
- x->x_trackv = (t_peak *)getbytes(x->x_ntrack * sizeof(*x->x_trackv));
- }
- x->x_clock = clock_new(&x->x_obj.ob_pd, (t_method)sigmund_tick);
-
- x->x_infill = 0;
- x->x_countdown = 0;
- sigmund_npts(x, x->x_npts);
- notefinder_init(&x->x_notefinder);
- sigmund_clear(x);
- return (x);
-}
-
-static void sigmund_list(t_sigmund *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_symbol *syminput = atom_getsymbolarg(0, argc, argv);
- int npts = atom_getintarg(1, argc, argv);
- int onset = atom_getintarg(2, argc, argv);
- t_float srate = atom_getfloatarg(3, argc, argv);
- int loud = atom_getfloatarg(4, argc, argv);
- int arraysize, totstorage, nfound, i;
- t_garray *a;
- t_float *arraypoints, pit;
- t_word *wordarray = 0;
- if (argc < 5)
- {
- post(
- "sigmund: array-name, npts, array-onset, samplerate, loud");
- return;
- }
- if (npts < 64 || npts != (1 << ilog2(npts)))
- {
- error("sigmund: bad npoints");
- return;
- }
- if (onset < 0)
- {
- error("sigmund: negative onset");
- return;
- }
- arraypoints = alloca(sizeof(t_float)*npts);
- if (!(a = (t_garray *)pd_findbyclass(syminput, garray_class)) ||
- !garray_getfloatwords(a, &arraysize, &wordarray) ||
- arraysize < onset + npts)
- {
- error("%s: array missing or too small", syminput->s_name);
- return;
- }
- if (arraysize < npts)
- {
- error("sigmund~: too few points in array");
- return;
- }
- for (i = 0; i < npts; i++)
- arraypoints[i] = wordarray[i+onset].w_float;
- sigmund_doit(x, npts, arraypoints, loud, srate);
-}
-
-static void sigmund_clear(t_sigmund *x)
-{
- if (x->x_trackv)
- memset(x->x_trackv, 0, x->x_ntrack * sizeof(*x->x_trackv));
- x->x_infill = x->x_countdown = 0;
-}
-
- /* these are for testing; their meanings vary... */
-static void sigmund_param1(t_sigmund *x, t_floatarg f)
-{
- x->x_param1 = f;
-}
-
-static void sigmund_param2(t_sigmund *x, t_floatarg f)
-{
- x->x_param2 = f;
-}
-
-static void sigmund_param3(t_sigmund *x, t_floatarg f)
-{
- x->x_param3 = f;
-}
-
-static void sigmund_printnext(t_sigmund *x, t_float f)
-{
- x->x_loud = f;
-}
-
-void sigmund_tilde_setup(void)
-{
- sigmund_class = class_new(gensym("sigmund~"), (t_newmethod)sigmund_new,
- (t_method)sigmund_free, sizeof(t_sigmund), 0, A_GIMME, 0);
- class_addlist(sigmund_class, sigmund_list);
- class_addmethod(sigmund_class, (t_method)sigmund_dsp, gensym("dsp"), 0);
- CLASS_MAINSIGNALIN(sigmund_class, t_sigmund, x_f);
- class_addmethod(sigmund_class, (t_method)sigmund_param1,
- gensym("param1"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_param2,
- gensym("param2"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_param3,
- gensym("param3"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_npts,
- gensym("npts"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_hop,
- gensym("hop"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_maxfreq,
- gensym("maxfreq"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_npeak,
- gensym("npeak"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_vibrato,
- gensym("vibrato"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_stabletime,
- gensym("stabletime"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_growth,
- gensym("growth"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_minpower,
- gensym("minpower"), A_FLOAT, 0);
- class_addmethod(sigmund_class, (t_method)sigmund_print,
- gensym("print"), 0);
- class_addmethod(sigmund_class, (t_method)sigmund_printnext,
- gensym("printnext"), A_FLOAT, 0);
- post("sigmund~ version 0.07");
-}
-
-#endif /* PD */
-
-/************************ Max/MSP glue **********************************/
-
-/* -------------------------- MSP glue ------------------------- */
-#ifdef MSP
-static void *sigmund_class;
-
-/* Max/MSP has laxer sync between DSP and "tick"s - so in the perf routine we
-keep a circular buffer that is rectified into inbuf only when the tick comes. */
-
-static void sigmund_tick(t_sigmund *x)
-{
- int i, j, npts = x->x_npts;
- if (!x->x_inbuf)
- return;
- for (i = x->x_infill, j = 0; i < npts; i++, j++)
- x->x_inbuf[j] = x->x_inbuf2[i];
- for (i = 0; j < npts; i++, j++)
- x->x_inbuf[j] = x->x_inbuf2[i];
- sigmund_doit(x, x->x_npts, x->x_inbuf, x->x_loud, x->x_sr);
- x->x_loud = 0;
-}
-
-static t_int *sigmund_perform(t_int *w)
-{
- t_sigmund *x = (t_sigmund *)(w[1]);
- t_float *in = (t_float *)(w[2]);
- int n = (int)(w[3]), j;
- int infill = x->x_infill;
- t_float *fp = x->x_inbuf2 + infill;
-
- if (x->x_obj.z_disabled) /* return if in muted MSP subpatch -Rd */
- return (w+4);
-
- if (infill < 0 || infill >= x->x_npts)
- infill = 0;
- /* for some reason this sometimes happens: */
- if (!x->x_inbuf2)
- return (w+4);
- for (j = 0; j < n; j++)
- {
- *fp++ = *in++;
- if (++infill == x->x_npts)
- infill = 0, fp = x->x_inbuf2;
- }
- x->x_infill = infill;
- if (x->x_countdown <= 0)
- {
- x->x_countdown = x->x_hop;
- clock_delay(x->x_clock, 0);
- }
- x->x_countdown -= n;
- return (w+4);
-}
-
-static void *sigmund_new(t_symbol *s, long ac, t_atom *av)
-{
- t_sigmund *x;
- t_varout *g;
- int i, j;
- if (!(x = (t_sigmund *)object_alloc(sigmund_class)))
- return (0);
- sigmund_preinit(x);
- attr_args_process(x, ac, av);
- dsp_setup((t_pxobject *)x, 1);
- object_obex_store(x, gensym("dumpout"), outlet_new(x, NULL));
-
- for (i = 0; i < ac; i++)
- if (av[i].a_type == A_SYM)
- {
- char *s = av[i].a_w.w_sym->s_name;
- if (!strcmp(s, "pitch"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_PITCH;
- x->x_nvarout = n2;
- x->x_dopitch = 1;
- }
- else if (!strcmp(s, "env"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_ENV;
- x->x_nvarout = n2;
- }
- else if (!strcmp(s, "note") || !strcmp(s, "notes"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_NOTE;
- x->x_nvarout = n2;
- x->x_dopitch = x->x_donote = 1;
- }
- else if (!strcmp(s, "peaks"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_PEAKS;
- x->x_nvarout = n2;
- }
- else if (!strcmp(s, "tracks"))
- {
- int n2 = x->x_nvarout+1;
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- x->x_nvarout*sizeof(t_varout), n2*sizeof(t_varout));
- x->x_varoutv[x->x_nvarout].v_what = OUT_TRACKS;
- x->x_nvarout = n2;
- x->x_dotracks = 1;
- }
- else if (s[0] != '@')
- post("sigmund: ignoring unknown argument '%s'" ,s);
- }
- if (!x->x_nvarout)
- {
- x->x_varoutv = (t_varout *)t_resizebytes(x->x_varoutv,
- 0, 2*sizeof(t_varout));
- x->x_varoutv[0].v_what = OUT_PITCH;
- x->x_varoutv[1].v_what = OUT_ENV;
- x->x_nvarout = 2;
- x->x_dopitch = 1;
- }
- for (j = 0, g = x->x_varoutv + x->x_nvarout-1; j < x->x_nvarout; j++, g--)
- g->v_outlet = ((g->v_what == OUT_PITCH || g->v_what == OUT_ENV ||
- g->v_what == OUT_NOTE) ?
- floatout((t_object *)x) : listout((t_object *)x));
- if (x->x_dotracks)
- {
- x->x_ntrack = x->x_npeak;
- x->x_trackv = (t_peak *)getbytes(x->x_ntrack * sizeof(*x->x_trackv));
- }
- x->x_clock = clock_new(x, (method)sigmund_tick);
- x->x_infill = 0;
- x->x_countdown = 0;
- sigmund_npts(x, x->x_npts);
- notefinder_init(&x->x_notefinder);
- return (x);
-}
-
-/* Attribute setters. */
-void sigmund_npts_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_npts(x, atom_getfloat(av));
-}
-
-void sigmund_hop_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_hop(x, atom_getfloat(av));
-}
-
-void sigmund_npeak_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_npeak(x, atom_getfloat(av));
-}
-
-void sigmund_maxfreq_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_maxfreq(x, atom_getfloat(av));
-}
-
-void sigmund_vibrato_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_vibrato(x, atom_getfloat(av));
-}
-
-void sigmund_stabletime_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_stabletime(x, atom_getfloat(av));
-}
-
-void sigmund_growth_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_growth(x, atom_getfloat(av));
-}
-
-void sigmund_minpower_set(t_sigmund *x, void *attr, long ac, t_atom *av)
-{
- if (ac && av)
- sigmund_minpower(x, atom_getfloat(av));
-}
-
-/* end attr setters */
-
-void sigmund_assist(t_sigmund *x, void *b, long m, long a, char *s)
-{
-}
-
-int main()
-{
- t_class *c;
- long attrflags = 0;
- t_symbol *sym_long = gensym("long"), *sym_float32 = gensym("float32");
-
- c = class_new("sigmund~", (method)sigmund_new,
- (method)sigmund_free, sizeof(t_sigmund), (method)0L, A_GIMME, 0);
-
- class_obexoffset_set(c, calcoffset(t_sigmund, obex));
-
- class_addattr(c, attr_offset_new("npts", sym_long, attrflags,
- (method)0L, (method)sigmund_npts_set,
- calcoffset(t_sigmund, x_npts)));
- class_addattr(c ,attr_offset_new("hop", sym_long, attrflags,
- (method)0L, (method)sigmund_hop_set,
- calcoffset(t_sigmund, x_hop)));
- class_addattr(c ,attr_offset_new("maxfreq", sym_float32, attrflags,
- (method)0L, (method)sigmund_maxfreq_set,
- calcoffset(t_sigmund, x_maxfreq)));
- class_addattr(c ,attr_offset_new("npeak", sym_long, attrflags,
- (method)0L, (method)sigmund_npeak_set,
- calcoffset(t_sigmund, x_npeak)));
- class_addattr(c ,attr_offset_new("vibrato", sym_float32, attrflags,
- (method)0L, (method)sigmund_vibrato_set,
- calcoffset(t_sigmund, x_vibrato)));
- class_addattr(c ,attr_offset_new("stabletime", sym_float32, attrflags,
- (method)0L, (method)sigmund_stabletime_set,
- calcoffset(t_sigmund, x_stabletime)));
- class_addattr(c ,attr_offset_new("growth", sym_float32, attrflags,
- (method)0L, (method)sigmund_growth_set,
- calcoffset(t_sigmund, x_growth)));
- class_addattr(c ,attr_offset_new("minpower", sym_float32, attrflags,
- (method)0L, (method)sigmund_minpower_set,
- calcoffset(t_sigmund, x_minpower)));
-
- class_addmethod(c, (method)sigmund_dsp, "dsp", A_CANT, 0);
- class_addmethod(c, (method)sigmund_print, "print", 0);
- class_addmethod(c, (method)sigmund_print, "printnext", A_DEFFLOAT, 0);
- class_addmethod(c, (method)sigmund_assist, "assist", A_CANT, 0);
-
- class_addmethod(c, (method)object_obex_dumpout, "dumpout", A_CANT, 0);
- class_addmethod(c, (method)object_obex_quickref, "quickref", A_CANT, 0);
-
- class_dspinit(c);
-
- class_register(CLASS_BOX, c);
- sigmund_class = c;
-
- post("sigmund~ version 0.07");
- return (0);
-}
-
-
-#endif /* MSP */
-
-
diff --git a/externals/extra/0.43.3/stdout/stdout-help.pd b/externals/extra/0.43.3/stdout/stdout-help.pd
deleted file mode 100644
index 91edbc41..00000000
--- a/externals/extra/0.43.3/stdout/stdout-help.pd
+++ /dev/null
@@ -1,19 +0,0 @@
-#N canvas 121 60 488 321 12;
-#X msg 126 203 walk the dog;
-#X msg 117 156 1;
-#X obj 117 240 stdout;
-#X text 269 287 updated for Pd version 0.42;
-#X obj 14 13 stdout;
-#X text 67 14 - write messages to standard output;
-#X msg 122 179 1 2;
-#X obj 119 291 pd~;
-#X text 44 291 see also:;
-#X text 34 39 Sends messages to Pd's standard output. This is useful
-in conjunction with the pd~ object \, which starts a pd sub-process.
-Messages sent to the sub-process standard output appear on the output
-of the pd~ object in the owning process. This might also be useful
-in other situations. Note that there's no corresponding "stdin" object
-- there seems to be no one canonical way such a thing should act.;
-#X connect 0 0 2 0;
-#X connect 1 0 2 0;
-#X connect 6 0 2 0;
diff --git a/externals/extra/0.43.3/stdout/stdout.c b/externals/extra/0.43.3/stdout/stdout.c
deleted file mode 100644
index 5cd52f25..00000000
--- a/externals/extra/0.43.3/stdout/stdout.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* stdout -- write messages to standard output.
-
- Copyright 2008 Miller Puckette
- BSD license; see README.txt in this distribution for details.
-*/
-
-#include "m_pd.h"
-#include <stdio.h>
-#include <string.h>
-static t_class *stdout_class;
-
-typedef struct _stdout
-{
- t_object x_obj;
-} t_stdout;
-
-static void *stdout_new(t_float fnonrepeat)
-{
- t_stdout *x = (t_stdout *)pd_new(stdout_class);
- return (x);
-}
-
-static void stdout_anything(t_stdout *x, t_symbol *s, int argc, t_atom *argv)
-{
- char msgbuf[MAXPDSTRING], *sp, *ep = msgbuf+MAXPDSTRING;
- msgbuf[0] = 0;
- strncpy(msgbuf, s->s_name, MAXPDSTRING);
- msgbuf[MAXPDSTRING-1] = 0;
- sp = msgbuf + strlen(msgbuf);
- while (argc--)
- {
- if (sp < ep-1)
- sp[0] = ' ', sp[1] = 0, sp++;
- atom_string(argv++, sp, ep-sp);
- sp += strlen(sp);
- }
- printf("%s;\n", msgbuf);
-}
-
-static void stdout_free(t_stdout *x)
-{
- fflush(stdout);
-}
-
-void stdout_setup(void)
-{
- stdout_class = class_new(gensym("stdout"), (t_newmethod)stdout_new,
- (t_method)stdout_free, sizeof(t_stdout), 0, 0);
- class_addanything(stdout_class, stdout_anything);
-}