From 05a9e3254454715e09b78f7a7ab788b02b2cbe60 Mon Sep 17 00:00:00 2001 From: musil Date: Fri, 8 Dec 2006 07:47:49 +0000 Subject: makefile help repaired spec2_sqrt~ svn path=/trunk/externals/iem/iem_spec2/; revision=6724 --- GnuGPL.txt | 340 ++++++++++++++++++++++ LICENSE.txt | 28 ++ READ_ME.txt | 20 ++ help/spec2_1p1z_freq~-help.pd | 92 ++++++ help/spec2_1p1z_time~-help.pd | 80 ++++++ help/spec2_abs~-help.pd | 14 + help/spec2_add_scalar~-help.pd | 14 + help/spec2_add~-help.pd | 13 + help/spec2_block_delay~-help.pd | 69 +++++ help/spec2_clip_max~-help.pd | 36 +++ help/spec2_clip_min~-help.pd | 36 +++ help/spec2_dbtopow~-help.pd | 14 + help/spec2_dbtorms~-help.pd | 14 + help/spec2_matrix_bundle_stat~-help.pd | 153 ++++++++++ help/spec2_mul_scalar~-help.pd | 14 + help/spec2_mul~-help.pd | 14 + help/spec2_powtodb~-help.pd | 14 + help/spec2_rmstodb~-help.pd | 14 + help/spec2_shift~-help.pd | 40 +++ help/spec2_sqrt~-help.pd | 31 ++ help/spec2_stretch~-help.pd | 42 +++ help/spec2_sub~-help.pd | 14 + help/spec2_sum~-help.pd | 67 +++++ help/spec2_tab_conv~-help.pd | 185 ++++++++++++ help/spec2_tabreceive_enable~-help.pd | 139 +++++++++ help/spec2_tabreceive~-help.pd | 125 ++++++++ src/iem_spec2.c | 76 +++++ src/iem_spec2.dsp | 85 ++++++ src/iem_spec2.dsw | 29 ++ src/iem_spec2.h | 11 + src/iemlib.h | 108 +++++++ src/makefile | 69 +++++ src/makefile_linux | 69 +++++ src/makefile_win | 59 ++++ src/spec2_1p1z_freq~.c | 504 +++++++++++++++++++++++++++++++++ src/spec2_1p1z_time~.c | 215 ++++++++++++++ src/spec2_abs~.c | 92 ++++++ src/spec2_add_scalar~.c | 106 +++++++ src/spec2_add~.c | 101 +++++++ src/spec2_block_delay~.c | 157 ++++++++++ src/spec2_clip_max~.c | 167 +++++++++++ src/spec2_clip_min~.c | 167 +++++++++++ src/spec2_dbtopow~.c | 67 +++++ src/spec2_dbtorms~.c | 67 +++++ src/spec2_matrix_bundle_stat~.c | 285 +++++++++++++++++++ src/spec2_mul_scalar~.c | 105 +++++++ src/spec2_mul~.c | 100 +++++++ src/spec2_powtodb~.c | 66 +++++ src/spec2_rmstodb~.c | 67 +++++ src/spec2_shift~.c | 107 +++++++ src/spec2_sqrt~.c | 93 ++++++ src/spec2_stretch~.c | 105 +++++++ src/spec2_sub~.c | 100 +++++++ src/spec2_sum~.c | 120 ++++++++ src/spec2_tab_conv~.c | 150 ++++++++++ src/spec2_tabreceive_enable~.c | 166 +++++++++++ src/spec2_tabreceive~.c | 147 ++++++++++ 57 files changed, 5382 insertions(+) create mode 100644 GnuGPL.txt create mode 100644 LICENSE.txt create mode 100644 READ_ME.txt create mode 100644 help/spec2_1p1z_freq~-help.pd create mode 100644 help/spec2_1p1z_time~-help.pd create mode 100644 help/spec2_abs~-help.pd create mode 100644 help/spec2_add_scalar~-help.pd create mode 100644 help/spec2_add~-help.pd create mode 100644 help/spec2_block_delay~-help.pd create mode 100644 help/spec2_clip_max~-help.pd create mode 100644 help/spec2_clip_min~-help.pd create mode 100644 help/spec2_dbtopow~-help.pd create mode 100644 help/spec2_dbtorms~-help.pd create mode 100644 help/spec2_matrix_bundle_stat~-help.pd create mode 100644 help/spec2_mul_scalar~-help.pd create mode 100644 help/spec2_mul~-help.pd create mode 100644 help/spec2_powtodb~-help.pd create mode 100644 help/spec2_rmstodb~-help.pd create mode 100644 help/spec2_shift~-help.pd create mode 100644 help/spec2_sqrt~-help.pd create mode 100644 help/spec2_stretch~-help.pd create mode 100644 help/spec2_sub~-help.pd create mode 100644 help/spec2_sum~-help.pd create mode 100644 help/spec2_tab_conv~-help.pd create mode 100644 help/spec2_tabreceive_enable~-help.pd create mode 100644 help/spec2_tabreceive~-help.pd create mode 100644 src/iem_spec2.c create mode 100644 src/iem_spec2.dsp create mode 100644 src/iem_spec2.dsw create mode 100644 src/iem_spec2.h create mode 100644 src/iemlib.h create mode 100644 src/makefile create mode 100644 src/makefile_linux create mode 100644 src/makefile_win create mode 100644 src/spec2_1p1z_freq~.c create mode 100644 src/spec2_1p1z_time~.c create mode 100644 src/spec2_abs~.c create mode 100644 src/spec2_add_scalar~.c create mode 100644 src/spec2_add~.c create mode 100644 src/spec2_block_delay~.c create mode 100644 src/spec2_clip_max~.c create mode 100644 src/spec2_clip_min~.c create mode 100644 src/spec2_dbtopow~.c create mode 100644 src/spec2_dbtorms~.c create mode 100644 src/spec2_matrix_bundle_stat~.c create mode 100644 src/spec2_mul_scalar~.c create mode 100644 src/spec2_mul~.c create mode 100644 src/spec2_powtodb~.c create mode 100644 src/spec2_rmstodb~.c create mode 100644 src/spec2_shift~.c create mode 100644 src/spec2_sqrt~.c create mode 100644 src/spec2_stretch~.c create mode 100644 src/spec2_sub~.c create mode 100644 src/spec2_sum~.c create mode 100644 src/spec2_tab_conv~.c create mode 100644 src/spec2_tabreceive_enable~.c create mode 100644 src/spec2_tabreceive~.c diff --git a/GnuGPL.txt b/GnuGPL.txt new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/GnuGPL.txt @@ -0,0 +1,340 @@ + 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. + + + Copyright (C) + + 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) year 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. + + , 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/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..1946bc3 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,28 @@ +iem_spec2 - dynamic library for pd; calculates a lot of pd signal objects + only with a vectorsize of blocksize/2 + 1 + +Copyright (C) 2000-2006 Thomas MUSIL [musil_at_iem.at] + +IEM - Institute of Electronic Music and Acoustics, Graz +Inffeldgasse 10/3, 8010 Graz, Austria +http://iem.at + + + + 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 ( GnuGPL.txt ). + (e.g. http://www.gnu.org/copyleft/gpl.html) + + 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Graz, 15 Nov. 2006 + Thomas Musil \ No newline at end of file diff --git a/READ_ME.txt b/READ_ME.txt new file mode 100644 index 0000000..045c7d3 --- /dev/null +++ b/READ_ME.txt @@ -0,0 +1,20 @@ +This library extends the performance of miller puckette's pure data (pd). + +iem_spec2 is written by Thomas Musil from IEM Graz Austria + and it is compatible to miller puckette's pd-0.37-3 to pd-0.39-2. +see also LICENCE.txt, GnuGPL.txt. + +iem_spec2 contains 23 objects: +all of them calculate only blocksize/2 + 1 samples of a signal vector; + +spec2_abs~, spec2+~, spec2*~, spec2-~, spec2_dbtopow~, spec2_dbtorms~, +spec2_powtodb~, spec2_rmstodb~, spec2_sqrt~, spec2_tabreceive~ +do the same as objects without spec2_ prefix; + +the other objects are: spec2_1p1z_freq~, spec2_1p1z_time~, spec2_+s~, +spec2_block_delay~, spec2_clip_max~, spec2_clip_min~, +spec2_matrix_bundle_stat~, spec2_*s~, spec2_shift~, spec2_stretch~, +spec2_sum~, spec2_tab_conv~, spec2_tabreceive_enable~. + + + diff --git a/help/spec2_1p1z_freq~-help.pd b/help/spec2_1p1z_freq~-help.pd new file mode 100644 index 0000000..8eb269c --- /dev/null +++ b/help/spec2_1p1z_freq~-help.pd @@ -0,0 +1,92 @@ +#N canvas 20 32 724 388 10; +#X obj 42 70 dsp; +#X obj 42 47 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X floatatom 42 111 5 0 0 0 - - -; +#X floatatom 55 94 5 0 0 0 - - -; +#N canvas 0 0 450 300 graph1 0; +#X array scope 256 float 0; +#X coords 0 100 255 0 300 200 1; +#X restore 346 82 graph; +#X text 130 39 iem_spec2 calculates only blocksize/2 + 1 samples of +block; +#N canvas 0 0 633 408 tables 0; +#N canvas 0 0 450 300 graph1 0; +#X array hann 259 float 0; +#X coords 0 1 258 -1 200 140 1; +#X restore 30 31 graph; +#X obj 246 34 loadbang; +#X msg 246 55 \; hann cosinesum 256 0.5 -0.5; +#X connect 1 0 2 0; +#X restore 149 82 pd tables; +#X obj 42 145 noise~; +#X obj 237 93 osc~ 11025; +#X msg 292 58 0; +#X obj 42 169 bpq2~ 7000 6 100; +#X msg 206 187 1 0 0; +#X msg 205 121 0.1 0 0.9; +#X text 90 302 IEM KUG; +#X text 74 290 musil; +#X text 104 290 @; +#X text 110 290 iem.at; +#X text 73 312 Graz \, Austria; +#X text 25 279 (c) Thomas Musil 2000 - 2006; +#X text 18 5 spec2_1p1z_freq~; +#N canvas 190 113 569 461 spec_analyse_by_1p1z_freq 0; +#X obj 100 51 inlet~; +#X obj 352 46 block~ 256 2; +#X obj 102 156 rfft~; +#X obj 101 108 *~; +#X obj 298 46 inlet; +#X obj 114 86 spec2_tabreceive~ hann; +#X obj 97 186 *~; +#X obj 124 186 *~; +#X obj 104 211 +~; +#X obj 104 266 powtodb~; +#X obj 104 291 tabsend~ scope; +#X obj 180 174 /; +#X obj 101 131 *~ 0.032; +#X msg 189 149 1 32; +#X obj 188 127 loadbang; +#X obj 300 225 spec2_1p1z_freq~ 0.5 0 0.5; +#X connect 0 0 3 0; +#X connect 2 0 6 0; +#X connect 2 0 6 1; +#X connect 2 1 7 0; +#X connect 2 1 7 1; +#X connect 3 0 12 0; +#X connect 4 0 15 0; +#X connect 5 0 3 1; +#X connect 6 0 8 0; +#X connect 7 0 8 1; +#X connect 8 0 15 0; +#X connect 9 0 10 0; +#X connect 11 0 12 1; +#X connect 12 0 2 0; +#X connect 13 0 11 0; +#X connect 14 0 13 0; +#X connect 15 0 9 0; +#X restore 42 214 pd spec_analyse_by_1p1z_freq; +#X msg 205 143 0.3 0 0.7; +#X msg 205 165 0.5 0 0.5; +#X msg 105 123 6; +#X msg 107 143 3; +#X msg 134 122 16; +#X msg 164 121 66; +#X text 168 3 filter the spectrum with a 1p1z-IIR filter; +#X text 169 14 first time from the left to right; +#X text 169 26 second time from the right to left; +#X connect 0 0 2 0; +#X connect 0 1 3 0; +#X connect 1 0 0 0; +#X connect 7 0 10 0; +#X connect 9 0 8 1; +#X connect 10 0 20 0; +#X connect 11 0 20 1; +#X connect 12 0 20 1; +#X connect 21 0 20 1; +#X connect 22 0 20 1; +#X connect 23 0 10 2; +#X connect 24 0 10 2; +#X connect 25 0 10 2; +#X connect 26 0 10 2; diff --git a/help/spec2_1p1z_time~-help.pd b/help/spec2_1p1z_time~-help.pd new file mode 100644 index 0000000..f583f4e --- /dev/null +++ b/help/spec2_1p1z_time~-help.pd @@ -0,0 +1,80 @@ +#N canvas 20 32 712 376 10; +#X obj 42 70 dsp; +#X obj 42 47 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X floatatom 42 111 5 0 0 0 - - -; +#X floatatom 55 94 5 0 0 0 - - -; +#N canvas 0 0 450 300 graph1 0; +#X array scope 256 float 0; +#X coords 0 100 255 0 300 200 1; +#X restore 346 82 graph; +#X text 18 5 spec2_1p1z_time~; +#X text 132 20 iem_spec2 calculates only blocksize/2 + 1 samples of +block; +#N canvas 0 0 629 404 tables 0; +#N canvas 0 0 450 300 graph1 0; +#X array hann 259 float 0; +#X coords 0 1 258 -1 200 140 1; +#X restore 30 31 graph; +#X obj 246 34 loadbang; +#X msg 246 55 \; hann cosinesum 256 0.5 -0.5; +#X connect 1 0 2 0; +#X restore 149 82 pd tables; +#X obj 42 145 noise~; +#X obj 237 93 osc~ 11025; +#X msg 292 58 0; +#X obj 42 169 bpq2~ 7000 6 100; +#X msg 201 187 1 0 0; +#X msg 200 165 0.1 0 0.9; +#X msg 200 143 0.01 0 0.99; +#N canvas 190 113 557 449 spec_analyse_by_1p1z_time 0; +#X obj 100 51 inlet~; +#X obj 352 46 block~ 256 2; +#X obj 102 156 rfft~; +#X obj 101 108 *~; +#X obj 300 225 spec2_1p1z_time~ 0.5 0 0.5; +#X obj 298 46 inlet; +#X obj 114 86 spec2_tabreceive~ hann; +#X obj 97 186 *~; +#X obj 124 186 *~; +#X obj 104 211 +~; +#X obj 104 266 powtodb~; +#X obj 104 291 tabsend~ scope; +#X obj 180 174 /; +#X obj 101 131 *~ 0.032; +#X msg 189 149 1 32; +#X obj 188 127 loadbang; +#X connect 0 0 3 0; +#X connect 2 0 7 0; +#X connect 2 0 7 1; +#X connect 2 1 8 0; +#X connect 2 1 8 1; +#X connect 3 0 13 0; +#X connect 4 0 10 0; +#X connect 5 0 4 0; +#X connect 6 0 3 1; +#X connect 7 0 9 0; +#X connect 8 0 9 1; +#X connect 9 0 4 0; +#X connect 10 0 11 0; +#X connect 12 0 13 1; +#X connect 13 0 2 0; +#X connect 14 0 12 0; +#X connect 15 0 14 0; +#X restore 42 214 pd spec_analyse_by_1p1z_time; +#X text 90 302 IEM KUG; +#X text 74 290 musil; +#X text 104 290 @; +#X text 110 290 iem.at; +#X text 73 312 Graz \, Austria; +#X text 25 279 (c) Thomas Musil 2000 - 2006; +#X text 168 3 makes a feedback of the spectrum; +#X connect 0 0 2 0; +#X connect 0 1 3 0; +#X connect 1 0 0 0; +#X connect 8 0 11 0; +#X connect 10 0 9 1; +#X connect 11 0 15 0; +#X connect 12 0 15 1; +#X connect 13 0 15 1; +#X connect 14 0 15 1; diff --git a/help/spec2_abs~-help.pd b/help/spec2_abs~-help.pd new file mode 100644 index 0000000..be08be8 --- /dev/null +++ b/help/spec2_abs~-help.pd @@ -0,0 +1,14 @@ +#N canvas 52 28 470 264 10; +#X text 102 53 no arg; +#X text 83 169 IEM KUG; +#X text 67 157 musil; +#X text 97 157 @; +#X text 103 157 iem.at; +#X text 66 179 Graz \, Austria; +#X text 18 146 (c) Thomas Musil 2000 - 2006; +#X text 183 49 like; +#X obj 29 52 spec2_abs~; +#X text 30 16 spec2_abs~; +#X obj 226 52 abs~; +#X text 109 25 with (blocksize/2 + 1) bins; +#X text 106 14 take absolute value of a signal spectrum; diff --git a/help/spec2_add_scalar~-help.pd b/help/spec2_add_scalar~-help.pd new file mode 100644 index 0000000..02cedca --- /dev/null +++ b/help/spec2_add_scalar~-help.pd @@ -0,0 +1,14 @@ +#N canvas 52 28 575 275 10; +#X text 83 169 IEM KUG; +#X text 67 157 musil; +#X text 97 157 @; +#X text 103 157 iem.at; +#X text 66 179 Graz \, Austria; +#X text 18 146 (c) Thomas Musil 2000 - 2006; +#X text 361 51 like; +#X obj 412 52 +~ 0; +#X text 134 53 1.arg: value to add; +#X text 106 14 add a value to a signal spectrum with (blocksize/2 + +1) bins; +#X obj 30 52 spec2+s~ 0; +#X text 30 14 spec2+s~; diff --git a/help/spec2_add~-help.pd b/help/spec2_add~-help.pd new file mode 100644 index 0000000..c8a4a18 --- /dev/null +++ b/help/spec2_add~-help.pd @@ -0,0 +1,13 @@ +#N canvas 52 28 474 268 10; +#X obj 30 52 spec2+~; +#X text 86 51 no arg; +#X text 83 169 IEM KUG; +#X text 67 157 musil; +#X text 97 157 @; +#X text 103 157 iem.at; +#X text 66 179 Graz \, Austria; +#X text 18 146 (c) Thomas Musil 2000 - 2006; +#X text 30 15 spec2+~; +#X text 183 49 like; +#X obj 234 50 +~; +#X text 106 14 add 2 signal spectras with (blocksize/2 + 1) bins; diff --git a/help/spec2_block_delay~-help.pd b/help/spec2_block_delay~-help.pd new file mode 100644 index 0000000..fa8f493 --- /dev/null +++ b/help/spec2_block_delay~-help.pd @@ -0,0 +1,69 @@ +#N canvas 90 35 769 482 10; +#X obj 42 70 dsp; +#X obj 42 47 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X floatatom 42 111 5 0 0 0 - - -; +#X floatatom 55 94 5 0 0 0 - - -; +#N canvas 0 0 450 300 graph1 0; +#X array array101 192 float 0; +#X coords 0 1 191 -1 382 128 1; +#X restore 319 224 graph; +#X obj 46 156 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 19 4 spec2_block_delay~; +#X text 202 216 no arguments; +#X text 90 402 IEM KUG; +#X text 74 390 musil; +#X text 104 390 @; +#X text 110 390 iem.at; +#X text 73 412 Graz \, Austria; +#X text 25 379 (c) Thomas Musil 2000 - 2006; +#X obj 84 217 spec2_block_delay~; +#X text 146 21 but copy only (blocksize/2 + 1) samples; +#N canvas 0 0 470 320 init 0; +#X obj 52 43 t f f; +#X obj 50 -10 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 43 77 + 0.5; +#X obj 52 -36 loadbang; +#X obj 50 11 for++ -64 63; +#X obj 56 107 / 64; +#X obj 101 105 + 64; +#X obj 57 147 tabwrite array100; +#X msg 161 -9 \; array100 xticks 0 32 2; +#X msg 174 75 \; array101 xticks 0 32 2; +#X msg 177 125 \; array101 xlabel -1.1 0 32 64 96 128 160 192; +#X msg 165 30 \; array100 xlabel -1.1 0 32 64 96 128; +#X connect 0 0 2 0; +#X connect 0 1 6 0; +#X connect 1 0 4 0; +#X connect 2 0 5 0; +#X connect 3 0 1 0; +#X connect 3 0 8 0; +#X connect 3 0 11 0; +#X connect 3 0 9 0; +#X connect 3 0 10 0; +#X connect 4 0 0 0; +#X connect 5 0 7 0; +#X connect 6 0 7 1; +#X restore 323 394 pd init; +#N canvas 0 0 450 300 graph1 0; +#X array array100 128 float 0; +#X coords 0 1 127 -1 256 128 1; +#X restore 319 62 graph; +#X obj 84 192 tabplay~ array100; +#X obj 46 252 tabwrite~ array101; +#X text 161 4 delay spectrum around blocksize samples; +#X text 484 372 0 .. 32: preceding signal (== 0); +#X text 480 385 33 .. 63: ignored input ramp; +#X text 481 399 64 .. 96: delayed ramp signal; +#X text 477 412 97 .. 127: ignored input ramp; +#X text 473 425 128 .. 160: delayed ramp signal; +#X text 471 438 161 .. 191: ignored input signal (== 0); +#X connect 0 0 2 0; +#X connect 0 1 3 0; +#X connect 1 0 0 0; +#X connect 5 0 18 0; +#X connect 5 0 19 0; +#X connect 14 0 19 0; +#X connect 18 0 14 0; diff --git a/help/spec2_clip_max~-help.pd b/help/spec2_clip_max~-help.pd new file mode 100644 index 0000000..e2871b9 --- /dev/null +++ b/help/spec2_clip_max~-help.pd @@ -0,0 +1,36 @@ +#N canvas 52 28 606 339 10; +#X text 230 141 no arg; +#X text 81 272 IEM KUG; +#X text 65 260 musil; +#X text 95 260 @; +#X text 101 260 iem.at; +#X text 64 282 Graz \, Austria; +#X text 16 249 (c) Thomas Musil 2000 - 2006; +#X text 351 143 like; +#X obj 128 141 spec2_clip_max~; +#X obj 128 118 sig~; +#X floatatom 128 98 5 0 0 0 - - -; +#X obj 212 118 sig~; +#X floatatom 212 98 5 0 0 0 - - -; +#X obj 401 144 min~; +#X text 9 6 spec2_clip_max~; +#X obj 21 61 dsp; +#X obj 21 38 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 21 107 5 0 0 0 - - -; +#X floatatom 34 86 5 0 0 0 - - -; +#X text 120 28 iem_spec2 calculates only blocksize/2 + 1 samples of +block; +#X text 139 9 restrict a signal to lie lower than max limit; +#X obj 84 179 print~; +#X obj 85 159 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X connect 8 0 21 0; +#X connect 9 0 8 0; +#X connect 10 0 9 0; +#X connect 11 0 8 1; +#X connect 12 0 11 0; +#X connect 15 0 17 0; +#X connect 15 1 18 0; +#X connect 16 0 15 0; +#X connect 22 0 21 0; diff --git a/help/spec2_clip_min~-help.pd b/help/spec2_clip_min~-help.pd new file mode 100644 index 0000000..eb782fa --- /dev/null +++ b/help/spec2_clip_min~-help.pd @@ -0,0 +1,36 @@ +#N canvas 52 28 546 330 10; +#X text 230 141 no arg; +#X text 81 272 IEM KUG; +#X text 65 260 musil; +#X text 95 260 @; +#X text 101 260 iem.at; +#X text 64 282 Graz \, Austria; +#X text 16 249 (c) Thomas Musil 2000 - 2006; +#X text 351 143 like; +#X obj 128 118 sig~; +#X floatatom 128 98 5 0 0 0 - - -; +#X obj 212 118 sig~; +#X floatatom 212 98 5 0 0 0 - - -; +#X obj 21 61 dsp; +#X obj 21 38 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X floatatom 21 107 5 0 0 0 - - -; +#X floatatom 34 86 5 0 0 0 - - -; +#X text 120 28 iem_spec2 calculates only blocksize/2 + 1 samples of +block; +#X text 9 6 spec2_clip_min~; +#X text 139 9 restrict a signal to lie higher than min limit; +#X obj 401 144 max~; +#X obj 128 141 spec2_clip_min~; +#X obj 84 179 print~; +#X obj 85 159 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X connect 8 0 20 0; +#X connect 9 0 8 0; +#X connect 10 0 20 1; +#X connect 11 0 10 0; +#X connect 12 0 14 0; +#X connect 12 1 15 0; +#X connect 13 0 12 0; +#X connect 20 0 21 0; +#X connect 22 0 21 0; diff --git a/help/spec2_dbtopow~-help.pd b/help/spec2_dbtopow~-help.pd new file mode 100644 index 0000000..00282c9 --- /dev/null +++ b/help/spec2_dbtopow~-help.pd @@ -0,0 +1,14 @@ +#N canvas 52 29 470 263 10; +#X text 120 53 no arg; +#X text 83 169 IEM KUG; +#X text 67 157 musil; +#X text 97 157 @; +#X text 103 157 iem.at; +#X text 66 179 Graz \, Austria; +#X text 18 146 (c) Thomas Musil 2000 - 2006; +#X text 211 52 like; +#X text 135 24 with (blocksize/2 + 1) bins; +#X obj 243 54 dbtopow~; +#X obj 26 53 spec2_dbtopow~; +#X text 29 15 spec2_dbtopow~; +#X text 132 13 convert dB to power of a signal spectrum; diff --git a/help/spec2_dbtorms~-help.pd b/help/spec2_dbtorms~-help.pd new file mode 100644 index 0000000..11d99cb --- /dev/null +++ b/help/spec2_dbtorms~-help.pd @@ -0,0 +1,14 @@ +#N canvas 52 29 470 263 10; +#X text 120 53 no arg; +#X text 83 169 IEM KUG; +#X text 67 157 musil; +#X text 97 157 @; +#X text 103 157 iem.at; +#X text 66 179 Graz \, Austria; +#X text 18 146 (c) Thomas Musil 2000 - 2006; +#X text 211 52 like; +#X text 135 24 with (blocksize/2 + 1) bins; +#X text 29 15 spec2_dbtorms~; +#X obj 243 54 dbtorms~; +#X obj 26 53 spec2_dbtorms~; +#X text 132 13 convert dB to rms value of a signal spectrum; diff --git a/help/spec2_matrix_bundle_stat~-help.pd b/help/spec2_matrix_bundle_stat~-help.pd new file mode 100644 index 0000000..746f42a --- /dev/null +++ b/help/spec2_matrix_bundle_stat~-help.pd @@ -0,0 +1,153 @@ +#N canvas 106 40 882 682 10; +#X obj 18 44 dsp; +#X obj 18 14 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 18 100 5 0 0 0 - - -; +#X floatatom 33 74 5 0 0 0 - - -; +#X obj 46 322 sig~ 1; +#X obj 96 353 sig~ 2; +#X obj 145 377 sig~ 4; +#X obj 195 402 sig~ 8; +#X obj 234 431 sig~ 16; +#X obj 47 488 unsig~; +#X floatatom 47 512 5 0 0 0 - - -; +#X obj 245 491 unsig~; +#X floatatom 245 515 5 0 0 0 - - -; +#X obj 298 442 any; +#X msg 298 154 bundle 0 0 0 0 0; +#X msg 298 180 bundle 1 1 1 1 1; +#X msg 298 201 bundle 2 2 2 2 2; +#X msg 298 227 bundle 1 0 0 0 0; +#X msg 298 247 bundle 0 1 0 0 0; +#X msg 298 267 bundle 0 0 1 0 0; +#X msg 298 287 bundle 0 0 0 1 0; +#X msg 298 307 bundle 0 0 0 0 1; +#X msg 298 333 bundle 2 0 0 0 0; +#X msg 298 353 bundle 0 2 0 0 0; +#X msg 298 373 bundle 0 0 2 0 0; +#X msg 298 393 bundle 0 0 0 2 0; +#X msg 298 413 bundle 0 0 0 0 2; +#X obj 432 442 pp element; +#X obj 432 419 pack 0 0; +#X obj 432 397 f; +#X floatatom 475 368 4 1 5 0 - - -; +#X floatatom 445 368 4 0 2 0 - - -; +#X obj 422 375 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 706 15 SIG_OUT = A * SIG_IN; +#X text 234 14 multiplies a n-dimensional signal-in-vector with a dynamic +static (like sig~) signal-matrix to a n-dimensional signal-out-vector +; +#X text 725 33 A is quadratic; +#X text 662 50 dim(SIG_OUT) = dim(SIG_IN) = n; +#X text 234 51 each matrix-column has only one one \, the other elements +are zero; +#X text 301 475 2.arg Nr. of outlets = rows; +#X text 301 464 1.arg Nr. of inlets = columns; +#X text 517 336 message "element"; +#X text 531 365 2.) item column_index (1 .. nr_columns); +#X text 531 353 1.) item row_index (0 .. nr_rows); +#X text 446 111 message "bundle"; +#X text 556 381 where the single one of the column will be placed; +#X text 557 393 if (row-index == 0) -> the column has only zeros; +#X text 449 126 (nr_inlets = nr_columns) row-indices (0 .. +nr_row); +#X text 454 162 if (row-index == 0) -> the column has only zeros; +#X text 453 150 where the single one of each column will be placed +; +#N canvas 176 206 818 475 block_______________________ 0; +#X obj 564 88 block~ 128 2; +#X obj 48 29 inlet~; +#X obj 51 260 outlet~; +#X obj 103 30 inlet~; +#X obj 159 29 inlet~; +#X obj 214 30 inlet~; +#X obj 272 30 inlet~; +#X obj 246 257 outlet~; +#X obj 51 209 spec2_matrix_bundle_stat~ 5 2; +#X obj 350 30 inlet; +#X obj 586 308 for++ 0 127 0.1; +#X obj 586 332 moses 64; +#X msg 586 359 1 \$1; +#X msg 637 358 0 \$1; +#X obj 586 287 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 586 267 loadbang; +#X obj 540 240 table \$0_rect 128; +#X obj 586 385 tabwrite \$0_rect; +#X obj 64 57 tabreceive~ \$0_rect; +#X obj 48 79 *~; +#X obj 116 81 tabreceive~ \$0_rect; +#X obj 100 103 *~; +#X obj 170 103 tabreceive~ \$0_rect; +#X obj 154 125 *~; +#X obj 220 124 tabreceive~ \$0_rect; +#X obj 204 146 *~; +#X obj 270 146 tabreceive~ \$0_rect; +#X obj 254 168 *~; +#X connect 1 0 19 0; +#X connect 3 0 21 0; +#X connect 4 0 23 0; +#X connect 5 0 25 0; +#X connect 6 0 27 0; +#X connect 8 0 2 0; +#X connect 8 1 7 0; +#X connect 9 0 8 0; +#X connect 10 0 11 0; +#X connect 11 0 12 0; +#X connect 11 1 13 0; +#X connect 12 0 17 0; +#X connect 13 0 17 0; +#X connect 14 0 10 0; +#X connect 15 0 14 0; +#X connect 18 0 19 1; +#X connect 19 0 8 0; +#X connect 20 0 21 1; +#X connect 21 0 8 1; +#X connect 22 0 23 1; +#X connect 23 0 8 2; +#X connect 24 0 25 1; +#X connect 25 0 8 3; +#X connect 26 0 27 1; +#X connect 27 0 8 4; +#X restore 48 463 pd block_______________________; +#X text 50 13 spec2_matrix_bundle_stat~; +#X text 90 575 IEM KUG; +#X text 74 563 musil; +#X text 104 563 @; +#X text 110 563 iem.at; +#X text 73 585 Graz \, Austria; +#X text 25 552 (c) Thomas Musil 2000 - 2006; +#X text 234 83 it calculates matrix only with (blocksize/2 + 1) samples +per signalvector; +#X connect 0 0 2 0; +#X connect 0 1 3 0; +#X connect 1 0 0 0; +#X connect 4 0 49 0; +#X connect 5 0 49 1; +#X connect 6 0 49 2; +#X connect 7 0 49 3; +#X connect 8 0 49 4; +#X connect 9 0 10 0; +#X connect 11 0 12 0; +#X connect 13 0 49 5; +#X connect 14 0 13 0; +#X connect 15 0 13 0; +#X connect 16 0 13 0; +#X connect 17 0 13 0; +#X connect 18 0 13 0; +#X connect 19 0 13 0; +#X connect 20 0 13 0; +#X connect 21 0 13 0; +#X connect 22 0 13 0; +#X connect 23 0 13 0; +#X connect 24 0 13 0; +#X connect 25 0 13 0; +#X connect 26 0 13 0; +#X connect 28 0 27 0; +#X connect 29 0 28 0; +#X connect 30 0 28 1; +#X connect 31 0 29 1; +#X connect 32 0 29 0; +#X connect 49 0 9 0; +#X connect 49 1 11 0; diff --git a/help/spec2_mul_scalar~-help.pd b/help/spec2_mul_scalar~-help.pd new file mode 100644 index 0000000..d0f6caf --- /dev/null +++ b/help/spec2_mul_scalar~-help.pd @@ -0,0 +1,14 @@ +#N canvas 52 28 591 268 10; +#X text 83 169 IEM KUG; +#X text 67 157 musil; +#X text 97 157 @; +#X text 103 157 iem.at; +#X text 66 179 Graz \, Austria; +#X text 18 146 (c) Thomas Musil 2000 - 2006; +#X text 361 51 like; +#X text 30 14 spec2*s~; +#X text 107 26 with (blocksize/2 + 1) bins; +#X text 106 14 multiply a value with a signal spectrum; +#X text 134 53 1.arg: value to multiply; +#X obj 30 52 spec2*s~ 0; +#X obj 412 52 *~ 0; diff --git a/help/spec2_mul~-help.pd b/help/spec2_mul~-help.pd new file mode 100644 index 0000000..65e173a --- /dev/null +++ b/help/spec2_mul~-help.pd @@ -0,0 +1,14 @@ +#N canvas 52 28 474 268 10; +#X text 86 51 no arg; +#X text 83 169 IEM KUG; +#X text 67 157 musil; +#X text 97 157 @; +#X text 103 157 iem.at; +#X text 66 179 Graz \, Austria; +#X text 18 146 (c) Thomas Musil 2000 - 2006; +#X text 183 49 like; +#X text 30 15 spec2*~; +#X obj 30 52 spec2*~; +#X obj 234 50 *~; +#X text 106 14 multiply 2 signal spectras with (blocksize/2 + 1) bins +; diff --git a/help/spec2_powtodb~-help.pd b/help/spec2_powtodb~-help.pd new file mode 100644 index 0000000..fd48690 --- /dev/null +++ b/help/spec2_powtodb~-help.pd @@ -0,0 +1,14 @@ +#N canvas 52 29 470 263 10; +#X text 120 53 no arg; +#X text 83 169 IEM KUG; +#X text 67 157 musil; +#X text 97 157 @; +#X text 103 157 iem.at; +#X text 66 179 Graz \, Austria; +#X text 18 146 (c) Thomas Musil 2000 - 2006; +#X text 211 52 like; +#X text 135 24 with (blocksize/2 + 1) bins; +#X obj 26 53 spec2_powtodb~; +#X text 29 15 spec2_powtodb~; +#X obj 243 54 powtodb~; +#X text 133 13 convert power to db of a signal spectrum; diff --git a/help/spec2_rmstodb~-help.pd b/help/spec2_rmstodb~-help.pd new file mode 100644 index 0000000..c3c6db0 --- /dev/null +++ b/help/spec2_rmstodb~-help.pd @@ -0,0 +1,14 @@ +#N canvas 52 29 470 263 10; +#X text 120 53 no arg; +#X text 83 169 IEM KUG; +#X text 67 157 musil; +#X text 97 157 @; +#X text 103 157 iem.at; +#X text 66 179 Graz \, Austria; +#X text 18 146 (c) Thomas Musil 2000 - 2006; +#X text 211 52 like; +#X text 135 24 with (blocksize/2 + 1) bins; +#X text 29 15 spec2_rmstodb~; +#X text 132 13 convert rms value to db of a signal spectrum; +#X obj 26 53 spec2_rmstodb~; +#X obj 243 54 rmstodb~; diff --git a/help/spec2_shift~-help.pd b/help/spec2_shift~-help.pd new file mode 100644 index 0000000..d87cc5f --- /dev/null +++ b/help/spec2_shift~-help.pd @@ -0,0 +1,40 @@ +#N canvas 10 8 548 293 10; +#X obj 15 90 dsp; +#X obj 15 67 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 15 131 5 0 0 0 - - -; +#X floatatom 28 114 5 0 0 0 - - -; +#N canvas 0 0 450 300 graph2 0; +#X array array100 64 float 1; +#A 0 -0.550001 -0.750001 -0.700001 -0.600001 -0.500001 -0.400001 -0.400001 +-0.350001 -0.25 -0.2 -0.15 -0.1 -0.0500001 -0.0500001 3.72529e-008 +0.0500001 0.0500001 0.1 0.1 0.15 0.2 0.2 0.250001 0.250001 0.300001 +0.350001 0.350001 0.400001 0.500001 0.500001 0.516668 0.533334 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; +#X coords 0 1 63 -1 64 40 1; +#X restore 436 66 graph; +#X text 83 210 IEM KUG; +#X text 67 198 musil; +#X text 97 198 @; +#X text 103 198 iem.at; +#X text 66 220 Graz \, Austria; +#X text 18 187 (c) Thomas Musil 2000 - 2006; +#N canvas 0 0 450 300 graph2 0; +#X array array101 64 float 0; +#X coords 0 1 63 -1 64 40 1; +#X restore 436 126 graph; +#X obj 143 102 spec2_shift~ 10; +#X obj 144 131 tabsend~ array101; +#X obj 142 71 tabreceive~ array100; +#X floatatom 105 51 5 -32 32 0 - - -; +#X text 15 10 spec2_shift~; +#X text 248 101 1.arg: shift width; +#X text 136 6 shift a spectrum of (blocksize/2 + 1) to the left or +right about n bins (+- blocksize/2); +#X text 80 37 shift width; +#X connect 0 0 2 0; +#X connect 0 1 3 0; +#X connect 1 0 0 0; +#X connect 12 0 13 0; +#X connect 14 0 12 0; +#X connect 15 0 12 0; diff --git a/help/spec2_sqrt~-help.pd b/help/spec2_sqrt~-help.pd new file mode 100644 index 0000000..15dbfe0 --- /dev/null +++ b/help/spec2_sqrt~-help.pd @@ -0,0 +1,31 @@ +#N canvas 52 28 437 304 10; +#X text 218 120 no arg; +#X text 89 234 IEM KUG; +#X text 73 222 musil; +#X text 103 222 @; +#X text 109 222 iem.at; +#X text 72 244 Graz \, Austria; +#X text 24 211 (c) Thomas Musil 2000 - 2006; +#X text 327 115 like; +#X text 109 25 with (blocksize/2 + 1) bins; +#X text 17 13 spec2_sqrt~; +#X obj 144 120 spec2_sqrt~; +#X obj 359 116 sqrt~; +#X obj 143 98 sig~ 16; +#X obj 143 148 print~; +#X obj 111 119 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 29 97 dsp; +#X obj 29 71 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 143 79 5 0 0 0 - - -; +#X floatatom 29 142 5 0 0 0 - - -; +#X floatatom 42 122 5 0 0 0 - - -; +#X text 106 14 take square root value of a signal spectrum; +#X connect 10 0 13 0; +#X connect 12 0 10 0; +#X connect 14 0 13 0; +#X connect 15 0 18 0; +#X connect 15 1 19 0; +#X connect 16 0 15 0; +#X connect 17 0 12 0; diff --git a/help/spec2_stretch~-help.pd b/help/spec2_stretch~-help.pd new file mode 100644 index 0000000..3f69ed0 --- /dev/null +++ b/help/spec2_stretch~-help.pd @@ -0,0 +1,42 @@ +#N canvas 10 8 548 293 10; +#X obj 15 90 dsp; +#X obj 15 67 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X floatatom 15 131 5 0 0 0 - - -; +#X floatatom 28 114 5 0 0 0 - - -; +#N canvas 0 0 450 300 graph2 0; +#X array array100 64 float 1; +#A 0 -0.550001 -0.750001 -0.700001 -0.600001 -0.500001 -0.400001 -0.400001 +-0.350001 -0.25 -0.2 -0.15 -0.1 -0.0500001 -0.0500001 3.72529e-008 +0.0500001 0.0500001 0.1 0.1 0.15 0.2 0.2 0.250001 0.250001 0.300001 +0.350001 0.350001 0.400001 0.500001 0.500001 0.516668 0.533334 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; +#X coords 0 1 63 -1 64 40 1; +#X restore 436 66 graph; +#X text 83 210 IEM KUG; +#X text 67 198 musil; +#X text 97 198 @; +#X text 103 198 iem.at; +#X text 66 220 Graz \, Austria; +#X text 18 187 (c) Thomas Musil 2000 - 2006; +#N canvas 0 0 450 300 graph2 0; +#X array array101 64 float 0; +#X coords 0 1 63 -1 64 40 1; +#X restore 436 126 graph; +#X obj 144 131 tabsend~ array101; +#X obj 142 71 tabreceive~ array100; +#X floatatom 93 41 5 20 500 0 - - -; +#X obj 143 102 spec2_stretch~ 1; +#X obj 93 58 / 100; +#X floatatom 93 78 5 0 0 0 - - -; +#X text 16 10 spec2_stretch~; +#X text 137 6 stretch a spectrum of (blocksize/2 + 1) by a factor; +#X text 256 102 1.arg: stretch factor; +#X connect 0 0 2 0; +#X connect 0 1 3 0; +#X connect 1 0 0 0; +#X connect 13 0 15 0; +#X connect 14 0 16 0; +#X connect 15 0 12 0; +#X connect 16 0 17 0; +#X connect 17 0 15 0; diff --git a/help/spec2_sub~-help.pd b/help/spec2_sub~-help.pd new file mode 100644 index 0000000..9acd02a --- /dev/null +++ b/help/spec2_sub~-help.pd @@ -0,0 +1,14 @@ +#N canvas 52 28 466 260 10; +#X text 86 51 no arg; +#X text 83 169 IEM KUG; +#X text 67 157 musil; +#X text 97 157 @; +#X text 103 157 iem.at; +#X text 66 179 Graz \, Austria; +#X text 18 146 (c) Thomas Musil 2000 - 2006; +#X text 183 49 like; +#X obj 30 52 spec2-~; +#X text 30 15 spec2-~; +#X obj 234 50 -~; +#X text 106 14 subtract 2 signal spectras with (blocksize/2 + 1) bins +; diff --git a/help/spec2_sum~-help.pd b/help/spec2_sum~-help.pd new file mode 100644 index 0000000..af87bc9 --- /dev/null +++ b/help/spec2_sum~-help.pd @@ -0,0 +1,67 @@ +#N canvas 90 35 781 494 10; +#X obj 42 70 dsp; +#X obj 42 47 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X floatatom 42 111 5 0 0 0 - - -; +#X floatatom 55 94 5 0 0 0 - - -; +#N canvas 0 0 450 300 graph1 0; +#X array array101 192 float 0; +#X coords 0 50 191 -50 382 128 1; +#X restore 319 224 graph; +#X obj 46 156 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 202 216 no arguments; +#X text 90 402 IEM KUG; +#X text 74 390 musil; +#X text 104 390 @; +#X text 110 390 iem.at; +#X text 73 412 Graz \, Austria; +#X text 25 379 (c) Thomas Musil 2000 - 2006; +#N canvas 0 0 754 332 init 0; +#X obj 52 43 t f f; +#X obj 50 -10 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 52 -36 loadbang; +#X obj 57 147 tabwrite array100; +#X msg 161 -9 \; array100 xticks 0 32 2; +#X msg 174 75 \; array101 xticks 0 32 2; +#X msg 165 30 \; array100 xlabel -1.1 0 32 64 96 128; +#X obj 50 11 for++ 0 127; +#X obj 56 107 / 128; +#X msg 431 -9 \; array100 yticks 0 0.5 2; +#X msg 435 30 \; array100 ylabel -6 -1 -0.5 0 0.5 1; +#X msg 177 125 \; array101 xlabel -55 0 32 64 96 128 160 192; +#X msg 444 75 \; array101 yticks 0 25 2; +#X msg 447 125 \; array101 ylabel -6 -50 -25 0 25 50; +#X connect 0 0 8 0; +#X connect 0 1 3 1; +#X connect 1 0 7 0; +#X connect 2 0 1 0; +#X connect 2 0 4 0; +#X connect 2 0 6 0; +#X connect 2 0 5 0; +#X connect 2 0 11 0; +#X connect 2 0 9 0; +#X connect 2 0 10 0; +#X connect 2 0 12 0; +#X connect 2 0 13 0; +#X connect 7 0 0 0; +#X connect 8 0 3 0; +#X restore 323 394 pd init; +#N canvas 0 0 450 300 graph1 0; +#X array array100 128 float 0; +#X coords 0 1 127 -1 256 128 1; +#X restore 319 62 graph; +#X obj 84 192 tabplay~ array100; +#X obj 46 252 tabwrite~ array101; +#X obj 84 218 spec2_sum~; +#X text 19 4 spec2_sum~; +#X text 400 5 (blocksize/2 + 1) bins; +#X text 161 4 accumulate the sum of the spectrum with; +#X connect 0 0 2 0; +#X connect 0 1 3 0; +#X connect 1 0 0 0; +#X connect 5 0 15 0; +#X connect 5 0 16 0; +#X connect 15 0 17 0; +#X connect 17 0 16 0; diff --git a/help/spec2_tab_conv~-help.pd b/help/spec2_tab_conv~-help.pd new file mode 100644 index 0000000..168488b --- /dev/null +++ b/help/spec2_tab_conv~-help.pd @@ -0,0 +1,185 @@ +#N canvas 9 18 777 596 10; +#X obj 44 49 dsp; +#X obj 44 26 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 44 90 5 0 0 0 - - -; +#X floatatom 57 73 5 0 0 0 - - -; +#N canvas 0 0 450 300 graph1 0; +#X array win 50 float 0; +#X coords 0 1 49 -1 200 140 1; +#X restore 267 333 graph; +#X floatatom 64 144 7 0 0 0 - - -; +#X obj 189 188 noise~; +#X floatatom 316 170 5 2 40 0 - - -; +#X msg 316 147 8; +#X text 22 -1 spec2_tab_conv~; +#X obj 64 166 osc~ 5000; +#N canvas 148 208 734 434 gen_win 0; +#X obj 92 43 inlet; +#X obj 92 121 - 1; +#X obj 92 142 t f f; +#X obj 92 167 / 20; +#X obj 92 188 * 3.14159; +#X obj 92 211 sin; +#X msg 92 232 \$1 \$1; +#X obj 92 254 *; +#X obj 92 65 t b f b; +#X msg 253 218 1 \$1; +#X obj 253 240 /; +#X obj 224 367 outlet; +#X obj 225 315 f; +#X msg 224 337 set win \$1; +#X obj 527 33 table hwin 50; +#X obj 242 124 tab_const hwin; +#X obj 92 274 tabwrite hwin; +#X obj 191 146 tab_sum hwin; +#X obj 253 264 tab_mul_scalar hwin hwin; +#X obj 191 192 tab_copy hwin win; +#X obj 93 95 for++ 1 20; +#X connect 0 0 8 0; +#X connect 1 0 2 0; +#X connect 2 0 3 0; +#X connect 2 1 16 1; +#X connect 3 0 4 0; +#X connect 4 0 5 0; +#X connect 5 0 6 0; +#X connect 6 0 7 0; +#X connect 7 0 16 0; +#X connect 8 0 20 0; +#X connect 8 1 3 1; +#X connect 8 1 12 1; +#X connect 8 1 20 1; +#X connect 8 2 15 0; +#X connect 9 0 10 0; +#X connect 10 0 18 0; +#X connect 12 0 13 0; +#X connect 13 0 11 0; +#X connect 17 0 19 0; +#X connect 17 1 9 0; +#X connect 19 0 12 0; +#X connect 20 0 1 0; +#X connect 20 1 17 0; +#X restore 316 189 pd gen_win; +#X obj 316 124 loadbang; +#N canvas 6 92 777 603 spec2_blockfilter~ 0; +#X obj 59 29 inlet~; +#X obj 72 488 outlet~; +#X obj 61 101 rfft~; +#X obj 71 392 rifft~; +#X obj 407 22 inlet; +#X text 199 240 1.arg: table-name; +#X obj 474 23 block~ 256 2; +#N canvas 0 0 450 300 graph1 0; +#X array hsin 256 float 0; +#X coords 0 1 255 -1 200 140 1; +#X restore 423 296 graph; +#X obj 458 140 for++ 0 255 0.1; +#X obj 458 119 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 458 160 t f f; +#X obj 457 190 / 256; +#X obj 457 210 * 3.14159; +#X obj 457 229 sin; +#X obj 457 251 tabwrite hsin; +#X obj 72 51 tabreceive~ hsin; +#X obj 60 73 *~; +#X obj 458 95 loadbang; +#X obj 241 100 rfft~; +#X obj 252 50 tabreceive~ hsin; +#X obj 240 72 *~; +#X obj 241 26 inlet~; +#X obj 84 417 tabreceive~ hsin; +#X obj 72 439 *~; +#X text 199 251 2.arg: table-size; +#X obj 72 463 /~ 32768; +#X obj 59 290 spec2_dbtorms~; +#X obj 65 363 spec2*~; +#X obj 122 366 spec2*~; +#X obj 58 178 spec2+~; +#X obj 47 151 spec2*~; +#X obj 94 151 spec2*~; +#X obj 58 201 spec2_powtodb~; +#X obj 59 247 spec2_tab_conv~ win 8; +#X connect 0 0 16 0; +#X connect 2 0 30 0; +#X connect 2 0 30 1; +#X connect 2 1 31 0; +#X connect 2 1 31 1; +#X connect 3 0 23 0; +#X connect 4 0 33 0; +#X connect 8 0 10 0; +#X connect 9 0 8 0; +#X connect 10 0 11 0; +#X connect 10 1 14 1; +#X connect 11 0 12 0; +#X connect 12 0 13 0; +#X connect 13 0 14 0; +#X connect 15 0 16 1; +#X connect 16 0 2 0; +#X connect 17 0 9 0; +#X connect 18 0 27 1; +#X connect 18 1 28 1; +#X connect 19 0 20 1; +#X connect 20 0 18 0; +#X connect 21 0 20 0; +#X connect 22 0 23 1; +#X connect 23 0 25 0; +#X connect 25 0 1 0; +#X connect 26 0 27 0; +#X connect 26 0 28 0; +#X connect 27 0 3 0; +#X connect 28 0 3 1; +#X connect 29 0 32 0; +#X connect 30 0 29 0; +#X connect 31 0 29 1; +#X connect 32 0 33 0; +#X connect 33 0 26 0; +#X restore 64 211 pd spec2_blockfilter~ using spec2_tab_conv~; +#X text 550 227 1.arg: table-name; +#X text 551 240 2.arg: table-size; +#X msg 429 209 set win 8; +#X obj 408 234 spec2_tab_conv~ win 8; +#X obj 68 298 dac~; +#X obj 144 311 prvu~; +#X obj 145 339 vu 15 120 empty empty -1 -8 0 8 -66577 -1 1 0; +#X floatatom 143 505 5 0 0 0 - - -; +#X floatatom 154 479 5 0 0 0 - - -; +#X msg 156 288 reset; +#X text 146 4 convolute a spectrum of size (blocksize/2 + 1) with a +table of size n; +#X obj 69 266 *~ 0.003; +#X obj 133 255 dbtorms; +#X obj 201 252 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X obj 161 131 mtof; +#X obj 165 111 hsl 137 15 0 136 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X text 98 553 IEM KUG; +#X text 82 541 musil; +#X text 112 541 @; +#X text 118 541 iem.at; +#X text 81 563 Graz \, Austria; +#X text 33 530 (c) Thomas Musil 2000 - 2006; +#X connect 0 0 2 0; +#X connect 0 1 3 0; +#X connect 1 0 0 0; +#X connect 5 0 10 0; +#X connect 6 0 13 1; +#X connect 7 0 11 0; +#X connect 8 0 7 0; +#X connect 10 0 13 0; +#X connect 11 0 13 2; +#X connect 12 0 8 0; +#X connect 13 0 25 0; +#X connect 16 0 17 0; +#X connect 19 0 20 0; +#X connect 20 0 21 0; +#X connect 20 1 22 0; +#X connect 23 0 19 0; +#X connect 25 0 19 0; +#X connect 25 0 18 0; +#X connect 25 0 18 1; +#X connect 26 0 25 1; +#X connect 27 0 26 0; +#X connect 28 0 5 0; +#X connect 29 0 28 0; diff --git a/help/spec2_tabreceive_enable~-help.pd b/help/spec2_tabreceive_enable~-help.pd new file mode 100644 index 0000000..c4ecebf --- /dev/null +++ b/help/spec2_tabreceive_enable~-help.pd @@ -0,0 +1,139 @@ +#N canvas 22 17 939 438 10; +#X obj 44 49 dsp; +#X obj 44 26 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 44 90 5 0 0 0 - - -; +#X floatatom 57 73 5 0 0 0 - - -; +#N canvas 0 0 450 300 graph1 0; +#X array scope 512 float 0; +#X coords 0 1 511 -1 512 100 1; +#X restore 371 240 graph; +#X obj 121 178 tabwrite~ scope; +#X obj 211 47 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#N canvas 0 0 450 300 graph2 0; +#X array filter 256 float 1; +#A 0 0 0 0 0 0 0 0 0.04 0.04 0.08 0.14 0.18 0.2 0.24 0.26 0.28 0.32 +0.34 0.36 0.38 0.4 0.42 0.44 0.44 0.46 0.5 0.54 0.58 0.6 0.62 0.646667 +0.673334 0.7 0.74 0.76 0.78 0 0 0 0 0 0 -0.06 -0.0866667 -0.113333 +-0.14 -0.175 -0.21 -0.245 -0.28 -0.31 -0.34 -0.366667 -0.393333 -0.42 +-0.45 -0.48 -0.52 -0.56 -0.58 -0.62 -0.62 -0.66 -0.67 -0.68 -0.7 -0.74 +-0.76 -0.78 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.8 0.78 0.76 0.68 0.62 0.58 +0.5 0.473334 0.446667 0.42 0.38 0.34 0.3 0.266667 0.233333 0.2 0.17 +0.14 0.11 0.08 0.05 0.02 0 0 0 0 0 0 -0.68 -0.68 -0.62 -0.56 -0.52 +-0.48 -0.45 -0.42 -0.37 -0.32 -0.28 -0.24 -0.19 -0.14 -0.12 -0.1 -0.08 +-0.02 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; +#X coords 0 1 255 -1 256 100 1; +#X restore 502 -33 graph; +#X obj 136 91 del 100; +#X msg 781 2 \; filter const 0; +#X text 14 -28 spec2_tabreceive_enable~; +#X obj 278 47 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X text 295 47 enable; +#X text 209 -15 and enables/disables reading the table; +#N canvas 63 41 965 587 spec2_blockfilter~ 0; +#X obj 100 51 inlet~; +#X obj 102 381 outlet~; +#X obj 271 120 block~ 256 2; +#N canvas 0 0 450 300 graph1 0; +#X array rect 256 float 0; +#X coords 0 1 255 -1 200 140 1; +#X restore 460 21 graph; +#X obj 276 459 tab_const rect; +#X obj 279 396 t b b; +#X msg 304 421 0 128 1; +#X msg 224 419 128 128 0; +#X obj 279 374 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 279 350 loadbang; +#X obj 101 309 /~ 256; +#X obj 101 108 *~; +#X obj 114 85 spec2_tabreceive~ rect; +#N canvas 0 0 450 300 graph1 0; +#X array real 256 float 0; +#X coords 0 1 255 -1 200 140 1; +#X restore 691 177 graph; +#N canvas 0 0 450 300 graph1 0; +#X array imag 256 float 0; +#X coords 0 1 255 -1 200 140 1; +#X restore 691 326 graph; +#X obj 697 56 inlet; +#X obj 697 80 t b; +#X text 351 190 1.arg: table-name; +#X obj 291 54 inlet; +#X obj 101 131 rfft~; +#X obj 102 280 rifft~; +#X obj 158 260 spec2+~; +#X obj 40 257 spec2-~; +#X obj 32 212 spec2*~; +#X obj 85 215 spec2*~; +#X obj 146 214 spec2*~; +#X obj 205 214 spec2*~; +#X obj 247 149 spec2_tabreceive_enable~ real 0; +#X obj 263 174 spec2_tabreceive_enable~ imag 0; +#X text 352 205 2.arg: enable-state; +#X obj 697 102 tab_rfft filter real imag 256; +#X connect 0 0 11 0; +#X connect 5 0 7 0; +#X connect 5 1 6 0; +#X connect 6 0 4 0; +#X connect 7 0 4 0; +#X connect 8 0 5 0; +#X connect 9 0 8 0; +#X connect 10 0 1 0; +#X connect 11 0 19 0; +#X connect 12 0 11 1; +#X connect 15 0 16 0; +#X connect 16 0 30 0; +#X connect 18 0 27 0; +#X connect 18 0 28 0; +#X connect 19 0 23 0; +#X connect 19 0 25 0; +#X connect 19 1 24 0; +#X connect 19 1 26 0; +#X connect 20 0 10 0; +#X connect 21 0 20 1; +#X connect 22 0 20 0; +#X connect 23 0 22 0; +#X connect 24 0 22 1; +#X connect 25 0 21 0; +#X connect 26 0 21 1; +#X connect 27 0 23 1; +#X connect 27 0 26 1; +#X connect 28 0 24 1; +#X connect 28 0 25 1; +#X restore 158 141 pd spec2_blockfilter~ using spec2_tabreceive_enable~ +; +#X text 749 122 1.arg: table-name; +#X msg 561 99 symbol filter; +#X text 749 134 2.arg: enable-state; +#X obj 536 129 spec2_tabreceive_enable~ filter 1; +#X msg 496 89 1; +#X msg 524 89 0; +#X obj 159 117 dirac~; +#X text 150 2 iem_spec2 calculates only (blocksize/2 + 1) samples; +#X text 180 -27 receives spectrum from table with (blocksize/2 + 1) +; +#X text 90 302 IEM KUG; +#X text 74 290 musil; +#X text 104 290 @; +#X text 110 290 iem.at; +#X text 73 312 Graz \, Austria; +#X text 25 279 (c) Thomas Musil 2000 - 2006; +#X connect 0 0 2 0; +#X connect 0 1 3 0; +#X connect 1 0 0 0; +#X connect 6 0 14 2; +#X connect 6 0 8 0; +#X connect 8 0 5 0; +#X connect 8 0 21 0; +#X connect 11 0 14 1; +#X connect 14 0 5 0; +#X connect 16 0 18 0; +#X connect 19 0 18 0; +#X connect 20 0 18 0; +#X connect 21 0 14 0; diff --git a/help/spec2_tabreceive~-help.pd b/help/spec2_tabreceive~-help.pd new file mode 100644 index 0000000..c2c06be --- /dev/null +++ b/help/spec2_tabreceive~-help.pd @@ -0,0 +1,125 @@ +#N canvas 9 28 944 451 10; +#X obj 44 49 dsp; +#X obj 44 26 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 44 90 5 0 0 0 - - -; +#X floatatom 57 73 5 0 0 0 - - -; +#N canvas 0 0 450 300 graph1 0; +#X array scope 512 float 0; +#X coords 0 1 511 -1 512 100 1; +#X restore 350 236 graph; +#X obj 211 175 tabwrite~ scope; +#X obj 269 55 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 17 -25 spec2_tabreceive~; +#N canvas 0 0 450 300 graph2 0; +#X array filter 256 float 1; +#A 0 0 0 0 0 0 0 0 0.04 0.04 0.08 0.14 0.18 0.2 0.24 0.26 0.28 0.32 +0.34 0.36 0.38 0.4 0.42 0.44 0.44 0.46 0.5 0.54 0.58 0.6 0.62 0.646667 +0.673334 0.7 0.74 0.76 0.78 0 0 0 0 0 0 -0.06 -0.0866667 -0.113333 +-0.14 -0.175 -0.21 -0.245 -0.28 -0.31 -0.34 -0.366667 -0.393333 -0.42 +-0.45 -0.48 -0.52 -0.56 -0.58 -0.62 -0.62 -0.66 -0.67 -0.68 -0.7 -0.74 +-0.76 -0.78 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.8 0.78 0.76 0.68 0.62 0.58 +0.5 0.473334 0.446667 0.42 0.38 0.34 0.3 0.266667 0.233333 0.2 0.17 +0.14 0.11 0.08 0.05 0.02 0 0 0 0 0 0 -0.68 -0.68 -0.62 -0.56 -0.52 +-0.48 -0.45 -0.42 -0.37 -0.32 -0.28 -0.24 -0.19 -0.14 -0.12 -0.1 -0.08 +-0.02 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; +#X coords 0 1 255 -1 256 100 1; +#X restore 488 -33 graph; +#X obj 226 88 del 100; +#X msg 767 2 \; filter const 0; +#N canvas 70 41 953 575 spec2_blockfilter~ 0; +#X obj 100 51 inlet~; +#X obj 102 381 outlet~; +#X obj 271 120 block~ 256 2; +#N canvas 0 0 450 300 graph1 0; +#X array rect 256 float 0; +#X coords 0 1 255 -1 200 140 1; +#X restore 460 21 graph; +#X obj 276 459 tab_const rect; +#X obj 279 396 t b b; +#X msg 304 421 0 128 1; +#X msg 224 419 128 128 0; +#X obj 279 374 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 279 350 loadbang; +#X obj 100 135 rfft~; +#X obj 101 284 rifft~; +#X obj 101 309 /~ 256; +#X obj 101 108 *~; +#X obj 114 85 spec2_tabreceive~ rect; +#N canvas 0 0 450 300 graph1 0; +#X array real 256 float 0; +#X coords 0 1 255 -1 200 140 1; +#X restore 691 177 graph; +#N canvas 0 0 450 300 graph1 0; +#X array imag 256 float 0; +#X coords 0 1 255 -1 200 140 1; +#X restore 691 326 graph; +#X obj 697 56 inlet; +#X obj 697 80 t b; +#X obj 246 153 spec2_tabreceive~ real; +#X obj 262 178 spec2_tabreceive~ imag; +#X text 407 178 1.arg: table-name; +#X obj 157 264 spec2+~; +#X obj 39 261 spec2-~; +#X obj 31 216 spec2*~; +#X obj 84 219 spec2*~; +#X obj 145 218 spec2*~; +#X obj 204 218 spec2*~; +#X obj 697 102 tab_rfft filter real imag 256; +#X connect 0 0 13 0; +#X connect 5 0 7 0; +#X connect 5 1 6 0; +#X connect 6 0 4 0; +#X connect 7 0 4 0; +#X connect 8 0 5 0; +#X connect 9 0 8 0; +#X connect 10 0 24 0; +#X connect 10 0 26 0; +#X connect 10 1 25 0; +#X connect 10 1 27 0; +#X connect 11 0 12 0; +#X connect 12 0 1 0; +#X connect 13 0 10 0; +#X connect 14 0 13 1; +#X connect 17 0 18 0; +#X connect 18 0 28 0; +#X connect 19 0 24 1; +#X connect 19 0 27 1; +#X connect 20 0 25 1; +#X connect 20 0 26 1; +#X connect 22 0 11 1; +#X connect 23 0 11 0; +#X connect 24 0 23 0; +#X connect 25 0 23 1; +#X connect 26 0 22 0; +#X connect 27 0 22 1; +#X restore 248 137 pd spec2_blockfilter~ using spec2_tabreceive~; +#X obj 582 122 spec2_tabreceive~ filter; +#X text 735 121 1.arg: table-name; +#X msg 607 92 symbol filter; +#X text 90 302 IEM KUG; +#X text 74 290 musil; +#X text 104 290 @; +#X text 110 290 iem.at; +#X text 73 312 Graz \, Austria; +#X text 25 279 (c) Thomas Musil 2000 - 2006; +#X obj 249 114 dirac~; +#X text 143 -11 iem_spec2 calculates only (blocksize/2 + 1) samples +; +#X text 140 -27 receives spectrum from table with (blocksize/2 + 1) +; +#X connect 0 0 2 0; +#X connect 0 1 3 0; +#X connect 1 0 0 0; +#X connect 6 0 11 1; +#X connect 6 0 9 0; +#X connect 9 0 5 0; +#X connect 9 0 21 0; +#X connect 11 0 5 0; +#X connect 14 0 12 0; +#X connect 21 0 11 0; diff --git a/src/iem_spec2.c b/src/iem_spec2.c new file mode 100644 index 0000000..e3059f4 --- /dev/null +++ b/src/iem_spec2.c @@ -0,0 +1,76 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + + +#include "m_pd.h" +#include "iemlib.h" + +static t_class *iem_spec2_class; + +static void *iem_spec2_new(void) +{ + t_object *x = (t_object *)pd_new(iem_spec2_class); + + return (x); +} + +void spec2_1p1z_freq_tilde_setup(void); +void spec2_1p1z_time_tilde_setup(void); +void spec2_abs_tilde_setup(void); +void spec2_add_scalar_tilde_setup(void); +void spec2_add_tilde_setup(void); +void spec2_block_delay_tilde_setup(void); +void spec2_clip_max_tilde_setup(void); +void spec2_clip_min_tilde_setup(void); +void spec2_dbtopow_tilde_setup(void); +void spec2_dbtorms_tilde_setup(void); +void spec2_matrix_bundle_stat_tilde_setup(void); +void spec2_mul_scalar_tilde_setup(void); +void spec2_mul_tilde_setup(void); +void spec2_powtodb_tilde_setup(void); +void spec2_rmstodb_tilde_setup(void); +void spec2_shift_tilde_setup(void); +void spec2_sqrt_tilde_setup(void); +void spec2_stretch_tilde_setup(void); +void spec2_sub_tilde_setup(void); +void spec2_sum_tilde_setup(void); +void spec2_tab_conv_tilde_setup(void); +void spec2_tabreceive_enable_tilde_setup(void); +void spec2_tabreceive_tilde_setup(void); + +/* ------------------------ setup routine ------------------------- */ + +void iem_spec2_setup(void) +{ + iem_spec2_class = class_new(gensym("iem_spec2"), iem_spec2_new, 0, + sizeof(t_object), CLASS_NOINLET, 0); + + spec2_1p1z_freq_tilde_setup(); + spec2_1p1z_time_tilde_setup(); + spec2_abs_tilde_setup(); + spec2_add_scalar_tilde_setup(); + spec2_add_tilde_setup(); + spec2_block_delay_tilde_setup(); + spec2_clip_max_tilde_setup(); + spec2_clip_min_tilde_setup(); + spec2_dbtopow_tilde_setup(); + spec2_dbtorms_tilde_setup(); + spec2_matrix_bundle_stat_tilde_setup(); + spec2_mul_scalar_tilde_setup(); + spec2_mul_tilde_setup(); + spec2_powtodb_tilde_setup(); + spec2_rmstodb_tilde_setup(); + spec2_shift_tilde_setup(); + spec2_sqrt_tilde_setup(); + spec2_stretch_tilde_setup(); + spec2_sub_tilde_setup(); + spec2_sum_tilde_setup(); + spec2_tab_conv_tilde_setup(); + spec2_tabreceive_enable_tilde_setup(); + spec2_tabreceive_tilde_setup(); + + post("iem_spec2 (R-1.16) library loaded! (c) Thomas Musil 05.2005"); + post(" musil%ciem.at iem KUG Graz Austria", '@'); +} diff --git a/src/iem_spec2.dsp b/src/iem_spec2.dsp new file mode 100644 index 0000000..d37ac36 --- /dev/null +++ b/src/iem_spec2.dsp @@ -0,0 +1,85 @@ +# Microsoft Developer Studio Project File - Name="iem_spec2" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** NICHT BEARBEITEN ** + +# TARGTYPE "Win32 (x86) External Target" 0x0106 + +CFG=iem_spec2 - 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 "iem_spec2.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 "iem_spec2.mak" CFG="iem_spec2 - Win32 Debug" +!MESSAGE +!MESSAGE Für die Konfiguration stehen zur Auswahl: +!MESSAGE +!MESSAGE "iem_spec2 - Win32 Release" (basierend auf "Win32 (x86) External Target") +!MESSAGE "iem_spec2 - Win32 Debug" (basierend auf "Win32 (x86) External Target") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" + +!IF "$(CFG)" == "iem_spec2 - Win32 Release" + +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Cmd_Line "NMAKE /f makefile_win" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "makefile_win.exe" +# PROP BASE Bsc_Name "makefile_win.bsc" +# PROP BASE Target_Dir "" +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Cmd_Line "NMAKE /f makefile_win" +# PROP Rebuild_Opt "/a" +# PROP Target_File "iem_spec2.exe" +# PROP Bsc_Name "iem_spec2.bsc" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "iem_spec2 - Win32 Debug" + +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Cmd_Line "NMAKE /f makefile_win" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "makefile_win.exe" +# PROP BASE Bsc_Name "makefile_win.bsc" +# PROP BASE Target_Dir "" +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Cmd_Line "NMAKE /f makefile_win" +# PROP Rebuild_Opt "/a" +# PROP Target_File "iem_spec2.exe" +# PROP Bsc_Name "iem_spec2.bsc" +# PROP Target_Dir "" + +!ENDIF + +# Begin Target + +# Name "iem_spec2 - Win32 Release" +# Name "iem_spec2 - Win32 Debug" + +!IF "$(CFG)" == "iem_spec2 - Win32 Release" + +!ELSEIF "$(CFG)" == "iem_spec2 - Win32 Debug" + +!ENDIF + +# Begin Source File + +SOURCE=.\makefile_win +# End Source File +# End Target +# End Project diff --git a/src/iem_spec2.dsw b/src/iem_spec2.dsw new file mode 100644 index 0000000..7ecb689 --- /dev/null +++ b/src/iem_spec2.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! + +############################################################################### + +Project: "iem_spec2"=.\iem_spec2.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/src/iem_spec2.h b/src/iem_spec2.h new file mode 100644 index 0000000..440dbdf --- /dev/null +++ b/src/iem_spec2.h @@ -0,0 +1,11 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#ifndef __IEMSPEC2_H__ +#define __IEMSPEC2_H__ + +#define DELLINE_DEF_VEC_SIZE 64 + +#endif diff --git a/src/iemlib.h b/src/iemlib.h new file mode 100644 index 0000000..36d47ca --- /dev/null +++ b/src/iemlib.h @@ -0,0 +1,108 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iemlib written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#ifndef __IEMLIB_H__ +#define __IEMLIB_H__ + + +#define IS_A_POINTER(atom,index) ((atom+index)->a_type == A_POINTER) +#define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT) +#define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL) +#define IS_A_DOLLAR(atom,index) ((atom+index)->a_type == A_DOLLAR) +#define IS_A_DOLLSYM(atom,index) ((atom+index)->a_type == A_DOLLSYM) +#define IS_A_SEMI(atom,index) ((atom+index)->a_type == A_SEMI) +#define IS_A_COMMA(atom,index) ((atom+index)->a_type == A_COMMA) + + +#ifdef NT +int sys_noloadbang; +//t_symbol *iemgui_key_sym=0; +#include +#else +extern int sys_noloadbang; +//extern t_symbol *iemgui_key_sym; +#include +#endif + +#define DEFDELVS 64 +#define XTRASAMPS 4 +#define SAMPBLK 4 + + +#define UNITBIT32 1572864. /* 3*2^19; bit 32 has place value 1 */ + +/* machine-dependent definitions. These ifdefs really +should have been by CPU type and not by operating system! */ +#ifdef IRIX +/* big-endian. Most significant byte is at low address in memory */ +#define HIOFFSET 0 /* word offset to find MSB */ +#define LOWOFFSET 1 /* word offset to find LSB */ +#define int32 long /* a data type that has 32 bits */ +#else +#ifdef MSW +/* little-endian; most significant byte is at highest address */ +#define HIOFFSET 1 +#define LOWOFFSET 0 +#define int32 long +#else +#ifdef __FreeBSD__ +#include +#if BYTE_ORDER == LITTLE_ENDIAN +#define HIOFFSET 1 +#define LOWOFFSET 0 +#else +#define HIOFFSET 0 /* word offset to find MSB */ +#define LOWOFFSET 1 /* word offset to find LSB */ +#endif /* BYTE_ORDER */ +#include +#define int32 int32_t +#endif +#ifdef __linux__ + +#include + +#if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN) +#error No byte order defined +#endif + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define HIOFFSET 1 +#define LOWOFFSET 0 +#else +#define HIOFFSET 0 /* word offset to find MSB */ +#define LOWOFFSET 1 /* word offset to find LSB */ +#endif /* __BYTE_ORDER */ + +#include +#define int32 int32_t + +#else +#ifdef __APPLE__ +#define HIOFFSET 0 /* word offset to find MSB */ +#define LOWOFFSET 1 /* word offset to find LSB */ +#define int32 int /* a data type that has 32 bits */ + +#endif /* __APPLE__ */ +#endif /* __linux__ */ +#endif /* MSW */ +#endif /* SGI */ + +union tabfudge +{ + double tf_d; + int32 tf_i[2]; +}; + +#ifdef __i386__ +#define IEM_DENORMAL(f) ((((*(unsigned int*)&(f))&0x60000000)==0) || \ +(((*(unsigned int*)&(f))&0x60000000)==0x60000000)) +/* more stringent test: anything not between 1e-19 and 1e19 in absolute val */ +#else + +#define IEM_DENORMAL(f) 0 + +#endif + +#endif diff --git a/src/makefile b/src/makefile new file mode 100644 index 0000000..fb74c4f --- /dev/null +++ b/src/makefile @@ -0,0 +1,69 @@ +current: all + +.SUFFIXES: .pd_linux + +INCLUDE = -I. -I/usr/local/src/pd/src + +LDFLAGS = -export-dynamic -shared +LIB = -ldl -lm -lpthread + +#select either the DBG and OPT compiler flags below: + +CFLAGS = -DPD -DUNIX -W -Werror -Wno-unused \ + -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer -fno-strict-aliasing \ + -DDL_OPEN + +SYSTEM = $(shell uname -m) + +# the sources + +SRC = spec2_1p1z_freq~.c \ + spec2_1p1z_time~.c \ + spec2_abs~.c \ + spec2_add_scalar~.c \ + spec2_add~.c \ + spec2_block_delay~.c \ + spec2_clip_max~.c \ + spec2_clip_min~.c \ + spec2_dbtopow~.c \ + spec2_dbtorms~.c \ + spec2_matrix_bundle_stat~.c \ + spec2_mul_scalar~.c \ + spec2_mul~.c \ + spec2_powtodb~.c \ + spec2_rmstodb~.c \ + spec2_shift~.c \ + spec2_sqrt~.c \ + spec2_stretch~.c \ + spec2_sub~.c \ + spec2_sum~.c \ + spec2_tab_conv~.c \ + spec2_tabreceive_enable~.c \ + spec2_tabreceive~.c \ + iem_spec2.c + +TARGET = iem_spec2.pd_linux + + +OBJ = $(SRC:.c=.o) + +# +# ------------------ targets ------------------------------------ +# + +clean: + rm ../$(TARGET) + rm *.o + +all: $(OBJ) + @echo :: $(OBJ) + $(LD) $(LDFLAGS) -o $(TARGET) *.o $(LIB) + strip --strip-unneeded $(TARGET) + mv $(TARGET) .. + +$(OBJ) : %.o : %.c + $(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $*.c + + + + diff --git a/src/makefile_linux b/src/makefile_linux new file mode 100644 index 0000000..fb74c4f --- /dev/null +++ b/src/makefile_linux @@ -0,0 +1,69 @@ +current: all + +.SUFFIXES: .pd_linux + +INCLUDE = -I. -I/usr/local/src/pd/src + +LDFLAGS = -export-dynamic -shared +LIB = -ldl -lm -lpthread + +#select either the DBG and OPT compiler flags below: + +CFLAGS = -DPD -DUNIX -W -Werror -Wno-unused \ + -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer -fno-strict-aliasing \ + -DDL_OPEN + +SYSTEM = $(shell uname -m) + +# the sources + +SRC = spec2_1p1z_freq~.c \ + spec2_1p1z_time~.c \ + spec2_abs~.c \ + spec2_add_scalar~.c \ + spec2_add~.c \ + spec2_block_delay~.c \ + spec2_clip_max~.c \ + spec2_clip_min~.c \ + spec2_dbtopow~.c \ + spec2_dbtorms~.c \ + spec2_matrix_bundle_stat~.c \ + spec2_mul_scalar~.c \ + spec2_mul~.c \ + spec2_powtodb~.c \ + spec2_rmstodb~.c \ + spec2_shift~.c \ + spec2_sqrt~.c \ + spec2_stretch~.c \ + spec2_sub~.c \ + spec2_sum~.c \ + spec2_tab_conv~.c \ + spec2_tabreceive_enable~.c \ + spec2_tabreceive~.c \ + iem_spec2.c + +TARGET = iem_spec2.pd_linux + + +OBJ = $(SRC:.c=.o) + +# +# ------------------ targets ------------------------------------ +# + +clean: + rm ../$(TARGET) + rm *.o + +all: $(OBJ) + @echo :: $(OBJ) + $(LD) $(LDFLAGS) -o $(TARGET) *.o $(LIB) + strip --strip-unneeded $(TARGET) + mv $(TARGET) .. + +$(OBJ) : %.o : %.c + $(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $*.c + + + + diff --git a/src/makefile_win b/src/makefile_win new file mode 100644 index 0000000..5fa4074 --- /dev/null +++ b/src/makefile_win @@ -0,0 +1,59 @@ + +all: ..\iem_spec2.dll + +VIS_CPP_PATH = "C:\Programme\Microsoft Visual Studio\Vc98" + +PD_INST_PATH = "C:\Programme\pd" + +PD_WIN_INCLUDE_PATH = /I. /I$(PD_INST_PATH)\src /I$(VIS_CPP_PATH)\include + +PD_WIN_C_FLAGS = /nologo /W3 /WX /DMSW /DNT /DPD /DWIN32 /DWINDOWS /Ox -DPA_LITTLE_ENDIAN + +PD_WIN_L_FLAGS = /nologo + +PD_WIN_LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel /NODEFAULTLIB:uuid \ + $(VIS_CPP_PATH)\lib\libc.lib \ + $(VIS_CPP_PATH)\lib\oldnames.lib \ + $(VIS_CPP_PATH)\lib\kernel32.lib \ + $(VIS_CPP_PATH)\lib\wsock32.lib \ + $(VIS_CPP_PATH)\lib\winmm.lib \ + $(PD_INST_PATH)\bin\pd.lib + + +SRC = spec2_1p1z_freq~.c \ + spec2_1p1z_time~.c \ + spec2_abs~.c \ + spec2_add_scalar~.c \ + spec2_add~.c \ + spec2_block_delay~.c \ + spec2_clip_max~.c \ + spec2_clip_min~.c \ + spec2_dbtopow~.c \ + spec2_dbtorms~.c \ + spec2_matrix_bundle_stat~.c \ + spec2_mul_scalar~.c \ + spec2_mul~.c \ + spec2_powtodb~.c \ + spec2_rmstodb~.c \ + spec2_shift~.c \ + spec2_sqrt~.c \ + spec2_stretch~.c \ + spec2_sub~.c \ + spec2_sum~.c \ + spec2_tab_conv~.c \ + spec2_tabreceive_enable~.c \ + spec2_tabreceive~.c \ + iem_spec2.c + + +OBJ = $(SRC:.c=.obj) + +.c.obj: + cl $(PD_WIN_C_FLAGS) $(PD_WIN_INCLUDE_PATH) /c $*.c + +..\iem_spec2.dll: $(OBJ) + link $(PD_WIN_L_FLAGS) /dll /export:iem_spec2_setup \ + /out:..\iem_spec2.dll $(OBJ) $(PD_WIN_LIB) + +clean: + del *.obj diff --git a/src/spec2_1p1z_freq~.c b/src/spec2_1p1z_freq~.c new file mode 100644 index 0000000..30cf55b --- /dev/null +++ b/src/spec2_1p1z_freq~.c @@ -0,0 +1,504 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* -- spec2_1p1z_freq~ - filter the spectrum with a 1.order IIR twice, once forwards, once backwards --- */ + +typedef struct spec2_1p1z_freq_tilde +{ + t_object x_obj; + t_float x_a0; + t_float x_a1; + t_float x_b1; + t_float *x_begmem; + int x_blocksize; + t_float x_msi; +} t_spec2_1p1z_freq_tilde; + +t_class *spec2_1p1z_freq_tilde_class; + +static void spec2_1p1z_freq_tilde_list(t_spec2_1p1z_freq_tilde *x, t_symbol *s, int argc, t_atom *argv) +{ + if((argc >= 3) && + IS_A_FLOAT(argv,0) && + IS_A_FLOAT(argv,1) && + IS_A_FLOAT(argv,2)) + { + x->x_a0 = (t_float)atom_getfloatarg(0, argc, argv); + x->x_a1 = (t_float)atom_getfloatarg(1, argc, argv); + x->x_b1 = (t_float)atom_getfloatarg(2, argc, argv); + } +} + +static t_int *spec2_1p1z_freq_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + t_spec2_1p1z_freq_tilde *x = (t_spec2_1p1z_freq_tilde *)(w[3]); + int i, m, n = (int)(w[4]); + t_float a0 = x->x_a0; + t_float a1 = x->x_a1; + t_float b1 = x->x_b1; + t_float *vec1, *vec2, *vec3; + t_float in_old, out_old, f; + + vec2 = x->x_begmem + n + 1; + vec1 = vec2 - 1; + vec3 = vec2 + 2*n; + + *vec2++ = in[0]; + for(i=1; ix_begmem + 2; + in_old = 0.0f; + out_old = 0.0f; + for(i=0; ix_begmem + 3*n - 2; + in_old = 0.0f; + out_old = 0.0f; + for(i=0; ix_begmem + n + 1; + for(i=0; i<=n; i++) + { + out[i] = *vec2++; + } + + return(w+5); +} + +static t_int *spec2_1p1z_freq_tilde_perf16(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + t_spec2_1p1z_freq_tilde *x = (t_spec2_1p1z_freq_tilde *)(w[3]); + int i, m, n = (int)(w[4]); + t_float a0 = x->x_a0; + t_float a1 = x->x_a1; + t_float b1 = x->x_b1; + t_float *vec1, *vec2, *vec3; + t_float in_old, out_old, f; + + m = 3*n; + + vec2 = x->x_begmem + n + 1; + vec1 = vec2; + // vec3 = vec2 + 2*n + 2 - 2; + vec3 = vec2 + 2*n; + + x->x_begmem[0] = 0.0f; + x->x_begmem[m-1] = 0.0f; + + i = n; + while(i) + { + f = in[0]; + vec2[0] = f; + vec1[0] = f; + vec3[0] = f; + + f = in[1]; + vec2[1] = f; + vec1[-1] = f; + vec3[-1] = f; + + f = in[2]; + vec2[2] = f; + vec1[-2] = f; + vec3[-2] = f; + + f = in[3]; + vec2[3] = f; + vec1[-3] = f; + vec3[-3] = f; + + f = in[4]; + vec2[4] = f; + vec1[-4] = f; + vec3[-4] = f; + + f = in[5]; + vec2[5] = f; + vec1[-5] = f; + vec3[-5] = f; + + f = in[6]; + vec2[6] = f; + vec1[-6] = f; + vec3[-6] = f; + + f = in[7]; + vec2[7] = f; + vec1[-7] = f; + vec3[-7] = f; + + f = in[8]; + vec2[8] = f; + vec1[-8] = f; + vec3[-8] = f; + + f = in[9]; + vec2[9] = f; + vec1[-9] = f; + vec3[-9] = f; + + f = in[10]; + vec2[10] = f; + vec1[-10] = f; + vec3[-10] = f; + + f = in[11]; + vec2[11] = f; + vec1[-11] = f; + vec3[-11] = f; + + f = in[12]; + vec2[12] = f; + vec1[-12] = f; + vec3[-12] = f; + + f = in[13]; + vec2[13] = f; + vec1[-13] = f; + vec3[-13] = f; + + f = in[14]; + vec2[14] = f; + vec1[-14] = f; + vec3[-14] = f; + + f = in[15]; + vec2[15] = f; + vec1[-15] = f; + vec3[-15] = f; + + in += 16; + vec1 -= 16; + vec2 += 16; + vec3 -= 16; + i -= 16; + } + f = in[0]; + vec2[0] = f; + vec1[0] = f; + vec3[0] = f; + + vec2 = x->x_begmem; + in_old = 0.0f; + out_old = 0.0f; + i = m; + while(i) + { + f = vec2[0]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[0] = out_old; + + f = vec2[1]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[1] = out_old; + + f = vec2[2]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[2] = out_old; + + f = vec2[3]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[3] = out_old; + + f = vec2[4]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[4] = out_old; + + f = vec2[5]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[5] = out_old; + + f = vec2[6]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[6] = out_old; + + f = vec2[7]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[7] = out_old; + + f = vec2[8]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[8] = out_old; + + f = vec2[9]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[9] = out_old; + + f = vec2[10]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[10] = out_old; + + f = vec2[11]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[11] = out_old; + + f = vec2[12]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[12] = out_old; + + f = vec2[13]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[13] = out_old; + + f = vec2[14]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[14] = out_old; + + f = vec2[15]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[15] = out_old; + + vec2 += 16; + i -= 16; + } + f = vec2[0]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[0] = out_old; + + f = vec2[1]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[1] = out_old; + + f = vec2[2]; + out_old = a0*f + a1*in_old + b1*out_old; + in_old = f; + vec2[2] = out_old; + + // vec2 = x->x_begmem + 3*n - 1 + 3; + vec2 = x->x_begmem + 3*n + 2; + in_old = 0.0f; + out_old = 0.0f; + for(i=0; ix_begmem + n + 1; + i = n; + while(i) + { + out[0] = vec2[0]; + out[1] = vec2[1]; + out[2] = vec2[2]; + out[3] = vec2[3]; + out[4] = vec2[4]; + out[5] = vec2[5]; + out[6] = vec2[6]; + out[7] = vec2[7]; + out[8] = vec2[8]; + out[9] = vec2[9]; + out[10] = vec2[10]; + out[11] = vec2[11]; + out[12] = vec2[12]; + out[13] = vec2[13]; + out[14] = vec2[14]; + out[15] = vec2[15]; + + vec2 += 16; + out += 16; + i -= 16; + } + out[0] = vec2[0]; + + return(w+5); +} + +static void spec2_1p1z_freq_tilde_dsp(t_spec2_1p1z_freq_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(!x->x_blocksize) + { + x->x_begmem = (t_float *)getbytes(3*(n+1)*sizeof(t_float)); + x->x_blocksize = n; + } + else if(x->x_blocksize != n) + { + x->x_begmem = (t_float *)resizebytes(x->x_begmem, 3*(x->x_blocksize+1)*sizeof(t_float), 3*(n+1)*sizeof(t_float)); + x->x_blocksize = n; + } + + if(n&15) + dsp_add(spec2_1p1z_freq_tilde_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, n); + else + dsp_add(spec2_1p1z_freq_tilde_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, n); +} + +static void spec2_1p1z_freq_tilde_free(t_spec2_1p1z_freq_tilde *x) +{ + if(x->x_begmem) + freebytes(x->x_begmem, 3*(x->x_blocksize+1)*sizeof(t_float)); +} + +static void *spec2_1p1z_freq_tilde_new(t_symbol *s, int argc, t_atom *argv) +{ + t_spec2_1p1z_freq_tilde *x = (t_spec2_1p1z_freq_tilde *)pd_new(spec2_1p1z_freq_tilde_class); + + outlet_new(&x->x_obj, &s_signal); + x->x_blocksize = 0; + x->x_begmem = (t_float *)0; + if(argc >= 3) + spec2_1p1z_freq_tilde_list(x, s, argc, argv); + else + { + x->x_a0 = 1.0f; + x->x_a1 = 0.0f; + x->x_b1 = 0.0f; + } + x->x_msi = 0.0f; + return (x); +} + +void spec2_1p1z_freq_tilde_setup(void) +{ + spec2_1p1z_freq_tilde_class = class_new(gensym("spec2_1p1z_freq~"), (t_newmethod)spec2_1p1z_freq_tilde_new, + (t_method)spec2_1p1z_freq_tilde_free, sizeof(t_spec2_1p1z_freq_tilde), 0, A_GIMME, 0); + CLASS_MAINSIGNALIN(spec2_1p1z_freq_tilde_class, t_spec2_1p1z_freq_tilde, x_msi); + class_addmethod(spec2_1p1z_freq_tilde_class, (t_method)spec2_1p1z_freq_tilde_dsp, gensym("dsp"), 0); + class_addlist(spec2_1p1z_freq_tilde_class, (t_method)spec2_1p1z_freq_tilde_list); + class_sethelpsymbol(spec2_1p1z_freq_tilde_class, gensym("iemhelp2/spec2_1p1z_freq~-help")); +} diff --git a/src/spec2_1p1z_time~.c b/src/spec2_1p1z_time~.c new file mode 100644 index 0000000..db779de --- /dev/null +++ b/src/spec2_1p1z_time~.c @@ -0,0 +1,215 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + + +#include "m_pd.h" +#include "iemlib.h" + +/* -------------------------- spec2_1p1z_time~ ------------------------------ */ + +static t_class *spec2_1p1z_time_tilde_class; + +typedef struct _spec2_1p1z_time_tilde +{ + t_object x_obj; + t_float x_a0; + t_float x_a1; + t_float x_b1; + t_float *x_begmem_forw; + t_float *x_begmem_back; + int x_blocksize; + t_float x_msi; +} t_spec2_1p1z_time_tilde; + +static void spec2_1p1z_time_tilde_list(t_spec2_1p1z_time_tilde *x, t_symbol *s, int argc, t_atom *argv) +{ + if((argc >= 3) && + IS_A_FLOAT(argv,0) && + IS_A_FLOAT(argv,1) && + IS_A_FLOAT(argv,2)) + { + x->x_a0 = (t_float)atom_getfloatarg(0, argc, argv); + x->x_a1 = (t_float)atom_getfloatarg(1, argc, argv); + x->x_b1 = (t_float)atom_getfloatarg(2, argc, argv); + } +} + +static t_int *spec2_1p1z_time_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + t_spec2_1p1z_time_tilde *x = (t_spec2_1p1z_time_tilde *)(w[3]); + int i, n = (t_int)(w[4]); + t_float a0 = x->x_a0; + t_float a1 = x->x_a1; + t_float b1 = x->x_b1; + t_float *vec_forw = x->x_begmem_forw; + t_float *vec_back = x->x_begmem_back; + t_float f; + + for(i=0; i<=n; i++) + { + f = in[i]; + out[i] = a0*f + a1*vec_forw[i] + b1*vec_back[i]; + vec_forw[i] = f; + vec_back[i] = out[i]; + } + return(w+5); +} + +static t_int *spec2_1p1z_time_tilde_perf16(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + t_spec2_1p1z_time_tilde *x = (t_spec2_1p1z_time_tilde *)(w[3]); + int n = (t_int)(w[4]); + t_float a0 = x->x_a0; + t_float a1 = x->x_a1; + t_float b1 = x->x_b1; + t_float *vec_forw = x->x_begmem_forw; + t_float *vec_back = x->x_begmem_back; + t_float ff; + + while(n) + { + t_float f[16]; + + f[0] = in[0]; + f[1] = in[1]; + f[2] = in[2]; + f[3] = in[3]; + f[4] = in[4]; + f[5] = in[5]; + f[6] = in[6]; + f[7] = in[7]; + f[8] = in[8]; + f[9] = in[9]; + f[10] = in[10]; + f[11] = in[11]; + f[12] = in[12]; + f[13] = in[13]; + f[14] = in[14]; + f[15] = in[15]; + + out[0] = a0*f[0] + a1*vec_forw[0] + b1*vec_back[0]; + out[1] = a0*f[1] + a1*vec_forw[1] + b1*vec_back[1]; + out[2] = a0*f[2] + a1*vec_forw[2] + b1*vec_back[2]; + out[3] = a0*f[3] + a1*vec_forw[3] + b1*vec_back[3]; + out[4] = a0*f[4] + a1*vec_forw[4] + b1*vec_back[4]; + out[5] = a0*f[5] + a1*vec_forw[5] + b1*vec_back[5]; + out[6] = a0*f[6] + a1*vec_forw[6] + b1*vec_back[6]; + out[7] = a0*f[7] + a1*vec_forw[7] + b1*vec_back[7]; + out[8] = a0*f[8] + a1*vec_forw[8] + b1*vec_back[8]; + out[9] = a0*f[9] + a1*vec_forw[9] + b1*vec_back[9]; + out[10] = a0*f[10] + a1*vec_forw[10] + b1*vec_back[10]; + out[11] = a0*f[11] + a1*vec_forw[11] + b1*vec_back[11]; + out[12] = a0*f[12] + a1*vec_forw[12] + b1*vec_back[12]; + out[13] = a0*f[13] + a1*vec_forw[13] + b1*vec_back[13]; + out[14] = a0*f[14] + a1*vec_forw[14] + b1*vec_back[14]; + out[15] = a0*f[15] + a1*vec_forw[15] + b1*vec_back[15]; + + vec_forw[0] = f[0]; + vec_forw[1] = f[1]; + vec_forw[2] = f[2]; + vec_forw[3] = f[3]; + vec_forw[4] = f[4]; + vec_forw[5] = f[5]; + vec_forw[6] = f[6]; + vec_forw[7] = f[7]; + vec_forw[8] = f[8]; + vec_forw[9] = f[9]; + vec_forw[10] = f[10]; + vec_forw[11] = f[11]; + vec_forw[12] = f[12]; + vec_forw[13] = f[13]; + vec_forw[14] = f[14]; + vec_forw[15] = f[15]; + + vec_back[0] = out[0]; + vec_back[1] = out[1]; + vec_back[2] = out[2]; + vec_back[3] = out[3]; + vec_back[4] = out[4]; + vec_back[5] = out[5]; + vec_back[6] = out[6]; + vec_back[7] = out[7]; + vec_back[8] = out[8]; + vec_back[9] = out[9]; + vec_back[10] = out[10]; + vec_back[11] = out[11]; + vec_back[12] = out[12]; + vec_back[13] = out[13]; + vec_back[14] = out[14]; + vec_back[15] = out[15]; + + in += 16; + out += 16; + vec_forw += 16; + vec_back += 16; + n -= 16; + } + ff = in[0]; + out[0] = a0*ff + a1*vec_forw[0] + b1*vec_back[0]; + vec_forw[0] = ff; + vec_back[0] = out[0]; + return(w+5); +} + +static void spec2_1p1z_time_tilde_dsp(t_spec2_1p1z_time_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(!x->x_blocksize)/*first time*/ + { + x->x_begmem_forw = (t_float *)getbytes(2 * (n+1) * sizeof(t_float)); + x->x_blocksize = n; + x->x_begmem_back = x->x_begmem_forw + n + 1; + } + else if(x->x_blocksize != n) + { + x->x_begmem_forw = (t_float *)resizebytes(x->x_begmem_forw, 2*(x->x_blocksize+1)*sizeof(t_float), 2*(n+1)*sizeof(t_float)); + x->x_blocksize = n; + x->x_begmem_back = x->x_begmem_forw + n +1; + } + if(n&15) + dsp_add(spec2_1p1z_time_tilde_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, n); + else + dsp_add(spec2_1p1z_time_tilde_perf16, 4, sp[0]->s_vec, sp[1]->s_vec, x, n); +} + +static void *spec2_1p1z_time_tilde_new(t_symbol *s, int argc, t_atom *argv) +{ + t_spec2_1p1z_time_tilde *x = (t_spec2_1p1z_time_tilde *)pd_new(spec2_1p1z_time_tilde_class); + + outlet_new(&x->x_obj, &s_signal); + x->x_blocksize = 0; + x->x_begmem_forw = (t_float *)0; + if(argc >= 3) + spec2_1p1z_time_tilde_list(x, s, argc, argv); + else + { + x->x_a0 = 1.0f; + x->x_a1 = 0.0f; + x->x_b1 = 0.0f; + } + x->x_msi = 0.0f; + return (x); +} + +static void spec2_1p1z_time_tilde_free(t_spec2_1p1z_time_tilde *x) +{ + if(x->x_begmem_forw) + freebytes(x->x_begmem_forw, 2 * (x->x_blocksize+1) * sizeof(t_float)); +} + +void spec2_1p1z_time_tilde_setup(void) +{ + spec2_1p1z_time_tilde_class = class_new(gensym("spec2_1p1z_time~"), (t_newmethod)spec2_1p1z_time_tilde_new, (t_method)spec2_1p1z_time_tilde_free, + sizeof(t_spec2_1p1z_time_tilde), 0, A_GIMME, 0); + CLASS_MAINSIGNALIN(spec2_1p1z_time_tilde_class, t_spec2_1p1z_time_tilde, x_msi); + class_addlist(spec2_1p1z_time_tilde_class, (t_method)spec2_1p1z_time_tilde_list); + class_addmethod(spec2_1p1z_time_tilde_class, (t_method)spec2_1p1z_time_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_1p1z_time_tilde_class, gensym("iemhelp2/spec2_1p1z_time~-help")); +} diff --git a/src/spec2_abs~.c b/src/spec2_abs~.c new file mode 100644 index 0000000..f74880e --- /dev/null +++ b/src/spec2_abs~.c @@ -0,0 +1,92 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + + +#include "m_pd.h" +#include "iemlib.h" +#include + +/* ------------------------ spec2_abs_tilde~ ------------------------- */ +static t_class *spec2_abs_tilde_class; + +typedef struct _spec2_abs_tilde +{ + t_object x_obj; + t_float x_msi; +} t_spec2_abs_tilde; + +static t_int *spec2_abs_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = w[3]+1; + + while(n--) + { + *in++ = fabs(*out++); + } + return(w+4); +} + +static t_int *spec2_abs_tilde_perf16(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = w[3]; + + while(n) + { + in[0] = fabs(out[0]); + in[1] = fabs(out[1]); + in[2] = fabs(out[2]); + in[3] = fabs(out[3]); + in[4] = fabs(out[4]); + in[5] = fabs(out[5]); + in[6] = fabs(out[6]); + in[7] = fabs(out[7]); + in[8] = fabs(out[8]); + in[9] = fabs(out[9]); + in[10] = fabs(out[10]); + in[11] = fabs(out[11]); + in[12] = fabs(out[12]); + in[13] = fabs(out[13]); + in[14] = fabs(out[14]); + in[15] = fabs(out[15]); + + in += 16; + out += 16; + n -= 16; + } + in[0] = fabs(out[0]); + return(w+4); +} + +static void spec2_abs_tilde_dsp(t_spec2_abs_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(n&15) + dsp_add(spec2_abs_tilde_perform, 3, sp[0]->s_vec, sp[0]->s_vec, n); + else + dsp_add(spec2_abs_tilde_perf16, 3, sp[0]->s_vec, sp[0]->s_vec, n); +} + +static void *spec2_abs_tilde_new(void) +{ + t_spec2_abs_tilde *x = (t_spec2_abs_tilde *)pd_new(spec2_abs_tilde_class); + + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +void spec2_abs_tilde_setup(void) +{ + spec2_abs_tilde_class = class_new(gensym("spec2_abs~"), (t_newmethod)spec2_abs_tilde_new, + 0, sizeof(t_spec2_abs_tilde), 0, 0); + CLASS_MAINSIGNALIN(spec2_abs_tilde_class, t_spec2_abs_tilde, x_msi); + class_addmethod(spec2_abs_tilde_class, (t_method)spec2_abs_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_abs_tilde_class, gensym("iemhelp2/spec2_abs~-help")); +} diff --git a/src/spec2_add_scalar~.c b/src/spec2_add_scalar~.c new file mode 100644 index 0000000..1581354 --- /dev/null +++ b/src/spec2_add_scalar~.c @@ -0,0 +1,106 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + + +#include "m_pd.h" +#include "iemlib.h" + +/* -------------------------- spec2_add_scalar~ ------------------------------ */ +static t_class *spec2_add_scalar_tilde_class; + +typedef struct _spec2_add_scalar_tilde +{ + t_object x_obj; + t_float x_f; + t_float x_msi; +} t_spec2_add_scalar_tilde; + +static void spec2_add_scalar_tilde_ft1(t_spec2_add_scalar_tilde *x, t_floatarg f) +{ + x->x_f = f; +} + +static t_int *spec2_add_scalar_tilde_perform(t_int *w) +{ + t_float *io = (t_float *)(w[1]); + t_spec2_add_scalar_tilde *x = (t_spec2_add_scalar_tilde *)(w[2]); + int i, n = (t_int)(w[3]); + t_float f = x->x_f; + + for(i=0; i<=n; i++) + { + io[i] += f; + } + return(w+4); +} + +static t_int *spec2_add_scalar_tilde_perf16(t_int *w) +{ + t_float *io = (t_float *)(w[1]); + t_spec2_add_scalar_tilde *x = (t_spec2_add_scalar_tilde *)(w[2]); + int n = (t_int)(w[3]); + t_float f = x->x_f; + + while(n) + { + io[0] += f; + io[1] += f; + io[2] += f; + io[3] += f; + io[4] += f; + io[5] += f; + io[6] += f; + io[7] += f; + io[8] += f; + io[9] += f; + io[10] += f; + io[11] += f; + io[12] += f; + io[13] += f; + io[14] += f; + io[15] += f; + + io += 16; + n -= 16; + } + io[0] += f; + return(w+4); +} + +static void spec2_add_scalar_tilde_dsp(t_spec2_add_scalar_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(n&15) + dsp_add(spec2_add_scalar_tilde_perform, 3, sp[0]->s_vec, x, n); + else + dsp_add(spec2_add_scalar_tilde_perf16, 3, sp[0]->s_vec, x, n); +} + +static void *spec2_add_scalar_tilde_new(t_floatarg f) +{ + t_spec2_add_scalar_tilde *x = (t_spec2_add_scalar_tilde *)pd_new(spec2_add_scalar_tilde_class); + + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1")); + outlet_new(&x->x_obj, &s_signal); + x->x_f = f; + x->x_msi = 0.0f; + return (x); +} + +static void spec2_add_scalar_tilde_free(t_spec2_add_scalar_tilde *x) +{ +} + +void spec2_add_scalar_tilde_setup(void) +{ + spec2_add_scalar_tilde_class = class_new(gensym("spec2_add_scalar~"), (t_newmethod)spec2_add_scalar_tilde_new, (t_method)spec2_add_scalar_tilde_free, + sizeof(t_spec2_add_scalar_tilde), 0, A_DEFFLOAT, 0); + class_addcreator((t_newmethod)spec2_add_scalar_tilde_new, gensym("spec2+s~"), A_DEFFLOAT, 0); + CLASS_MAINSIGNALIN(spec2_add_scalar_tilde_class, t_spec2_add_scalar_tilde, x_msi); + class_addmethod(spec2_add_scalar_tilde_class, (t_method)spec2_add_scalar_tilde_ft1, gensym("ft1"), A_FLOAT, 0); + class_addmethod(spec2_add_scalar_tilde_class, (t_method)spec2_add_scalar_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_add_scalar_tilde_class, gensym("iemhelp2/spec2_add_scalar~-help")); +} diff --git a/src/spec2_add~.c b/src/spec2_add~.c new file mode 100644 index 0000000..aa48ca0 --- /dev/null +++ b/src/spec2_add~.c @@ -0,0 +1,101 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + + +#include "m_pd.h" +#include "iemlib.h" + +/* -------------------------- spec2_add~ ------------------------------ */ +static t_class *spec2_add_tilde_class; + +typedef struct _spec2_add_tilde +{ + t_object x_obj; + t_float x_msi; +} t_spec2_add_tilde; + +static t_int *spec2_add_tilde_perform(t_int *w) +{ + t_float *in1 = (t_float *)(w[1]); + t_float *in2 = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int i, n = (t_int)(w[4]); + + for(i=0; i<=n; i++) + { + out[i] = in1[i] + in2[i]; + } + return(w+5); +} + +static t_int *spec2_add_tilde_perf16(t_int *w) +{ + t_float *in1 = (t_float *)(w[1]); + t_float *in2 = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int n = (t_int)(w[4]); + + while(n) + { + out[0] = in1[0] + in2[0]; + out[1] = in1[1] + in2[1]; + out[2] = in1[2] + in2[2]; + out[3] = in1[3] + in2[3]; + out[4] = in1[4] + in2[4]; + out[5] = in1[5] + in2[5]; + out[6] = in1[6] + in2[6]; + out[7] = in1[7] + in2[7]; + out[8] = in1[8] + in2[8]; + out[9] = in1[9] + in2[9]; + out[10] = in1[10] + in2[10]; + out[11] = in1[11] + in2[11]; + out[12] = in1[12] + in2[12]; + out[13] = in1[13] + in2[13]; + out[14] = in1[14] + in2[14]; + out[15] = in1[15] + in2[15]; + + + in1 += 16; + in2 += 16; + out += 16; + n -= 16; + } + out[0] = in1[0] + in2[0]; + return(w+5); +} + +static void spec2_add_tilde_dsp(t_spec2_add_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(n&15) + dsp_add(spec2_add_tilde_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n); + else + dsp_add(spec2_add_tilde_perf16, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n); +} + +static void *spec2_add_tilde_new(void) +{ + t_spec2_add_tilde *x = (t_spec2_add_tilde *)pd_new(spec2_add_tilde_class); + + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +static void spec2_add_tilde_free(t_spec2_add_tilde *x) +{ +} + +void spec2_add_tilde_setup(void) +{ + spec2_add_tilde_class = class_new(gensym("spec2_add~"), (t_newmethod)spec2_add_tilde_new, (t_method)spec2_add_tilde_free, + sizeof(t_spec2_add_tilde), 0, 0); + class_addcreator((t_newmethod)spec2_add_tilde_new, gensym("spec2+~"), 0); + CLASS_MAINSIGNALIN(spec2_add_tilde_class, t_spec2_add_tilde, x_msi); + class_addmethod(spec2_add_tilde_class, (t_method)spec2_add_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_add_tilde_class, gensym("iemhelp2/spec2_add~-help")); +} diff --git a/src/spec2_block_delay~.c b/src/spec2_block_delay~.c new file mode 100644 index 0000000..9462bc2 --- /dev/null +++ b/src/spec2_block_delay~.c @@ -0,0 +1,157 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* -------------------------- spec2_block_delay~ ------------------------------ */ +static t_class *spec2_block_delay_tilde_class; + +typedef struct _spec2_block_delay_tilde +{ + t_object x_obj; + t_float *x_begmem; + int x_blocksize; + t_float x_msi; +} t_spec2_block_delay_tilde; + +static t_int *spec2_block_delay_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + t_spec2_block_delay_tilde *x = (t_spec2_block_delay_tilde *)(w[3]); + int i, n = (t_int)(w[4]); + t_float *rw_vec; + + rw_vec = x->x_begmem; + for(i=0; i<=n; i++) + { + t_float f = in[i]; + out[i] = rw_vec[i]; + rw_vec[i] = f; + } + return(w+5); +} + +static t_int *spec2_block_delay_tilde_perf16(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + t_spec2_block_delay_tilde *x = (t_spec2_block_delay_tilde *)(w[3]); + int i, n = (t_int)(w[4]); + t_float *rw_vec, ff; + + rw_vec = x->x_begmem; + while(n) + { + t_float f[16]; + + f[0] = in[0]; + f[1] = in[1]; + f[2] = in[2]; + f[3] = in[3]; + f[4] = in[4]; + f[5] = in[5]; + f[6] = in[6]; + f[7] = in[7]; + f[8] = in[8]; + f[9] = in[9]; + f[10] = in[10]; + f[11] = in[11]; + f[12] = in[12]; + f[13] = in[13]; + f[14] = in[14]; + f[15] = in[15]; + + out[0] = rw_vec[0]; + out[1] = rw_vec[1]; + out[2] = rw_vec[2]; + out[3] = rw_vec[3]; + out[4] = rw_vec[4]; + out[5] = rw_vec[5]; + out[6] = rw_vec[6]; + out[7] = rw_vec[7]; + out[8] = rw_vec[8]; + out[9] = rw_vec[9]; + out[10] = rw_vec[10]; + out[11] = rw_vec[11]; + out[12] = rw_vec[12]; + out[13] = rw_vec[13]; + out[14] = rw_vec[14]; + out[15] = rw_vec[15]; + + rw_vec[0] = f[0]; + rw_vec[1] = f[1]; + rw_vec[2] = f[2]; + rw_vec[3] = f[3]; + rw_vec[4] = f[4]; + rw_vec[5] = f[5]; + rw_vec[6] = f[6]; + rw_vec[7] = f[7]; + rw_vec[8] = f[8]; + rw_vec[9] = f[9]; + rw_vec[10] = f[10]; + rw_vec[11] = f[11]; + rw_vec[12] = f[12]; + rw_vec[13] = f[13]; + rw_vec[14] = f[14]; + rw_vec[15] = f[15]; + + rw_vec += 16; + in += 16; + out += 16; + n -= 16; + } + ff = in[0]; + out[0] = rw_vec[0]; + rw_vec[0] = ff; + return(w+5); +} + +static void spec2_block_delay_tilde_dsp(t_spec2_block_delay_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(!x->x_blocksize)/*first time*/ + { + x->x_begmem = (t_float *)getbytes((n+1) * sizeof(t_float)); + x->x_blocksize = n; + } + else if(x->x_blocksize != n) + { + x->x_begmem = (t_float *)resizebytes(x->x_begmem, (x->x_blocksize+1)*sizeof(t_float), (n+1)*sizeof(t_float)); + x->x_blocksize = n; + } + if(n&15) + dsp_add(spec2_block_delay_tilde_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, n); + else + dsp_add(spec2_block_delay_tilde_perf16, 4, sp[0]->s_vec, sp[1]->s_vec, x, n); +} + +static void *spec2_block_delay_tilde_new(void) +{ + t_spec2_block_delay_tilde *x = (t_spec2_block_delay_tilde *)pd_new(spec2_block_delay_tilde_class); + + x->x_blocksize = 0; + x->x_begmem = (t_float *)0; + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +static void spec2_block_delay_tilde_free(t_spec2_block_delay_tilde *x) +{ + if(x->x_begmem) + freebytes(x->x_begmem, (x->x_blocksize+1) * sizeof(t_float)); +} + +void spec2_block_delay_tilde_setup(void) +{ + spec2_block_delay_tilde_class = class_new(gensym("spec2_block_delay~"), (t_newmethod)spec2_block_delay_tilde_new, (t_method)spec2_block_delay_tilde_free, + sizeof(t_spec2_block_delay_tilde), 0, 0); + CLASS_MAINSIGNALIN(spec2_block_delay_tilde_class, t_spec2_block_delay_tilde, x_msi); + class_addmethod(spec2_block_delay_tilde_class, (t_method)spec2_block_delay_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_block_delay_tilde_class, gensym("iemhelp2/spec2_block_delay~-help")); +} diff --git a/src/spec2_clip_max~.c b/src/spec2_clip_max~.c new file mode 100644 index 0000000..fce2adb --- /dev/null +++ b/src/spec2_clip_max~.c @@ -0,0 +1,167 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* -------------------------- spec2_clip_max~ ------------------------------ */ +static t_class *spec2_clip_max_tilde_class; + +typedef struct _spec2_clip_max_tilde +{ + t_object x_obj; + t_float x_msi; +} t_spec2_clip_max_tilde; + +static t_int *spec2_clip_max_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *max = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int i, n = (t_int)(w[4]); + + for(i=0; i<=n; i++) + { + if(in[i] > max[i]) + out[i] = max[i]; + else + out[i] = in[i]; + } + return(w+5); +} + +static t_int *spec2_clip_max_tilde_perf16(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *max = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int n = (t_int)(w[4]); + + while(n) + { + if(in[0] > max[0]) + out[0] = max[0]; + else + out[0] = in[0]; + + if(in[1] > max[1]) + out[1] = max[1]; + else + out[1] = in[1]; + + if(in[2] > max[2]) + out[2] = max[2]; + else + out[2] = in[2]; + + if(in[3] > max[3]) + out[3] = max[3]; + else + out[3] = in[3]; + + if(in[4] > max[4]) + out[4] = max[4]; + else + out[4] = in[4]; + + if(in[5] > max[5]) + out[5] = max[5]; + else + out[5] = in[5]; + + if(in[6] > max[6]) + out[6] = max[6]; + else + out[6] = in[6]; + + if(in[7] > max[7]) + out[7] = max[7]; + else + out[7] = in[7]; + + if(in[8] > max[8]) + out[8] = max[8]; + else + out[8] = in[8]; + + if(in[9] > max[9]) + out[9] = max[9]; + else + out[9] = in[9]; + + if(in[10] > max[10]) + out[10] = max[10]; + else + out[10] = in[10]; + + if(in[11] > max[11]) + out[11] = max[11]; + else + out[11] = in[11]; + + if(in[12] > max[12]) + out[12] = max[12]; + else + out[12] = in[12]; + + if(in[13] > max[13]) + out[13] = max[13]; + else + out[13] = in[13]; + + if(in[14] > max[14]) + out[14] = max[14]; + else + out[14] = in[14]; + + if(in[15] > max[15]) + out[15] = max[15]; + else + out[15] = in[15]; + + in += 16; + max += 16; + out += 16; + n -= 16; + } + if(in[0] > max[0]) + out[0] = max[0]; + else + out[0] = in[0]; + return(w+5); +} + +static void spec2_clip_max_tilde_dsp(t_spec2_clip_max_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(n&15) + dsp_add(spec2_clip_max_tilde_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n); + else + dsp_add(spec2_clip_max_tilde_perf16, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n); +} + +static void *spec2_clip_max_tilde_new(void) +{ + t_spec2_clip_max_tilde *x = (t_spec2_clip_max_tilde *)pd_new(spec2_clip_max_tilde_class); + + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +static void spec2_clip_max_tilde_free(t_spec2_clip_max_tilde *x) +{ +} + +void spec2_clip_max_tilde_setup(void) +{ + spec2_clip_max_tilde_class = class_new(gensym("spec2_clip_max~"), (t_newmethod)spec2_clip_max_tilde_new, (t_method)spec2_clip_max_tilde_free, + sizeof(t_spec2_clip_max_tilde), 0, 0); + CLASS_MAINSIGNALIN(spec2_clip_max_tilde_class, t_spec2_clip_max_tilde, x_msi); + class_addmethod(spec2_clip_max_tilde_class, (t_method)spec2_clip_max_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_clip_max_tilde_class, gensym("iemhelp2/spec2_clip_max~-help")); +} diff --git a/src/spec2_clip_min~.c b/src/spec2_clip_min~.c new file mode 100644 index 0000000..f3071da --- /dev/null +++ b/src/spec2_clip_min~.c @@ -0,0 +1,167 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* -------------------------- spec2_clip_min~ ------------------------------ */ +static t_class *spec2_clip_min_tilde_class; + +typedef struct _spec2_clip_min_tilde +{ + t_object x_obj; + t_float x_msi; +} t_spec2_clip_min_tilde; + +static t_int *spec2_clip_min_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *min = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int i, n = (t_int)(w[4]); + + for(i=0; i<=n; i++) + { + if(in[i] < min[i]) + out[i] = min[i]; + else + out[i] = in[i]; + } + return(w+5); +} + +static t_int *spec2_clip_min_tilde_perf16(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *min = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int n = (t_int)(w[4]); + + while(n) + { + if(in[0] < min[0]) + out[0] = min[0]; + else + out[0] = in[0]; + + if(in[1] < min[1]) + out[1] = min[1]; + else + out[1] = in[1]; + + if(in[2] < min[2]) + out[2] = min[2]; + else + out[2] = in[2]; + + if(in[3] < min[3]) + out[3] = min[3]; + else + out[3] = in[3]; + + if(in[4] < min[4]) + out[4] = min[4]; + else + out[4] = in[4]; + + if(in[5] < min[5]) + out[5] = min[5]; + else + out[5] = in[5]; + + if(in[6] < min[6]) + out[6] = min[6]; + else + out[6] = in[6]; + + if(in[7] < min[7]) + out[7] = min[7]; + else + out[7] = in[7]; + + if(in[8] < min[8]) + out[8] = min[8]; + else + out[8] = in[8]; + + if(in[9] < min[9]) + out[9] = min[9]; + else + out[9] = in[9]; + + if(in[10] < min[10]) + out[10] = min[10]; + else + out[10] = in[10]; + + if(in[11] < min[11]) + out[11] = min[11]; + else + out[11] = in[11]; + + if(in[12] < min[12]) + out[12] = min[12]; + else + out[12] = in[12]; + + if(in[13] < min[13]) + out[13] = min[13]; + else + out[13] = in[13]; + + if(in[14] < min[14]) + out[14] = min[14]; + else + out[14] = in[14]; + + if(in[15] < min[15]) + out[15] = min[15]; + else + out[15] = in[15]; + + in += 16; + min += 16; + out += 16; + n -= 16; + } + if(in[0] < min[0]) + out[0] = min[0]; + else + out[0] = in[0]; + return(w+5); +} + +static void spec2_clip_min_tilde_dsp(t_spec2_clip_min_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(n&15) + dsp_add(spec2_clip_min_tilde_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n); + else + dsp_add(spec2_clip_min_tilde_perf16, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n); +} + +static void *spec2_clip_min_tilde_new(void) +{ + t_spec2_clip_min_tilde *x = (t_spec2_clip_min_tilde *)pd_new(spec2_clip_min_tilde_class); + + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +static void spec2_clip_min_tilde_free(t_spec2_clip_min_tilde *x) +{ +} + +void spec2_clip_min_tilde_setup(void) +{ + spec2_clip_min_tilde_class = class_new(gensym("spec2_clip_min~"), (t_newmethod)spec2_clip_min_tilde_new, (t_method)spec2_clip_min_tilde_free, + sizeof(t_spec2_clip_min_tilde), 0, 0); + CLASS_MAINSIGNALIN(spec2_clip_min_tilde_class, t_spec2_clip_min_tilde, x_msi); + class_addmethod(spec2_clip_min_tilde_class, (t_method)spec2_clip_min_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_clip_min_tilde_class, gensym("iemhelp2/spec2_clip_min~-help")); +} diff --git a/src/spec2_dbtopow~.c b/src/spec2_dbtopow~.c new file mode 100644 index 0000000..72c2b11 --- /dev/null +++ b/src/spec2_dbtopow~.c @@ -0,0 +1,67 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" +#include + +#define SPEC2LOGTEN 2.302585092994f + +/* ------------------------ spec2_dbtopow_tilde~ ------------------------- */ + +static t_class *spec2_dbtopow_tilde_class; + +typedef struct _spec2_dbtopow_tilde +{ + t_object x_obj; + t_float x_msi; +} t_spec2_dbtopow_tilde; + +static t_int *spec2_dbtopow_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = w[3]+1; + + for (; n--; in++, out++) + { + t_float f = *in; + + if(f <= 0.0f) + *out = 0.0f; + else + { + if(f > 870.0f) + f = 870.0f; + *out = exp((SPEC2LOGTEN * 0.1f) * (f-100.0f)); + } + } + return(w+4); +} + +static void spec2_dbtopow_tilde_dsp(t_spec2_dbtopow_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + dsp_add(spec2_dbtopow_tilde_perform, 3, sp[0]->s_vec, sp[0]->s_vec, n); +} + +static void *spec2_dbtopow_tilde_new(void) +{ + t_spec2_dbtopow_tilde *x = (t_spec2_dbtopow_tilde *)pd_new(spec2_dbtopow_tilde_class); + + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +void spec2_dbtopow_tilde_setup(void) +{ + spec2_dbtopow_tilde_class = class_new(gensym("spec2_dbtopow~"), (t_newmethod)spec2_dbtopow_tilde_new, + 0, sizeof(t_spec2_dbtopow_tilde), 0, 0); + CLASS_MAINSIGNALIN(spec2_dbtopow_tilde_class, t_spec2_dbtopow_tilde, x_msi); + class_addmethod(spec2_dbtopow_tilde_class, (t_method)spec2_dbtopow_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_dbtopow_tilde_class, gensym("iemhelp2/spec2_dbtopow~-help")); +} diff --git a/src/spec2_dbtorms~.c b/src/spec2_dbtorms~.c new file mode 100644 index 0000000..3eb3a3e --- /dev/null +++ b/src/spec2_dbtorms~.c @@ -0,0 +1,67 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" +#include + +#define SPEC2LOGTEN 2.302585092994f + +/* ------------------------ spec2_dbtorms_tilde~ ------------------------- */ + +static t_class *spec2_dbtorms_tilde_class; + +typedef struct _spec2_dbtorms_tilde +{ + t_object x_obj; + t_float x_msi; +} t_spec2_dbtorms_tilde; + +static t_int *spec2_dbtorms_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = w[3]+1; + + for (; n--; in++, out++) + { + t_float f = *in; + + if(f <= 0.0f) + *out = 0.0f; + else + { + if(f > 485.0f) + f = 485.0f; + *out = exp((SPEC2LOGTEN * 0.05f) * (f-100.0f)); + } + } + return(w+4); +} + +static void spec2_dbtorms_tilde_dsp(t_spec2_dbtorms_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + dsp_add(spec2_dbtorms_tilde_perform, 3, sp[0]->s_vec, sp[0]->s_vec, n); +} + +static void *spec2_dbtorms_tilde_new(void) +{ + t_spec2_dbtorms_tilde *x = (t_spec2_dbtorms_tilde *)pd_new(spec2_dbtorms_tilde_class); + + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +void spec2_dbtorms_tilde_setup(void) +{ + spec2_dbtorms_tilde_class = class_new(gensym("spec2_dbtorms~"), (t_newmethod)spec2_dbtorms_tilde_new, + 0, sizeof(t_spec2_dbtorms_tilde), 0, 0); + CLASS_MAINSIGNALIN(spec2_dbtorms_tilde_class, t_spec2_dbtorms_tilde, x_msi); + class_addmethod(spec2_dbtorms_tilde_class, (t_method)spec2_dbtorms_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_dbtorms_tilde_class, gensym("iemhelp2/spec2_dbtorms~-help")); +} diff --git a/src/spec2_matrix_bundle_stat~.c b/src/spec2_matrix_bundle_stat~.c new file mode 100644 index 0000000..ebba2dd --- /dev/null +++ b/src/spec2_matrix_bundle_stat~.c @@ -0,0 +1,285 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* ---------- spec2_matrix_bundle_stat~ - signal matrix multiplication object with message matrix-coeff. ----------- */ + +typedef struct spec2_matrix_bundle_stat_tilde +{ + t_object x_obj; + int *x_matbuf; + t_float **x_io; + t_float *x_outsumbuf; + int x_outsumbufsize; + int x_n_in; /* columns */ + int x_n_out; /* rows */ + t_float x_msi; +} t_spec2_matrix_bundle_stat_tilde; + +t_class *spec2_matrix_bundle_stat_tilde_class; + +static void spec2_matrix_bundle_stat_tilde_element(t_spec2_matrix_bundle_stat_tilde *x, t_symbol *s, int argc, t_atom *argv) +{ + int inindex, outindex; + int *matrix = x->x_matbuf; + + if(argc < 2) + { + post("spec2_matrix_bundle_stat~ : bad list: output_row_index input_col_index !"); + return; + } + + outindex = (int)atom_getint(argv); + argv++; + inindex = (int)atom_getint(argv) - 1; + + if(inindex >= x->x_n_in) + inindex = x->x_n_in - 1; + if(inindex < 0) + inindex = 0; + if(outindex >= x->x_n_out) + outindex = x->x_n_out; + if(outindex < 0) + outindex = 0; + + matrix[inindex] = outindex; +} + +static void spec2_matrix_bundle_stat_tilde_list(t_spec2_matrix_bundle_stat_tilde *x, t_symbol *s, int argc, t_atom *argv) +{ + int outindex, i, n=x->x_n_in; + int *matrix = x->x_matbuf; + + if(argc < n) + { + post("spec2_matrix_bundle_stat~ : bad list: (number_of_input_cols = %d) * output_row_index !", n); + return; + } + + for(i=0; i= x->x_n_out) + outindex = x->x_n_out; + if(outindex < 0) + outindex = 0; + matrix[i] = outindex; + } +} + +static void spec2_matrix_bundle_stat_tilde_bundle(t_spec2_matrix_bundle_stat_tilde *x, t_symbol *s, int argc, t_atom *argv) +{ + spec2_matrix_bundle_stat_tilde_list(x, &s_list, argc, argv); +} + +/* the dsp thing */ + +static t_int *spec2_matrix_bundle_stat_tilde_perform(t_int *w) +{ + t_spec2_matrix_bundle_stat_tilde *x = (t_spec2_matrix_bundle_stat_tilde *)(w[1]); + int n = (int)(w[2]); + + t_float **io = x->x_io; + t_float *outsum; + int *mat = x->x_matbuf; + int n_in = x->x_n_in; /* columns */ + int n_out = x->x_n_out; /* rows */ + t_float *in, *out; + int i, j, thrw; + + outsum = x->x_outsumbuf; + for(j=0; jx_outsumbuf + n*thrw; + for(i=0; i<=n; i++) + *outsum++ += *in++; + } + } + + outsum = x->x_outsumbuf; + for(j=0; jx_io; + t_float *outsum; + int *mat = x->x_matbuf; + int n_in = x->x_n_in; /* columns */ + int n_out = x->x_n_out; /* rows */ + t_float *in, *out; + int i, j, thrw; + + for(j=0; jx_outsumbuf + j*(n+1); + for(i=n; i; i -= 8, outsum += 8) + { + outsum[0] = 0.0f; + outsum[1] = 0.0f; + outsum[2] = 0.0f; + outsum[3] = 0.0f; + outsum[4] = 0.0f; + outsum[5] = 0.0f; + outsum[6] = 0.0f; + outsum[7] = 0.0f; + } + outsum[0] = 0.0f; + } + + for(j=0; jx_outsumbuf + (n+1)*thrw; + for(i=n; i; i -= 8, outsum += 8, in += 8) + { + outsum[0] += in[0]; + outsum[1] += in[1]; + outsum[2] += in[2]; + outsum[3] += in[3]; + outsum[4] += in[4]; + outsum[5] += in[5]; + outsum[6] += in[6]; + outsum[7] += in[7]; + } + outsum[0] += in[0]; + } + } + + for(j=0; jx_outsumbuf + j*(n+1); + for (i=n; i; i -= 8, out += 8, outsum += 8) + { + out[0] = outsum[0]; + out[1] = outsum[1]; + out[2] = outsum[2]; + out[3] = outsum[3]; + out[4] = outsum[4]; + out[5] = outsum[5]; + out[6] = outsum[6]; + out[7] = outsum[7]; + } + out[0] = outsum[0]; + } + return (w+3); +} + +static void spec2_matrix_bundle_stat_tilde_dsp(t_spec2_matrix_bundle_stat_tilde *x, t_signal **sp) +{ + int i, n=x->x_n_out*sp[0]->s_n/2; + + if(!x->x_outsumbuf) + { + x->x_outsumbufsize = n; + x->x_outsumbuf = (t_float *)getbytes((x->x_outsumbufsize+x->x_n_out) * sizeof(t_float)); + } + else if(x->x_outsumbufsize != n) + { + x->x_outsumbuf = (t_float *)resizebytes(x->x_outsumbuf, (x->x_outsumbufsize+x->x_n_out)*sizeof(t_float), (n+x->x_n_out)*sizeof(t_float)); + x->x_outsumbufsize = n; + } + + n = x->x_n_in + x->x_n_out; + for(i=0; ix_io[i] = sp[i]->s_vec; + /*post("iovec_addr = %d", (unsigned int)x->x_io[i]);*/ + } + + n = sp[0]->s_n/2; + if(n&7) + dsp_add(spec2_matrix_bundle_stat_tilde_perform, 2, x, n); + else + dsp_add(spec2_matrix_bundle_stat_tilde_perf8, 2, x, n); +} + + +/* setup/setdown things */ + +static void spec2_matrix_bundle_stat_tilde_free(t_spec2_matrix_bundle_stat_tilde *x) +{ + freebytes(x->x_matbuf, x->x_n_in * sizeof(int)); + freebytes(x->x_io, (x->x_n_in + x->x_n_out) * sizeof(t_float *)); + if(x->x_outsumbuf) + freebytes(x->x_outsumbuf, (x->x_outsumbufsize+1) * sizeof(t_float)); +} + +static void *spec2_matrix_bundle_stat_tilde_new(t_symbol *s, int argc, t_atom *argv) +{ + t_spec2_matrix_bundle_stat_tilde *x = (t_spec2_matrix_bundle_stat_tilde *)pd_new(spec2_matrix_bundle_stat_tilde_class); + int i; + + switch (argc) + { + case 0: + x->x_n_in = x->x_n_out = 1; + break; + case 1: + x->x_n_in = x->x_n_out = (int)atom_getint(argv); + break; + default: + x->x_n_in = (int)atom_getint(argv); + x->x_n_out = (int)atom_getint(argv+1); + break; + } + + if(x->x_n_in < 1) + x->x_n_in = 1; + if(x->x_n_out < 1) + x->x_n_out = 1; + i = x->x_n_in - 1; + while(i--) + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); + i = x->x_n_out; + while(i--) + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0; + x->x_outsumbuf = (t_float *)0; + x->x_outsumbufsize = 0; + x->x_matbuf = (int *)getbytes(x->x_n_in * sizeof(int)); + x->x_io = (t_float **)getbytes((x->x_n_in + x->x_n_out) * sizeof(t_float *)); + return (x); +} + +void spec2_matrix_bundle_stat_tilde_setup(void) +{ + spec2_matrix_bundle_stat_tilde_class = class_new(gensym("spec2_matrix_bundle_stat~"), (t_newmethod)spec2_matrix_bundle_stat_tilde_new, (t_method)spec2_matrix_bundle_stat_tilde_free, + sizeof(t_spec2_matrix_bundle_stat_tilde), 0, A_GIMME, 0); + CLASS_MAINSIGNALIN(spec2_matrix_bundle_stat_tilde_class, t_spec2_matrix_bundle_stat_tilde, x_msi); + class_addmethod(spec2_matrix_bundle_stat_tilde_class, (t_method)spec2_matrix_bundle_stat_tilde_dsp, gensym("dsp"), 0); + class_addlist(spec2_matrix_bundle_stat_tilde_class, (t_method)spec2_matrix_bundle_stat_tilde_list); + class_addmethod(spec2_matrix_bundle_stat_tilde_class, (t_method)spec2_matrix_bundle_stat_tilde_element, gensym("element"), A_GIMME, 0); + class_addmethod(spec2_matrix_bundle_stat_tilde_class, (t_method)spec2_matrix_bundle_stat_tilde_bundle, gensym("bundle"), A_GIMME, 0); + class_sethelpsymbol(spec2_matrix_bundle_stat_tilde_class, gensym("iemhelp2/spec2_matrix_bundle_stat~-help")); +} diff --git a/src/spec2_mul_scalar~.c b/src/spec2_mul_scalar~.c new file mode 100644 index 0000000..ae00ee6 --- /dev/null +++ b/src/spec2_mul_scalar~.c @@ -0,0 +1,105 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* -------------------------- spec2_mul_scalar~ ------------------------------ */ +static t_class *spec2_mul_scalar_tilde_class; + +typedef struct _spec2_mul_scalar_tilde +{ + t_object x_obj; + t_float x_f; + t_float x_msi; +} t_spec2_mul_scalar_tilde; + +static void spec2_mul_scalar_tilde_ft1(t_spec2_mul_scalar_tilde *x, t_floatarg f) +{ + x->x_f = f; +} + +static t_int *spec2_mul_scalar_tilde_perform(t_int *w) +{ + t_float *io = (t_float *)(w[1]); + t_spec2_mul_scalar_tilde *x = (t_spec2_mul_scalar_tilde *)(w[2]); + int i, n = (t_int)(w[3]); + t_float f = x->x_f; + + for(i=0; i<=n; i++) + { + io[i] *= f; + } + return(w+4); +} + +static t_int *spec2_mul_scalar_tilde_perf16(t_int *w) +{ + t_float *io = (t_float *)(w[1]); + t_spec2_mul_scalar_tilde *x = (t_spec2_mul_scalar_tilde *)(w[2]); + int n = (t_int)(w[3]); + t_float f = x->x_f; + + while(n) + { + io[0] *= f; + io[1] *= f; + io[2] *= f; + io[3] *= f; + io[4] *= f; + io[5] *= f; + io[6] *= f; + io[7] *= f; + io[8] *= f; + io[9] *= f; + io[10] *= f; + io[11] *= f; + io[12] *= f; + io[13] *= f; + io[14] *= f; + io[15] *= f; + + io += 16; + n -= 16; + } + io[0] *= f; + return(w+4); +} + +static void spec2_mul_scalar_tilde_dsp(t_spec2_mul_scalar_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(n&15) + dsp_add(spec2_mul_scalar_tilde_perform, 3, sp[0]->s_vec, x, n); + else + dsp_add(spec2_mul_scalar_tilde_perf16, 3, sp[0]->s_vec, x, n); +} + +static void *spec2_mul_scalar_tilde_new(t_floatarg f) +{ + t_spec2_mul_scalar_tilde *x = (t_spec2_mul_scalar_tilde *)pd_new(spec2_mul_scalar_tilde_class); + + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1")); + outlet_new(&x->x_obj, &s_signal); + x->x_f = f; + x->x_msi = 0.0f; + return (x); +} + +static void spec2_mul_scalar_tilde_free(t_spec2_mul_scalar_tilde *x) +{ +} + +void spec2_mul_scalar_tilde_setup(void) +{ + spec2_mul_scalar_tilde_class = class_new(gensym("spec2_mul_scalar~"), (t_newmethod)spec2_mul_scalar_tilde_new, (t_method)spec2_mul_scalar_tilde_free, + sizeof(t_spec2_mul_scalar_tilde), 0, A_DEFFLOAT, 0); + class_addcreator((t_newmethod)spec2_mul_scalar_tilde_new, gensym("spec2*s~"), A_DEFFLOAT, 0); + CLASS_MAINSIGNALIN(spec2_mul_scalar_tilde_class, t_spec2_mul_scalar_tilde, x_msi); + class_addmethod(spec2_mul_scalar_tilde_class, (t_method)spec2_mul_scalar_tilde_ft1, gensym("ft1"), A_FLOAT, 0); + class_addmethod(spec2_mul_scalar_tilde_class, (t_method)spec2_mul_scalar_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_mul_scalar_tilde_class, gensym("iemhelp2/spec2_mul_scalar~-help")); +} diff --git a/src/spec2_mul~.c b/src/spec2_mul~.c new file mode 100644 index 0000000..e0cd10c --- /dev/null +++ b/src/spec2_mul~.c @@ -0,0 +1,100 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* -------------------------- spec2_mul~ ------------------------------ */ +static t_class *spec2_mul_tilde_class; + +typedef struct _spec2_mul_tilde +{ + t_object x_obj; + t_float x_msi; +} t_spec2_mul_tilde; + +static t_int *spec2_mul_tilde_perform(t_int *w) +{ + t_float *in1 = (t_float *)(w[1]); + t_float *in2 = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int i, n = (t_int)(w[4]); + + for(i=0; i<=n; i++) + { + out[i] = in1[i] * in2[i]; + } + return(w+5); +} + +static t_int *spec2_mul_tilde_perf16(t_int *w) +{ + t_float *in1 = (t_float *)(w[1]); + t_float *in2 = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int n = (t_int)(w[4]); + + while(n) + { + out[0] = in1[0] * in2[0]; + out[1] = in1[1] * in2[1]; + out[2] = in1[2] * in2[2]; + out[3] = in1[3] * in2[3]; + out[4] = in1[4] * in2[4]; + out[5] = in1[5] * in2[5]; + out[6] = in1[6] * in2[6]; + out[7] = in1[7] * in2[7]; + out[8] = in1[8] * in2[8]; + out[9] = in1[9] * in2[9]; + out[10] = in1[10] * in2[10]; + out[11] = in1[11] * in2[11]; + out[12] = in1[12] * in2[12]; + out[13] = in1[13] * in2[13]; + out[14] = in1[14] * in2[14]; + out[15] = in1[15] * in2[15]; + + + in1 += 16; + in2 += 16; + out += 16; + n -= 16; + } + out[0] = in1[0] * in2[0]; + return(w+5); +} + +static void spec2_mul_tilde_dsp(t_spec2_mul_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(n&15) + dsp_add(spec2_mul_tilde_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n); + else + dsp_add(spec2_mul_tilde_perf16, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n); +} + +static void *spec2_mul_tilde_new(void) +{ + t_spec2_mul_tilde *x = (t_spec2_mul_tilde *)pd_new(spec2_mul_tilde_class); + + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +static void spec2_mul_tilde_free(t_spec2_mul_tilde *x) +{ +} + +void spec2_mul_tilde_setup(void) +{ + spec2_mul_tilde_class = class_new(gensym("spec2_mul~"), (t_newmethod)spec2_mul_tilde_new, (t_method)spec2_mul_tilde_free, + sizeof(t_spec2_mul_tilde), 0, 0); + class_addcreator((t_newmethod)spec2_mul_tilde_new, gensym("spec2*~"), 0); + CLASS_MAINSIGNALIN(spec2_mul_tilde_class, t_spec2_mul_tilde, x_msi); + class_addmethod(spec2_mul_tilde_class, (t_method)spec2_mul_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_mul_tilde_class, gensym("iemhelp2/spec2_mul~-help")); +} diff --git a/src/spec2_powtodb~.c b/src/spec2_powtodb~.c new file mode 100644 index 0000000..ebb064e --- /dev/null +++ b/src/spec2_powtodb~.c @@ -0,0 +1,66 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" +#include + +#define SPEC2LOGTEN 2.302585092994f + +/* ------------------------ spec2_powtodb_tilde~ ------------------------- */ + +static t_class *spec2_powtodb_tilde_class; + +typedef struct _spec2_powtodb_tilde +{ + t_object x_obj; + t_float x_msi; +} t_spec2_powtodb_tilde; + +static t_int *spec2_powtodb_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = w[3]+1; + + for(; n--; in++, out++) + { + t_float f = *in; + + if(f <= 0.0f) + *out = 0.0f; + else + { + t_float g = 100.0f + 10.0f/SPEC2LOGTEN * log(f); + *out = (g < 0.0f ? 0.0f : g); + } + } + return(w+4); +} + +static void spec2_powtodb_tilde_dsp(t_spec2_powtodb_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + dsp_add(spec2_powtodb_tilde_perform, 3, sp[0]->s_vec, sp[0]->s_vec, n); +} + +static void *spec2_powtodb_tilde_new(void) +{ + t_spec2_powtodb_tilde *x = (t_spec2_powtodb_tilde *)pd_new(spec2_powtodb_tilde_class); + + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +void spec2_powtodb_tilde_setup(void) +{ + spec2_powtodb_tilde_class = class_new(gensym("spec2_powtodb~"), (t_newmethod)spec2_powtodb_tilde_new, + 0, sizeof(t_spec2_powtodb_tilde), 0, 0); + CLASS_MAINSIGNALIN(spec2_powtodb_tilde_class, t_spec2_powtodb_tilde, x_msi); + class_addmethod(spec2_powtodb_tilde_class, (t_method)spec2_powtodb_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_powtodb_tilde_class, gensym("iemhelp2/spec2_powtodb~-help")); +} diff --git a/src/spec2_rmstodb~.c b/src/spec2_rmstodb~.c new file mode 100644 index 0000000..a6369da --- /dev/null +++ b/src/spec2_rmstodb~.c @@ -0,0 +1,67 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + + +#include "m_pd.h" +#include "iemlib.h" +#include + +#define SPEC2LOGTEN 2.302585092994f + +/* ------------------------ spec2_rmstodb_tilde~ ------------------------- */ + +static t_class *spec2_rmstodb_tilde_class; + +typedef struct _spec2_rmstodb_tilde +{ + t_object x_obj; + t_float x_msi; +} t_spec2_rmstodb_tilde; + +static t_int *spec2_rmstodb_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = w[3]+1; + + for(; n--; in++, out++) + { + t_float f = *in; + + if(f <= 0.0f) + *out = 0.0f; + else + { + t_float g = 100.0f + 20.0f/SPEC2LOGTEN * log(f); + *out = (g < 0.0f ? 0.0f : g); + } + } + return(w+4); +} + +static void spec2_rmstodb_tilde_dsp(t_spec2_rmstodb_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + dsp_add(spec2_rmstodb_tilde_perform, 3, sp[0]->s_vec, sp[0]->s_vec, n); +} + +static void *spec2_rmstodb_tilde_new(void) +{ + t_spec2_rmstodb_tilde *x = (t_spec2_rmstodb_tilde *)pd_new(spec2_rmstodb_tilde_class); + + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +void spec2_rmstodb_tilde_setup(void) +{ + spec2_rmstodb_tilde_class = class_new(gensym("spec2_rmstodb~"), (t_newmethod)spec2_rmstodb_tilde_new, + 0, sizeof(t_spec2_rmstodb_tilde), 0, 0); + CLASS_MAINSIGNALIN(spec2_rmstodb_tilde_class, t_spec2_rmstodb_tilde, x_msi); + class_addmethod(spec2_rmstodb_tilde_class, (t_method)spec2_rmstodb_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_rmstodb_tilde_class, gensym("iemhelp2/spec2_rmstodb~-help")); +} diff --git a/src/spec2_shift~.c b/src/spec2_shift~.c new file mode 100644 index 0000000..14ccea1 --- /dev/null +++ b/src/spec2_shift~.c @@ -0,0 +1,107 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil (c) IEM KUG Graz Austria 2002 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* -- spec2_shift~ - shift spectral bins to left (lower, negative) or to right (higher, positiv) --- */ + +typedef struct spec2_shift_tilde +{ + t_object x_obj; + int x_blocksize; + t_float x_add; + t_float *x_spec; + t_float x_msi; +} t_spec2_shift_tilde; + +t_class *spec2_shift_tilde_class; + +static t_int *spec2_shift_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + t_spec2_shift_tilde *x = (t_spec2_shift_tilde *)(w[3]); + int i, j, n = (t_int)(w[4])+1; + t_float *spec=x->x_spec; + t_float add=x->x_add; + + if((add >= n) || (add <= -n)) + { + for(i=0; i= 0) + { + for(i=0; ix_add = add; +} + +static void spec2_shift_tilde_dsp(t_spec2_shift_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(!x->x_blocksize) + { + x->x_spec = (t_float *)getbytes((n+1)*sizeof(t_float)); + x->x_blocksize = n; + } + else if(x->x_blocksize != n) + { + x->x_spec = (t_float *)resizebytes(x->x_spec, (x->x_blocksize+1)*sizeof(t_float), (n+1)*sizeof(t_float)); + x->x_blocksize = n; + } + dsp_add(spec2_shift_tilde_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, n); +} + +static void *spec2_shift_tilde_new(t_floatarg add) +{ + t_spec2_shift_tilde *x = (t_spec2_shift_tilde *)pd_new(spec2_shift_tilde_class); + + outlet_new(&x->x_obj, &s_signal); + x->x_blocksize = 0; + x->x_add = add; + x->x_spec = (t_float *)0; + return (x); +} + +static void spec2_shift_tilde_free(t_spec2_shift_tilde *x) +{ + if(x->x_spec) + freebytes(x->x_spec, (x->x_blocksize+1) * sizeof(t_float)); +} + +void spec2_shift_tilde_setup(void) +{ + spec2_shift_tilde_class = class_new(gensym("spec2_shift~"), (t_newmethod)spec2_shift_tilde_new, + 0, sizeof(t_spec2_shift_tilde), 0, A_DEFFLOAT, 0); + CLASS_MAINSIGNALIN(spec2_shift_tilde_class, t_spec2_shift_tilde, x_msi); + class_addmethod(spec2_shift_tilde_class, (t_method)spec2_shift_tilde_dsp, gensym("dsp"), 0); + class_addfloat(spec2_shift_tilde_class, (t_method)spec2_shift_tilde_add); + class_sethelpsymbol(spec2_shift_tilde_class, gensym("iemhelp/spec2_shift~-help")); +} diff --git a/src/spec2_sqrt~.c b/src/spec2_sqrt~.c new file mode 100644 index 0000000..2701eec --- /dev/null +++ b/src/spec2_sqrt~.c @@ -0,0 +1,93 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" +#include + +/* ------------------------ spec2_sqrt_tilde~ ------------------------- */ + +static t_class *spec2_sqrt_tilde_class; + +#define SPEC2DUMTAB1SIZE 256 +#define SPEC2DUMTAB2SIZE 1024 + +static t_float spec2_rsqrt_exptab[SPEC2DUMTAB1SIZE], spec2_rsqrt_mantissatab[SPEC2DUMTAB2SIZE]; + +static void init_spec2_rsqrt(void) +{ + int i; + + for (i=0; i> 23) & 0xff] * spec2_rsqrt_mantissatab[(l >> 13) & 0x3ff]; + + *out++ = f*g*(1.5f - 0.5f*g*g*f); + } + } + return(w+4); +} + +static void spec2_sqrt_tilde_dsp(t_spec2_sqrt_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + dsp_add(spec2_sqrt_tilde_perform, 3, sp[0]->s_vec, sp[0]->s_vec, n); +} + +static void *spec2_sqrt_tilde_new(void) +{ + t_spec2_sqrt_tilde *x = (t_spec2_sqrt_tilde *)pd_new(spec2_sqrt_tilde_class); + + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +void spec2_sqrt_tilde_setup(void) +{ + init_spec2_rsqrt(); + spec2_sqrt_tilde_class = class_new(gensym("spec2_sqrt~"), (t_newmethod)spec2_sqrt_tilde_new, + 0, sizeof(t_spec2_sqrt_tilde), 0, 0); + CLASS_MAINSIGNALIN(spec2_sqrt_tilde_class, t_spec2_sqrt_tilde, x_msi); + class_addmethod(spec2_sqrt_tilde_class, (t_method)spec2_sqrt_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_sqrt_tilde_class, gensym("iemhelp2/spec2_sqrt~-help")); +} diff --git a/src/spec2_stretch~.c b/src/spec2_stretch~.c new file mode 100644 index 0000000..fa5c921 --- /dev/null +++ b/src/spec2_stretch~.c @@ -0,0 +1,105 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil (c) IEM KUG Graz Austria 2002 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* -- spec2_stretch~ - stretch spectral bins --- */ + +typedef struct spec2_stretch_tilde +{ + t_object x_obj; + int x_blocksize; + t_float x_mul; + t_float *x_spec; + t_float x_msi; +} t_spec2_stretch_tilde; + +t_class *spec2_stretch_tilde_class; + +static t_int *spec2_stretch_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + t_spec2_stretch_tilde *x = (t_spec2_stretch_tilde *)(w[3]); + int i, j, m, n = (t_int)(w[4])+1; + t_float yn0, yn1, fract; + t_float *spec=x->x_spec; + t_float mul=x->x_mul; + t_float rcp_mul = 1.0f / mul; + + for(i=0; i n) + m = n; + for(i=0; ix_mul = mul; +} + +static void spec2_stretch_tilde_dsp(t_spec2_stretch_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(!x->x_blocksize) + { + x->x_spec = (t_float *)getbytes((n+1)*sizeof(t_float)); + x->x_blocksize = n; + } + else if(x->x_blocksize != n) + { + x->x_spec = (t_float *)resizebytes(x->x_spec, (x->x_blocksize+1)*sizeof(t_float), (n+1)*sizeof(t_float)); + x->x_blocksize = n; + } + dsp_add(spec2_stretch_tilde_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, n); +} + +static void *spec2_stretch_tilde_new(t_floatarg mul) +{ + t_spec2_stretch_tilde *x = (t_spec2_stretch_tilde *)pd_new(spec2_stretch_tilde_class); + + outlet_new(&x->x_obj, &s_signal); + if(mul <= 0.0f) + mul = 1.0f; + x->x_blocksize = 0; + x->x_mul = mul; + x->x_spec = (t_float *)0; + return (x); +} + +static void spec2_stretch_tilde_free(t_spec2_stretch_tilde *x) +{ + if(x->x_spec) + freebytes(x->x_spec, (x->x_blocksize+1) * sizeof(t_float)); +} + +void spec2_stretch_tilde_setup(void) +{ + spec2_stretch_tilde_class = class_new(gensym("spec2_stretch~"), (t_newmethod)spec2_stretch_tilde_new, + 0, sizeof(t_spec2_stretch_tilde), 0, A_DEFFLOAT, 0); + CLASS_MAINSIGNALIN(spec2_stretch_tilde_class, t_spec2_stretch_tilde, x_msi); + class_addmethod(spec2_stretch_tilde_class, (t_method)spec2_stretch_tilde_dsp, gensym("dsp"), 0); + class_addfloat(spec2_stretch_tilde_class, (t_method)spec2_stretch_tilde_mul); + class_sethelpsymbol(spec2_stretch_tilde_class, gensym("iemhelp/spec2_stretch~-help")); +} diff --git a/src/spec2_sub~.c b/src/spec2_sub~.c new file mode 100644 index 0000000..1164a60 --- /dev/null +++ b/src/spec2_sub~.c @@ -0,0 +1,100 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* -------------------------- spec2_sub~ ------------------------------ */ +static t_class *spec2_sub_tilde_class; + +typedef struct _spec2_sub_tilde +{ + t_object x_obj; + t_float x_msi; +} t_spec2_sub_tilde; + +static t_int *spec2_sub_tilde_perform(t_int *w) +{ + t_float *in1 = (t_float *)(w[1]); + t_float *in2 = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int i, n = (t_int)(w[4]); + + for(i=0; i<=n; i++) + { + out[i] = in1[i] - in2[i]; + } + return(w+5); +} + +static t_int *spec2_sub_tilde_perf16(t_int *w) +{ + t_float *in1 = (t_float *)(w[1]); + t_float *in2 = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int n = (t_int)(w[4]); + + while(n) + { + out[0] = in1[0] - in2[0]; + out[1] = in1[1] - in2[1]; + out[2] = in1[2] - in2[2]; + out[3] = in1[3] - in2[3]; + out[4] = in1[4] - in2[4]; + out[5] = in1[5] - in2[5]; + out[6] = in1[6] - in2[6]; + out[7] = in1[7] - in2[7]; + out[8] = in1[8] - in2[8]; + out[9] = in1[9] - in2[9]; + out[10] = in1[10] - in2[10]; + out[11] = in1[11] - in2[11]; + out[12] = in1[12] - in2[12]; + out[13] = in1[13] - in2[13]; + out[14] = in1[14] - in2[14]; + out[15] = in1[15] - in2[15]; + + + in1 += 16; + in2 += 16; + out += 16; + n -= 16; + } + out[0] = in1[0] - in2[0]; + return(w+5); +} + +static void spec2_sub_tilde_dsp(t_spec2_sub_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(n&15) + dsp_add(spec2_sub_tilde_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n); + else + dsp_add(spec2_sub_tilde_perf16, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n); +} + +static void *spec2_sub_tilde_new(void) +{ + t_spec2_sub_tilde *x = (t_spec2_sub_tilde *)pd_new(spec2_sub_tilde_class); + + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +static void spec2_sub_tilde_free(t_spec2_sub_tilde *x) +{ +} + +void spec2_sub_tilde_setup(void) +{ + spec2_sub_tilde_class = class_new(gensym("spec2_sub~"), (t_newmethod)spec2_sub_tilde_new, (t_method)spec2_sub_tilde_free, + sizeof(t_spec2_sub_tilde), 0, 0); + class_addcreator((t_newmethod)spec2_sub_tilde_new, gensym("spec2-~"), 0); + CLASS_MAINSIGNALIN(spec2_sub_tilde_class, t_spec2_sub_tilde, x_msi); + class_addmethod(spec2_sub_tilde_class, (t_method)spec2_sub_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_sub_tilde_class, gensym("iemhelp2/spec2_sub~-help")); +} diff --git a/src/spec2_sum~.c b/src/spec2_sum~.c new file mode 100644 index 0000000..52b864d --- /dev/null +++ b/src/spec2_sum~.c @@ -0,0 +1,120 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* ------------------------ spec2_sum_tilde~ ------------------------- */ + +static t_class *spec2_sum_tilde_class; + +typedef struct _spec2_sum_tilde +{ + t_object x_obj; + t_float x_msi; +} t_spec2_sum_tilde; + +static t_int *spec2_sum_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + t_float sum = 0.0f; + int n, hn; + + n = hn = w[3]; + sum = *in++; + while(n--) + sum += (*in++)*2.0f; + while(hn--) + *out++ = sum; + *out++ = sum; + return(w+4); +} + +static t_int *spec2_sum_tilde_perf16(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + t_float sum=0.0f; + int n, hn; + + n = hn = w[3]; + sum = *in++; + while(n) + { + sum += 2.0f*in[0]; + sum += 2.0f*in[1]; + sum += 2.0f*in[2]; + sum += 2.0f*in[3]; + sum += 2.0f*in[4]; + sum += 2.0f*in[5]; + sum += 2.0f*in[6]; + sum += 2.0f*in[7]; + sum += 2.0f*in[8]; + sum += 2.0f*in[9]; + sum += 2.0f*in[10]; + sum += 2.0f*in[11]; + sum += 2.0f*in[12]; + sum += 2.0f*in[13]; + sum += 2.0f*in[14]; + sum += 2.0f*in[15]; + + in += 16; + n -= 16; + } + + while(hn) + { + out[0] = sum; + out[1] = sum; + out[2] = sum; + out[3] = sum; + out[4] = sum; + out[5] = sum; + out[6] = sum; + out[7] = sum; + out[8] = sum; + out[9] = sum; + out[10] = sum; + out[11] = sum; + out[12] = sum; + out[13] = sum; + out[14] = sum; + out[15] = sum; + + out += 16; + hn -= 16; + } + out[0] = sum; + return(w+4); +} + +static void spec2_sum_tilde_dsp(t_spec2_sum_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + if(n&15) + dsp_add(spec2_sum_tilde_perform, 3, sp[0]->s_vec, sp[0]->s_vec, n); + else + dsp_add(spec2_sum_tilde_perf16, 3, sp[0]->s_vec, sp[0]->s_vec, n); +} + +static void *spec2_sum_tilde_new(void) +{ + t_spec2_sum_tilde *x = (t_spec2_sum_tilde *)pd_new(spec2_sum_tilde_class); + + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +void spec2_sum_tilde_setup(void) +{ + spec2_sum_tilde_class = class_new(gensym("spec2_sum~"), (t_newmethod)spec2_sum_tilde_new, + 0, sizeof(t_spec2_sum_tilde), 0, 0); + CLASS_MAINSIGNALIN(spec2_sum_tilde_class, t_spec2_sum_tilde, x_msi); + class_addmethod(spec2_sum_tilde_class, (t_method)spec2_sum_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_sum_tilde_class, gensym("iemhelp2/spec2_sum~-help")); +} diff --git a/src/spec2_tab_conv~.c b/src/spec2_tab_conv~.c new file mode 100644 index 0000000..8168e9c --- /dev/null +++ b/src/spec2_tab_conv~.c @@ -0,0 +1,150 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil (c) IEM KUG Graz Austria 2002 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* -- spec2_tab_conv~ - convolute a spectrum with a table --- */ + +typedef struct spec2_tab_conv_tilde +{ + t_object x_obj; + t_float *x_spec; + t_float *x_beg_array; + int x_blocksize; + int x_winsize; + int x_has_changed; + t_symbol *x_sym_array; + t_float x_msi; +} t_spec2_tab_conv_tilde; + +t_class *spec2_tab_conv_tilde_class; + +static void spec2_tab_conv_tilde_set(t_spec2_tab_conv_tilde *x, t_symbol *s, int argc, t_atom *argv) +{ + if(argc >= 2) + { + x->x_sym_array = (t_symbol *)(atom_getsymbol(argv)); + argv++; + x->x_winsize = (int)(atom_getint(argv)); + x->x_has_changed = 1; + } +} + +static t_int *spec2_tab_conv_tilde_perform(t_int *w) +{ + t_float *in = (t_float *)(w[1]); + t_float *out = (t_float *)(w[2]); + t_spec2_tab_conv_tilde *x = (t_spec2_tab_conv_tilde *)(w[3]); + t_float sum=0.0f; + t_float *vec1, *vec2, *vec3, *win; + int i, m, n = (int)(w[4])+1; + int j, ws=x->x_winsize; + + vec2 = x->x_spec + n; + vec1 = vec2; + vec3 = vec2 + 2*n - 2; + + for(i=0; ix_spec + n - ws/2; + win = x->x_beg_array; + + for(i=0; is_n)/2; + t_garray *a; + int n_points; + + if(x->x_has_changed) + { + x->x_has_changed = 0; + if(!(a = (t_garray *)pd_findbyclass(x->x_sym_array, garray_class))) + { + if(*x->x_sym_array->s_name) + error("spec2_tab_conv~: %s: no such array", x->x_sym_array->s_name); + } + else if(!garray_getfloatarray(a, &n_points, &x->x_beg_array)) + error("%s: bad template for spec2_tab_conv~", x->x_sym_array->s_name); + else + { + if(n_points > (n+1)) + n_points = n+1; + if(x->x_winsize < 0) + x->x_winsize = 0; + if(x->x_winsize > n_points) + x->x_winsize = n_points; + } + } + + if(!x->x_blocksize) + { + x->x_spec = (t_float *)getbytes(3*(n+1)*sizeof(t_float)); + x->x_blocksize = n; + } + else if(x->x_blocksize != n) + { + x->x_spec = (t_float *)resizebytes(x->x_spec, 3*(x->x_blocksize+1)*sizeof(t_float), 3*(n+1)*sizeof(t_float)); + x->x_blocksize = n; + } + + dsp_add(spec2_tab_conv_tilde_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, n); +} + +static void spec2_tab_conv_tilde_free(t_spec2_tab_conv_tilde *x) +{ + if(x->x_spec) + freebytes(x->x_spec, 3*(x->x_blocksize+1)*sizeof(t_float)); +} + +static void *spec2_tab_conv_tilde_new(t_symbol *s, int argc, t_atom *argv) +{ + t_spec2_tab_conv_tilde *x = (t_spec2_tab_conv_tilde *)pd_new(spec2_tab_conv_tilde_class); + + if(argc >= 2) + { + x->x_sym_array = (t_symbol *)(atom_getsymbol(argv)); + argv++; + x->x_winsize = (int)(atom_getint(argv)); + x->x_spec = (t_float *)0; + x->x_beg_array = (t_float *)0; + x->x_blocksize = 0; + x->x_has_changed = 1; + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return(x); + } + else + { + post("spec2_tab_conv~-ERROR: needs 2 args: convolution-array-name + convolution-array-size !!!"); + return(0); + } +} + +void spec2_tab_conv_tilde_setup(void) +{ + spec2_tab_conv_tilde_class = class_new(gensym("spec2_tab_conv~"), (t_newmethod)spec2_tab_conv_tilde_new, + (t_method)spec2_tab_conv_tilde_free, sizeof(t_spec2_tab_conv_tilde), 0, A_GIMME, 0); + CLASS_MAINSIGNALIN(spec2_tab_conv_tilde_class, t_spec2_tab_conv_tilde, x_msi); + class_addmethod(spec2_tab_conv_tilde_class, (t_method)spec2_tab_conv_tilde_dsp, gensym("dsp"), 0); + class_addmethod(spec2_tab_conv_tilde_class, (t_method)spec2_tab_conv_tilde_set, gensym("set"), A_GIMME, 0); + class_sethelpsymbol(spec2_tab_conv_tilde_class, gensym("iemhelp/spec2_tab_conv~-help")); +} diff --git a/src/spec2_tabreceive_enable~.c b/src/spec2_tabreceive_enable~.c new file mode 100644 index 0000000..182e495 --- /dev/null +++ b/src/spec2_tabreceive_enable~.c @@ -0,0 +1,166 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* ------------------------ spec2_tabreceive_enable_tilde~ ------------------------- */ + +static t_class *spec2_tabreceive_enable_tilde_class; + +typedef struct _spec2_tabreceive_enable_tilde +{ + t_object x_obj; + t_float *x_vec; + t_symbol *x_arrayname; + int x_enable; +} t_spec2_tabreceive_enable_tilde; + +static void spec2_tabreceive_enable_tilde_symbol(t_spec2_tabreceive_enable_tilde *x, t_symbol *s) +{ + x->x_arrayname = s; +} + +static void spec2_tabreceive_enable_tilde_float(t_spec2_tabreceive_enable_tilde *x, t_floatarg f) +{ + int i=(int)f; + + if(i) + i = 1; + + x->x_enable = i; +} + +static t_int *spec2_tabreceive_enable_tilde_perform(t_int *w) +{ + t_spec2_tabreceive_enable_tilde *x = (t_spec2_tabreceive_enable_tilde *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = w[3]+1; + t_float *vec = x->x_vec; + + if(vec && x->x_enable) + while(n--) + *out++ = *vec++; + else + while(n--) + *out++ = 0.0f; + return(w+4); +} + +static t_int *spec2_tabreceive_enable_tilde_perf16(t_int *w) +{ + t_spec2_tabreceive_enable_tilde *x = (t_spec2_tabreceive_enable_tilde *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = w[3]; + t_float *vec = x->x_vec; + + if(vec && x->x_enable) + { + while(n) + { + out[0] = vec[0]; + out[1] = vec[1]; + out[2] = vec[2]; + out[3] = vec[3]; + out[4] = vec[4]; + out[5] = vec[5]; + out[6] = vec[6]; + out[7] = vec[7]; + out[8] = vec[8]; + out[9] = vec[9]; + out[10] = vec[10]; + out[11] = vec[11]; + out[12] = vec[12]; + out[13] = vec[13]; + out[14] = vec[14]; + out[15] = vec[15]; + + vec += 16; + out += 16; + n -= 16; + } + out[0] = vec[0]; + } + else + { + while(n) + { + out[0] = 0.0f; + out[1] = 0.0f; + out[2] = 0.0f; + out[3] = 0.0f; + out[4] = 0.0f; + out[5] = 0.0f; + out[6] = 0.0f; + out[7] = 0.0f; + out[8] = 0.0f; + out[9] = 0.0f; + out[10] = 0.0f; + out[11] = 0.0f; + out[12] = 0.0f; + out[13] = 0.0f; + out[14] = 0.0f; + out[15] = 0.0f; + + out += 16; + n -= 16; + } + out[0] = 0.0f; + } + + return(w+4); +} + +static void spec2_tabreceive_enable_tilde_dsp(t_spec2_tabreceive_enable_tilde *x, t_signal **sp) +{ + t_garray *a; + int vecsize; + + if(!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) + { + if(*x->x_arrayname->s_name) + error("spec2_tabreceive_enable~: %s: no such array", x->x_arrayname->s_name); + } + else if(!garray_getfloatarray(a, &vecsize, &x->x_vec)) + error("%s: bad template for spec2_tabreceive_enable~", x->x_arrayname->s_name); + else + { + int n = sp[0]->s_n; + + if(n < vecsize) + vecsize = n; + vecsize /= 2; + if(vecsize&15) + dsp_add(spec2_tabreceive_enable_tilde_perform, 3, x, sp[0]->s_vec, vecsize); + else + dsp_add(spec2_tabreceive_enable_tilde_perf16, 3, x, sp[0]->s_vec, vecsize); + } +} + +static void *spec2_tabreceive_enable_tilde_new(t_symbol *s, int argc, t_atom *argv) +{ + t_spec2_tabreceive_enable_tilde *x = (t_spec2_tabreceive_enable_tilde *)pd_new(spec2_tabreceive_enable_tilde_class); + + x->x_enable = 0; + if((argc >= 1) && IS_A_SYMBOL(argv,0)) + x->x_arrayname = atom_getsymbolarg(0, argc, argv); + if((argc >= 2) && IS_A_FLOAT(argv,1)) + x->x_enable = (int)atom_getintarg(1, argc, argv); + if(x->x_enable) + x->x_enable = 1; + + outlet_new(&x->x_obj, &s_signal); + return (x); +} + +void spec2_tabreceive_enable_tilde_setup(void) +{ + spec2_tabreceive_enable_tilde_class = class_new(gensym("spec2_tabreceive_enable~"), (t_newmethod)spec2_tabreceive_enable_tilde_new, + 0, sizeof(t_spec2_tabreceive_enable_tilde), 0, A_GIMME, 0); + class_addmethod(spec2_tabreceive_enable_tilde_class, (t_method)spec2_tabreceive_enable_tilde_dsp, gensym("dsp"), 0); + class_addsymbol(spec2_tabreceive_enable_tilde_class, (t_method)spec2_tabreceive_enable_tilde_symbol); + class_addfloat(spec2_tabreceive_enable_tilde_class, (t_method)spec2_tabreceive_enable_tilde_float); + class_sethelpsymbol(spec2_tabreceive_enable_tilde_class, gensym("iemhelp2/spec2_tabreceive_enable~-help")); +} diff --git a/src/spec2_tabreceive~.c b/src/spec2_tabreceive~.c new file mode 100644 index 0000000..0314886 --- /dev/null +++ b/src/spec2_tabreceive~.c @@ -0,0 +1,147 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil (c) IEM KUG Graz Austria 2002 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" + +/* ------------------------ spec2_tabreceive_tilde~ ------------------------- */ + +static t_class *spec2_tabreceive_tilde_class; + +typedef struct _spec2_tabreceive_tilde +{ + t_object x_obj; + t_float *x_vec; + t_symbol *x_arrayname; +} t_spec2_tabreceive_tilde; + +static void spec2_tabreceive_tilde_symbol(t_spec2_tabreceive_tilde *x, t_symbol *s) +{ + x->x_arrayname = s; +} + +static t_int *spec2_tabreceive_tilde_perform(t_int *w) +{ + t_spec2_tabreceive_tilde *x = (t_spec2_tabreceive_tilde *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = w[3]+1; + t_float *vec = x->x_vec; + + if(vec) + while(n--) + *out++ = *vec++; + else + while(n--) + *out++ = 0.0f; + return(w+4); +} + +static t_int *spec2_tabreceive_tilde_perf16(t_int *w) +{ + t_spec2_tabreceive_tilde *x = (t_spec2_tabreceive_tilde *)(w[1]); + t_float *out = (t_float *)(w[2]); + int n = w[3]; + t_float *vec = x->x_vec; + + if(vec) + { + while(n) + { + out[0] = vec[0]; + out[1] = vec[1]; + out[2] = vec[2]; + out[3] = vec[3]; + out[4] = vec[4]; + out[5] = vec[5]; + out[6] = vec[6]; + out[7] = vec[7]; + out[8] = vec[8]; + out[9] = vec[9]; + out[10] = vec[10]; + out[11] = vec[11]; + out[12] = vec[12]; + out[13] = vec[13]; + out[14] = vec[14]; + out[15] = vec[15]; + + vec += 16; + out += 16; + n -= 16; + } + out[0] = vec[0]; + } + else + { + while(n) + { + out[0] = 0.0f; + out[1] = 0.0f; + out[2] = 0.0f; + out[3] = 0.0f; + out[4] = 0.0f; + out[5] = 0.0f; + out[6] = 0.0f; + out[7] = 0.0f; + out[8] = 0.0f; + out[9] = 0.0f; + out[10] = 0.0f; + out[11] = 0.0f; + out[12] = 0.0f; + out[13] = 0.0f; + out[14] = 0.0f; + out[15] = 0.0f; + + out += 16; + n -= 16; + } + out[0] = 0.0f; + } + + return(w+4); +} + +static void spec2_tabreceive_tilde_dsp(t_spec2_tabreceive_tilde *x, t_signal **sp) +{ + t_garray *a; + int vecsize; + + if(!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) + { + if(*x->x_arrayname->s_name) + error("spec2_tabreceive~: %s: no such array", x->x_arrayname->s_name); + } + else if(!garray_getfloatarray(a, &vecsize, &x->x_vec)) + error("%s: bad template for spec2_tabreceive~", x->x_arrayname->s_name); + else + { + int n = sp[0]->s_n; + + if(n < vecsize) + vecsize = n; + vecsize /= 2; + if(vecsize&15) + dsp_add(spec2_tabreceive_tilde_perform, 3, x, sp[0]->s_vec, vecsize); + else + dsp_add(spec2_tabreceive_tilde_perf16, 3, x, sp[0]->s_vec, vecsize); + } +} + +static void *spec2_tabreceive_tilde_new(t_symbol *s) +{ + t_spec2_tabreceive_tilde *x = (t_spec2_tabreceive_tilde *)pd_new(spec2_tabreceive_tilde_class); + + x->x_arrayname = s; + outlet_new(&x->x_obj, &s_signal); + return (x); +} + +void spec2_tabreceive_tilde_setup(void) +{ + spec2_tabreceive_tilde_class = class_new(gensym("spec2_tabreceive~"), (t_newmethod)spec2_tabreceive_tilde_new, + 0, sizeof(t_spec2_tabreceive_tilde), 0, A_DEFSYM, 0); + class_addmethod(spec2_tabreceive_tilde_class, (t_method)spec2_tabreceive_tilde_dsp, gensym("dsp"), 0); + class_addsymbol(spec2_tabreceive_tilde_class, (t_method)spec2_tabreceive_tilde_symbol); + class_sethelpsymbol(spec2_tabreceive_tilde_class, gensym("iemhelp/spec2_tabreceive~-help")); +} -- cgit v1.2.1