aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/fftease
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/fftease')
-rw-r--r--externals/grill/fftease/fftease.dsp396
-rw-r--r--externals/grill/fftease/gpl.txt346
-rw-r--r--externals/grill/fftease/license.txt87
-rw-r--r--externals/grill/fftease/pd/burrow.pd44
-rw-r--r--externals/grill/fftease/readme.txt57
-rw-r--r--externals/grill/fftease/src/burrow~.cpp255
-rw-r--r--externals/grill/fftease/src/convert.c55
-rw-r--r--externals/grill/fftease/src/convert_new.c64
-rw-r--r--externals/grill/fftease/src/fft.c161
-rw-r--r--externals/grill/fftease/src/fft4.c340
-rw-r--r--externals/grill/fftease/src/fold.c24
-rw-r--r--externals/grill/fftease/src/leanconvert.c19
-rw-r--r--externals/grill/fftease/src/leanunconvert.c23
-rw-r--r--externals/grill/fftease/src/main.cpp60
-rw-r--r--externals/grill/fftease/src/main.h40
-rw-r--r--externals/grill/fftease/src/makewindows.c202
-rw-r--r--externals/grill/fftease/src/overlapadd.c17
-rw-r--r--externals/grill/fftease/src/pv.h60
-rw-r--r--externals/grill/fftease/src/unconvert.c36
19 files changed, 2286 insertions, 0 deletions
diff --git a/externals/grill/fftease/fftease.dsp b/externals/grill/fftease/fftease.dsp
new file mode 100644
index 00000000..2b66b6d8
--- /dev/null
+++ b/externals/grill/fftease/fftease.dsp
@@ -0,0 +1,396 @@
+# Microsoft Developer Studio Project File - Name="fftease" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=fftease - Win32 Debug
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "fftease.mak".
+!MESSAGE
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "fftease.mak" CFG="fftease - Win32 Debug"
+!MESSAGE
+!MESSAGE Für die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "fftease - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "fftease - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName "max/fftease"
+# PROP Scc_LocalPath "."
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "pd-msvc/r"
+# PROP Intermediate_Dir "pd-msvc/r"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D FLEXT_SYS=2 /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0xc07 /d "NDEBUG"
+# ADD RSC /l 0xc07 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winsfftease.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib pd.lib ../flext_sh/pd-msvc/t/flext.lib /nologo /dll /machine:I386 /out:"pd-msvc/fftease.dll" /libpath:"c:\programme\audio\pd\bin" /libpath:"f:\prog\max\flext\pd-msvc"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "pd-msvc/d"
+# PROP Intermediate_Dir "pd-msvc/d"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D FLEXT_SYS=2 /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0xc07 /d "_DEBUG"
+# ADD RSC /l 0xc07 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winsfftease.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib pd.lib flext_d-pdwin.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"c:\programme\audio\pd\bin" /libpath:"f:\prog\max\flext\pd-msvc"
+
+!ENDIF
+
+# Begin Target
+
+# Name "fftease - Win32 Release"
+# Name "fftease - Win32 Debug"
+# Begin Group "pv-lib"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\src\convert.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\convert_new.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\fft.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\fft4.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\fold.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\leanconvert.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\leanunconvert.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\makewindows.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\overlapadd.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\pv.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\unconvert.c
+# End Source File
+# End Group
+# Begin Group "objects"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\src\burrow~.cpp
+# End Source File
+# End Group
+# Begin Group "doc"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\gpl.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\license.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\readme.txt
+# End Source File
+# End Group
+# Begin Group "Ori"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\burrow~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\cross~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\dentist~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\disarray~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\drown~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\ether~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\morphine~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\pvcompand~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\pvoc~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\scrape~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\shapee~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\swinger~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\taint~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\thresher~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\unconvert.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\vacancy~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\packs\FFTease\c\src\xsyn~.c
+
+!IF "$(CFG)" == "fftease - Win32 Release"
+
+!ELSEIF "$(CFG)" == "fftease - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\src\main.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\src\main.h
+# End Source File
+# End Target
+# End Project
diff --git a/externals/grill/fftease/gpl.txt b/externals/grill/fftease/gpl.txt
new file mode 100644
index 00000000..5ea29a7d
--- /dev/null
+++ b/externals/grill/fftease/gpl.txt
@@ -0,0 +1,346 @@
+ 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/grill/fftease/license.txt b/externals/grill/fftease/license.txt
new file mode 100644
index 00000000..a8303e67
--- /dev/null
+++ b/externals/grill/fftease/license.txt
@@ -0,0 +1,87 @@
+FFTease - A set of Live Spectral Processors
+Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
+
+This flext port is based on the jMax port of Christian Klippel
+Copyright (c)Thomas Grill (xovo@gmx.net)
+
+---------------------------------------------------------
+
+Please note that this license only applies to the core FFTease objects,
+but *NOT* the sources of the pv-lib.
+The pv-lib is instead free for everyone to use as (s)he wants.
+
+---------------------------------------------------------
+
+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.
+
+In the official fftease distribution, the GNU General Public License is
+in the file gpl.txt
+
+---------------------------------------------------------
+
+ OTHER COPYRIGHT NOTICES
+
+---------------------------------------------------------
+
+
+--- FFtease jMax port --------------------------------------
+
+This is FFTease, a set of live spectral processors.
+
+FFTease was originally designed & programmed by
+Eric Lyon Web: http://arcana.dartmouth.edu/~eric/
+ eMail: mailto:Eric.Lyon@Dartmouth.EDU
+Christopher Web: http://www.sfc.keio.ac.jp/~penrose/
+ eMail: mailto:penrose@sfc.keio.ac.jp
+
+NOTE! The original FFTease package for the MAX/MSP platform is *NOT*
+ under the GPL !!
+ However, Eric and Christoph gave me friendly permission to
+ port this really nice packagee to jMax and put
+ *ONLY THE jMax FFTease SOURCE'S* undert the GPL.
+ (for the GPL see the file LICENSE.TXT)
+ Thanks to you !
+
+FFTease uses the pv-lib, which is used by this this release.
+NOTE! The pv-lib is *NOT* under the GPL.
+ Rather it *IS FREE* to use by anyone as (s)he decides !!
+The pv-lib is also written by E. Lyon and Ch. Penrose.
+
+The port of these objects to the jMax system is done by
+Christian Klippel Web: http://mamalala.de
+
+
+
+--- flext ----------------------------------------------
+flext - C++ layer for Max/MSP and pd (pure data) externals
+Copyright (C) 2001-2003 Thomas Grill
+
+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.
+
+In the official flext distribution, the GNU General Public License is
+in the file gpl.txt
+
diff --git a/externals/grill/fftease/pd/burrow.pd b/externals/grill/fftease/pd/burrow.pd
new file mode 100644
index 00000000..cda92a9c
--- /dev/null
+++ b/externals/grill/fftease/pd/burrow.pd
@@ -0,0 +1,44 @@
+#N canvas 313 248 586 352 12;
+#X msg 26 165 getattributes;
+#X obj 292 233 print A;
+#X obj 161 210 burrow~ -30 -18 0;
+#X obj 26 82 tgl 20 1 empty empty enable_dsp 0 -6 0 10 -225271 -1 -1
+1 1;
+#X msg 26 107 enable \$1;
+#X obj 184 78 tgl 20 0 empty empty inverse_filtering 0 -6 0 10 -225271
+-1 -1 0 1;
+#X msg 184 102 invert \$1;
+#X obj 373 78 nbx 5 18 -100 0 0 0 empty empty filtering_threshold(dB)
+0 -6 0 10 -225271 -1 -1 -42 256;
+#X msg 373 100 thresh \$1;
+#X obj 374 145 nbx 5 18 -100 0 0 0 empty empty filter_multiplier(dB)
+0 -6 0 10 -225271 -1 -1 -4 256;
+#X msg 374 167 mult \$1;
+#X obj 162 275 *~;
+#X obj 198 280 hsl 128 15 0.001 1 1 1 empty empty volume -2 -6 0 10
+-261681 -1 -1 11200 1;
+#X obj 151 312 dac~;
+#X obj 162 162 adc~ 1;
+#X text 355 232 print attributes;
+#X text 24 147 list attributes;
+#X obj 292 162 adc~ 2;
+#X obj 16 8 cnv 15 550 40 empty empty burrow~ 10 22 0 24 -260818 -1
+0;
+#X text 202 9 FFTease (C)Lyon \, Penrose (for Max/MSP);
+#X text 202 29 flext port by Thomas Grill;
+#X connect 0 0 2 0;
+#X connect 2 0 11 0;
+#X connect 2 1 1 0;
+#X connect 3 0 4 0;
+#X connect 4 0 2 0;
+#X connect 5 0 6 0;
+#X connect 6 0 2 0;
+#X connect 7 0 8 0;
+#X connect 8 0 2 0;
+#X connect 9 0 10 0;
+#X connect 10 0 2 0;
+#X connect 11 0 13 0;
+#X connect 11 0 13 1;
+#X connect 12 0 11 1;
+#X connect 14 0 2 0;
+#X connect 17 0 2 1;
diff --git a/externals/grill/fftease/readme.txt b/externals/grill/fftease/readme.txt
new file mode 100644
index 00000000..7507ee56
--- /dev/null
+++ b/externals/grill/fftease/readme.txt
@@ -0,0 +1,57 @@
+FFTease - A set of Live Spectral Processors
+Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
+
+This flext port is based on the jMax port of Christian Klippel
+
+Copyright (c)Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+
+----------------------------------------------------------------------------
+
+The package should at least compile (and is tested) with the following compilers:
+
+pd - Windows:
+-------------
+o Microsoft Visual C++ 6: edit "config-pd-msvc.txt" & run "build-pd-msvc.bat"
+
+o Borland C++ 5.5 (free): edit "config-pd-bcc.txt" & run "build-pd-bcc.bat"
+
+o Cygwin: edit "config-pd-cygwin.txt" & run "sh build-pd-cygwin.sh"
+ additional settings (e.g. target processor, compiler flags) can be made in makefile.pd-cygwin
+
+
+pd - linux:
+-----------
+o GCC: edit "config-pd-linux.txt" & run "sh build-pd-linux.sh"
+ additional settings (e.g. target processor, compiler flags) can be made in makefile.pd-linux
+
+
+pd - MacOSX:
+-----------
+o GCC: edit "config-pd-darwin.txt" & run "sh build-pd-darwin.sh"
+ additional settings (e.g. target processor, compiler flags) can be made in makefile.pd-darwin
+
+
+Max/MSP - MacOS 9:
+------------------
+o Metrowerks CodeWarrior V6: edit & use the "fftease.cw" project file
+
+You must have the following "Source Trees" defined:
+"flext" - Pointing to the flext main directory
+"Cycling74" - Pointing to the Cycling 74 SDK
+
+
+
+Max/MSP - MacOSX:
+------------------
+o Metrowerks CodeWarrior V6: edit & use the "fftease.cw" project file
+
+You must have the following "Source Trees" defined:
+"OS X Volume" - Pointing to your OSX boot drive
+"flext" - Pointing to the flext main directory
+"Cycling74 OSX" - Pointing to the Cycling 74 SDK for xmax
+"MP SDK" - Pointing to the Multiprocessing SDK (for threading support)
+
+
diff --git a/externals/grill/fftease/src/burrow~.cpp b/externals/grill/fftease/src/burrow~.cpp
new file mode 100644
index 00000000..7fbc45b8
--- /dev/null
+++ b/externals/grill/fftease/src/burrow~.cpp
@@ -0,0 +1,255 @@
+/*
+
+FFTease - A set of Live Spectral Processors
+Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
+
+This flext port is based on the jMax port of Christian Klippel
+
+Copyright (c)Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+#include "main.h"
+
+
+class burrow:
+ public flext_dsp
+{
+ FLEXT_HEADER_S(burrow,flext_dsp,setup)
+
+public:
+ burrow(I argc,const t_atom *argv);
+ ~burrow();
+
+protected:
+
+ virtual V m_dsp(I n,S *const *in,S *const *out);
+ virtual V m_signal(I n,S *const *in,S *const *out);
+
+ BL _invert;
+ I _inCount;
+ I *_bitshuffle;
+
+ F _threshold,_multiplier;
+ F _thresh_dB,_mult_dB;
+
+ F *_Wanal;
+ F *_Wsyn;
+ F *_inputOne,*_inputTwo;
+ F *_Hwin;
+ F *_bufferOne,*_bufferTwo;
+ F *_channelOne,*_channelTwo;
+ F *_output;
+ F *_trigland;
+
+private:
+ V Reset();
+ V Clear();
+
+ V ms_thresh(F v) { _threshold = (float) (pow( 10., ((_thresh_dB = v) * .05))); }
+ V ms_mult(F v) { _multiplier = (float) (pow( 10., ((_mult_dB = v) * .05))); }
+
+
+ static V setup(t_classid c);
+
+ FLEXT_ATTRGET_F(_thresh_dB)
+ FLEXT_CALLSET_F(ms_thresh)
+ FLEXT_ATTRGET_F(_mult_dB)
+ FLEXT_CALLSET_F(ms_mult)
+ FLEXT_ATTRVAR_B(_invert)
+};
+
+FLEXT_LIB_DSP_V("fftease, burrow~",burrow)
+
+
+V burrow::setup(t_classid c)
+{
+ FLEXT_CADDATTR_VAR(c,"thresh",_thresh_dB,ms_thresh);
+ FLEXT_CADDATTR_VAR(c,"mult",_mult_dB,ms_mult);
+ FLEXT_CADDATTR_VAR1(c,"invert",_invert);
+}
+
+
+burrow::burrow(I argc,const t_atom *argv):
+ _thresh_dB(-30),_mult_dB(-18),
+ _invert(false)
+{
+ /* parse and set object's options given */
+ if(argc >= 1) {
+ if(CanbeFloat(argv[0]))
+ _thresh_dB = GetAFloat(argv[0]);
+ else
+ post("%s - Threshold must be a float value - set to %0f",thisName(),_thresh_dB);
+ }
+ if(argc >= 2) {
+ if(CanbeFloat(argv[1]))
+ _mult_dB = GetAFloat(argv[1]);
+ else
+ post("%s - Multiplier must be a float value - set to %0f",thisName(),_mult_dB);
+ }
+ if(argc >= 3) {
+ if(CanbeBool(argv[2]))
+ _invert = GetABool(argv[2]);
+ else
+ post("%s - Invert flags must be a boolean value - set to %i",thisName(),_invert?1:0);
+ }
+
+ ms_thresh(_thresh_dB);
+ ms_mult(_mult_dB);
+
+ Reset();
+
+ AddInSignal(2);
+ AddOutSignal();
+}
+
+burrow::~burrow()
+{
+ Clear();
+}
+
+V burrow::Reset()
+{
+ _bitshuffle = NULL;
+ _trigland = NULL;
+ _inputOne = _inputTwo = NULL;
+ _Hwin = NULL;
+ _Wanal = _Wsyn = NULL;
+ _bufferOne = _bufferTwo = NULL;
+ _channelOne = _channelTwo = NULL;
+ _output = NULL;
+}
+
+V burrow::Clear()
+{
+ if(_bitshuffle) delete[] _bitshuffle;
+ if(_trigland) delete[] _trigland;
+ if(_inputOne) delete[] _inputOne;
+ if(_inputTwo) delete[] _inputTwo;
+ if(_Hwin) delete[] _Hwin;
+ if(_Wanal) delete[] _Wanal;
+ if(_Wsyn) delete[] _Wsyn;
+ if(_bufferOne) delete[] _bufferOne;
+ if(_bufferTwo) delete[] _bufferTwo;
+ if(_channelOne) delete[] _channelOne;
+ if(_channelTwo) delete[] _channelTwo;
+ if(_output) delete[] _output;
+}
+
+
+
+V burrow::m_dsp(I n,S *const *in,S *const *out)
+{
+ Clear();
+
+ /* preset the objects data */
+ const I _D = Blocksize();
+ const I _N = _D* 4,_Nw = _N,_N2 = _N / 2,_Nw2 = _Nw / 2;
+
+ _inCount = -_Nw;
+
+ /* assign memory to the buffers */
+ _bitshuffle = new I[_N*2];
+ _trigland = new F[_N*2];
+ _inputOne = new F[_Nw];
+ _inputTwo = new F[_Nw];
+ _Hwin = new F[_Nw];
+ _Wanal = new F[_Nw];
+ _Wsyn = new F[_Nw];
+ _bufferOne = new F[_N];
+ _bufferTwo = new F[_N];
+ _channelOne = new F[_N+2];
+ _channelTwo = new F[_N+2];
+ _output = new F[_Nw];
+
+ /* initialize pv-lib functions */
+ init_rdft( _N, _bitshuffle, _trigland);
+ makewindows( _Hwin, _Wanal, _Wsyn, _Nw, _N, _D, 0);
+}
+
+V burrow::m_signal(I n,S *const *in,S *const *out)
+{
+ const S *inOne = in[0],*inTwo = in[1];
+ S *outOne = out[0];
+
+ /* declare working variables */
+ I i, j, even, odd;
+ const I _D = Blocksize();
+ const I _N = _D* 4,_Nw = _N,_N2 = _N / 2,_Nw2 = _Nw / 2;
+
+ /* fill our retaining buffers */
+ _inCount += _D;
+
+ for(i = 0; i < _N-_D ; i++ ) {
+ _inputOne[i] = _inputOne[i+_D];
+ _inputTwo[i] = _inputTwo[i+_D];
+ }
+ for(j = 0; i < _N; i++,j++) {
+ _inputOne[i] = inOne[j];
+ _inputTwo[i] = inTwo[j];
+ }
+
+ /* apply hamming window and fold our window buffer into the fft buffer */
+ fold( _inputOne, _Wanal, _Nw, _bufferOne, _N, _inCount );
+ fold( _inputTwo, _Wanal, _Nw, _bufferTwo, _N, _inCount );
+
+ /* do an fft */
+ rdft( _N, 1, _bufferOne, _bitshuffle, _trigland );
+ rdft( _N, 1, _bufferTwo, _bitshuffle, _trigland );
+
+
+ /* convert to polar coordinates from complex values */
+ for ( i = 0; i <= _N2; i++ ) {
+ register F a,b;
+
+ odd = ( even = i<<1 ) + 1;
+
+ a = ( i == _N2 ? _bufferOne[1] : _bufferOne[even] );
+ b = ( i == 0 || i == _N2 ? 0. : _bufferOne[odd] );
+
+ _channelOne[even] = hypot( a, b );
+ _channelOne[odd] = -atan2( b, a );
+
+ a = ( i == _N2 ? _bufferTwo[1] : _bufferTwo[even] );
+ b = ( i == 0 || i == _N2 ? 0. : _bufferTwo[odd] );
+
+ _channelTwo[even] = hypot( a, b );
+
+ /* use simple threshold from second signal to trigger filtering */
+ if (_invert?(_channelTwo[even] < _threshold):(_channelTwo[even] > _threshold) )
+ _channelOne[even] *= _multiplier;
+ }
+
+ /* convert back to complex form, read for the inverse fft */
+ for ( i = 0; i <= _N2; i++ ) {
+ odd = ( even = i<<1 ) + 1;
+
+ *(_bufferOne+even) = *(_channelOne+even) * cos( *(_channelOne+odd) );
+
+ if ( i != _N2 )
+ *(_bufferOne+odd) = -(*(_channelOne+even)) * sin( *(_channelOne+odd) );
+ }
+
+ /* do an inverse fft */
+ rdft( _N, -1, _bufferOne, _bitshuffle, _trigland );
+
+ /* dewindow our result */
+ overlapadd( _bufferOne, _N, _Wsyn, _output, _Nw, _inCount);
+
+ /* set our output and adjust our retaining output buffer */
+ F mult = 1./_N;
+ for ( j = 0; j < _D; j++ )
+ outOne[j] = _output[j] * mult;
+
+ for ( j = 0; j < _N-_D; j++ )
+ _output[j] = _output[j+_D];
+ for (; j < _N; j++ )
+ _output[j] = 0.;
+
+ /* restore state variables */
+}
+
+
+
diff --git a/externals/grill/fftease/src/convert.c b/externals/grill/fftease/src/convert.c
new file mode 100644
index 00000000..8eb238f0
--- /dev/null
+++ b/externals/grill/fftease/src/convert.c
@@ -0,0 +1,55 @@
+#include "pv.h"
+
+/* S is a spectrum in rfft format, i.e., it contains N real values
+ arranged as real followed by imaginary values, except for first
+ two values, which are real parts of 0 and Nyquist frequencies;
+ convert first changes these into N/2+1 PAIRS of magnitude and
+ phase values to be stored in output array C; the phases are then
+ unwrapped and successive phase differences are used to compute
+ estimates of the instantaneous frequencies for each phase vocoder
+ analysis channel; decimation rate D and sampling rate R are used
+ to render these frequency values directly in Hz. */
+
+void convert(float *S, float *C, int N2, float *lastphase, float fundamental, float factor )
+{
+ float phase,
+ phasediff;
+ int real,
+ imag,
+ amp,
+ freq;
+ float a,
+ b;
+ int i;
+
+ float myTWOPI, myPI;
+
+ myTWOPI = 8.*atan(1.);
+ myPI = 4.*atan(1.);
+
+
+ for ( i = 0; i <= N2; i++ ) {
+ imag = freq = ( real = amp = i<<1 ) + 1;
+ a = ( i == N2 ? S[1] : S[real] );
+ b = ( i == 0 || i == N2 ? 0. : S[imag] );
+
+ C[amp] = hypot( a, b );
+ if ( C[amp] == 0. )
+ phasediff = 0.;
+ else {
+ phasediff = ( phase = -atan2( b, a ) ) - lastphase[i];
+ lastphase[i] = phase;
+
+ while ( phasediff > myPI )
+ phasediff -= myTWOPI;
+ while ( phasediff < -myPI )
+ phasediff += myTWOPI;
+ }
+ C[freq] = phasediff*factor + i*fundamental;
+ /*
+ if( i > 8 && i < 12 ) {
+ fprintf(stderr,"convert freq %d: %f\n",i, C[freq]);
+ }
+ */
+ }
+}
diff --git a/externals/grill/fftease/src/convert_new.c b/externals/grill/fftease/src/convert_new.c
new file mode 100644
index 00000000..5df717f8
--- /dev/null
+++ b/externals/grill/fftease/src/convert_new.c
@@ -0,0 +1,64 @@
+#include "pv.h" // T.Grill
+
+// #include <stdio.h>
+#include <math.h>
+
+
+
+/* S is a spectrum in rfft format, i.e., it contains N real values
+ arranged as real followed by imaginary values, except for first
+ two values, which are real parts of 0 and Nyquist frequencies;
+ convert first changes these into N/2+1 PAIRS of magnitude and
+ phase values to be stored in output array C; the phases are then
+ unwrapped and successive phase differences are used to compute
+ estimates of the instantaneous frequencies for each phase vocoder
+ analysis channel; decimation rate D and sampling rate R are used
+ to render these frequency values directly in Hz. */
+
+
+
+
+
+void convert_new(float *S, float *C, int N2, float *lastphase, float fundamental, float factor )
+{
+ float phase,
+ phasediff;
+ int real,
+ imag,
+ amp,
+ freq;
+ float a,
+ b;
+ int i;
+
+ float myTWOPI, myPI;
+
+ myTWOPI = 8.*atan(1.);
+ myPI = 4.*atan(1.);
+
+
+ for ( i = 0; i <= N2; i++ ) {
+ imag = freq = ( real = amp = i<<1 ) + 1;
+ a = ( i == N2 ? S[1] : S[real] );
+ b = ( i == 0 || i == N2 ? 0. : S[imag] );
+
+ C[amp] = hypot( a, b );
+ if ( C[amp] == 0. )
+ phasediff = 0.;
+ else {
+ phasediff = ( phase = -atan2( b, a ) ) - lastphase[i];
+ lastphase[i] = phase;
+
+ while ( phasediff > myPI )
+ phasediff -= myTWOPI;
+ while ( phasediff < -myPI )
+ phasediff += myTWOPI;
+ }
+ C[freq] = phasediff*factor + i*fundamental;
+ /*
+ if( i > 8 && i < 12 ) {
+ fprintf(stderr,"convert freq %d: %f\n",i, C[freq]);
+ }
+ */
+ }
+}
diff --git a/externals/grill/fftease/src/fft.c b/externals/grill/fftease/src/fft.c
new file mode 100644
index 00000000..f920e231
--- /dev/null
+++ b/externals/grill/fftease/src/fft.c
@@ -0,0 +1,161 @@
+#include "pv.h"
+
+
+//float TWOPI;
+
+/* If forward is true, rfft replaces 2*N real data points in x with
+ N complex values representing the positive frequency half of their
+ Fourier spectrum, with x[1] replaced with the real part of the Nyquist
+ frequency value. If forward is false, rfft expects x to contain a
+ positive frequency spectrum arranged as before, and replaces it with
+ 2*N real values. N MUST be a power of 2. */
+static void
+bitreverse( float *x, int N );
+
+void rfft( float *x, int N, int forward )
+{
+ float c1,c2,
+ h1r,h1i,
+ h2r,h2i,
+ wr,wi,
+ wpr,wpi,
+ temp,
+ theta;
+ float xr,xi;
+ int i,
+ i1,i2,i3,i4,
+ N2p1;
+ static int first = 1;
+float PI, TWOPI;
+
+PI = 3.141592653589793115997963468544185161590576171875;
+TWOPI = 6.28318530717958623199592693708837032318115234375;
+ if ( first ) {
+
+ first = 0;
+ }
+ theta = PI/N;
+ wr = 1.;
+ wi = 0.;
+ c1 = 0.5;
+ if ( forward ) {
+ c2 = -0.5;
+ cfft( x, N, forward );
+ xr = x[0];
+ xi = x[1];
+ } else {
+ c2 = 0.5;
+ theta = -theta;
+ xr = x[1];
+ xi = 0.;
+ x[1] = 0.;
+ }
+ wpr = -2.*pow( sin( 0.5*theta ), 2. );
+ wpi = sin( theta );
+ N2p1 = (N<<1) + 1;
+ for ( i = 0; i <= N>>1; i++ ) {
+ i1 = i<<1;
+ i2 = i1 + 1;
+ i3 = N2p1 - i2;
+ i4 = i3 + 1;
+ if ( i == 0 ) {
+ h1r = c1*(x[i1] + xr );
+ h1i = c1*(x[i2] - xi );
+ h2r = -c2*(x[i2] + xi );
+ h2i = c2*(x[i1] - xr );
+ x[i1] = h1r + wr*h2r - wi*h2i;
+ x[i2] = h1i + wr*h2i + wi*h2r;
+ xr = h1r - wr*h2r + wi*h2i;
+ xi = -h1i + wr*h2i + wi*h2r;
+ } else {
+ h1r = c1*(x[i1] + x[i3] );
+ h1i = c1*(x[i2] - x[i4] );
+ h2r = -c2*(x[i2] + x[i4] );
+ h2i = c2*(x[i1] - x[i3] );
+ x[i1] = h1r + wr*h2r - wi*h2i;
+ x[i2] = h1i + wr*h2i + wi*h2r;
+ x[i3] = h1r - wr*h2r + wi*h2i;
+ x[i4] = -h1i + wr*h2i + wi*h2r;
+ }
+ wr = (temp = wr)*wpr - wi*wpi + wr;
+ wi = wi*wpr + temp*wpi + wi;
+ }
+ if ( forward )
+ x[1] = xr;
+ else
+ cfft( x, N, forward );
+}
+
+/* cfft replaces float array x containing NC complex values
+ (2*NC float values alternating real, imagininary, etc.)
+ by its Fourier transform if forward is true, or by its
+ inverse Fourier transform if forward is false, using a
+ recursive Fast Fourier transform method due to Danielson
+ and Lanczos. NC MUST be a power of 2. */
+
+void cfft( float *x, int NC, int forward )
+{
+ float wr,wi,
+ wpr,wpi,
+ theta,
+ scale;
+ int mmax,
+ ND,
+ m,
+ i,j,
+ delta;
+float TWOPI;
+TWOPI = 6.28318530717958623199592693708837032318115234375;
+ ND = NC<<1;
+ bitreverse( x, ND );
+ for ( mmax = 2; mmax < ND; mmax = delta ) {
+ delta = mmax<<1;
+ theta = TWOPI/( forward? mmax : -mmax );
+ wpr = -2.*pow( sin( 0.5*theta ), 2. );
+ wpi = sin( theta );
+ wr = 1.;
+ wi = 0.;
+ for ( m = 0; m < mmax; m += 2 ) {
+ register float rtemp, itemp;
+ for ( i = m; i < ND; i += delta ) {
+ j = i + mmax;
+ rtemp = wr*x[j] - wi*x[j+1];
+ itemp = wr*x[j+1] + wi*x[j];
+ x[j] = x[i] - rtemp;
+ x[j+1] = x[i+1] - itemp;
+ x[i] += rtemp;
+ x[i+1] += itemp;
+ }
+ wr = (rtemp = wr)*wpr - wi*wpi + wr;
+ wi = wi*wpr + rtemp*wpi + wi;
+ }
+ }
+
+/* scale output */
+
+ scale = forward ? 1./ND : 2.;
+ { register float *xi=x, *xe=x+ND;
+ while ( xi < xe )
+ *xi++ *= scale;
+ }
+}
+
+/* bitreverse places float array x containing N/2 complex values
+ into bit-reversed order */
+
+void bitreverse( float *x, int N )
+{
+ float rtemp,itemp;
+ int i,j,
+ m;
+
+ for ( i = j = 0; i < N; i += 2, j += m ) {
+ if ( j > i ) {
+ rtemp = x[j]; itemp = x[j+1]; /* complex exchange */
+ x[j] = x[i]; x[j+1] = x[i+1];
+ x[i] = rtemp; x[i+1] = itemp;
+ }
+ for ( m = N>>1; m >= 2 && j >= m; m >>= 1 )
+ j -= m;
+ }
+}
diff --git a/externals/grill/fftease/src/fft4.c b/externals/grill/fftease/src/fft4.c
new file mode 100644
index 00000000..ffb3574d
--- /dev/null
+++ b/externals/grill/fftease/src/fft4.c
@@ -0,0 +1,340 @@
+/*
+ * This file is part of the pv-lib
+ *
+ * The pv-lib can be used by everyone as desired
+ *
+ * (c) Eric Lyon and Christopher Penrose
+ *
+ */
+
+#include <math.h>
+#include "pv.h"
+
+static void bitrv2(int n, int *ip, float *a);
+static void cftsub(int n, float *a, float *w);
+static void rftsub(int n, float *a, int nc, float *c);
+static void makewt(int nw, int *ip, float *w);
+static void makect(int nc, int *ip, float *c);
+
+void init_rdft(int n, int *ip, float *w)
+{
+
+ int nw,
+ nc;
+
+ nw = n >> 2;
+ makewt(nw, ip, w);
+
+ nc = n >> 2;
+ makect(nc, ip, w + nw);
+
+ return;
+}
+
+
+void rdft(int n, int isgn, float *a, int *ip, float *w)
+{
+
+ int j,
+ nw,
+ nc;
+
+ float xi;
+
+ nw = ip[0];
+ nc = ip[1];
+
+ if (isgn < 0) {
+ a[1] = 0.5 * (a[1] - a[0]);
+ a[0] += a[1];
+
+ for (j = 3; j <= n - 1; j += 2) {
+ a[j] = -a[j];
+ }
+
+ if (n > 4) {
+ rftsub(n, a, nc, w + nw);
+ bitrv2(n, ip + 2, a);
+ }
+
+ cftsub(n, a, w);
+
+ for (j = 1; j < n; j += 2) {
+ a[j] = -a[j];
+ }
+ }
+
+ else {
+
+ if (n > 4) {
+ bitrv2(n, ip + 2, a);
+ }
+
+ cftsub(n, a, w);
+
+ if (n > 4) {
+ rftsub(n, a, nc, w + nw);
+ }
+
+ xi = a[0] - a[1];
+ a[0] += a[1];
+ a[1] = xi;
+ }
+}
+
+
+static void bitrv2(int n, int *ip, float *a)
+{
+ int j, j1, k, k1, l, m, m2;
+ float xr, xi;
+
+ ip[0] = 0;
+ l = n;
+ m = 1;
+
+ while ((m << 2) < l) {
+ l >>= 1;
+ for (j = 0; j < m; j++) {
+ ip[m + j] = ip[j] + l;
+ }
+ m <<= 1;
+ }
+
+ if ((m << 2) > l) {
+
+ for (k = 1; k < m; k++) {
+
+ for (j = 0; j <= k - 1; j++) {
+ j1 = (j << 1) + ip[k];
+ k1 = (k << 1) + ip[j];
+ xr = a[j1];
+ xi = a[j1 + 1];
+ a[j1] = a[k1];
+ a[j1 + 1] = a[k1 + 1];
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ }
+ }
+ }
+
+ else {
+ m2 = m << 1;
+
+ for (k = 1; k < m; k++) {
+
+ for (j = 0; j < k; j++) {
+ j1 = (j << 1) + ip[k];
+ k1 = (k << 1) + ip[j];
+ xr = a[j1];
+ xi = a[j1 + 1];
+ a[j1] = a[k1];
+ a[j1 + 1] = a[k1 + 1];
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ j1 += m2;
+ k1 += m2;
+ xr = a[j1];
+ xi = a[j1 + 1];
+ a[j1] = a[k1];
+ a[j1 + 1] = a[k1 + 1];
+ a[k1] = xr;
+ a[k1 + 1] = xi;
+ }
+ }
+ }
+}
+
+
+static void cftsub(int n, float *a, float *w)
+{
+ int j, j1, j2, j3, k, k1, ks, l, m;
+ float wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
+ float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
+
+ l = 2;
+
+ while ((l << 1) < n) {
+ m = l << 2;
+
+ for (j = 0; j <= l - 2; j += 2) {
+ j1 = j + l;
+ j2 = j1 + l;
+ j3 = j2 + l;
+ x0r = a[j] + a[j1];
+ x0i = a[j + 1] + a[j1 + 1];
+ x1r = a[j] - a[j1];
+ x1i = a[j + 1] - a[j1 + 1];
+ x2r = a[j2] + a[j3];
+ x2i = a[j2 + 1] + a[j3 + 1];
+ x3r = a[j2] - a[j3];
+ x3i = a[j2 + 1] - a[j3 + 1];
+ a[j] = x0r + x2r;
+ a[j + 1] = x0i + x2i;
+ a[j2] = x0r - x2r;
+ a[j2 + 1] = x0i - x2i;
+ a[j1] = x1r - x3i;
+ a[j1 + 1] = x1i + x3r;
+ a[j3] = x1r + x3i;
+ a[j3 + 1] = x1i - x3r;
+ }
+
+ if (m < n) {
+ wk1r = w[2];
+
+ for (j = m; j <= l + m - 2; j += 2) {
+ j1 = j + l;
+ j2 = j1 + l;
+ j3 = j2 + l;
+ x0r = a[j] + a[j1];
+ x0i = a[j + 1] + a[j1 + 1];
+ x1r = a[j] - a[j1];
+ x1i = a[j + 1] - a[j1 + 1];
+ x2r = a[j2] + a[j3];
+ x2i = a[j2 + 1] + a[j3 + 1];
+ x3r = a[j2] - a[j3];
+ x3i = a[j2 + 1] - a[j3 + 1];
+ a[j] = x0r + x2r;
+ a[j + 1] = x0i + x2i;
+ a[j2] = x2i - x0i;
+ a[j2 + 1] = x0r - x2r;
+ x0r = x1r - x3i;
+ x0i = x1i + x3r;
+ a[j1] = wk1r * (x0r - x0i);
+ a[j1 + 1] = wk1r * (x0r + x0i);
+ x0r = x3i + x1r;
+ x0i = x3r - x1i;
+ a[j3] = wk1r * (x0i - x0r);
+ a[j3 + 1] = wk1r * (x0i + x0r);
+ }
+
+ k1 = 1;
+ ks = -1;
+
+ for (k = (m << 1); k <= n - m; k += m) {
+ k1++;
+ ks = -ks;
+ wk1r = w[k1 << 1];
+ wk1i = w[(k1 << 1) + 1];
+ wk2r = ks * w[k1];
+ wk2i = w[k1 + ks];
+ wk3r = wk1r - 2 * wk2i * wk1i;
+ wk3i = 2 * wk2i * wk1r - wk1i;
+
+ for (j = k; j <= l + k - 2; j += 2) {
+ j1 = j + l;
+ j2 = j1 + l;
+ j3 = j2 + l;
+ x0r = a[j] + a[j1];
+ x0i = a[j + 1] + a[j1 + 1];
+ x1r = a[j] - a[j1];
+ x1i = a[j + 1] - a[j1 + 1];
+ x2r = a[j2] + a[j3];
+ x2i = a[j2 + 1] + a[j3 + 1];
+ x3r = a[j2] - a[j3];
+ x3i = a[j2 + 1] - a[j3 + 1];
+ a[j] = x0r + x2r;
+ a[j + 1] = x0i + x2i;
+ x0r -= x2r;
+ x0i -= x2i;
+ a[j2] = wk2r * x0r - wk2i * x0i;
+ a[j2 + 1] = wk2r * x0i + wk2i * x0r;
+ x0r = x1r - x3i;
+ x0i = x1i + x3r;
+ a[j1] = wk1r * x0r - wk1i * x0i;
+ a[j1 + 1] = wk1r * x0i + wk1i * x0r;
+ x0r = x1r + x3i;
+ x0i = x1i - x3r;
+ a[j3] = wk3r * x0r - wk3i * x0i;
+ a[j3 + 1] = wk3r * x0i + wk3i * x0r;
+ }
+ }
+ }
+
+ l = m;
+ }
+
+ if (l < n) {
+
+ for (j = 0; j <= l - 2; j += 2) {
+ j1 = j + l;
+ x0r = a[j] - a[j1];
+ x0i = a[j + 1] - a[j1 + 1];
+ a[j] += a[j1];
+ a[j + 1] += a[j1 + 1];
+ a[j1] = x0r;
+ a[j1 + 1] = x0i;
+ }
+ }
+}
+
+
+static void rftsub(int n, float *a, int nc, float *c)
+{
+ int j, k, kk, ks;
+ float wkr, wki, xr, xi, yr, yi;
+
+ ks = (nc << 2) / n;
+ kk = 0;
+
+ for (k = (n >> 1) - 2; k >= 2; k -= 2) {
+ j = n - k;
+ kk += ks;
+ wkr = 0.5 - c[kk];
+ wki = c[nc - kk];
+ xr = a[k] - a[j];
+ xi = a[k + 1] + a[j + 1];
+ yr = wkr * xr - wki * xi;
+ yi = wkr * xi + wki * xr;
+ a[k] -= yr;
+ a[k + 1] -= yi;
+ a[j] += yr;
+ a[j + 1] -= yi;
+ }
+}
+
+
+static void makewt(int nw, int *ip, float *w)
+{
+ int nwh, j;
+ float delta, x, y;
+
+ ip[0] = nw;
+ ip[1] = 1;
+ if (nw > 2) {
+ nwh = nw >> 1;
+ delta = atan(1.0) / nwh;
+ w[0] = 1;
+ w[1] = 0;
+ w[nwh] = cos(delta * nwh);
+ w[nwh + 1] = w[nwh];
+ for (j = 2; j <= nwh - 2; j += 2) {
+ x = cos(delta * j);
+ y = sin(delta * j);
+ w[j] = x;
+ w[j + 1] = y;
+ w[nw - j] = y;
+ w[nw - j + 1] = x;
+ }
+ bitrv2(nw, ip + 2, w);
+ }
+}
+
+
+static void makect(int nc, int *ip, float *c)
+{
+ int nch, j;
+ float delta;
+
+ ip[1] = nc;
+ if (nc > 1) {
+ nch = nc >> 1;
+ delta = atan(1.0) / nch;
+ c[0] = 0.5;
+ c[nch] = 0.5 * cos(delta * nch);
+ for (j = 1; j <= nch - 1; j++) {
+ c[j] = 0.5 * cos(delta * j);
+ c[nc - j] = 0.5 * sin(delta * j);
+ }
+ }
+}
+
diff --git a/externals/grill/fftease/src/fold.c b/externals/grill/fftease/src/fold.c
new file mode 100644
index 00000000..0ecee5d6
--- /dev/null
+++ b/externals/grill/fftease/src/fold.c
@@ -0,0 +1,24 @@
+/*
+ * multiply current input I by window W (both of length Nw);
+ * using modulus arithmetic, fold and rotate windowed input
+ * into output array O of (FFT) length N according to current
+ * input time n
+ */
+void fold( float *I, float *W, int Nw, float *O, int N, int n )
+{
+
+ int i;
+
+ for ( i = 0; i < N; i++ )
+ O[i] = 0.;
+
+ while ( n < 0 )
+ n += N;
+ n %= N;
+ for ( i = 0; i < Nw; i++ ) {
+ O[n] += I[i]*W[i];
+ if ( ++n == N )
+ n = 0;
+ }
+}
+
diff --git a/externals/grill/fftease/src/leanconvert.c b/externals/grill/fftease/src/leanconvert.c
new file mode 100644
index 00000000..36b1452a
--- /dev/null
+++ b/externals/grill/fftease/src/leanconvert.c
@@ -0,0 +1,19 @@
+#include "pv.h"
+
+void leanconvert( float *S, float *C, int N2 )
+{
+
+ int real, imag,
+ amp, phase;
+ float a, b;
+ int i;
+
+ for ( i = 0; i <= N2; i++ ) {
+ imag = phase = ( real = amp = i<<1 ) + 1;
+ a = ( i == N2 ? S[1] : S[real] );
+ b = ( i == 0 || i == N2 ? 0. : S[imag] );
+ C[amp] = hypot( a, b );
+ C[phase] = -atan2( b, a );
+ }
+}
+
diff --git a/externals/grill/fftease/src/leanunconvert.c b/externals/grill/fftease/src/leanunconvert.c
new file mode 100644
index 00000000..f8575168
--- /dev/null
+++ b/externals/grill/fftease/src/leanunconvert.c
@@ -0,0 +1,23 @@
+#include "pv.h"
+
+/* unconvert essentially undoes what convert does, i.e., it
+ turns N2+1 PAIRS of amplitude and frequency values in
+ C into N2 PAIR of complex spectrum data (in rfft format)
+ in output array S; sampling rate R and interpolation factor
+ I are used to recompute phase values from frequencies */
+
+void leanunconvert( float *C, float *S, int N2 )
+{
+ int real, imag,
+ amp, phase;
+ float a, b;
+ register int i;
+
+ for ( i = 0; i <= N2; i++ ) {
+ imag = phase = ( real = amp = i<<1 ) + 1;
+ S[real] = *(C+amp) * cos( *(C+phase) );
+ if ( i != N2 )
+ S[imag] = -*(C+amp) * sin( *(C+phase) );
+ }
+}
+
diff --git a/externals/grill/fftease/src/main.cpp b/externals/grill/fftease/src/main.cpp
new file mode 100644
index 00000000..1d627cf2
--- /dev/null
+++ b/externals/grill/fftease/src/main.cpp
@@ -0,0 +1,60 @@
+/*
+
+FFTease - A set of Live Spectral Processors
+Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
+
+This flext port is based on the jMax port of Christian Klippel
+
+Copyright (c)Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+#include "main.h"
+
+
+// Initialization function for xsample library
+V lib_setup()
+{
+ post("");
+ post("-------------------------------------------------------");
+ post("FFTease - A set of Live Spectral Processors");
+ post("Originally written by Eric Lyon and Christopher Penrose");
+ post("for the MAX/MSP platform.");
+ post("");
+ post("flext port done by Thomas Grill, (C)2003");
+ post("-------------------------------------------------------");
+ post("");
+
+ // call the objects' setup routines
+ FLEXT_DSP_SETUP(burrow);
+
+/*
+ FLEXT_DSP_SETUP(cross);
+ FLEXT_DSP_SETUP(dentist);
+ FLEXT_DSP_SETUP(disarray);
+ FLEXT_DSP_SETUP(drown);
+ FLEXT_DSP_SETUP(ether);
+
+ FLEXT_DSP_SETUP(morphine);
+ FLEXT_DSP_SETUP(pvcompand);
+ FLEXT_DSP_SETUP(pvoc);
+ FLEXT_DSP_SETUP(scrape);
+ FLEXT_DSP_SETUP(shapee);
+
+ FLEXT_DSP_SETUP(swinger);
+ FLEXT_DSP_SETUP(taint);
+ FLEXT_DSP_SETUP(thresher);
+ FLEXT_DSP_SETUP(vacancy);
+ FLEXT_DSP_SETUP(xsyn);
+*/
+
+#if FLEXT_SYS == FLEXT_SYS_MAX
+// finder_addclass((C *)"FFTease",(C *)"xxxxx");
+#endif
+}
+
+// setup the library
+FLEXT_LIB_SETUP(fftease,lib_setup)
+
diff --git a/externals/grill/fftease/src/main.h b/externals/grill/fftease/src/main.h
new file mode 100644
index 00000000..c0fb56f8
--- /dev/null
+++ b/externals/grill/fftease/src/main.h
@@ -0,0 +1,40 @@
+/*
+
+FFTease - A set of Live Spectral Processors
+Originally written by Eric Lyon and Christopher Penrose for the Max/MSP platform
+
+This flext port is based on the jMax port of Christian Klippel
+
+Copyright (c)Thomas Grill (xovo@gmx.net)
+For information on usage and redistribution, and for a DISCLAIMER OF ALL
+WARRANTIES, see the file, "license.txt," in this distribution.
+
+*/
+
+#ifndef __FFTEASE_H
+#define __FFTEASE_H
+
+#define FFTEASE_VERSION "0.0.1"
+
+#define FLEXT_ATTRIBUTES 1
+
+#include <flext.h>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
+#error You need at least flext version 0.4.1
+#endif
+
+#include "pv.h"
+
+// lazy me
+#define F float
+#define D double
+#define I int
+#define L long
+#define C char
+#define V void
+#define BL bool
+#define S t_sample
+
+
+#endif
diff --git a/externals/grill/fftease/src/makewindows.c b/externals/grill/fftease/src/makewindows.c
new file mode 100644
index 00000000..1287390e
--- /dev/null
+++ b/externals/grill/fftease/src/makewindows.c
@@ -0,0 +1,202 @@
+#include "pv.h"
+#include "math.h"
+
+/*
+ * make balanced pair of analysis (A) and synthesis (S) windows;
+ * window lengths are Nw, FFT length is N, synthesis interpolation
+ * factor is I, and osc is true (1) if oscillator bank resynthesis
+ * is specified
+ */
+void makewindows( float *H, float *A, float *S, int Nw, int N, int I, int osc )
+{
+ int i ;
+ float sum ;
+float PI, TWOPI;
+
+PI = 3.141592653589793115997963468544185161590576171875;
+TWOPI = 6.28318530717958623199592693708837032318115234375;
+
+/*
+ * basic Hamming windows
+ */
+ for ( i = 0 ; i < Nw ; i++ )
+ H[i] = A[i] = S[i] = 0.54 - 0.46*cos( TWOPI*i/(Nw - 1) ) ;
+/*
+ * when Nw > N, also apply interpolating (sinc) windows to
+ * ensure that window are 0 at increments of N (the FFT length)
+ * away from the center of the analysis window and of I away
+ * from the center of the synthesis window
+ */
+ if ( Nw > N ) {
+ float x ;
+
+/*
+ * take care to create symmetrical windows
+ */
+ x = -(Nw - 1)/2. ;
+ for ( i = 0 ; i < Nw ; i++, x += 1. )
+ if ( x != 0. ) {
+ A[i] *= N*sin( PI*x/N )/(PI*x) ;
+ if ( I )
+ S[i] *= I*sin( PI*x/I )/(PI*x) ;
+ }
+ }
+/*
+ * normalize windows for unity gain across unmodified
+ * analysis-synthesis procedure
+ */
+ for ( sum = i = 0 ; i < Nw ; i++ )
+ sum += A[i] ;
+
+ for ( i = 0 ; i < Nw ; i++ ) {
+ float afac = 2./sum ;
+ float sfac = Nw > N ? 1./afac : afac ;
+ A[i] *= afac ;
+ S[i] *= sfac ;
+ }
+
+ if ( Nw <= N && I ) {
+ for ( sum = i = 0 ; i < Nw ; i += I )
+ sum += S[i]*S[i] ;
+ for ( sum = 1./sum, i = 0 ; i < Nw ; i++ )
+ S[i] *= sum ;
+ }
+}
+
+void makehamming( float *H, float *A, float *S, int Nw, int N, int I, int osc,int odd )
+{
+ int i;
+ float sum ;
+float PI, TWOPI;
+
+PI = 3.141592653589793115997963468544185161590576171875;
+TWOPI = 6.28318530717958623199592693708837032318115234375;
+
+/*
+ * basic Hamming windows
+ */
+
+
+ if (odd) {
+ for ( i = 0 ; i < Nw ; i++ )
+ H[i] = A[i] = S[i] = sqrt(0.54 - 0.46*cos( TWOPI*i/(Nw - 1) ));
+ }
+
+ else {
+
+ for ( i = 0 ; i < Nw ; i++ )
+ H[i] = A[i] = S[i] = 0.54 - 0.46*cos( TWOPI*i/(Nw - 1) );
+
+ }
+
+/*
+ * when Nw > N, also apply interpolating (sinc) windows to
+ * ensure that window are 0 at increments of N (the FFT length)
+ * away from the center of the analysis window and of I away
+ * from the center of the synthesis window
+ */
+ if ( Nw > N ) {
+ float x ;
+
+/*
+ * take care to create symmetrical windows
+ */
+ x = -(Nw - 1)/2. ;
+ for ( i = 0 ; i < Nw ; i++, x += 1. )
+ if ( x != 0. ) {
+ A[i] *= N*sin( PI*x/N )/(PI*x) ;
+ if ( I )
+ S[i] *= I*sin( PI*x/I )/(PI*x) ;
+ }
+ }
+/*
+ * normalize windows for unity gain across unmodified
+ * analysis-synthesis procedure
+ */
+ for ( sum = i = 0 ; i < Nw ; i++ )
+ sum += A[i] ;
+
+ for ( i = 0 ; i < Nw ; i++ ) {
+ float afac = 2./sum ;
+ float sfac = Nw > N ? 1./afac : afac ;
+ A[i] *= afac ;
+ S[i] *= sfac ;
+ }
+
+ if ( Nw <= N && I ) {
+ for ( sum = i = 0 ; i < Nw ; i += I )
+ sum += S[i]*S[i] ;
+ for ( sum = 1./sum, i = 0 ; i < Nw ; i++ )
+ S[i] *= sum ;
+ }
+}
+
+
+void makehanning( float *H, float *A, float *S, int Nw, int N, int I, int osc, int odd )
+{
+ int i;
+ float sum ;
+float PI, TWOPI;
+
+PI = 3.141592653589793115997963468544185161590576171875;
+TWOPI = 6.28318530717958623199592693708837032318115234375;
+
+/*
+ * basic Hanning windows
+ */
+
+
+ if (odd) {
+ for ( i = 0 ; i < Nw ; i++ )
+ H[i] = A[i] = S[i] = sqrt(0.5 * (1. + cos(PI + TWOPI * i / (Nw - 1))));
+ }
+
+ else {
+
+ for ( i = 0 ; i < Nw ; i++ )
+ H[i] = A[i] = S[i] = 0.5 * (1. + cos(PI + TWOPI * i / (Nw - 1)));
+
+ }
+
+/*
+ * when Nw > N, also apply interpolating (sinc) windows to
+ * ensure that window are 0 at increments of N (the FFT length)
+ * away from the center of the analysis window and of I away
+ * from the center of the synthesis window
+ */
+ if ( Nw > N ) {
+ float x ;
+
+/*
+ * take care to create symmetrical windows
+ */
+ x = -(Nw - 1)/2. ;
+ for ( i = 0 ; i < Nw ; i++, x += 1. )
+ if ( x != 0. ) {
+ A[i] *= N*sin( PI*x/N )/(PI*x) ;
+ if ( I )
+ S[i] *= I*sin( PI*x/I )/(PI*x) ;
+ }
+ }
+/*
+ * normalize windows for unity gain across unmodified
+ * analysis-synthesis procedure
+ */
+ for ( sum = i = 0 ; i < Nw ; i++ )
+ sum += A[i] ;
+
+ for ( i = 0 ; i < Nw ; i++ ) {
+ float afac = 2./sum ;
+ float sfac = Nw > N ? 1./afac : afac ;
+ A[i] *= afac ;
+ S[i] *= sfac ;
+ }
+
+ if ( Nw <= N && I ) {
+ for ( sum = i = 0 ; i < Nw ; i += I )
+ sum += S[i]*S[i] ;
+ for ( sum = 1./sum, i = 0 ; i < Nw ; i++ )
+ S[i] *= sum ;
+ }
+}
+
diff --git a/externals/grill/fftease/src/overlapadd.c b/externals/grill/fftease/src/overlapadd.c
new file mode 100644
index 00000000..7e832a00
--- /dev/null
+++ b/externals/grill/fftease/src/overlapadd.c
@@ -0,0 +1,17 @@
+/*
+ * input I is a folded spectrum of length N; output O and
+ * synthesis window W are of length Nw--overlap-add windowed,
+ * unrotated, unfolded input data into output O
+ */
+void overlapadd( float *I, int N, float *W, float *O, int Nw, int n )
+{
+ int i ;
+ while ( n < 0 )
+ n += N ;
+ n %= N ;
+ for ( i = 0 ; i < Nw ; i++ ) {
+ O[i] += I[n]*W[i] ;
+ if ( ++n == N )
+ n = 0 ;
+ }
+}
diff --git a/externals/grill/fftease/src/pv.h b/externals/grill/fftease/src/pv.h
new file mode 100644
index 00000000..b945e72e
--- /dev/null
+++ b/externals/grill/fftease/src/pv.h
@@ -0,0 +1,60 @@
+/*
+ * This file is part of the pv-lib
+ *
+ * The pv-lib can be used by everyone as desired
+ *
+ * (c) Eric Lyon and Christopher Penrose
+ */
+
+#include <stdio.h>
+
+// -------------------------------------
+// modifications by Thomas Grill
+
+//#include <fts/fts.h>
+#include <math.h>
+
+#ifdef _MSC_VER
+#pragma warning(disable: 4305)
+#pragma warning(disable: 4244)
+#pragma warning(disable: 4101)
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// -------------------------------------
+
+
+#define FORWARD 1
+#define INVERSE 0
+
+typedef struct {
+ float min;
+ float max;
+} Bound;
+
+void init_rdft(int n, int *ip, float *w);
+void rdft(int n, int isgn, float *a, int *ip, float *w);
+void fold( float *I, float *W, int Nw, float *O, int N, int n );
+void overlapadd(float *I, int N, float *W, float *O, int Nw, int n );
+void makehanning( float *H, float *A, float *S, int Nw, int N, int I, int osc, int odd );
+void makewindows( float *H, float *A, float *S, int Nw, int N, int I, int osc );
+void leanconvert( float *S, float *C, int N2 );
+void leanunconvert( float *C, float *S, int N2 );
+void rfft( float *x, int N, int forward );
+void cfft( float *x, int NC, int forward );
+void convert_new(float *S, float *C, int N2, float *lastphase, float fundamental, float factor );
+void convert(float *S, float *C, int N2, float *lastphase, float fundamental, float factor );
+void unconvert(float *C, float *S, int N2, float *lastphase, float fundamental, float factor );
+
+
+// -------------------------------------
+
+#ifdef __cplusplus
+}
+#endif
+
+// -------------------------------------
+
diff --git a/externals/grill/fftease/src/unconvert.c b/externals/grill/fftease/src/unconvert.c
new file mode 100644
index 00000000..54bb6ca1
--- /dev/null
+++ b/externals/grill/fftease/src/unconvert.c
@@ -0,0 +1,36 @@
+#include "pv.h"
+
+
+
+void unconvert(float *C, float *S, int N2, float *lastphase, float fundamental, float factor )
+{
+ int i,
+ real,
+ imag,
+ amp,
+ freq;
+ float mag,
+ phase;
+
+ for ( i = 0; i <= N2; i++ ) {
+
+ imag = freq = ( real = amp = i<<1 ) + 1;
+
+ if ( i == N2 )
+ real = 1;
+
+ mag = C[amp];
+ lastphase[i] += C[freq] - i*fundamental;
+ phase = lastphase[i]*factor;
+ S[real] = mag*cos( phase );
+
+ if ( i != N2 )
+ S[imag] = -mag*sin( phase );
+ /*
+ if( i == 10 ) {
+ fprintf(stderr,"unconvert: amp: %f freq: %f funda %f fac %f\n", C[amp],C[freq],fundamental,factor);
+ }
+ */
+ }
+
+}