BASEDIR=`pwd`;
LIBDIR=${BASEDIR}/libs;
SUBDIRS="ilbc curl iksemel js js/nsprpub libdingaling libedit libsndfile pcre sofia-sip \
- speex sqlite srtp openzap freetdm spandsp libg722_1 portaudio unimrcp tiff-3.8.2 broadvoice silk";
+ speex sqlite srtp openzap freetdm spandsp libg722_1 portaudio unimrcp tiff-3.8.2 broadvoice silk libcodec2";
if [ ! -f modules.conf ]; then
cp build/modules.conf.in modules.conf
AC_CONFIG_SUBDIRS([libs/broadvoice])
AC_CONFIG_SUBDIRS([libs/libg722_1])
AC_CONFIG_SUBDIRS([libs/silk])
+AC_CONFIG_SUBDIRS([libs/libcodec2])
case $host in
*-openbsd*)
--- /dev/null
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+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 and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, 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 library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete 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 distribute a copy of this License along with the
+Library.
+
+ 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.
+\f
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+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 Library, 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 Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+\f
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you 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.
+
+ If distribution of 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 satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be 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.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library 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.
+
+ 9. 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 Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+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 with
+this License.
+\f
+ 11. 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 Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library 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 Library.
+
+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.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library 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.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+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 Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+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
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "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
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. 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 LIBRARY 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
+LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+\f
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
--- /dev/null
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory. After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script). Here is a another example:
+
+ /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
--- /dev/null
+AM_CFLAGS = -Isrc -Wall -lm
+AUTOMAKE_OPTS = gnu
+NAME = libcodec2
+AM_CPPFLAGS = $(AM_CFLAGS)
+
+EXTRA_DIST = pitch/hts1a.p \
+pitch/hts2a.p \
+octave/glottal.m \
+octave/lsp_pdf.m \
+octave/phase.m \
+octave/pl2.m \
+octave/plinterp.m \
+octave/plnlp.m \
+octave/plpitch.m \
+octave/postfilter.m \
+octave/load_raw.m \
+octave/phase2.m \
+octave/pitch_test.m \
+octave/plamp.m \
+octave/pl.m \
+octave/plphase.m \
+octave/png.m \
+octave/pulse.m \
+raw/b0067.raw \
+raw/forig_speex_8k.raw \
+raw/hts1.raw \
+raw/hts2.raw \
+raw/mmt1.raw \
+raw/morig_speex_8k.raw \
+raw/f2400.raw \
+raw/hts1a_g729a.raw \
+raw/hts2a_g729a.raw \
+raw/hts.raw \
+raw/mmt1_speex_8k.raw \
+raw/forig_g729a.raw \
+raw/hts1a_gsm13k.raw \
+raw/hts2a_gsm13k.raw \
+raw/m2400.raw \
+raw/morig_g729a.raw \
+raw/forig_gsm13k.raw \
+raw/hts1a.raw \
+raw/hts2a.raw \
+raw/mmt1_g729a.raw \
+raw/morig_gsm13k.raw \
+raw/forig.raw \
+raw/hts1a_speex_8k.raw \
+raw/hts2a_speex_8k.raw \
+raw/mmt1_gsm13k.raw \
+raw/morig.raw \
+script/menu.sh \
+script/playraw.sh \
+script/raw2wav.sh \
+script/wav2raw.sh \
+wav/f2400.wav \
+wav/hts1a_c2_v0.1.wav \
+wav/hts1a.wav \
+wav/hts2a_speex_8k.wav \
+wav/mmt1_speex_8k.wav \
+wav/morig.wav \
+wav/forig_speex_8k.wav \
+wav/hts1a_g729a.wav \
+wav/hts2a_c2_v0.1.wav \
+wav/hts2a.wav \
+wav/mmt1.wav \
+wav/forig.wav \
+wav/hts1a_speex_8k.wav \
+wav/hts2a_g729a.wav \
+wav/m2400.wav \
+wav/morig_speex_8k.wav \
+src/globals.c \
+doc/A_m.gif \
+doc/omega_0.gif \
+doc/phi_m.gif \
+doc/s_n.gif \
+doc/s_n.txt \
+unittest/lsp2.txt \
+unittest/lsp7.txt \
+unittest/lspd78.txt \
+unittest/lsp3.txt \
+unittest/lsp8.txt \
+unittest/lspd910.txt \
+unittest/lsp4.txt \
+unittest/lsp9.txt \
+unittest/lsp10.txt \
+unittest/lsp5.txt \
+unittest/lspd123.txt \
+unittest/lsp1.txt \
+unittest/lsp6.txt \
+unittest/lspd456.txt \
+src/codeall.sh \
+src/fq20.sh \
+src/listen1.sh \
+src/listen.sh \
+src/listensim.sh \
+src/sim.sh
+
+
+SUBDIRS = src unittest
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
+ ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \
+ install-sh ltmain.sh missing
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AM_CFLAGS = -Isrc -Wall -lm
+AUTOMAKE_OPTS = gnu
+NAME = libcodec2
+AM_CPPFLAGS = $(AM_CFLAGS)
+EXTRA_DIST = pitch/hts1a.p \
+pitch/hts2a.p \
+octave/glottal.m \
+octave/lsp_pdf.m \
+octave/phase.m \
+octave/pl2.m \
+octave/plinterp.m \
+octave/plnlp.m \
+octave/plpitch.m \
+octave/postfilter.m \
+octave/load_raw.m \
+octave/phase2.m \
+octave/pitch_test.m \
+octave/plamp.m \
+octave/pl.m \
+octave/plphase.m \
+octave/png.m \
+octave/pulse.m \
+raw/b0067.raw \
+raw/forig_speex_8k.raw \
+raw/hts1.raw \
+raw/hts2.raw \
+raw/mmt1.raw \
+raw/morig_speex_8k.raw \
+raw/f2400.raw \
+raw/hts1a_g729a.raw \
+raw/hts2a_g729a.raw \
+raw/hts.raw \
+raw/mmt1_speex_8k.raw \
+raw/forig_g729a.raw \
+raw/hts1a_gsm13k.raw \
+raw/hts2a_gsm13k.raw \
+raw/m2400.raw \
+raw/morig_g729a.raw \
+raw/forig_gsm13k.raw \
+raw/hts1a.raw \
+raw/hts2a.raw \
+raw/mmt1_g729a.raw \
+raw/morig_gsm13k.raw \
+raw/forig.raw \
+raw/hts1a_speex_8k.raw \
+raw/hts2a_speex_8k.raw \
+raw/mmt1_gsm13k.raw \
+raw/morig.raw \
+script/menu.sh \
+script/playraw.sh \
+script/raw2wav.sh \
+script/wav2raw.sh \
+wav/f2400.wav \
+wav/hts1a_c2_v0.1.wav \
+wav/hts1a.wav \
+wav/hts2a_speex_8k.wav \
+wav/mmt1_speex_8k.wav \
+wav/morig.wav \
+wav/forig_speex_8k.wav \
+wav/hts1a_g729a.wav \
+wav/hts2a_c2_v0.1.wav \
+wav/hts2a.wav \
+wav/mmt1.wav \
+wav/forig.wav \
+wav/hts1a_speex_8k.wav \
+wav/hts2a_g729a.wav \
+wav/m2400.wav \
+wav/morig_speex_8k.wav \
+src/globals.c \
+doc/A_m.gif \
+doc/omega_0.gif \
+doc/phi_m.gif \
+doc/s_n.gif \
+doc/s_n.txt \
+unittest/lsp2.txt \
+unittest/lsp7.txt \
+unittest/lspd78.txt \
+unittest/lsp3.txt \
+unittest/lsp8.txt \
+unittest/lspd910.txt \
+unittest/lsp4.txt \
+unittest/lsp9.txt \
+unittest/lsp10.txt \
+unittest/lsp5.txt \
+unittest/lspd123.txt \
+unittest/lsp1.txt \
+unittest/lsp6.txt \
+unittest/lspd456.txt \
+src/codeall.sh \
+src/fq20.sh \
+src/listen1.sh \
+src/listen.sh \
+src/listensim.sh \
+src/sim.sh
+
+SUBDIRS = src unittest
+all: all-recursive
+
+.SUFFIXES:
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+ cd $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ mkdir $(distdir)
+ $(mkdir_p) $(distdir)/doc $(distdir)/octave $(distdir)/pitch $(distdir)/raw $(distdir)/script $(distdir)/src $(distdir)/unittest $(distdir)/wav
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+ check-am clean clean-generic clean-libtool clean-recursive \
+ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
+ dist-shar dist-tarZ dist-zip distcheck distclean \
+ distclean-generic distclean-libtool distclean-recursive \
+ distclean-tags distcleancheck distdir distuninstallcheck dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- /dev/null
+#! /bin/sh
+srcpath=$(dirname $0 2>/dev/null ) || srcpath="."
+$srcpath/configure "$@" --disable-shared --with-pic
+
--- /dev/null
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.59])
+AC_INIT(libcodec2, 1.0, david@rowetel.com)
+AM_INIT_AUTOMAKE(libcodec2,1.0)
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_LIBTOOL
+
+# Checks for libraries.
+# FIXME: Replace `main' with a function in `-lm':
+AC_CHECK_LIB([m], [main])
+
+# Checks for header files.
+AC_CHECK_HEADERS([stdlib.h string.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_CHECK_FUNCS([floor pow sqrt])
+
+AC_CONFIG_FILES([Makefile src/Makefile unittest/Makefile])
+AC_OUTPUT
--- /dev/null
+s(n)=A_1cos(\omega_0+\phi_1)+A_2cos(2\omega_0+\phi_2)+...+A_Lcos(L\omega_0+\phi_L)
--- /dev/null
+% glottal.m
+% David Rowe 12 Sep 2009
+% Matlab script to generate the phase spectra of a glottal pulse
+
+% lpc10 pulse from spandsp. When the file glottal.c was used as a part of the
+% excitation phase component in phase.c, phase_synth_zero_order(), no difference
+% in speech quality was apparent. So left out of code for now.
+
+sh=12
+kexc = [ 8, -16, 26, -48, 86, -162, 294, -502, 718, -728, 184 672, -610, -672, 184, 728, 718, 502, 294, 162, 86, 48, 26, 16, 8];
+kexc = shift(kexc,sh);
+kexc = [kexc(1:sh) zeros(1,512-25) kexc(sh+1:25)];
+figure(1)
+plot(kexc)
+figure(2)
+G = fft(kexc);
+plot((1:256)*(4000/256),unwrap(angle(G(1:256))))
+
+f=fopen("glottal.c","wt");
+fprintf(f,"float glottal[]={\n");
+for m=1:255
+ fprintf(f," %f,\n",angle(G(m)));
+endfor
+fprintf(f," %f};\n",angle(G(256)));
+fclose(f);
--- /dev/null
+% load_raw.m
+% David Rowe 7 Oct 2009
+
+function s = load_raw(fn)
+ fs=fopen(fn,"rb");
+ s = fread(fs,Inf,"short");
+ plot(s)
+endfunction
--- /dev/null
+% lsp_pdf.m
+% David Rowe 2 Oct 2009
+% Plots histograms (PDF estimates) of LSP training data
+
+function lsp_pdf(lsp)
+ [r,c] = size(lsp);
+
+ % LSPs
+
+ figure(3);
+ clf;
+ [x,y] = hist(lsp(:,1),100);
+ plot(y*4000/pi,x,";1;");
+ hold on;
+ for i=2:c
+ [x,y] = hist(lsp(:,i),100);
+ legend = sprintf(";%d;",i);
+ plot(y*4000/pi,x,legend);
+ endfor
+ hold off;
+ grid;
+
+ % LSP differences
+
+ figure(4);
+ clf;
+ subplot(211)
+ [x,y] = hist(lsp(:,1),100);
+ plot(y,x,";1;");
+ hold on;
+ for i=2:5
+ [x,y] = hist(lsp(:,i) - lsp(:,i-1),100);
+ legend = sprintf(";%d;",i);
+ plot(y,x,legend);
+ endfor
+ hold off;
+ grid;
+
+ subplot(212)
+ [x,y] = hist(lsp(:,6)-lsp(:,5),100);
+ plot(y,x,";6;");
+ hold on;
+ for i=7:c
+ [x,y] = hist(lsp(:,i) - lsp(:,i-1),100);
+ legend = sprintf(";%d;",i);
+ plot(y,x,legend);
+ endfor
+ hold off;
+ grid;
+endfunction
--- /dev/null
+% phase.m
+% David Rowe August 2009
+% experiments with phase for sinusoidal codecs
+
+function phase(samname, F0, png)
+ Wo=2*pi*F0/8000;
+ P=2*pi/Wo;
+ L = floor(pi/Wo);
+ Nsam = 16000;
+ N = 80;
+ F = Nsam/N;
+ A = 10000/L;
+ phi = zeros(1,L);
+ s = zeros(1,Nsam);
+
+ for m=floor(L/2):L
+ phi_off(m) = -m*Wo*8;
+ end
+
+ for f=1:F
+ phi(1) = phi(1) + Wo*N;
+ phi(1) = mod(phi(1),2*pi);
+
+ for m=1:L
+ phi(m) = m*phi(1);
+ end
+
+ x = zeros(1,N);
+ for m=1:L
+ x = x + A*cos(m*Wo*(0:(N-1)) + phi(m));
+ endfor
+ s((f-1)*N+1:f*N) = x;
+ endfor
+
+ figure(1);
+ clf;
+ plot(s(1:250));
+
+ fs=fopen(samname,"wb");
+ fwrite(fs,s,"short");
+ fclose(fs);
+
+ if (nargin == 3)
+ % small image to fit blog
+
+ __gnuplot_set__ terminal png size 450,300
+ ss = sprintf("__gnuplot_set__ output \"%s.png\"", samname);
+ eval(ss)
+ replot;
+
+ % for some reason I need this to stop large plot getting wiped
+ __gnuplot_set__ output "/dev/null"
+ endif
+
+endfunction
+
--- /dev/null
+% phase2.m
+% David Rowe Sep 2009
+% experiments with phase for sinusoidal codecs, looking at phase
+% of excitation with real Am samples from hts1
+
+function phase2(samname, png)
+ N = 16000;
+
+ f=45;
+ model = load("../src/hts1a_model.txt");
+ phase = load("../src/hts1a_phase_phase.txt");
+ Wo = model(f,1);
+ P=2*pi/Wo;
+ L = model(f,2);
+ A = model(f,3:(L+2));
+ phi = phase(f,1:L);
+ phi = zeros(1,L);
+ for m=L/2:L
+ phi(m) = 2*pi*rand(1,1);
+ end
+
+ s = zeros(1,N);
+
+ for m=1:L
+ s_m = A(m)*cos(m*Wo*(0:(N-1)) + phi(m));
+ s = s + s_m;
+ endfor
+
+ figure(1);
+ clf;
+ plot(s(1:250));
+
+ fs=fopen(samname,"wb");
+ fwrite(fs,s,"short");
+ fclose(fs);
+
+ if (nargin == 2)
+ % small image to fit blog
+
+ __gnuplot_set__ terminal png size 450,300
+ ss = sprintf("__gnuplot_set__ output \"%s.png\"", samname);
+ eval(ss)
+ replot;
+
+ % for some reason I need this to stop large plot getting wiped
+ __gnuplot_set__ output "/dev/null"
+ endif
+
+endfunction
+
--- /dev/null
+% pitch_test.m
+% David Rowe Sep 2009
+% Constructs a sequence to test the pitch estimator
+
+function pitch_test(samname)
+ M=320;
+ F=200;
+
+ fs=fopen(samname,"wb");
+
+ f0 = 100;
+ for f=1:200
+ Wo=2*pi*f0/8000;
+ P=2*pi/Wo;
+ L = floor(pi/Wo);
+ A = 10000/L;
+ phi = zeros(1,L);
+ s = zeros(1,M);
+
+ for m=1:L
+ s = s + A*cos(m*Wo*(0:(M-1)) + phi(m));
+ endfor
+
+ figure(1);
+ clf;
+ plot(s);
+
+ fwrite(fs,s,"short");
+
+ f0 = f0 + 5;
+ if (f0 > 400)
+ f0 = 100;
+ endif
+ endfor
+
+ fclose(fs);
+
+endfunction
+
--- /dev/null
+% Copyright David Rowe 2009
+% This program is distributed under the terms of the GNU General Public License
+% Version 2
+
+function pl(samname1, start_sam, end_sam, pngname)
+
+ fs=fopen(samname1,"rb");
+ s=fread(fs,Inf,"short");
+
+ st = 1;
+ en = length(s);
+ if (nargin >= 2)
+ st = start_sam;
+ endif
+ if (nargin >= 3)
+ en = end_sam;
+ endif
+
+ figure(1);
+ clf;
+ plot(s(st:en));
+ axis([1 en-st min(s) max(s)]);
+
+ if (nargin == 4)
+
+ % small image
+
+ __gnuplot_set__ terminal png size 420,300
+ ss = sprintf("__gnuplot_set__ output \"%s.png\"", pngname);
+ eval(ss)
+ replot;
+
+ % larger image
+
+ __gnuplot_set__ terminal png size 800,600
+ ss = sprintf("__gnuplot_set__ output \"%s_large.png\"", pngname);
+ eval(ss)
+ replot;
+
+ endif
+
+endfunction
--- /dev/null
+% Copyright David Rowe 2009
+% This program is distributed under the terms of the GNU General Public License
+% Version 2
+
+function pl2(samname1, samname2, start_sam, end_sam, pngname)
+
+ fs1=fopen(samname1,"rb");
+ s1=fread(fs1,Inf,"short");
+ fs2=fopen(samname2,"rb");
+ s2=fread(fs2,Inf,"short");
+
+ st = 1;
+ en = length(s1);
+ if (nargin >= 3)
+ st = start_sam;
+ endif
+ if (nargin >= 4)
+ en = end_sam;
+ endif
+
+ figure(1);
+ clf;
+ subplot(211);
+ l1 = strcat("r;",samname1,";");
+ plot(s1(st:en), l1);
+ axis([1 en-st min(s1(st:en)) max(s1(st:en))]);
+ subplot(212);
+ l2 = strcat("r;",samname2,";");
+ plot(s2(st:en),l2);
+ axis([1 en-st min(s1(st:en)) max(s1(st:en))]);
+
+ if (nargin == 5)
+
+ % small image
+
+ __gnuplot_set__ terminal png size 420,300
+ s = sprintf("__gnuplot_set__ output \"%s.png\"", pngname);
+ eval(s)
+ replot;
+
+ % larger image
+
+ __gnuplot_set__ terminal png size 800,600
+ s = sprintf("__gnuplot_set__ output \"%s_large.png\"", pngname);
+ eval(s)
+ replot;
+
+ endif
+
+endfunction
--- /dev/null
+% Copyright David Rowe 2009
+% This program is distributed under the terms of the GNU General Public License
+% Version 2
+%
+% Plot ampltiude modelling information from dump files.
+
+function plamp(samname, f)
+
+ sn_name = strcat(samname,"_sn.txt");
+ Sn = load(sn_name);
+
+ sw_name = strcat(samname,"_sw.txt");
+ Sw = load(sw_name);
+
+ sw__name = strcat(samname,"_sw_.txt");
+ if (file_in_path(".",sw__name))
+ Sw_ = load(sw__name);
+ endif
+
+ model_name = strcat(samname,"_model.txt");
+ model = load(model_name);
+
+ modelq_name = strcat(samname,"_qmodel.txt");
+ if (file_in_path(".",modelq_name))
+ modelq = load(modelq_name);
+ endif
+
+ pw_name = strcat(samname,"_pw.txt");
+ if (file_in_path(".",pw_name))
+ Pw = load(pw_name);
+ endif
+
+ lsp_name = strcat(samname,"_lsp.txt");
+ if (file_in_path(".",lsp_name))
+ lsp = load(lsp_name);
+ endif
+
+ phase_name = strcat(samname,"_phase.txt");
+ if (file_in_path(".",phase_name))
+ phase = load(phase_name);
+ endif
+
+ phase_name_ = strcat(samname,"_phase_.txt");
+ if (file_in_path(".",phase_name_))
+ phase_ = load(phase_name_);
+ endif
+
+ snr_name = strcat(samname,"_snr.txt");
+ if (file_in_path(".",snr_name))
+ snr = load(snr_name);
+ endif
+
+ k = ' ';
+ do
+ figure(1);
+ clf;
+% s = [ Sn(2*(f-2)-1,:) Sn(2*(f-2),:) ];
+ s = [ Sn(2*f-1,:) Sn(2*f,:) ];
+ plot(s);
+ axis([1 length(s) -20000 20000]);
+
+ figure(2);
+ Wo = model(f,1);
+ L = model(f,2);
+ Am = model(f,3:(L+2));
+ plot((1:L)*Wo*4000/pi, 20*log10(Am),";Am;r");
+ axis([1 4000 -10 80]);
+ hold on;
+% plot((0:255)*4000/256, Sw(f-2,:),";Sw;");
+ plot((0:255)*4000/256, Sw(f,:),";Sw;");
+
+ if (file_in_path(".",modelq_name))
+ Amq = modelq(f,3:(L+2));
+ plot((1:L)*Wo*4000/pi, 20*log10(Amq),";Amq;g" );
+ if (file_in_path(".",pw_name))
+ plot((0:255)*4000/256, 10*log10(Pw(f,:)),";Pw;c");
+ endif
+ signal = Am * Am';
+ noise = (Am-Amq) * (Am-Amq)';
+ snr1 = 10*log10(signal/noise);
+ Am_err_label = sprintf(";Am error SNR %4.2f dB;m",snr1);
+ plot((1:L)*Wo*4000/pi, 20*log10(Amq) - 20*log10(Am), Am_err_label);
+ endif
+
+ if (file_in_path(".",snr_name))
+ snr_label = sprintf(";phase SNR %4.2f dB;",snr(f));
+ plot(1,1,snr_label);
+ endif
+
+ % phase model - determine SNR and error spectrum for phase model 1
+
+ if (file_in_path(".",phase_name_))
+ orig = Am.*exp(j*phase(f,1:L));
+ synth = Am.*exp(j*phase_(f,1:L));
+ signal = orig * orig';
+ noise = (orig-synth) * (orig-synth)';
+ snr_phase = 10*log10(signal/noise);
+
+ phase_err_label = sprintf(";phase_err SNR %4.2f dB;",snr_phase);
+ plot((1:L)*Wo*4000/pi, 20*log10(orig-synth), phase_err_label);
+ endif
+
+ if (file_in_path(".",lsp_name))
+ for l=1:10
+ plot([lsp(f,l)*4000/pi lsp(f,l)*4000/pi], [60 80], 'r');
+ endfor
+ endif
+
+ hold off;
+
+ if (file_in_path(".",phase_name))
+ figure(3);
+ plot((1:L)*Wo*4000/pi, phase(f,1:L), ";phase;");
+ axis;
+ if (file_in_path(".",phase_name_))
+ hold on;
+ plot((1:L)*Wo*4000/pi, phase_(f,1:L), ";phase_;");
+ hold off;
+ endif
+ figure(2);
+ endif
+
+ % autocorrelation function to research voicing est
+
+ %M = length(s);
+ %sw = s .* hanning(M)';
+ %for k=0:159
+ % R(k+1) = sw(1:320-k) * sw(1+k:320)';
+ %endfor
+ %figure(4);
+ %R_label = sprintf(";R(k) %3.2f;",max(R(20:159))/R(1));
+ %plot(R/R(1),R_label);
+ %grid
+
+ % interactive menu
+
+ printf("\rframe: %d menu: n-next b-back p-png q-quit ", f);
+ fflush(stdout);
+ k = kbhit();
+ if (k == 'n')
+ f = f + 1;
+ endif
+ if (k == 'b')
+ f = f - 1;
+ endif
+
+ % optional print to PNG
+
+ if (k == 'p')
+ figure(1);
+ pngname = sprintf("%s_%d_sn.png",samname,f);
+ print(pngname, '-dpng', "-S500,500")
+ pngname = sprintf("%s_%d_sn_large.png",samname,f);
+ print(pngname, '-dpng', "-S800,600")
+
+ figure(2);
+ pngname = sprintf("%s_%d_sw.png",samname,f);
+ print(pngname, '-dpng', "-S500,500")
+ pngname = sprintf("%s_%d_sw_large.png",samname,f);
+ print(pngname, '-dpng', "-S800,600")
+ endif
+
+ until (k == 'q')
+ printf("\n");
+
+endfunction
--- /dev/null
+load ../unittest/tinterp_prev.txt;
+load ../unittest/tinterp_interp.txt;
+load ../unittest/tinterp_next.txt;
+
+clf;
+plot(tinterp_prev(:,1), 20.0*log10(tinterp_prev(:,2)),";prev;")
+hold on;
+plot(tinterp_interp(:,1), 20.0*log10(tinterp_interp(:,2)),'g+-;interp;')
+plot(tinterp_next(:,1), 20.0*log10(tinterp_next(:,2)),'ro-;next;')
+hold off;
+axis([0 pi 0 80])
--- /dev/null
+% Copyright David Rowe 2009
+% This program is distributed under the terms of the GNU General Public License
+% Version 2
+%
+% Plot NLP states from dump files.
+
+function plnlp(samname, f)
+
+ sn_name = strcat(samname,"_sn.txt");
+ Sn = load(sn_name);
+
+ sw_name = strcat(samname,"_sw.txt");
+ Sw = load(sw_name);
+
+ fw_name = strcat(samname,"_fw.txt");
+ if (file_in_path(".",fw_name))
+ fw = load(fw_name);
+ endif
+
+ e_name = strcat(samname,"_e.txt");
+ if (file_in_path(".",e_name))
+ e = load(e_name);
+ endif
+
+ p_name = strcat(samname,".p");
+ if (file_in_path(".",p_name))
+ p = load(p_name);
+ endif
+
+ sq_name = strcat(samname,"_sq.txt");
+ if (file_in_path(".",sq_name))
+ sq = load(sq_name);
+ endif
+
+ dec_name = strcat(samname,"_dec.txt");
+ if (file_in_path(".",dec_name))
+ dec = load(dec_name);
+ endif
+
+ do
+ figure(1);
+ clf;
+ s = [ Sn(2*f-1,:) Sn(2*f,:) ];
+ plot(s, ";Sn;");
+ grid
+ axis([1 length(s) -20000 20000]);
+
+ figure(2);
+ plot((0:255)*4000/256, Sw(f,:),";Sw;");
+ grid
+ axis([1 4000 -10 80]);
+ hold on;
+
+ f0 = 8000/p(f);
+ Wo = 2*pi/p(f);
+ L = floor(pi/Wo);
+ f0_label = sprintf("b;P=%3.1f F0=%3.0f;",p(f),f0);
+ for m=1:L-1
+ plot([ m*Wo*4000/pi m*Wo*4000/pi], [10 60], 'b');
+ endfor
+ plot([ L*Wo*4000/pi L*Wo*4000/pi], [10 60], f0_label);
+
+ hold off;
+
+ if (file_in_path(".",fw_name))
+ figure(3);
+ if (file_in_path(".",e_name))
+ subplot(211);
+ endif
+ plot((0:255)*800/256, fw(f,:)/max(fw(f,:)), ";Fw;");
+ axis([1 400 0 1]);
+ if (file_in_path(".",e_name))
+ subplot(212);
+ e_concat = [ e(2*f-1,:) e(2*f,:) ];
+ plot(e_concat(1:400)/max(e_concat(1:400)), "+;MBE E(f);");
+ axis([1 400 0 1]);
+ endif
+ endif
+
+ if (file_in_path(".",sq_name))
+ figure(4);
+ sq_concat = [ sq(2*f-1,:) sq(2*f,:) ];
+ axis
+ plot(sq_concat, ";sq;");
+ endif
+
+ if (file_in_path(".",dec_name))
+ figure(5);
+ plot(dec(f,:), ";dec;");
+ endif
+
+ figure(2);
+
+ % interactive menu
+
+ printf("\rframe: %d menu: n-next b-back p-png q-quit ", f);
+ fflush(stdout);
+ k = kbhit();
+ if (k == 'n')
+ f = f + 1;
+ endif
+ if (k == 'b')
+ f = f - 1;
+ endif
+
+ % optional print to PNG
+
+ if (k == 'p')
+
+ pngname = sprintf("%s_%d",samname,f);
+
+ % small image
+
+ __gnuplot_set__ terminal png size 420,300
+ ss = sprintf("__gnuplot_set__ output \"%s.png\"", pngname);
+ eval(ss)
+ replot;
+
+ % larger image
+
+ __gnuplot_set__ terminal png size 800,600
+ ss = sprintf("__gnuplot_set__ output \"%s_large.png\"", pngname);
+ eval(ss)
+ replot;
+
+ % for some reason I need this to stop large plot getting wiped
+ __gnuplot_set__ output "/dev/null"
+
+ endif
+
+ until (k == 'q')
+ printf("\n");
+
+endfunction
--- /dev/null
+% Copyright David Rowe 2009
+% This program is distributed under the terms of the GNU General Public License
+% Version 2
+%
+% Plot phase modelling information from dump files.
+
+function plphase(samname, f)
+
+ sn_name = strcat(samname,"_sn.txt");
+ Sn = load(sn_name);
+
+ sw_name = strcat(samname,"_sw.txt");
+ Sw = load(sw_name);
+
+ model_name = strcat(samname,"_model.txt");
+ model = load(model_name);
+
+ sw__name = strcat(samname,"_sw_.txt");
+ if (file_in_path(".",sw__name))
+ Sw_ = load(sw__name);
+ endif
+
+ pw_name = strcat(samname,"_pw.txt");
+ if (file_in_path(".",pw_name))
+ Pw = load(pw_name);
+ endif
+
+ ak_name = strcat(samname,"_ak.txt");
+ if (file_in_path(".",ak_name))
+ ak = load(ak_name);
+ endif
+
+ phase_name = strcat(samname,"_phase.txt");
+ if (file_in_path(".",phase_name))
+ phase = load(phase_name);
+ endif
+
+ phase_name_ = strcat(samname,"_phase_.txt");
+ if (file_in_path(".",phase_name_))
+ phase_ = load(phase_name_);
+ endif
+
+ snr_name = strcat(samname,"_snr.txt");
+ if (file_in_path(".",snr_name))
+ snr = load(snr_name);
+ endif
+
+ sn_name_ = strcat(samname,".raw");
+ if (file_in_path(".",sn_name_))
+ fs_ = fopen(sn_name_,"rb");
+ sn_ = fread(fs_,Inf,"short");
+ endif
+
+ k = ' ';
+ do
+ figure(1);
+ clf;
+ s = [ Sn(2*f-1,:) Sn(2*f,:) ];
+ plot(s);
+ grid;
+ axis([1 length(s) -20000 20000]);
+ if (k == 'p')
+ pngname = sprintf("%s_%d_sn",samname,f);
+ png(pngname);
+ endif
+
+ figure(2);
+ Wo = model(f,1);
+ L = model(f,2);
+ Am = model(f,3:(L+2));
+ plot((1:L)*Wo*4000/pi, 20*log10(Am),"r;Am;");
+ axis([1 4000 -10 80]);
+ hold on;
+ plot((0:255)*4000/256, Sw(f,:),";Sw;");
+ grid;
+
+ if (file_in_path(".",sw__name))
+ plot((0:255)*4000/256, Sw_(f,:),"g;Sw_;");
+ endif
+
+ if (file_in_path(".",pw_name))
+ plot((0:255)*4000/256, 10*log10(Pw(f,:)),";Pw;");
+ endif
+
+ if (file_in_path(".",snr_name))
+ snr_label = sprintf(";phase SNR %4.2f dB;",snr(f));
+ plot(1,1,snr_label);
+ endif
+
+ % phase model - determine SNR and error spectrum for phase model 1
+
+ if (file_in_path(".",phase_name_))
+ orig = Am.*exp(j*phase(f,1:L));
+ synth = Am.*exp(j*phase_(f,1:L));
+ signal = orig * orig';
+ noise = (orig-synth) * (orig-synth)';
+ snr_phase = 10*log10(signal/noise);
+
+ phase_err_label = sprintf("g;phase_err SNR %4.2f dB;",snr_phase);
+ plot((1:L)*Wo*4000/pi, 20*log10(orig-synth), phase_err_label);
+ endif
+
+ hold off;
+ if (k == 'p')
+ pngname = sprintf("%s_%d_sw",samname,f);
+ png(pngname);
+ endif
+
+ if (file_in_path(".",phase_name))
+ figure(3);
+ plot((1:L)*Wo*4000/pi, phase(f,1:L)*180/pi, "-o;phase;");
+ axis;
+ if (file_in_path(".", phase_name_))
+ hold on;
+ plot((1:L)*Wo*4000/pi, phase_(f,1:L)*180/pi, "g;phase_;");
+ grid
+ hold off;
+ endif
+ if (k == 'p')
+ pngname = sprintf("%s_%d_phase",samname,f);
+ png(pngname);
+ endif
+ endif
+
+ % synthesised speech
+
+ if (file_in_path(".",sn_name_))
+ figure(4);
+ s_ = sn_((f-3)*80+1:(f+1)*80);
+ plot(s_);
+ axis([1 length(s_) -20000 20000]);
+ if (k == 'p')
+ pngname = sprintf("%s_%d_sn_",samname,f)
+ png(pngname);
+ endif
+ endif
+
+ if (file_in_path(".",ak_name))
+ figure(5);
+ axis;
+ akw = ak(f,:);
+ weight = 1.0 .^ (0:length(akw)-1);
+ akw = akw .* weight;
+ H = 1./fft(akw,8000);
+ subplot(211);
+ plot(20*log10(abs(H(1:4000))),";LPC mag spec;");
+ grid;
+ subplot(212);
+ plot(angle(H(1:4000))*180/pi,";LPC phase spec;");
+ grid;
+ if (k == 'p')
+ % stops multimode errors from gnuplot, I know not why...
+ figure(2);
+ figure(5);
+
+ pngname = sprintf("%s_%d_lpc",samname,f);
+ png(pngname);
+ endif
+ endif
+
+
+ % autocorrelation function to research voicing est
+
+ %M = length(s);
+ %sw = s .* hanning(M)';
+ %for k=0:159
+ % R(k+1) = sw(1:320-k) * sw(1+k:320)';
+ %endfor
+ %figure(4);
+ %R_label = sprintf(";R(k) %3.2f;",max(R(20:159))/R(1));
+ %plot(R/R(1),R_label);
+ %grid
+
+ figure(2);
+
+ % interactive menu
+
+ printf("\rframe: %d menu: n-next b-back p-png q-quit ", f);
+ fflush(stdout);
+ k = kbhit();
+ if (k == 'n')
+ f = f + 1;
+ endif
+ if (k == 'b')
+ f = f - 1;
+ endif
+
+ % optional print to PNG
+
+ if (k == 'p')
+ pngname = sprintf("%s_%d",samname,f);
+ png(pngname);
+ endif
+
+ until (k == 'q')
+ printf("\n");
+
+endfunction
--- /dev/null
+% Copyright David Rowe 2009
+% This program is distributed under the terms of the GNU General Public License
+% Version 2
+%
+% plpitch.m
+% Plots two pitch tracks on top of each other, used for comparing pitch
+% estimators
+
+function plpitch(pitch1_name, pitch2_name, start_fr, end_fr)
+
+ pitch1 = load(pitch1_name);
+ pitch2 = load(pitch2_name);
+
+ st = 1;
+ en = length(pitch1);
+ if (nargin >= 3)
+ st = start_fr;
+ endif
+ if (nargin >= 4)
+ en = end_fr;
+ endif
+
+ figure(1);
+ clf;
+ l1 = strcat("r;",pitch1_name,";")
+ l1
+ st
+ en
+ plot(pitch1(st:en), l1);
+ axis([1 en-st 20 160]);
+ l2 = strcat("g;",pitch2_name,";");
+ hold on;
+ plot(pitch2(st:en),l2);
+ hold off;
+endfunction
+
--- /dev/null
+% Copyright David Rowe 2009
+% This program is distributed under the terms of the GNU General Public License
+% Version 2
+%
+% Replot current plot as a png, generates small and large versions
+
+function png(pngname)
+ % small image
+
+ __gnuplot_set__ terminal png size 420,300
+ ss = sprintf("__gnuplot_set__ output \"%s.png\"", pngname);
+ eval(ss)
+ replot;
+
+ % larger image
+
+ __gnuplot_set__ terminal png size 800,600
+ ss = sprintf("__gnuplot_set__ output \"%s_large.png\"", pngname);
+ eval(ss)
+ replot;
+
+ % for some reason I need this to stop large plot getting wiped
+ __gnuplot_set__ output "/dev/null"
+
+endfunction
--- /dev/null
+% Copyright David Rowe 2009
+% This program is distributed under the terms of the GNU General Public License
+% Version 2
+%
+% Plot postfilter doing its thing
+
+function postfilter(samname)
+ p = load(samname);
+ figure(1);
+ plot(p(:,1),";energy;");
+ hold on;
+ plot(p(:,2),";bg_est;");
+ hold off;
+ grid;
+ pngname=sprintf("%s_postfilter_1", samname);
+ png(pngname);
+
+ figure(2);
+ plot(p(:,3),";% unvoiced;");
+ grid;
+ pngname=sprintf("%s_postfilter_2", samname);
+ png(pngname);
+endfunction
+
--- /dev/null
+% pulse.m
+% David Rowe August 2009
+%
+% Experiments with human pulse perception for sinusoidal codecs
+
+function pulse(samname)
+
+ A = 1000;
+ K = 16000;
+ N = 80;
+ frames = K/N;
+ s = zeros(1,K);
+
+ for f=1:frames
+ % lets try placing np random pulses in every frame
+
+ P = 20 + (160-20)*rand(1,1);
+ Wo = 2*pi/P;
+ L = floor(pi/Wo);
+ sf = zeros(1,N);
+ for m=1:L/2:L
+ pos = floor(rand(1,1)*N)+1;
+ %pos = 50;
+ for l=m:m+L/2-1
+ sf = sf + A*cos(l*Wo*((f-1)*N+1:f*N) - pos*l*Wo);
+ endfor
+ endfor
+ s((f-1)*N+1:f*N) = sf;
+ endfor
+
+ plot(s(1:250));
+
+ fs=fopen(samname,"wb");
+ fwrite(fs,s,"short");
+ fclose(fs);
+endfunction
+
--- /dev/null
+111.627907\r
+97.959183\r
+97.959183\r
+97.959183\r
+87.272736\r
+78.048775\r
+112.280701\r
+120.000008\r
+61.538464\r
+68.817207\r
+84.210526\r
+90.140846\r
+90.140846\r
+90.140846\r
+101.587303\r
+80.000000\r
+72.727272\r
+95.522392\r
+90.140846\r
+90.140846\r
+101.587303\r
+90.140846\r
+85.333336\r
+86.486488\r
+91.428574\r
+91.428574\r
+91.428574\r
+91.428574\r
+91.428574\r
+90.140846\r
+86.486488\r
+86.486488\r
+85.333336\r
+85.333336\r
+85.333336\r
+81.012657\r
+74.418610\r
+71.111115\r
+71.111115\r
+71.111115\r
+71.111115\r
+68.085106\r
+68.085106\r
+67.368423\r
+67.368423\r
+70.329674\r
+70.329674\r
+70.329674\r
+71.111115\r
+74.418610\r
+74.418610\r
+75.294121\r
+79.012352\r
+85.333336\r
+96.969704\r
+111.627907\r
+111.627907\r
+120.000008\r
+111.627907\r
+104.347832\r
+104.347832\r
+97.959183\r
+104.347832\r
+104.347832\r
+104.347832\r
+104.347832\r
+104.347832\r
+104.347832\r
+104.347832\r
+104.347832\r
+97.959183\r
+97.959183\r
+112.280701\r
+112.280701\r
+96.969704\r
+96.969704\r
+96.969704\r
+110.344841\r
+104.347832\r
+97.959183\r
+97.959183\r
+104.347832\r
+97.959183\r
+104.347832\r
+120.000008\r
+104.347832\r
+120.000008\r
+120.000008\r
+97.959183\r
+83.116882\r
+75.294121\r
+71.910118\r
+71.910110\r
+71.910110\r
+71.910110\r
+75.294121\r
+76.190483\r
+80.000008\r
+80.000008\r
+84.210526\r
+85.333336\r
+90.140846\r
+101.587303\r
+108.474571\r
+104.347832\r
+120.000008\r
+120.000008\r
+104.347832\r
+104.347832\r
+71.111115\r
+88.888893\r
+75.294121\r
+111.627907\r
+120.000008\r
+120.000008\r
+97.959183\r
+111.627907\r
+111.627907\r
+111.627907\r
+97.959183\r
+92.307693\r
+92.307693\r
+92.307693\r
+92.307693\r
+120.000008\r
+111.627907\r
+111.627907\r
+86.486488\r
+85.333336\r
+85.333336\r
+90.140846\r
+95.522392\r
+101.587311\r
+101.587311\r
+104.918037\r
+104.347832\r
+104.347832\r
+111.627907\r
+120.000008\r
+97.959183\r
+104.347832\r
+111.627907\r
+88.888893\r
+80.000000\r
+81.012657\r
+85.333336\r
+85.333336\r
+86.486488\r
+91.428574\r
+90.140846\r
+91.428574\r
+96.969704\r
+96.969704\r
+95.522392\r
+95.522392\r
+95.522392\r
+96.969704\r
+96.969704\r
+98.461533\r
+104.918022\r
+97.959183\r
+97.959183\r
+97.959183\r
+104.347832\r
+120.000008\r
+120.000008\r
+92.307693\r
+92.307693\r
+77.108429\r
+79.012344\r
+75.294121\r
+75.294121\r
+76.190483\r
+76.190483\r
+80.000008\r
+81.012657\r
+85.333336\r
+85.333336\r
+85.333336\r
+85.333336\r
+85.333336\r
+90.140846\r
+90.140846\r
+91.428574\r
+96.969704\r
+98.461533\r
+120.000008\r
+120.000008\r
+104.347832\r
+97.959183\r
+97.959183\r
+104.918037\r
+120.000008\r
+120.000008\r
+120.000008\r
+104.347832\r
+92.307693\r
+72.727272\r
+72.727272\r
+76.190483\r
+84.210533\r
+88.888901\r
+120.000008\r
+104.347832\r
+120.000008\r
+120.000008\r
+111.627907\r
+92.307693\r
+97.959183\r
+97.959183\r
+111.627907\r
+120.000008\r
+120.000008\r
+97.959183\r
+97.959183\r
+104.347832\r
+104.347832\r
+104.347832\r
+111.627907\r
+120.000008\r
+97.959183\r
+104.347832\r
+97.959183\r
+97.959183\r
+84.210526\r
+94.117653\r
+96.969704\r
+110.344841\r
+120.000008\r
+97.959183\r
+97.959183\r
+104.347832\r
+97.959183\r
+104.347832\r
+97.959183\r
+97.959183\r
+111.627907\r
+120.000008\r
+92.307693\r
+92.307693\r
+98.461533\r
+98.461533\r
+104.918022\r
+111.627907\r
+111.627907\r
+92.307693\r
+97.959183\r
+92.307693\r
+92.307693\r
+92.307693\r
+92.307693\r
+92.307693\r
+57.657658\r
+90.140846\r
+90.140846\r
+95.522392\r
+101.587311\r
+101.587311\r
+108.474586\r
+111.627907\r
+97.959183\r
+111.627907\r
+120.000008\r
+92.307693\r
+74.418610\r
+74.418610\r
+74.418610\r
+74.418610\r
+76.190483\r
+72.727280\r
+76.190483\r
+76.190483\r
+69.565224\r
+66.666672\r
+54.700855\r
+56.637169\r
+56.637169\r
+71.910110\r
+90.140846\r
+90.140846\r
+72.727272\r
+72.727272\r
+72.727272\r
+72.727272\r
+55.172413\r
+57.142857\r
+55.172413\r
+90.140846\r
+95.522392\r
+101.587311\r
+101.587311\r
+71.910110\r
+74.418610\r
+46.376812\r
+40.000000\r
+95.522392\r
+0\r
+0\r
--- /dev/null
+ 0.0000000e+000\r
+ 9.2753623e+001\r
+ 5.4237288e+001\r
+ 8.5906040e+001\r
+ 7.0329670e+001\r
+ 5.5652174e+001\r
+ 5.4237288e+001\r
+ 5.4935622e+001\r
+ 5.4700855e+001\r
+ 7.5739645e+001\r
+ 7.3563218e+001\r
+ 1.2307692e+002\r
+ 1.1428571e+002\r
+ 7.3563218e+001\r
+ 7.7108434e+001\r
+ 1.8550725e+002\r
+ 1.2673267e+002\r
+ 1.0847458e+002\r
+ 7.8527607e+001\r
+ 8.8888889e+001\r
+ 8.3116883e+001\r
+ 8.1012658e+001\r
+ 1.0756303e+002\r
+ 1.3061224e+002\r
+ 4.8301887e+001\r
+ 4.7940075e+001\r
+ 4.8120301e+001\r
+ 4.9230769e+001\r
+ 4.9420849e+001\r
+ 4.6886447e+001\r
+ 4.2953020e+001\r
+ 3.9263804e+001\r
+ 3.7869822e+001\r
+ 3.5457064e+001\r
+ 3.4224599e+001\r
+ 3.3333333e+001\r
+ 3.2820513e+001\r
+ 3.2000000e+001\r
+ 3.1295844e+001\r
+ 2.9906542e+001\r
+ 2.9493088e+001\r
+ 2.9090909e+001\r
+ 2.8699552e+001\r
+ 2.8131868e+001\r
+ 2.7826087e+001\r
+ 2.7826087e+001\r
+ 2.7826087e+001\r
+ 2.8193833e+001\r
+ 2.7467811e+001\r
+ 2.6890756e+001\r
+ 5.4468085e+001\r
+ 5.4237288e+001\r
+ 6.4974619e+001\r
+ 1.0756303e+002\r
+ 8.8888889e+001\r
+ 1.0406504e+002\r
+ 4.4599303e+001\r
+ 5.4468085e+001\r
+ 3.6260623e+001\r
+ 3.6260623e+001\r
+ 8.1012658e+001\r
+ 7.0329670e+001\r
+ 1.2929293e+002\r
+ 9.9224806e+001\r
+ 4.3097643e+001\r
+ 4.4137931e+001\r
+ 4.5714286e+001\r
+ 4.7407407e+001\r
+ 4.8301887e+001\r
+ 4.9230769e+001\r
+ 4.9420849e+001\r
+ 5.0996016e+001\r
+ 5.1405622e+001\r
+ 5.1405622e+001\r
+ 5.2244898e+001\r
+ 5.2459016e+001\r
+ 5.2459016e+001\r
+ 5.2244898e+001\r
+ 5.3333333e+001\r
+ 5.2459016e+001\r
+ 5.2244898e+001\r
+ 5.1405622e+001\r
+ 5.1405622e+001\r
+ 5.1200000e+001\r
+ 5.0996016e+001\r
+ 5.0196078e+001\r
+ 4.9230769e+001\r
+ 4.9230769e+001\r
+ 4.9230769e+001\r
+ 4.9420849e+001\r
+ 4.9230769e+001\r
+ 4.9042146e+001\r
+ 9.8461538e+001\r
+ 1.0158730e+002\r
+ 5.1821862e+001\r
+ 9.0140845e+001\r
+ 1.0491803e+002\r
+ 1.4382022e+002\r
+ 5.2459016e+001\r
+ 5.2459016e+001\r
+ 1.2929293e+002\r
+ 1.6410256e+002\r
+ 8.0000000e+001\r
+ 7.3563218e+001\r
+ 1.0158730e+002\r
+ 9.9224806e+001\r
+ 4.9042146e+001\r
+ 4.9042146e+001\r
+ 4.9042146e+001\r
+ 5.9259259e+001\r
+ 1.4382022e+002\r
+ 7.2316384e+001\r
+ 1.0847458e+002\r
+ 1.1228070e+002\r
+ 1.6202532e+002\r
+ 8.1528662e+001\r
+ 7.2727273e+001\r
+ 1.8550725e+002\r
+ 6.0093897e+001\r
+ 1.0847458e+002\r
+ 8.9510490e+001\r
+ 7.1508380e+001\r
+ 4.0125392e+001\r
+ 4.0634921e+001\r
+ 4.0634921e+001\r
+ 4.0251572e+001\r
+ 4.0506329e+001\r
+ 4.3986254e+001\r
+ 4.0506329e+001\r
+ 9.8461538e+001\r
+ 5.6140351e+001\r
+ 6.5641026e+001\r
+ 5.4237288e+001\r
+ 1.1636364e+002\r
+ 3.4316354e+001\r
+ 3.4972678e+001\r
+ 3.7758112e+001\r
+ 4.0634921e+001\r
+ 4.0506329e+001\r
+ 4.1290323e+001\r
+ 4.2524917e+001\r
+ 4.3389831e+001\r
+ 4.4599303e+001\r
+ 4.4912281e+001\r
+ 4.6545455e+001\r
+ 4.7232472e+001\r
+ 4.8301887e+001\r
+ 4.9230769e+001\r
+ 4.9420849e+001\r
+ 5.0393701e+001\r
+ 5.1405622e+001\r
+ 5.3333333e+001\r
+ 5.3112033e+001\r
+ 1.1034483e+002\r
+ 9.7709924e+001\r
+ 1.4382022e+002\r
+ 5.0996016e+001\r
+ 5.1821862e+001\r
+ 5.0996016e+001\r
+ 5.2032520e+001\r
+ 5.3112033e+001\r
+ 5.3556485e+001\r
+ 5.4468085e+001\r
+ 5.5652174e+001\r
+ 5.4700855e+001\r
+ 5.4700855e+001\r
+ 5.4935622e+001\r
+ 5.4700855e+001\r
+ 5.4700855e+001\r
+ 5.4468085e+001\r
+ 5.4468085e+001\r
+ 5.4468085e+001\r
+ 5.4468085e+001\r
+ 5.3333333e+001\r
+ 5.1405622e+001\r
+ 5.0996016e+001\r
+ 5.0000000e+001\r
+ 4.8120301e+001\r
+ 4.8669202e+001\r
+ 4.7058824e+001\r
+ 4.6376812e+001\r
+ 4.5070423e+001\r
+ 4.4912281e+001\r
+ 4.4137931e+001\r
+ 4.2809365e+001\r
+ 4.2666667e+001\r
+ 4.2105263e+001\r
+ 4.1423948e+001\r
+ 4.1290323e+001\r
+ 4.1290323e+001\r
+ 4.1290323e+001\r
+ 4.0634921e+001\r
+ 4.0634921e+001\r
+ 4.0634921e+001\r
+ 4.0634921e+001\r
+ 4.0764331e+001\r
+ 4.1423948e+001\r
+ 4.2953020e+001\r
+ 4.5551601e+001\r
+ 1.7534247e+002\r
+ 4.7232472e+001\r
+ 1.3763441e+002\r
+ 1.3061224e+002\r
+ 4.5551601e+001\r
+ 4.3686007e+001\r
+ 4.8669202e+001\r
+ 9.4117647e+001\r
+ 8.1012658e+001\r
+ 1.1228070e+002\r
+ 1.3617021e+002\r
+ 4.3097643e+001\r
+ 4.3835616e+001\r
+ 4.6376812e+001\r
+ 4.6545455e+001\r
+ 4.6043165e+001\r
+ 4.8301887e+001\r
+ 4.9042146e+001\r
+ 4.9420849e+001\r
+ 5.1200000e+001\r
+ 5.1405622e+001\r
+ 5.2244898e+001\r
+ 1.2929293e+002\r
+ 1.2929293e+002\r
+ 1.5238095e+002\r
+ 1.5238095e+002\r
+ 1.3913043e+002\r
+ 9.0140845e+001\r
+ 1.0940171e+002\r
+ 9.0140845e+001\r
+ 1.2307692e+002\r
+ 8.9510490e+001\r
+ 6.9565217e+001\r
+ 7.3142857e+001\r
+ 1.1034483e+002\r
+ 7.8048780e+001\r
+ 7.2727273e+001\r
+ 1.0078740e+002\r
+ 1.0940171e+002\r
+ 1.1743119e+002\r
+ 8.7074830e+001\r
+ 1.8550725e+002\r
+ 6.5306122e+001\r
+ 1.3617021e+002\r
+ 5.2674897e+001\r
+ 1.0940171e+002\r
+ 1.5238095e+002\r
+ 1.4065934e+002\r
+ 1.0756303e+002\r
+ 1.0406504e+002\r
+ 5.0793651e+001\r
+ 4.9420849e+001\r
+ 4.4444444e+001\r
+ 7.0329670e+001\r
+ 7.2727273e+001\r
+ 7.4418605e+001\r
+ 1.1636364e+002\r
+ 1.0406504e+002\r
+ 1.2307692e+002\r
+ 1.2549020e+002\r
+ 1.7297297e+002\r
+ 4.5878136e+001\r
+ 4.9805447e+001\r
+ 6.2745098e+001\r
+ 9.2086331e+001\r
+ 9.1428571e+001\r
+ 5.7142857e+001\r
+ 4.8484848e+001\r
+ 4.1157556e+001\r
+ 2.2857143e+001\r
+ 3.0046948e+001\r
+ 9.4814815e+001\r
+ 5.7918552e+001\r
+ 9.0140845e+001\r
+ 7.4418605e+001\r
+ 7.4418605e+001\r
+ 5.4700855e+001\r
+ 9.5522388e+001\r
+ 7.4853801e+001\r
+ 9.4117647e+001\r
+ 9.5522388e+001\r
+ 9.9224806e+001\r
+ 8.1012658e+001\r
+ 1.1851852e+002\r
+ 6.8817204e+001\r
+ 8.5906040e+001\r
+ 6.7015707e+001\r
+ 4.3537415e+001\r
+ 6.5306122e+001\r
+ 3.1295844e+001\r
+ 7.5739645e+001\r
+ 6.2135922e+001\r
+ 9.9224806e+001\r
+ 5.7657658e+001\r
+ 5.2244898e+001\r
+ 5.8447489e+001\r
+ 0.0000000e+000\r
+ 0.0000000e+000\r
+ 0.0000000e+000\r
+ 0.0000000e+000\r
+ 0.0000000e+000\r
--- /dev/null
+#!/bin/bash
+# ./menu.sh
+#
+# David Rowe
+# Created August 2009
+#
+# Presents a menu of sound files, press 1 to play file1, 2 to play file2 etc
+#
+# The aim is to make comparing files with different processing easier than
+# using up-arrow on the command line. Based on cdialog.
+#
+# usage:
+# menu.sh file1.raw file2.raw ........ [-d playbackdevice]
+#
+# for example:
+#
+# ../script/menu.sh hts1a.raw hts1a_uq.raw
+#
+# or:
+#
+# ../script/menu.sh hts1a.raw hts1a_uq.raw -d /dev/dsp1
+#
+
+# Copyright (C) 2007 David Rowe
+#
+# All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2, as
+# published by the Free Software Foundation.
+#
+# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+files=0
+items="Q-Quit\n"
+while [ ! -z "$1" ]
+do
+ case "$1" in
+ -d) dsp="${1} ${2}"; shift;;
+ *) files=`expr 1 + $files`;
+ new_file=$1;
+ file[$files]=$new_file;
+ items="${items} ${files}-${new_file}\n";;
+ esac
+ shift
+done
+
+readchar=1
+echo -n -e "\r" $items"- "
+while [ $readchar -ne 0 ]
+do
+ echo -n -e "\r -"
+ stty cbreak # or stty raw
+ readchar=`dd if=/dev/tty bs=1 count=1 2>/dev/null`
+ stty -cbreak
+ if [ $readchar == 'q' ] ; then
+ readchar=0
+ fi
+ if [ $readchar -ne 0 ] ; then
+ play -r 8000 -s -2 ${file[$readchar]} $dsp 2> /dev/null
+ fi
+done
+echo
--- /dev/null
+#!/bin/sh
+# Plays a raw file
+# usage:
+# playraw file.raw
+# playraw file.raw -d /dev/dsp1 (e.g. for USB headphones)
+play -r 8000 -s -2 $1 $2 $3
--- /dev/null
+#!/bin/sh
+# Converts 16 bit signed short 8 kHz raw (headerless) files to wave
+sox -r 8000 -s -2 $1 $2
--- /dev/null
+#!/bin/sh
+# Converts wave files to raw (headerless) files
+sox $1 -t raw $2
--- /dev/null
+AM_CFLAGS = -I../src -Wall -DFLOATING_POINT -DVAR_ARRAYS
+AUTOMAKE_OPTS = gnu
+NAME = libcodec2
+AM_CPPFLAGS = $(AM_CFLAGS)
+
+lib_LTLIBRARIES = libcodec2.la
+libcodec2_la_SOURCES = dump.c \
+lpc.c \
+nlp.c \
+postfilter.c \
+sine.c \
+codec2.c \
+four1.c \
+interp.c \
+lsp.c \
+phase.c \
+quantise.c \
+pack.c \
+codebook.c
+
+libcodec2_la_CFLAGS = $(AM_CFLAGS)
+libcodec2_la_LDFLAGS = $(LIBS)
+
+library_includedir = $(prefix)
+library_include_HEADERS = codec2.h \
+defines.h \
+four1.h \
+interp.h \
+lsp.h \
+phase.h \
+quantise.h \
+comp.h \
+dump.h \
+globals.h \
+lpc.h \
+nlp.h \
+postfilter.h \
+sine.h \
+codebook.h
+
+bin_PROGRAMS = c2dec c2enc c2sim
+
+c2dec_SOURCES = c2dec.c
+c2dec_LDADD = $(lib_LTLIBRARIES)
+c2dec_LDFLAGS = $(LIBS)
+
+c2enc_SOURCES = c2enc.c
+c2enc_LDADD = $(lib_LTLIBRARIES)
+c2enc_LDFLAGS = $(LIBS)
+
+c2sim_SOURCES = c2sim.c
+c2sim_LDADD = $(lib_LTLIBRARIES)
+c2sim_LDFLAGS = $(LIBS)
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = c2dec$(EXEEXT) c2enc$(EXEEXT) c2sim$(EXEEXT)
+subdir = src
+DIST_COMMON = $(library_include_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(library_includedir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libcodec2_la_LIBADD =
+am_libcodec2_la_OBJECTS = libcodec2_la-dump.lo libcodec2_la-lpc.lo \
+ libcodec2_la-nlp.lo libcodec2_la-postfilter.lo \
+ libcodec2_la-sine.lo libcodec2_la-codec2.lo \
+ libcodec2_la-four1.lo libcodec2_la-interp.lo \
+ libcodec2_la-lsp.lo libcodec2_la-phase.lo \
+ libcodec2_la-quantise.lo libcodec2_la-pack.lo \
+ libcodec2_la-codebook.lo
+libcodec2_la_OBJECTS = $(am_libcodec2_la_OBJECTS)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_c2dec_OBJECTS = c2dec.$(OBJEXT)
+c2dec_OBJECTS = $(am_c2dec_OBJECTS)
+am__DEPENDENCIES_1 = libcodec2.la
+c2dec_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_c2enc_OBJECTS = c2enc.$(OBJEXT)
+c2enc_OBJECTS = $(am_c2enc_OBJECTS)
+c2enc_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_c2sim_OBJECTS = c2sim.$(OBJEXT)
+c2sim_OBJECTS = $(am_c2sim_OBJECTS)
+c2sim_DEPENDENCIES = $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libcodec2_la_SOURCES) $(c2dec_SOURCES) $(c2enc_SOURCES) \
+ $(c2sim_SOURCES)
+DIST_SOURCES = $(libcodec2_la_SOURCES) $(c2dec_SOURCES) \
+ $(c2enc_SOURCES) $(c2sim_SOURCES)
+library_includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(library_include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AM_CFLAGS = -I../src -Wall -DFLOATING_POINT -DVAR_ARRAYS
+AUTOMAKE_OPTS = gnu
+NAME = libcodec2
+AM_CPPFLAGS = $(AM_CFLAGS)
+lib_LTLIBRARIES = libcodec2.la
+libcodec2_la_SOURCES = dump.c \
+lpc.c \
+nlp.c \
+postfilter.c \
+sine.c \
+codec2.c \
+four1.c \
+interp.c \
+lsp.c \
+phase.c \
+quantise.c \
+pack.c \
+codebook.c
+
+libcodec2_la_CFLAGS = $(AM_CFLAGS)
+libcodec2_la_LDFLAGS = $(LIBS)
+library_includedir = $(prefix)
+library_include_HEADERS = codec2.h \
+defines.h \
+four1.h \
+interp.h \
+lsp.h \
+phase.h \
+quantise.h \
+comp.h \
+dump.h \
+globals.h \
+lpc.h \
+nlp.h \
+postfilter.h \
+sine.h \
+codebook.h
+
+c2dec_SOURCES = c2dec.c
+c2dec_LDADD = $(lib_LTLIBRARIES)
+c2dec_LDFLAGS = $(LIBS)
+c2enc_SOURCES = c2enc.c
+c2enc_LDADD = $(lib_LTLIBRARIES)
+c2enc_LDFLAGS = $(LIBS)
+c2sim_SOURCES = c2sim.c
+c2sim_LDADD = $(lib_LTLIBRARIES)
+c2sim_LDFLAGS = $(LIBS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libcodec2.la: $(libcodec2_la_OBJECTS) $(libcodec2_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libcodec2_la_LDFLAGS) $(libcodec2_la_OBJECTS) $(libcodec2_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+c2dec$(EXEEXT): $(c2dec_OBJECTS) $(c2dec_DEPENDENCIES)
+ @rm -f c2dec$(EXEEXT)
+ $(LINK) $(c2dec_LDFLAGS) $(c2dec_OBJECTS) $(c2dec_LDADD) $(LIBS)
+c2enc$(EXEEXT): $(c2enc_OBJECTS) $(c2enc_DEPENDENCIES)
+ @rm -f c2enc$(EXEEXT)
+ $(LINK) $(c2enc_LDFLAGS) $(c2enc_OBJECTS) $(c2enc_LDADD) $(LIBS)
+c2sim$(EXEEXT): $(c2sim_OBJECTS) $(c2sim_DEPENDENCIES)
+ @rm -f c2sim$(EXEEXT)
+ $(LINK) $(c2sim_LDFLAGS) $(c2sim_OBJECTS) $(c2sim_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2dec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2enc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2sim.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-codebook.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-codec2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-dump.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-four1.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-interp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-lpc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-lsp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-nlp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-pack.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-phase.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-postfilter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-quantise.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-sine.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+libcodec2_la-dump.lo: dump.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-dump.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-dump.Tpo" -c -o libcodec2_la-dump.lo `test -f 'dump.c' || echo '$(srcdir)/'`dump.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-dump.Tpo" "$(DEPDIR)/libcodec2_la-dump.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-dump.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dump.c' object='libcodec2_la-dump.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-dump.lo `test -f 'dump.c' || echo '$(srcdir)/'`dump.c
+
+libcodec2_la-lpc.lo: lpc.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-lpc.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-lpc.Tpo" -c -o libcodec2_la-lpc.lo `test -f 'lpc.c' || echo '$(srcdir)/'`lpc.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-lpc.Tpo" "$(DEPDIR)/libcodec2_la-lpc.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-lpc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lpc.c' object='libcodec2_la-lpc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-lpc.lo `test -f 'lpc.c' || echo '$(srcdir)/'`lpc.c
+
+libcodec2_la-nlp.lo: nlp.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-nlp.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-nlp.Tpo" -c -o libcodec2_la-nlp.lo `test -f 'nlp.c' || echo '$(srcdir)/'`nlp.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-nlp.Tpo" "$(DEPDIR)/libcodec2_la-nlp.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-nlp.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nlp.c' object='libcodec2_la-nlp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-nlp.lo `test -f 'nlp.c' || echo '$(srcdir)/'`nlp.c
+
+libcodec2_la-postfilter.lo: postfilter.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-postfilter.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-postfilter.Tpo" -c -o libcodec2_la-postfilter.lo `test -f 'postfilter.c' || echo '$(srcdir)/'`postfilter.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-postfilter.Tpo" "$(DEPDIR)/libcodec2_la-postfilter.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-postfilter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='postfilter.c' object='libcodec2_la-postfilter.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-postfilter.lo `test -f 'postfilter.c' || echo '$(srcdir)/'`postfilter.c
+
+libcodec2_la-sine.lo: sine.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-sine.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-sine.Tpo" -c -o libcodec2_la-sine.lo `test -f 'sine.c' || echo '$(srcdir)/'`sine.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-sine.Tpo" "$(DEPDIR)/libcodec2_la-sine.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-sine.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sine.c' object='libcodec2_la-sine.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-sine.lo `test -f 'sine.c' || echo '$(srcdir)/'`sine.c
+
+libcodec2_la-codec2.lo: codec2.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-codec2.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-codec2.Tpo" -c -o libcodec2_la-codec2.lo `test -f 'codec2.c' || echo '$(srcdir)/'`codec2.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-codec2.Tpo" "$(DEPDIR)/libcodec2_la-codec2.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-codec2.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codec2.c' object='libcodec2_la-codec2.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-codec2.lo `test -f 'codec2.c' || echo '$(srcdir)/'`codec2.c
+
+libcodec2_la-four1.lo: four1.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-four1.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-four1.Tpo" -c -o libcodec2_la-four1.lo `test -f 'four1.c' || echo '$(srcdir)/'`four1.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-four1.Tpo" "$(DEPDIR)/libcodec2_la-four1.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-four1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='four1.c' object='libcodec2_la-four1.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-four1.lo `test -f 'four1.c' || echo '$(srcdir)/'`four1.c
+
+libcodec2_la-interp.lo: interp.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-interp.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-interp.Tpo" -c -o libcodec2_la-interp.lo `test -f 'interp.c' || echo '$(srcdir)/'`interp.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-interp.Tpo" "$(DEPDIR)/libcodec2_la-interp.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-interp.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='interp.c' object='libcodec2_la-interp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-interp.lo `test -f 'interp.c' || echo '$(srcdir)/'`interp.c
+
+libcodec2_la-lsp.lo: lsp.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-lsp.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-lsp.Tpo" -c -o libcodec2_la-lsp.lo `test -f 'lsp.c' || echo '$(srcdir)/'`lsp.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-lsp.Tpo" "$(DEPDIR)/libcodec2_la-lsp.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-lsp.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lsp.c' object='libcodec2_la-lsp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-lsp.lo `test -f 'lsp.c' || echo '$(srcdir)/'`lsp.c
+
+libcodec2_la-phase.lo: phase.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-phase.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-phase.Tpo" -c -o libcodec2_la-phase.lo `test -f 'phase.c' || echo '$(srcdir)/'`phase.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-phase.Tpo" "$(DEPDIR)/libcodec2_la-phase.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-phase.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='phase.c' object='libcodec2_la-phase.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-phase.lo `test -f 'phase.c' || echo '$(srcdir)/'`phase.c
+
+libcodec2_la-quantise.lo: quantise.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-quantise.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-quantise.Tpo" -c -o libcodec2_la-quantise.lo `test -f 'quantise.c' || echo '$(srcdir)/'`quantise.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-quantise.Tpo" "$(DEPDIR)/libcodec2_la-quantise.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-quantise.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='quantise.c' object='libcodec2_la-quantise.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-quantise.lo `test -f 'quantise.c' || echo '$(srcdir)/'`quantise.c
+
+libcodec2_la-pack.lo: pack.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-pack.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-pack.Tpo" -c -o libcodec2_la-pack.lo `test -f 'pack.c' || echo '$(srcdir)/'`pack.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-pack.Tpo" "$(DEPDIR)/libcodec2_la-pack.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-pack.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pack.c' object='libcodec2_la-pack.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-pack.lo `test -f 'pack.c' || echo '$(srcdir)/'`pack.c
+
+libcodec2_la-codebook.lo: codebook.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-codebook.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-codebook.Tpo" -c -o libcodec2_la-codebook.lo `test -f 'codebook.c' || echo '$(srcdir)/'`codebook.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-codebook.Tpo" "$(DEPDIR)/libcodec2_la-codebook.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-codebook.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codebook.c' object='libcodec2_la-codebook.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-codebook.lo `test -f 'codebook.c' || echo '$(srcdir)/'`codebook.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+install-library_includeHEADERS: $(library_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(library_includedir)" || $(mkdir_p) "$(DESTDIR)$(library_includedir)"
+ @list='$(library_include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(library_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(library_includedir)/$$f'"; \
+ $(library_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(library_includedir)/$$f"; \
+ done
+
+uninstall-library_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(library_include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(library_includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(library_includedir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(library_includedir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+ clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-library_includeHEADERS
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am \
+ uninstall-libLTLIBRARIES uninstall-library_includeHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libLTLIBRARIES clean-libtool ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-libLTLIBRARIES \
+ install-library_includeHEADERS install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-info-am uninstall-libLTLIBRARIES \
+ uninstall-library_includeHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: c2dec.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/8/2010
+
+ Decodes a file of bits to a file of raw speech samples using codec2. Demo
+ program for codec2.
+
+ NOTE: the bit file is not packed, 51 bits/frame actually consumes 51
+ bytes/frame on disk. If you are using this for a real world
+ application you may want to pack the 51 bytes into 7 bytes.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2010 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "codec2.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+int main(int argc, char *argv[])
+{
+ static const int bitsSize = ((CODEC2_BITS_PER_FRAME + 7) / 8);
+ void *codec2;
+ FILE *fin;
+ FILE *fout;
+ short buf[CODEC2_SAMPLES_PER_FRAME];
+ unsigned char bits[bitsSize];
+
+ if (argc != 3) {
+ printf("usage: %s InputBitFile OutputRawSpeechFile\n", argv[0]);
+ exit(1);
+ }
+
+ if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+ fprintf(stderr, "Error opening input bit file: %s: %s.\n",
+ argv[1], strerror(errno));
+ exit(1);
+ }
+
+ if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+ fprintf(stderr, "Error opening output speech file: %s: %s.\n",
+ argv[2], strerror(errno));
+ exit(1);
+ }
+
+ codec2 = codec2_create();
+
+ while(fread(bits, sizeof(char), bitsSize, fin) == bitsSize) {
+ codec2_decode(codec2, buf, bits);
+ fwrite(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fout);
+ }
+
+ codec2_destroy(codec2);
+
+ fclose(fin);
+ fclose(fout);
+
+ return 0;
+}
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: c2enc.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/8/2010
+
+ Encodes a file of raw speech samples using codec2 and ouputs a file
+ of bits (each bit is stored in the LSB or each output byte). Demo
+ program for codec2.
+
+ NOTE: the bit file is not packed, 51 bits/frame actually consumes 51
+ bytes/frame on disk. If you are using this for a real world
+ application you may want to pack the 51 bytes into 7 bytes.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2010 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "codec2.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+int main(int argc, char *argv[])
+{
+ static const int bitsSize = ((CODEC2_BITS_PER_FRAME + 7) / 8);
+ void *codec2;
+ FILE *fin;
+ FILE *fout;
+ short buf[CODEC2_SAMPLES_PER_FRAME];
+ unsigned char bits[bitsSize];
+
+ if (argc != 3) {
+ printf("usage: %s InputRawspeechFile OutputBitFile\n", argv[0]);
+ exit(1);
+ }
+
+ if ( (fin = fopen(argv[1],"rb")) == NULL ) {
+ fprintf(stderr, "Error opening input bit file: %s: %s.\n",
+ argv[1], strerror(errno));
+ exit(1);
+ }
+
+ if ( (fout = fopen(argv[2],"wb")) == NULL ) {
+ fprintf(stderr, "Error opening output speech file: %s: %s.\n",
+ argv[2], strerror(errno));
+ exit(1);
+ }
+
+ codec2 = codec2_create();
+
+ while(fread(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fin) ==
+ CODEC2_SAMPLES_PER_FRAME) {
+ codec2_encode(codec2, bits, buf);
+ fwrite(bits, sizeof(char), bitsSize, fout);
+ }
+
+ codec2_destroy(codec2);
+
+ fclose(fin);
+ fclose(fout);
+
+ return 0;
+}
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: c2sim.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 20/8/2010
+
+ Codec2 simulation. Combines encoder and decoder and allows switching in
+ out various algorithms and quantisation steps.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <math.h>
+
+#include "defines.h"
+#include "sine.h"
+#include "nlp.h"
+#include "dump.h"
+#include "lpc.h"
+#include "lsp.h"
+#include "quantise.h"
+#include "phase.h"
+#include "postfilter.h"
+#include "interp.h"
+
+/*---------------------------------------------------------------------------*\
+
+ switch_present()
+
+ Searches the command line arguments for a "switch". If the switch is
+ found, returns the command line argument where it ws found, else returns
+ NULL.
+
+\*---------------------------------------------------------------------------*/
+
+int switch_present(sw,argc,argv)
+register char sw[]; /* switch in string form */
+register int argc; /* number of command line arguments */
+register char *argv[]; /* array of command line arguments in string form */
+{
+ register int i; /* loop variable */
+
+ for(i=1; i<argc; i++)
+ if (!strcmp(sw,argv[i]))
+ return(i);
+
+ return 0;
+}
+
+void synth_one_frame(short buf[], MODEL *model, float Sn_[], float Pn[]);
+
+/*---------------------------------------------------------------------------*\
+
+ MAIN
+
+\*---------------------------------------------------------------------------*/
+
+int main(int argc, char *argv[])
+{
+ FILE *fout; /* output speech file */
+ FILE *fin; /* input speech file */
+ short buf[N]; /* input/output buffer */
+ float Sn[M]; /* float input speech samples */
+ COMP Sw[FFT_ENC]; /* DFT of Sn[] */
+ float w[M]; /* time domain hamming window */
+ COMP W[FFT_ENC]; /* DFT of w[] */
+ MODEL model;
+ float Pn[2*N]; /* trapezoidal synthesis window */
+ float Sn_[2*N]; /* synthesised speech */
+ int i; /* loop variable */
+ int frames;
+ float prev_Wo;
+ float pitch;
+ int voiced1;
+
+ char out_file[MAX_STR];
+ int arg;
+ float snr;
+ float sum_snr;
+
+ int lpc_model, order;
+ int lsp, lsp_quantiser;
+ float ak[LPC_MAX];
+ COMP Sw_[FFT_ENC];
+
+ int dump;
+
+ int phase0;
+ float ex_phase[MAX_AMP+1];
+
+ int postfilt;
+ float bg_est;
+
+ int hand_voicing;
+ FILE *fvoicing;
+
+ MODEL prev_model, interp_model;
+ int decimate;
+
+ void *nlp_states;
+
+ for(i=0; i<M; i++)
+ Sn[i] = 1.0;
+ for(i=0; i<2*N; i++)
+ Sn_[i] = 0;
+
+ prev_Wo = TWO_PI/P_MAX;
+
+ prev_model.Wo = TWO_PI/P_MIN;
+ prev_model.L = floor(PI/prev_model.Wo);
+ for(i=1; i<=prev_model.L; i++) {
+ prev_model.A[i] = 0.0;
+ prev_model.phi[i] = 0.0;
+ }
+ for(i=1; i<=MAX_AMP; i++) {
+ ex_phase[i] = 0.0;
+ }
+
+ nlp_states = nlp_create();
+
+ if (argc < 2) {
+ fprintf(stderr, "\nCodec2 - 2400 bit/s speech codec - Simulation Program\n"
+ "\thttp://rowetel.com/codec2.html\n\n"
+ "usage: %s InputFile [-o OutputFile]\n"
+ "\t[-o lpc Order]\n"
+ "\t[--lsp]\n"
+ "\t[--phase0]\n"
+ "\t[--postfilter]\n"
+ "\t[--hand_voicing]\n"
+ "\t[--dec]\n"
+ "\t[--dump DumpFilePrefix]\n", argv[0]);
+ exit(1);
+ }
+
+ /* Interpret command line arguments -------------------------------------*/
+
+ /* Input file */
+
+ if ((fin = fopen(argv[1],"rb")) == NULL) {
+ fprintf(stderr, "Error opening input bit file: %s: %s.\n",
+ argv[1], strerror(errno));
+ exit(1);
+ }
+
+ /* Output file */
+
+ if ((arg = switch_present("-o",argc,argv))) {
+ if ((fout = fopen(argv[arg+1],"wb")) == NULL) {
+ fprintf(stderr, "Error opening output speech file: %s: %s.\n",
+ argv[arg+1], strerror(errno));
+ exit(1);
+ }
+ strcpy(out_file,argv[arg+1]);
+ }
+ else
+ fout = NULL;
+
+ lpc_model = 0;
+ if ((arg = switch_present("--lpc",argc,argv))) {
+ lpc_model = 1;
+ order = atoi(argv[arg+1]);
+ if ((order < 4) || (order > 20)) {
+ fprintf(stderr, "Error in lpc order: %d\n", order);
+ exit(1);
+ }
+ }
+
+ dump = switch_present("--dump",argc,argv);
+ if (dump)
+ dump_on(argv[dump+1]);
+
+ lsp = switch_present("--lsp",argc,argv);
+ lsp_quantiser = 0;
+
+ phase0 = switch_present("--phase0",argc,argv);
+ if (phase0) {
+ ex_phase[0] = 0;
+ }
+
+ hand_voicing = switch_present("--hand_voicing",argc,argv);
+ if (hand_voicing) {
+ fvoicing = fopen(argv[hand_voicing+1],"rt");
+ assert(fvoicing != NULL);
+ }
+
+ bg_est = 0.0;
+ postfilt = switch_present("--postfilter",argc,argv);
+
+ decimate = switch_present("--dec",argc,argv);
+
+ /* Initialise ------------------------------------------------------------*/
+
+ make_analysis_window(w,W);
+ make_synthesis_window(Pn);
+ quantise_init();
+
+ /* Main loop ------------------------------------------------------------*/
+
+ frames = 0;
+ sum_snr = 0;
+ while(fread(buf,sizeof(short),N,fin)) {
+ frames++;
+
+ /* Read input speech */
+
+ for(i=0; i<M-N; i++)
+ Sn[i] = Sn[i+N];
+ for(i=0; i<N; i++)
+ Sn[i+M-N] = buf[i];
+
+ /* Estimate pitch */
+
+ nlp(nlp_states,Sn,N,M,P_MIN,P_MAX,&pitch,Sw,&prev_Wo);
+ prev_Wo = TWO_PI/pitch;
+ model.Wo = TWO_PI/pitch;
+
+ /* estimate model parameters */
+
+ dft_speech(Sw, Sn, w);
+ two_stage_pitch_refinement(&model, Sw);
+ estimate_amplitudes(&model, Sw, W);
+ dump_Sn(Sn); dump_Sw(Sw); dump_model(&model);
+
+ /* optional zero-phase modelling */
+
+ if (phase0) {
+ float Wn[M]; /* windowed speech samples */
+ float Rk[LPC_ORD+1]; /* autocorrelation coeffs */
+
+ dump_phase(&model.phi[0], model.L);
+
+ /* find aks here, these are overwritten if LPC modelling is enabled */
+
+ for(i=0; i<M; i++)
+ Wn[i] = Sn[i]*w[i];
+ autocorrelate(Wn,Rk,M,LPC_ORD);
+ levinson_durbin(Rk,ak,LPC_ORD);
+
+ if (lpc_model)
+ assert(order == LPC_ORD);
+
+ dump_ak(ak, LPC_ORD);
+
+ /* determine voicing */
+
+ snr = est_voicing_mbe(&model, Sw, W, (FS/TWO_PI)*model.Wo, Sw_);
+ dump_Sw_(Sw_);
+ dump_snr(snr);
+
+ /* just to make sure we are not cheating - kill all phases */
+
+ for(i=0; i<MAX_AMP; i++)
+ model.phi[i] = 0;
+
+ if (hand_voicing) {
+ fscanf(fvoicing,"%d\n",&model.voiced);
+ }
+ }
+
+ /* optional LPC model amplitudes */
+
+ if (lpc_model) {
+ int lpc_correction;
+ float e;
+ float lsps[LPC_ORD];
+ int lsp_indexes[LPC_ORD];
+
+ e = speech_to_uq_lsps(lsps, ak, Sn, w, order);
+ lpc_correction = need_lpc_correction(&model, ak, e);
+
+ if (lsp) {
+ encode_lsps(lsp_indexes, lsps, LPC_ORD);
+ /*
+ for(i=0; i<LPC_ORD; i++)
+ printf("lsps[%d] = %f lsp_indexes[%d] = %d\n",
+ i, lsps[i], i, lsp_indexes[i]);
+ printf("\n");
+ */
+ decode_lsps(lsps, lsp_indexes, LPC_ORD);
+ bw_expand_lsps(lsps, LPC_ORD);
+ lsp_to_lpc(lsps, ak, LPC_ORD);
+ }
+
+ e = decode_energy(encode_energy(e));
+ model.Wo = decode_Wo(encode_Wo(model.Wo));
+
+ aks_to_M2(ak, order, &model, e, &snr, 1);
+ apply_lpc_correction(&model, lpc_correction);
+ sum_snr += snr;
+ dump_quantised_model(&model);
+ }
+
+ /* option decimation to 20ms rate, which enables interpolation
+ routine to synthesise in between frame */
+
+ if (decimate) {
+ if (!phase0) {
+ printf("needs --phase0 to resample phase for interpolated Wo\n");
+ exit(0);
+ }
+
+ /* odd frame - interpolate */
+
+ if (frames%2) {
+
+ #ifdef TEST
+ model.voiced = 1;
+ prev_model.voiced = 1;
+ if (fabs(prev_model.Wo - model.Wo) < 0.1*model.Wo) {
+ interp_model.voiced = 1;
+ interpolate(&interp_model, &prev_model, &model);
+ for(i=0; i<=interp_model.L; i++) {
+ interp_model.phi[i] = phi1[i];
+ }
+ printf("interp\n");
+ }
+ else
+ interp_model = tmp_model;
+ #endif
+
+ interp_model.voiced = voiced1;
+ interpolate(&interp_model, &prev_model, &model);
+
+ if (phase0)
+ phase_synth_zero_order(&interp_model, ak, ex_phase);
+ if (postfilt)
+ postfilter(&interp_model, &bg_est);
+ synth_one_frame(buf, &interp_model, Sn_, Pn);
+ if (fout != NULL) fwrite(buf,sizeof(short),N,fout);
+
+ if (phase0)
+ phase_synth_zero_order(&model, ak, ex_phase);
+ if (postfilt)
+ postfilter(&model, &bg_est);
+ synth_one_frame(buf, &model, Sn_, Pn);
+ if (fout != NULL) fwrite(buf,sizeof(short),N,fout);
+
+ prev_model = model;
+ }
+ else {
+ voiced1 = model.voiced;
+ }
+ }
+ else {
+ if (phase0)
+ phase_synth_zero_order(&model, ak, ex_phase);
+ if (postfilt)
+ postfilter(&model, &bg_est);
+ synth_one_frame(buf, &model, Sn_, Pn);
+ if (fout != NULL) fwrite(buf,sizeof(short),N,fout);
+ }
+ }
+
+ if (fout != NULL)
+ fclose(fout);
+
+ if (lpc_model)
+ printf("SNR av = %5.2f dB\n", sum_snr/frames);
+
+ if (dump)
+ dump_off();
+
+ if (hand_voicing)
+ fclose(fvoicing);
+
+ nlp_destroy(nlp_states);
+
+ return 0;
+}
+
+void synth_one_frame(short buf[], MODEL *model, float Sn_[], float Pn[])
+{
+ int i;
+
+ synthesise(Sn_, model, Pn, 1);
+
+ for(i=0; i<N; i++) {
+ if (Sn_[i] > 32767.0)
+ buf[i] = 32767;
+ else if (Sn_[i] < -32767.0)
+ buf[i] = -32767;
+ else
+ buf[i] = Sn_[i];
+ }
+
+}
--- /dev/null
+#!/bin/sh
+# codeall.sh
+# David Rowe 24 sep 2009
+# Code all samples using various processing steps
+./code.sh hts1a
+./code.sh hts2a
+./code.sh mmt1
+./code.sh morig
+./code.sh forig
--- /dev/null
+float codebook_lsp1[] = {
+ 225,
+ 250,
+ 275,
+ 300,
+ 325,
+ 350,
+ 375,
+ 400,
+ 425,
+ 450,
+ 475,
+ 500,
+ 525,
+ 550,
+ 575,
+ 600,0,0,0,0,0,0,0,0,0,0
+};
+
+float codebook_lsp2[] = {
+ 325,
+ 350,
+ 375,
+ 400,
+ 425,
+ 450,
+ 475,
+ 500,
+ 525,
+ 550,
+ 575,
+ 600,
+ 625,
+ 650,
+ 675,
+ 700,0,0,0,0,0,0,0,0,0,0
+};
+
+float codebook_lsp3[] = {
+ 500,
+ 550,
+ 600,
+ 650,
+ 700,
+ 750,
+ 800,
+ 850,
+ 900,
+ 950,
+ 1000,
+ 1050,
+ 1100,
+ 1150,
+ 1200,
+ 1250,0,0,0,0,0,0,0,0,0,0
+};
+
+float codebook_lsp4[] = {
+ 700,
+ 800,
+ 900,
+ 1000,
+ 1100,
+ 1200,
+ 1300,
+ 1400,
+ 1500,
+ 1600,
+ 1700,
+ 1800,
+ 1900,
+ 2000,
+ 2100,
+ 2200,0,0,0,0,0,0,0,0,0,0
+};
+
+float codebook_lsp5[] = {
+ 950,
+ 1050,
+ 1150,
+ 1250,
+ 1350,
+ 1450,
+ 1550,
+ 1650,
+ 1750,
+ 1850,
+ 1950,
+ 2050,
+ 2150,
+ 2250,
+ 2350,
+ 2450,0,0,0,0,0,0,0,0,0,0
+};
+
+float codebook_lsp6[] = {
+ 1100,
+ 1200,
+ 1300,
+ 1400,
+ 1500,
+ 1600,
+ 1700,
+ 1800,
+ 1900,
+ 2000,
+ 2100,
+ 2200,
+ 2300,
+ 2400,
+ 2500,
+ 2600,0,0,0,0,0,0,0,0,0,0
+};
+
+float codebook_lsp7[] = {
+ 1500,
+ 1600,
+ 1700,
+ 1800,
+ 1900,
+ 2000,
+ 2100,
+ 2200,
+ 2300,
+ 2400,
+ 2500,
+ 2600,
+ 2700,
+ 2800,
+ 2900,
+ 3000,0,0,0,0,0,0,0,0,0,0
+};
+
+float codebook_lsp8[] = {
+ 2300,
+ 2400,
+ 2500,
+ 2600,
+ 2700,
+ 2800,
+ 2900,
+ 3000,0,0,0,0,0,0,0,0,0,0
+};
+
+float codebook_lsp9[] = {
+ 2500,
+ 2600,
+ 2700,
+ 2800,
+ 2900,
+ 3000,
+ 3100,
+ 3200,0,0,0,0,0,0,0,0,0,0
+};
+
+float codebook_lsp10[] = {
+ 2900,
+ 3100,
+ 3300,
+ 3500,0,0,0,0,0,0,0,0,0,0
+};
+
--- /dev/null
+#ifndef CODEBOOK_H
+#define CODEBOOK_H
+
+extern float codebook_lsp1[];
+extern float codebook_lsp2[];
+extern float codebook_lsp3[];
+extern float codebook_lsp4[];
+extern float codebook_lsp5[];
+extern float codebook_lsp6[];
+extern float codebook_lsp7[];
+extern float codebook_lsp8[];
+extern float codebook_lsp9[];
+extern float codebook_lsp10[];
+
+#endif
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: codec2.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 21/8/2010
+
+ Codec2 fully quantised encoder and decoder functions. If you want use
+ codec2, the codec2_xxx functions are for you.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2010 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "defines.h"
+#include "sine.h"
+#include "nlp.h"
+#include "dump.h"
+#include "lpc.h"
+#include "quantise.h"
+#include "phase.h"
+#include "interp.h"
+#include "postfilter.h"
+#include "codec2.h"
+
+typedef struct {
+ float Sn[M]; /* input speech */
+ float w[M]; /* time domain hamming window */
+ COMP W[FFT_ENC]; /* DFT of w[] */
+ float Pn[2*N]; /* trapezoidal synthesis window */
+ float Sn_[2*N]; /* synthesised speech */
+ float prev_Wo; /* previous frame's pitch estimate */
+ float ex_phase; /* excitation model phase track */
+ float bg_est; /* background noise estimate for post filter */
+ MODEL prev_model; /* model parameters from 20ms ago */
+ void *nlp; /* pitch predictor states */
+} CODEC2;
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION HEADERS
+
+\*---------------------------------------------------------------------------*/
+
+void analyse_one_frame(CODEC2 *c2, MODEL *model, short speech[]);
+void synthesise_one_frame(CODEC2 *c2, short speech[], MODEL *model,float ak[]);
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTIONS
+
+\*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: codec2_create
+ AUTHOR......: David Rowe
+ DATE CREATED: 21/8/2010
+
+ Create and initialise an instance of the codec. Returns a pointer
+ to the codec states or NULL on failure. One set of states is
+ sufficient for a full duuplex codec (i.e. an encoder and decoder).
+ You don't need separate states for encoders and decoders. See
+ c2enc.c and c2dec.c for examples.
+
+\*---------------------------------------------------------------------------*/
+
+void *codec2_create()
+{
+ CODEC2 *c2;
+ int i,l;
+
+ c2 = (CODEC2*)malloc(sizeof(CODEC2));
+ if (c2 == NULL)
+ return NULL;
+
+ for(i=0; i<M; i++)
+ c2->Sn[i] = 1.0;
+ for(i=0; i<2*N; i++)
+ c2->Sn_[i] = 0;
+ make_analysis_window(c2->w,c2->W);
+ make_synthesis_window(c2->Pn);
+ quantise_init();
+ c2->prev_Wo = 0.0;
+ c2->bg_est = 0.0;
+ c2->ex_phase = 0.0;
+
+ for(l=1; l<=MAX_AMP; l++)
+ c2->prev_model.A[l] = 0.0;
+ c2->prev_model.Wo = TWO_PI/P_MAX;
+
+ c2->nlp = nlp_create();
+ if (c2->nlp == NULL) {
+ free (c2);
+ return NULL;
+ }
+
+ return (void*)c2;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: codec2_create
+ AUTHOR......: David Rowe
+ DATE CREATED: 21/8/2010
+
+ Destroy an instance of the codec.
+
+\*---------------------------------------------------------------------------*/
+
+void codec2_destroy(void *codec2_state)
+{
+ CODEC2 *c2;
+
+ assert(codec2_state != NULL);
+ c2 = (CODEC2*)codec2_state;
+ nlp_destroy(c2->nlp);
+ free(codec2_state);
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: codec2_encode
+ AUTHOR......: David Rowe
+ DATE CREATED: 21/8/2010
+
+ Encodes 160 speech samples (20ms of speech) into 51 bits.
+
+ The codec2 algorithm actually operates internally on 10ms (80
+ sample) frames, so we run the encoding algorithm twice. On the
+ first frame we just send the voicing bit. One the second frame we
+ send all model parameters.
+
+ The bit allocation is:
+
+ Parameter bits/frame
+ --------------------------------------
+ Harmonic magnitudes (LSPs) 36
+ Low frequency LPC correction 1
+ Energy 5
+ Wo (fundamental frequnecy) 7
+ Voicing (10ms update) 2
+ TOTAL 51
+
+\*---------------------------------------------------------------------------*/
+
+void codec2_encode(void *codec2_state, unsigned char * bits, short speech[])
+{
+ CODEC2 *c2;
+ MODEL model;
+ int voiced1, voiced2;
+ int lsp_indexes[LPC_ORD];
+ int lpc_correction;
+ int energy_index;
+ int Wo_index;
+ int i;
+ unsigned int nbit = 0;
+
+ assert(codec2_state != NULL);
+ c2 = (CODEC2*)codec2_state;
+
+ /* first 10ms analysis frame - we just want voicing */
+
+ analyse_one_frame(c2, &model, speech);
+ voiced1 = model.voiced;
+
+ /* second 10ms analysis frame */
+
+ analyse_one_frame(c2, &model, &speech[N]);
+ voiced2 = model.voiced;
+
+ Wo_index = encode_Wo(model.Wo);
+ encode_amplitudes(lsp_indexes,
+ &lpc_correction,
+ &energy_index,
+ &model,
+ c2->Sn,
+ c2->w);
+ memset(bits, '\0', ((CODEC2_BITS_PER_FRAME + 7) / 8));
+ pack(bits, &nbit, Wo_index, WO_BITS);
+ for(i=0; i<LPC_ORD; i++) {
+ pack(bits, &nbit, lsp_indexes[i], lsp_bits(i));
+ }
+ pack(bits, &nbit, lpc_correction, 1);
+ pack(bits, &nbit, energy_index, E_BITS);
+ pack(bits, &nbit, voiced1, 1);
+ pack(bits, &nbit, voiced2, 1);
+
+ assert(nbit == CODEC2_BITS_PER_FRAME);
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: codec2_decode
+ AUTHOR......: David Rowe
+ DATE CREATED: 21/8/2010
+
+ Decodes frames of 51 bits into 160 samples (20ms) of speech.
+
+\*---------------------------------------------------------------------------*/
+
+void codec2_decode(void *codec2_state, short speech[],
+ const unsigned char * bits)
+{
+ CODEC2 *c2;
+ MODEL model;
+ int voiced1, voiced2;
+ int lsp_indexes[LPC_ORD];
+ int lpc_correction;
+ int energy_index;
+ int Wo_index;
+ float ak[LPC_ORD+1];
+ int i;
+ unsigned int nbit = 0;
+ MODEL model_interp;
+
+ assert(codec2_state != NULL);
+ c2 = (CODEC2*)codec2_state;
+
+ Wo_index = unpack(bits, &nbit, WO_BITS);
+ for(i=0; i<LPC_ORD; i++) {
+ lsp_indexes[i] = unpack(bits, &nbit, lsp_bits(i));
+ }
+ lpc_correction = unpack(bits, &nbit, 1);
+ energy_index = unpack(bits, &nbit, E_BITS);
+ voiced1 = unpack(bits, &nbit, 1);
+ voiced2 = unpack(bits, &nbit, 1);
+ assert(nbit == CODEC2_BITS_PER_FRAME);
+
+ model.Wo = decode_Wo(Wo_index);
+ model.L = PI/model.Wo;
+ decode_amplitudes(&model,
+ ak,
+ lsp_indexes,
+ lpc_correction,
+ energy_index);
+
+ model.voiced = voiced2;
+ model_interp.voiced = voiced1;
+ interpolate(&model_interp, &c2->prev_model, &model);
+
+ synthesise_one_frame(c2, speech, &model_interp, ak);
+ synthesise_one_frame(c2, &speech[N], &model, ak);
+
+ memcpy(&c2->prev_model, &model, sizeof(MODEL));
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: synthesise_one_frame()
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/8/2010
+
+ Synthesise 80 speech samples (10ms) from model parameters.
+
+\*---------------------------------------------------------------------------*/
+
+void synthesise_one_frame(CODEC2 *c2, short speech[], MODEL *model, float ak[])
+{
+ int i;
+
+ phase_synth_zero_order(model, ak, &c2->ex_phase);
+ postfilter(model, &c2->bg_est);
+ synthesise(c2->Sn_, model, c2->Pn, 1);
+
+ for(i=0; i<N; i++) {
+ if (c2->Sn_[i] > 32767.0)
+ speech[i] = 32767;
+ else if (c2->Sn_[i] < -32767.0)
+ speech[i] = -32767;
+ else
+ speech[i] = c2->Sn_[i];
+ }
+
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: analyse_one_frame()
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/8/2010
+
+ Extract sinusoidal model parameters from 80 speech samples (10ms of
+ speech).
+
+\*---------------------------------------------------------------------------*/
+
+void analyse_one_frame(CODEC2 *c2, MODEL *model, short speech[])
+{
+ COMP Sw[FFT_ENC];
+ COMP Sw_[FFT_ENC];
+ float pitch;
+ int i;
+
+ /* Read input speech */
+
+ for(i=0; i<M-N; i++)
+ c2->Sn[i] = c2->Sn[i+N];
+ for(i=0; i<N; i++)
+ c2->Sn[i+M-N] = speech[i];
+ dft_speech(Sw, c2->Sn, c2->w);
+
+ /* Estimate pitch */
+
+ nlp(c2->nlp,c2->Sn,N,M,P_MIN,P_MAX,&pitch,Sw,&c2->prev_Wo);
+ c2->prev_Wo = TWO_PI/pitch;
+ model->Wo = TWO_PI/pitch;
+ model->L = PI/model->Wo;
+
+ /* estimate model parameters */
+
+ dft_speech(Sw, c2->Sn, c2->w);
+ two_stage_pitch_refinement(model, Sw);
+ estimate_amplitudes(model, Sw, c2->W);
+ est_voicing_mbe(model, Sw, c2->W, (FS/TWO_PI)*model->Wo, Sw_);
+}
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: codec2.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 21/8/2010
+
+ Codec2 fully quantised encoder and decoder functions. If you want use
+ codec2, these are the functions you need to call.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2010 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __CODEC2__
+#define __CODEC2__
+#include "codebook.h"
+
+#define CODEC2_SAMPLES_PER_FRAME 160
+#define CODEC2_BITS_PER_FRAME 51
+
+void *codec2_create();
+void codec2_destroy(void *codec2_state);
+void codec2_encode(void *codec2_state, unsigned char * bits, short speech_in[]);
+void codec2_decode(void *codec2_state, short speech_out[],
+ const unsigned char * bits);
+
+#endif
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: comp.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 24/08/09
+
+ Complex number definition.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __COMP__
+#define __COMP__
+
+/* Complex number */
+
+typedef struct {
+ float real;
+ float imag;
+} COMP;
+
+#endif
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: defines.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/4/93
+
+ Defines and structures used throughout the codec.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __DEFINES__
+#define __DEFINES__
+
+/*---------------------------------------------------------------------------*\
+
+ DEFINES
+
+\*---------------------------------------------------------------------------*/
+
+/* General defines */
+
+#define N 80 /* number of samples per frame */
+#define MAX_AMP 80 /* maximum number of harmonics */
+#define PI 3.141592654 /* mathematical constant */
+#define TWO_PI 6.283185307 /* mathematical constant */
+#define FS 8000 /* sample rate in Hz */
+#define MAX_STR 256 /* maximum string size */
+
+#define NW 279 /* analysis window size */
+#define FFT_ENC 512 /* size of FFT used for encoder */
+#define FFT_DEC 512 /* size of FFT used in decoder */
+#define TW 40 /* Trapezoidal synthesis window overlap */
+#define V_THRESH 4.0 /* voicing threshold in dB */
+#define LPC_MAX 20 /* maximum LPC order */
+#define LPC_ORD 10 /* phase modelling LPC order */
+
+/* Pitch estimation defines */
+
+#define M 320 /* pitch analysis frame size */
+#define P_MIN 20 /* minimum pitch */
+#define P_MAX 160 /* maximum pitch */
+
+/*---------------------------------------------------------------------------*\
+
+ TYPEDEFS
+
+\*---------------------------------------------------------------------------*/
+
+/* Complex number */
+
+typedef struct {
+ float real;
+ float imag;
+} COMP;
+
+/* Structure to hold model parameters for one frame */
+
+typedef struct {
+ float Wo; /* fundamental frequency estimate in radians */
+ int L; /* number of harmonics */
+ float A[MAX_AMP]; /* amplitiude of each harmonic */
+ float phi[MAX_AMP]; /* phase of each harmonic */
+ int voiced; /* non-zero if this frame is voiced */
+} MODEL;
+
+#endif
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: dump.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 25/8/09
+
+ Routines to dump data to text files for Octave analysis.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "defines.h"
+#include "dump.h"
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+static int dumpon = 0;
+
+static FILE *fsn = NULL;
+static FILE *fsw = NULL;
+static FILE *fsw_ = NULL;
+static FILE *fmodel = NULL;
+static FILE *fqmodel = NULL;
+static FILE *fpw = NULL;
+static FILE *flsp = NULL;
+static FILE *fphase = NULL;
+static FILE *fphase_ = NULL;
+static FILE *ffw = NULL;
+static FILE *fe = NULL;
+static FILE *fsq = NULL;
+static FILE *fdec = NULL;
+static FILE *fsnr = NULL;
+static FILE *fak = NULL;
+static FILE *fbg = NULL;
+static FILE *fE = NULL;
+
+static char prefix[MAX_STR];
+
+void dump_on(char p[]) {
+ dumpon = 1;
+ strcpy(prefix, p);
+}
+
+void dump_off(){
+ if (fsn != NULL)
+ fclose(fsn);
+ if (fsw != NULL)
+ fclose(fsw);
+ if (fsw_ != NULL)
+ fclose(fsw_);
+ if (fmodel != NULL)
+ fclose(fmodel);
+ if (fqmodel != NULL)
+ fclose(fqmodel);
+ if (fpw != NULL)
+ fclose(fpw);
+ if (flsp != NULL)
+ fclose(flsp);
+ if (fphase != NULL)
+ fclose(fphase);
+ if (fphase_ != NULL)
+ fclose(fphase_);
+ if (ffw != NULL)
+ fclose(ffw);
+ if (fe != NULL)
+ fclose(fe);
+ if (fsq != NULL)
+ fclose(fsq);
+ if (fdec != NULL)
+ fclose(fdec);
+ if (fsnr != NULL)
+ fclose(fsnr);
+ if (fak != NULL)
+ fclose(fak);
+ if (fbg != NULL)
+ fclose(fbg);
+ if (fE != NULL)
+ fclose(fE);
+}
+
+void dump_Sn(float Sn[]) {
+ int i;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fsn == NULL) {
+ sprintf(s,"%s_sn.txt", prefix);
+ fsn = fopen(s, "wt");
+ assert(fsn != NULL);
+ }
+
+ /* split across two lines to avoid max line length problems */
+ /* reconstruct in Octave */
+
+ for(i=0; i<M/2; i++)
+ fprintf(fsn,"%f\t",Sn[i]);
+ fprintf(fsn,"\n");
+ for(i=M/2; i<M; i++)
+ fprintf(fsn,"%f\t",Sn[i]);
+ fprintf(fsn,"\n");
+}
+
+void dump_Sw(COMP Sw[]) {
+ int i;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fsw == NULL) {
+ sprintf(s,"%s_sw.txt", prefix);
+ fsw = fopen(s, "wt");
+ assert(fsw != NULL);
+ }
+
+ for(i=0; i<FFT_ENC/2; i++)
+ fprintf(fsw,"%f\t",
+ 10.0*log10(Sw[i].real*Sw[i].real + Sw[i].imag*Sw[i].imag));
+ fprintf(fsw,"\n");
+}
+
+void dump_Sw_(COMP Sw_[]) {
+ int i;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fsw_ == NULL) {
+ sprintf(s,"%s_sw_.txt", prefix);
+ fsw_ = fopen(s, "wt");
+ assert(fsw_ != NULL);
+ }
+
+ for(i=0; i<FFT_ENC/2; i++)
+ fprintf(fsw_,"%f\t",
+ 10.0*log10(Sw_[i].real*Sw_[i].real + Sw_[i].imag*Sw_[i].imag));
+ fprintf(fsw_,"\n");
+}
+
+void dump_model(MODEL *model) {
+ int l;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fmodel == NULL) {
+ sprintf(s,"%s_model.txt", prefix);
+ fmodel = fopen(s, "wt");
+ assert(fmodel != NULL);
+ }
+
+ fprintf(fmodel,"%f\t%d\t", model->Wo, model->L);
+ for(l=1; l<=model->L; l++)
+ fprintf(fmodel,"%f\t",model->A[l]);
+ for(l=model->L+1; l<MAX_AMP; l++)
+ fprintf(fmodel,"0.0\t");
+ fprintf(fmodel,"%d\t",model->voiced);
+ fprintf(fmodel,"\n");
+}
+
+void dump_quantised_model(MODEL *model) {
+ int l;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fqmodel == NULL) {
+ sprintf(s,"%s_qmodel.txt", prefix);
+ fqmodel = fopen(s, "wt");
+ assert(fqmodel != NULL);
+ }
+
+ fprintf(fqmodel,"%f\t%d\t", model->Wo, model->L);
+ for(l=1; l<=model->L; l++)
+ fprintf(fqmodel,"%f\t",model->A[l]);
+ for(l=model->L+1; l<MAX_AMP; l++)
+ fprintf(fqmodel,"0.0\t");
+ fprintf(fqmodel,"\n");
+}
+
+void dump_phase(float phase[], int L) {
+ int l;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fphase == NULL) {
+ sprintf(s,"%s_phase.txt", prefix);
+ fphase = fopen(s, "wt");
+ assert(fphase != NULL);
+ }
+
+ for(l=1; l<=L; l++)
+ fprintf(fphase,"%f\t",phase[l]);
+ for(l=L+1; l<MAX_AMP; l++)
+ fprintf(fphase,"%f\t",0.0);
+ fprintf(fphase,"\n");
+}
+
+void dump_phase_(float phase_[], int L) {
+ int l;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fphase_ == NULL) {
+ sprintf(s,"%s_phase_.txt", prefix);
+ fphase_ = fopen(s, "wt");
+ assert(fphase_ != NULL);
+ }
+
+ for(l=1; l<=L; l++)
+ fprintf(fphase_,"%f\t",phase_[l]);
+ for(l=L+1; l<MAX_AMP; l++)
+ fprintf(fphase_,"%f\t",0.0);
+ fprintf(fphase_,"\n");
+}
+
+void dump_snr(float snr) {
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fsnr == NULL) {
+ sprintf(s,"%s_snr.txt", prefix);
+ fsnr = fopen(s, "wt");
+ assert(fsnr != NULL);
+ }
+
+ fprintf(fsnr,"%f\n",snr);
+}
+
+void dump_Pw(COMP Pw[]) {
+ int i;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fpw == NULL) {
+ sprintf(s,"%s_pw.txt", prefix);
+ fpw = fopen(s, "wt");
+ assert(fpw != NULL);
+ }
+
+ for(i=0; i<FFT_DEC/2; i++)
+ fprintf(fpw,"%f\t",Pw[i].real);
+ fprintf(fpw,"\n");
+}
+
+void dump_lsp(float lsp[]) {
+ int i;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (flsp == NULL) {
+ sprintf(s,"%s_lsp.txt", prefix);
+ flsp = fopen(s, "wt");
+ assert(flsp != NULL);
+ }
+
+ for(i=0; i<10; i++)
+ fprintf(flsp,"%f\t",lsp[i]);
+ fprintf(flsp,"\n");
+}
+
+void dump_ak(float ak[], int order) {
+ int i;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fak == NULL) {
+ sprintf(s,"%s_ak.txt", prefix);
+ fak = fopen(s, "wt");
+ assert(fak != NULL);
+ }
+
+ for(i=0; i<=order; i++)
+ fprintf(fak,"%f\t",ak[i]);
+ fprintf(fak,"\n");
+}
+
+void dump_Fw(COMP Fw[]) {
+ int i;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (ffw == NULL) {
+ sprintf(s,"%s_fw.txt", prefix);
+ ffw = fopen(s, "wt");
+ assert(ffw != NULL);
+ }
+
+ for(i=0; i<256; i++)
+ fprintf(ffw,"%f\t",Fw[i].real);
+ fprintf(ffw,"\n");
+}
+
+void dump_e(float e_hz[]) {
+ int i;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fe == NULL) {
+ sprintf(s,"%s_e.txt", prefix);
+ fe = fopen(s, "wt");
+ assert(fe != NULL);
+ }
+
+ for(i=0; i<500/2; i++)
+ fprintf(fe,"%f\t",e_hz[i]);
+ fprintf(fe,"\n");
+ for(i=500/2; i<500; i++)
+ fprintf(fe,"%f\t",e_hz[i]);
+ fprintf(fe,"\n");
+}
+
+void dump_sq(float sq[]) {
+ int i;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fsq == NULL) {
+ sprintf(s,"%s_sq.txt", prefix);
+ fsq = fopen(s, "wt");
+ assert(fsq != NULL);
+ }
+
+ for(i=0; i<M/2; i++)
+ fprintf(fsq,"%f\t",sq[i]);
+ fprintf(fsq,"\n");
+ for(i=M/2; i<M; i++)
+ fprintf(fsq,"%f\t",sq[i]);
+ fprintf(fsq,"\n");
+}
+
+void dump_dec(COMP Fw[]) {
+ int i;
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fdec == NULL) {
+ sprintf(s,"%s_dec.txt", prefix);
+ fdec = fopen(s, "wt");
+ assert(fdec != NULL);
+ }
+
+ for(i=0; i<320/5; i++)
+ fprintf(fdec,"%f\t",Fw[i].real);
+ fprintf(fdec,"\n");
+}
+
+void dump_bg(float e, float bg_est, float percent_uv) {
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fbg == NULL) {
+ sprintf(s,"%s_bg.txt", prefix);
+ fbg = fopen(s, "wt");
+ assert(fbg != NULL);
+ }
+
+ fprintf(fbg,"%f\t%f\t%f\n", e, bg_est, percent_uv);
+}
+
+void dump_E(float E) {
+ char s[MAX_STR];
+
+ if (!dumpon) return;
+
+ if (fE == NULL) {
+ sprintf(s,"%s_E.txt", prefix);
+ fE = fopen(s, "wt");
+ assert(fE != NULL);
+ }
+
+ fprintf(fE,"%f\n", 10.0*log10(E));
+}
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: dump.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 25/8/09
+
+ Routines to dump data to text files for Octave analysis.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __DUMP__
+#define __DUMP__
+
+void dump_on(char filename_prefix[]);
+void dump_off();
+
+void dump_Sn(float Sn[]);
+void dump_Sw(COMP Sw[]);
+void dump_Sw_(COMP Sw_[]);
+
+/* amplitude modelling */
+
+void dump_model(MODEL *m);
+void dump_quantised_model(MODEL *m);
+void dump_Pw(COMP Pw[]);
+void dump_lsp(float lsp[]);
+void dump_ak(float ak[], int order);
+void dump_E(float E);
+
+/* phase modelling */
+
+void dump_snr(float snr);
+void dump_phase(float phase[], int L);
+void dump_phase_(float phase[], int L);
+
+/* NLP states */
+
+void dump_sq(float sq[]);
+void dump_dec(COMP Fw[]);
+void dump_Fw(COMP Fw[]);
+void dump_e(float e_hz[]);
+
+/* post filter */
+
+void dump_bg(float e, float bg_est, float percent_uv);
+
+#endif
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: four1.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 20/2/95
+
+ Numerical Recipies in C FFT function. I have a nasty licence so please
+ replace me.
+
+\*---------------------------------------------------------------------------*/
+
+#include <math.h>
+
+#define SWAP(a,b) tempr=(a);(a)=(b);(b)=tempr
+
+void four1(data,nn,isign)
+float data[];
+int nn,isign;
+{
+ int n,mmax,m,j,istep,i;
+ double wtemp,wr,wpr,wpi,wi,theta;
+ float tempr,tempi;
+
+ n=nn << 1;
+ j=1;
+ for (i=1;i<n;i+=2) {
+ if (j > i) {
+ SWAP(data[j],data[i]);
+ SWAP(data[j+1],data[i+1]);
+ }
+ m=n >> 1;
+ while (m >= 2 && j > m) {
+ j -= m;
+ m >>= 1;
+ }
+ j += m;
+ }
+ mmax=2;
+ while (n > mmax) {
+ istep=2*mmax;
+ theta=6.28318530717959/(isign*mmax);
+ wtemp=sin(0.5*theta);
+ wpr = -2.0*wtemp*wtemp;
+ wpi=sin(theta);
+ wr=1.0;
+ wi=0.0;
+ for (m=1;m<mmax;m+=2) {
+ for (i=m;i<=n;i+=istep) {
+ j=i+mmax;
+ tempr=wr*data[j]-wi*data[j+1];
+ tempi=wr*data[j+1]+wi*data[j];
+ data[j]=data[i]-tempr;
+ data[j+1]=data[i+1]-tempi;
+ data[i] += tempr;
+ data[i+1] += tempi;
+ }
+ wr=(wtemp=wr)*wpr-wi*wpi+wr;
+ wi=wi*wpr+wtemp*wpi+wi;
+ }
+ mmax=istep;
+ }
+}
+
+#undef SWAP
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: four1.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 20/2/95
+
+ Numerical Recipies in C FFT function. I have a nasty licence so please
+ replace me.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef __FOUR1__
+#define __FOUR1__
+
+void four1(float x[], int n, int isign);
+
+#endif /* __FOUR1__ */
+
--- /dev/null
+#!/bin/sh
+# fq20.shsh
+# David Rowe 27 July 2010
+#
+# Decode a file with fully quantised codec at 20ms frame rate
+
+../src/sinedec ../raw/$1.raw $1.mdl -o $1_phase0_lsp_20_EWo2.raw --phase 0 --lpc 10 --lsp --postfilter --dec
+
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: globals.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 11/5/94
+
+ Globals for sinusoidal speech coder.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "sine.h" /* global defines for coder */
+
+/* Globals used in encoder and decoder */
+
+int frames; /* number of frames processed so far */
+float Sn[M]; /* float input speech samples */
+MODEL model; /* model parameters for the current frame */
+int Nw; /* number of samples in analysis window */
+float sig; /* energy of current frame */
+
+/* Globals used in encoder */
+
+float w[M]; /* time domain hamming window */
+COMP W[FFT_ENC]; /* DFT of w[] */
+COMP Sw[FFT_ENC]; /* DFT of current frame */
+
+/* Globals used in decoder */
+
+COMP Sw_[FFT_ENC]; /* DFT of all voiced synthesised signal */
+float Sn_[AW_DEC]; /* synthesised speech */
+float Pn[AW_DEC]; /* time domain Parzen (trapezoidal) window */
+
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: globals.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 1/11/94
+
+ Globals for sinusoidal speech coder.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/* Globals used in encoder and decoder */
+
+extern int frames; /* number of frames processed so far */
+extern float Sn[]; /* float input speech samples */
+extern MODEL model; /* model parameters for the current frame */
+extern int Nw; /* number of samples in analysis window */
+extern float sig; /* energy of current frame */
+
+/* Globals used in encoder */
+
+extern float w[]; /* time domain hamming window */
+extern COMP W[]; /* frequency domain hamming window */
+extern COMP Sw[]; /* DFT of current frame */
+extern COMP Sw_[]; /* DFT of all voiced synthesised signal */
+
+/* Globals used in decoder */
+
+extern float Sn_[]; /* output synthesised speech samples */
+extern float Pn[]; /* time domain Parzen (trapezoidal) window */
+
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: interp.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 9/10/09
+
+ Interpolation of 20ms frames to 10ms frames.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <assert.h>
+#include <math.h>
+#include <string.h>
+
+#include "defines.h"
+#include "interp.h"
+
+float sample_log_amp(MODEL *model, float w);
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: interp()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/10
+
+ Given two frames decribed by model parameters 20ms apart, determines
+ the model parameters of the 10ms frame between them. Assumes
+ voicing is available for middle (interpolated) frame. Outputs are
+ amplitudes and Wo for the interpolated frame.
+
+ This version can interpolate the amplitudes between two frames of
+ different Wo and L.
+
+\*---------------------------------------------------------------------------*/
+
+void interpolate(
+ MODEL *interp, /* interpolated model params */
+ MODEL *prev, /* previous frames model params */
+ MODEL *next /* next frames model params */
+)
+{
+ int l;
+ float w,log_amp;
+
+ /* Wo depends on voicing of this and adjacent frames */
+
+ if (interp->voiced) {
+ if (prev->voiced && next->voiced)
+ interp->Wo = (prev->Wo + next->Wo)/2.0;
+ if (!prev->voiced && next->voiced)
+ interp->Wo = next->Wo;
+ if (prev->voiced && !next->voiced)
+ interp->Wo = prev->Wo;
+ }
+ else {
+ interp->Wo = TWO_PI/P_MAX;
+ }
+ interp->L = PI/interp->Wo;
+
+ /* Interpolate amplitudes using linear interpolation in log domain */
+
+ for(l=1; l<=interp->L; l++) {
+ w = l*interp->Wo;
+ log_amp = (sample_log_amp(prev, w) + sample_log_amp(next, w))/2.0;
+ interp->A[l] = pow(10.0, log_amp);
+ }
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: sample_log_amp()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/10
+
+ Samples the amplitude envelope at an arbitrary frequency w. Uses
+ linear interpolation in the log domain to sample between harmonic
+ amplitudes.
+
+\*---------------------------------------------------------------------------*/
+
+float sample_log_amp(MODEL *model, float w)
+{
+ int m;
+ float f, log_amp;
+
+ assert(w > 0.0); assert (w <= PI);
+
+ m = floor(w/model->Wo + 0.5);
+ f = (w - m*model->Wo)/w;
+ assert(f <= 1.0);
+
+ if (m < 1) {
+ log_amp = f*log10(model->A[1]);
+ }
+ else if ((m+1) > model->L) {
+ log_amp = (1.0-f)*log10(model->A[model->L]);
+ }
+ else {
+ log_amp = (1.0-f)*log10(model->A[m]) + f*log10(model->A[m+1]);
+ }
+
+ return log_amp;
+}
+
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: interp.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 9/10/09
+
+ Interpolation of 20ms frames to 10ms frames.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __INTERP__
+#define __INTERP__
+
+void interpolate(MODEL *interp, MODEL *prev, MODEL *next);
+
+#endif
--- /dev/null
+#!/bin/sh
+# listensim.sh
+# David Rowe 10 Sep 2009
+#
+# Listen to files processed with sim.sh
+
+../script/menu.sh ../raw/$1.raw $1_uq.raw $1_phase0.raw $1_lpc10.raw $1_lsp.raw $1_phase0_lpc10.raw $1_phase0_lsp.raw $1_phase0_lsp.raw $2 $3
+
+
--- /dev/null
+#!/bin/sh
+# listen1.sh
+# David Rowe 10 Sep 2009
+#
+# Run menu with common sample file options, headphone version
+
+#../script/menu.sh ../raw/$1.raw $1_uq.raw $1_phase0.raw $1_lpc10.raw $1_lsp.raw $1_phase0_lpc10.raw $1_phase0_lsp.raw ../raw/$1_g729a.raw $2 $3 -d /dev/dsp1
+
+# compare to other codecs
+
+#../script/menu.sh ../raw/$1.raw $1_phase0_lsp.raw $1_phase0_lsp_20.raw ../raw/$1_g729a.raw ../raw/$1_gsm13k.raw ../raw/$1_speex_8k.raw $2 $3 -d /dev/dsp1
+
+../script/menu.sh ../raw/$1.raw $1_uq.raw $1_phase0.raw $1_test.raw ../raw/$1_g729a.raw $2 $3 -d /dev/dsp1
+
+
--- /dev/null
+#!/bin/sh
+# listensim.sh
+# David Rowe 10 Sep 2009
+#
+# Listen to files processed with sim.sh
+
+../script/menu.sh ../raw/$1.raw $1_uq.raw $1_phase0.raw $1_lpc10.raw $1_lsp.raw $1_phase0_lpc10.raw $1_phase0_lsp.raw $1_phase0_lsp_dec.raw $2 $3
+
+
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: lpc.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 30/9/90
+
+ Linear Prediction functions written in C.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#define LPC_MAX_N 512 /* maximum no. of samples in frame */
+#define PI 3.141592654 /* mathematical constant */
+
+#include <assert.h>
+#include <math.h>
+#include "defines.h"
+#include "lpc.h"
+
+/*---------------------------------------------------------------------------*\
+
+ hanning_window()
+
+ Hanning windows a frame of speech samples.
+
+\*---------------------------------------------------------------------------*/
+
+void hanning_window(
+ float Sn[], /* input frame of speech samples */
+ float Wn[], /* output frame of windowed samples */
+ int Nsam /* number of samples */
+)
+{
+ int i; /* loop variable */
+
+ for(i=0; i<Nsam; i++)
+ Wn[i] = Sn[i]*(0.5 - 0.5*cos(2*PI*(float)i/(Nsam-1)));
+}
+
+/*---------------------------------------------------------------------------*\
+
+ autocorrelate()
+
+ Finds the first P autocorrelation values of an array of windowed speech
+ samples Sn[].
+
+\*---------------------------------------------------------------------------*/
+
+void autocorrelate(
+ float Sn[], /* frame of Nsam windowed speech samples */
+ float Rn[], /* array of P+1 autocorrelation coefficients */
+ int Nsam, /* number of windowed samples to use */
+ int order /* order of LPC analysis */
+)
+{
+ int i,j; /* loop variables */
+
+ for(j=0; j<order+1; j++) {
+ Rn[j] = 0.0;
+ for(i=0; i<Nsam-j; i++)
+ Rn[j] += Sn[i]*Sn[i+j];
+ }
+}
+
+/*---------------------------------------------------------------------------*\
+
+ levinson_durbin()
+
+ Given P+1 autocorrelation coefficients, finds P Linear Prediction Coeff.
+ (LPCs) where P is the order of the LPC all-pole model. The Levinson-Durbin
+ algorithm is used, and is described in:
+
+ J. Makhoul
+ "Linear prediction, a tutorial review"
+ Proceedings of the IEEE
+ Vol-63, No. 4, April 1975
+
+\*---------------------------------------------------------------------------*/
+
+void levinson_durbin(
+ float R[], /* order+1 autocorrelation coeff */
+ float lpcs[], /* order+1 LPC's */
+ int order /* order of the LPC analysis */
+)
+{
+ float E[LPC_MAX+1];
+ float k[LPC_MAX+1];
+ float a[LPC_MAX+1][LPC_MAX+1];
+ float sum;
+ int i,j; /* loop variables */
+
+ E[0] = R[0]; /* Equation 38a, Makhoul */
+
+ for(i=1; i<=order; i++) {
+ sum = 0.0;
+ for(j=1; j<=i-1; j++)
+ sum += a[i-1][j]*R[i-j];
+ k[i] = -1.0*(R[i] + sum)/E[i-1]; /* Equation 38b, Makhoul */
+ if (fabs(k[i]) > 1.0)
+ k[i] = 0.0;
+
+ a[i][i] = k[i];
+
+ for(j=1; j<=i-1; j++)
+ a[i][j] = a[i-1][j] + k[i]*a[i-1][i-j]; /* Equation 38c, Makhoul */
+
+ E[i] = (1-k[i]*k[i])*E[i-1]; /* Equation 38d, Makhoul */
+ }
+
+ for(i=1; i<=order; i++)
+ lpcs[i] = a[order][i];
+ lpcs[0] = 1.0;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ inverse_filter()
+
+ Inverse Filter, A(z). Produces an array of residual samples from an array
+ of input samples and linear prediction coefficients.
+
+ The filter memory is stored in the first order samples of the input array.
+
+\*---------------------------------------------------------------------------*/
+
+void inverse_filter(
+ float Sn[], /* Nsam input samples */
+ float a[], /* LPCs for this frame of samples */
+ int Nsam, /* number of samples */
+ float res[], /* Nsam residual samples */
+ int order /* order of LPC */
+)
+{
+ int i,j; /* loop variables */
+
+ for(i=0; i<Nsam; i++) {
+ res[i] = 0.0;
+ for(j=0; j<=order; j++)
+ res[i] += Sn[i-j]*a[j];
+ }
+}
+
+/*---------------------------------------------------------------------------*\
+
+ synthesis_filter()
+
+ C version of the Speech Synthesis Filter, 1/A(z). Given an array of
+ residual or excitation samples, and the the LP filter coefficients, this
+ function will produce an array of speech samples. This filter structure is
+ IIR.
+
+ The synthesis filter has memory as well, this is treated in the same way
+ as the memory for the inverse filter (see inverse_filter() notes above).
+ The difference is that the memory for the synthesis filter is stored in
+ the output array, wheras the memory of the inverse filter is stored in the
+ input array.
+
+ Note: the calling function must update the filter memory.
+
+\*---------------------------------------------------------------------------*/
+
+void synthesis_filter(
+ float res[], /* Nsam input residual (excitation) samples */
+ float a[], /* LPCs for this frame of speech samples */
+ int Nsam, /* number of speech samples */
+ int order, /* LPC order */
+ float Sn_[] /* Nsam output synthesised speech samples */
+)
+{
+ int i,j; /* loop variables */
+
+ /* Filter Nsam samples */
+
+ for(i=0; i<Nsam; i++) {
+ Sn_[i] = res[i]*a[0];
+ for(j=1; j<=order; j++)
+ Sn_[i] -= Sn_[i-j]*a[j];
+ }
+}
+
+/*---------------------------------------------------------------------------*\
+
+ find_aks()
+
+ This function takes a frame of samples, and determines the linear
+ prediction coefficients for that frame of samples.
+
+\*---------------------------------------------------------------------------*/
+
+void find_aks(
+ float Sn[], /* Nsam samples with order sample memory */
+ float a[], /* order+1 LPCs with first coeff 1.0 */
+ int Nsam, /* number of input speech samples */
+ int order, /* order of the LPC analysis */
+ float *E /* residual energy */
+)
+{
+ float Wn[LPC_MAX_N]; /* windowed frame of Nsam speech samples */
+ float R[LPC_MAX+1]; /* order+1 autocorrelation values of Sn[] */
+ int i;
+
+ assert(order < LPC_MAX);
+ assert(Nsam < LPC_MAX_N);
+
+ hanning_window(Sn,Wn,Nsam);
+ autocorrelate(Wn,R,Nsam,order);
+ levinson_durbin(R,a,order);
+
+ *E = 0.0;
+ for(i=0; i<=order; i++)
+ *E += a[i]*R[i];
+ if (*E < 0.0)
+ *E = 1E-12;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ weight()
+
+ Weights a vector of LPCs.
+
+\*---------------------------------------------------------------------------*/
+
+void weight(
+ float ak[], /* vector of order+1 LPCs */
+ float gamma, /* weighting factor */
+ int order, /* num LPCs (excluding leading 1.0) */
+ float akw[] /* weighted vector of order+1 LPCs */
+)
+{
+ int i;
+
+ for(i=1; i<=order; i++)
+ akw[i] = ak[i]*pow(gamma,(float)i);
+}
+
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: lpc.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 24/8/09
+
+ Linear Prediction functions written in C.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __LPC__
+#define __LPC__
+
+#define LPC_MAX_ORDER 20
+
+void hanning_window(float Sn[], float Wn[], int Nsam);
+void autocorrelate(float Sn[], float Rn[], int Nsam, int order);
+void levinson_durbin(float R[], float lpcs[], int order);
+void inverse_filter(float Sn[], float a[], int Nsam, float res[], int order);
+void synthesis_filter(float res[], float a[], int Nsam, int order, float Sn_[]);
+void find_aks(float Sn[], float a[], int Nsam, int order, float *E);
+void weight(float ak[], float gamma, int order, float akw[]);
+
+#endif
--- /dev/null
+/*---------------------------------------------------------------------------*\\r
+\r
+ FILE........: lsp.c\r
+ AUTHOR......: David Rowe\r
+ DATE CREATED: 24/2/93\r
+\r
+\r
+ This file contains functions for LPC to LSP conversion and LSP to\r
+ LPC conversion. Note that the LSP coefficients are not in radians\r
+ format but in the x domain of the unit circle.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+#include "defines.h"\r
+#include "lsp.h"\r
+#include <math.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+\r
+/*---------------------------------------------------------------------------*\\r
+\r
+ Introduction to Line Spectrum Pairs (LSPs)\r
+ ------------------------------------------\r
+\r
+ LSPs are used to encode the LPC filter coefficients {ak} for\r
+ transmission over the channel. LSPs have several properties (like\r
+ less sensitivity to quantisation noise) that make them superior to\r
+ direct quantisation of {ak}.\r
+\r
+ A(z) is a polynomial of order lpcrdr with {ak} as the coefficients.\r
+\r
+ A(z) is transformed to P(z) and Q(z) (using a substitution and some\r
+ algebra), to obtain something like:\r
+\r
+ A(z) = 0.5[P(z)(z+z^-1) + Q(z)(z-z^-1)] (1)\r
+\r
+ As you can imagine A(z) has complex zeros all over the z-plane. P(z)\r
+ and Q(z) have the very neat property of only having zeros _on_ the\r
+ unit circle. So to find them we take a test point z=exp(jw) and\r
+ evaluate P (exp(jw)) and Q(exp(jw)) using a grid of points between 0\r
+ and pi.\r
+\r
+ The zeros (roots) of P(z) also happen to alternate, which is why we\r
+ swap coefficients as we find roots. So the process of finding the\r
+ LSP frequencies is basically finding the roots of 5th order\r
+ polynomials.\r
+\r
+ The root so P(z) and Q(z) occur in symmetrical pairs at +/-w, hence\r
+ the name Line Spectrum Pairs (LSPs).\r
+\r
+ To convert back to ak we just evaluate (1), "clocking" an impulse\r
+ thru it lpcrdr times gives us the impulse response of A(z) which is\r
+ {ak}.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+/*---------------------------------------------------------------------------*\\r
+\r
+ FUNCTION....: cheb_poly_eva()\r
+ AUTHOR......: David Rowe\r
+ DATE CREATED: 24/2/93\r
+\r
+ This function evalutes a series of chebyshev polynomials\r
+\r
+ FIXME: performing memory allocation at run time is very inefficient,\r
+ replace with stack variables of MAX_P size.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+\r
+float cheb_poly_eva(float *coef,float x,int m)\r
+/* float coef[] coefficients of the polynomial to be evaluated */\r
+/* float x the point where polynomial is to be evaluated */\r
+/* int m order of the polynomial */\r
+{\r
+ int i;\r
+ float *T,*t,*u,*v,sum;\r
+\r
+ /* Allocate memory for chebyshev series formulation */\r
+\r
+ if((T = (float *)malloc((m/2+1)*sizeof(float))) == NULL){\r
+ fprintf(stderr, "not enough memory to allocate buffer\n");\r
+ exit(1);\r
+ }\r
+\r
+ /* Initialise pointers */\r
+\r
+ t = T; /* T[i-2] */\r
+ *t++ = 1.0;\r
+ u = t--; /* T[i-1] */\r
+ *u++ = x;\r
+ v = u--; /* T[i] */\r
+\r
+ /* Evaluate chebyshev series formulation using iterative approach */\r
+\r
+ for(i=2;i<=m/2;i++)\r
+ *v++ = (2*x)*(*u++) - *t++; /* T[i] = 2*x*T[i-1] - T[i-2] */\r
+\r
+ sum=0.0; /* initialise sum to zero */\r
+ t = T; /* reset pointer */\r
+\r
+ /* Evaluate polynomial and return value also free memory space */\r
+\r
+ for(i=0;i<=m/2;i++)\r
+ sum+=coef[(m/2)-i]**t++;\r
+\r
+ free(T);\r
+ return sum;\r
+}\r
+\r
+\r
+/*---------------------------------------------------------------------------*\\r
+\r
+ FUNCTION....: lpc_to_lsp()\r
+ AUTHOR......: David Rowe\r
+ DATE CREATED: 24/2/93\r
+\r
+ This function converts LPC coefficients to LSP coefficients.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+int lpc_to_lsp (float *a, int lpcrdr, float *freq, int nb, float delta)\r
+/* float *a lpc coefficients */\r
+/* int lpcrdr order of LPC coefficients (10) */\r
+/* float *freq LSP frequencies in radians */\r
+/* int nb number of sub-intervals (4) */\r
+/* float delta grid spacing interval (0.02) */\r
+{\r
+ float psuml,psumr,psumm,temp_xr,xl,xr,xm;\r
+ float temp_psumr;\r
+ int i,j,m,flag,k;\r
+ float *Q; /* ptrs for memory allocation */\r
+ float *P;\r
+ float *px; /* ptrs of respective P'(z) & Q'(z) */\r
+ float *qx;\r
+ float *p;\r
+ float *q;\r
+ float *pt; /* ptr used for cheb_poly_eval()\r
+ whether P' or Q' */\r
+ int roots=0; /* number of roots found */\r
+ flag = 1; \r
+ m = lpcrdr/2; /* order of P'(z) & Q'(z) polynimials */\r
+\r
+ /* Allocate memory space for polynomials */\r
+\r
+ Q = (float *) malloc((m+1)*sizeof(float));\r
+ P = (float *) malloc((m+1)*sizeof(float));\r
+ if( (P == NULL) || (Q == NULL) ) {\r
+ fprintf(stderr,"not enough memory to allocate buffer\n");\r
+ exit(1);\r
+ }\r
+\r
+ /* determine P'(z)'s and Q'(z)'s coefficients where\r
+ P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */\r
+\r
+ px = P; /* initilaise ptrs */\r
+ qx = Q;\r
+ p = px;\r
+ q = qx;\r
+ *px++ = 1.0;\r
+ *qx++ = 1.0;\r
+ for(i=1;i<=m;i++){\r
+ *px++ = a[i]+a[lpcrdr+1-i]-*p++;\r
+ *qx++ = a[i]-a[lpcrdr+1-i]+*q++;\r
+ }\r
+ px = P;\r
+ qx = Q;\r
+ for(i=0;i<m;i++){\r
+ *px = 2**px;\r
+ *qx = 2**qx;\r
+ px++;\r
+ qx++;\r
+ }\r
+ px = P; /* re-initialise ptrs */\r
+ qx = Q;\r
+\r
+ /* Search for a zero in P'(z) polynomial first and then alternate to Q'(z).\r
+ Keep alternating between the two polynomials as each zero is found */\r
+\r
+ xr = 0; /* initialise xr to zero */\r
+ xl = 1.0; /* start at point xl = 1 */\r
+\r
+\r
+ for(j=0;j<lpcrdr;j++){\r
+ if(j%2) /* determines whether P' or Q' is eval. */\r
+ pt = qx;\r
+ else\r
+ pt = px;\r
+\r
+ psuml = cheb_poly_eva(pt,xl,lpcrdr); /* evals poly. at xl */\r
+ flag = 1;\r
+ while(flag && (xr >= -1.0)){\r
+ xr = xl - delta ; /* interval spacing */\r
+ psumr = cheb_poly_eva(pt,xr,lpcrdr);/* poly(xl-delta_x) */\r
+ temp_psumr = psumr;\r
+ temp_xr = xr;\r
+\r
+ /* if no sign change increment xr and re-evaluate\r
+ poly(xr). Repeat til sign change. if a sign change has\r
+ occurred the interval is bisected and then checked again\r
+ for a sign change which determines in which interval the\r
+ zero lies in. If there is no sign change between poly(xm)\r
+ and poly(xl) set interval between xm and xr else set\r
+ interval between xl and xr and repeat till root is located\r
+ within the specified limits */\r
+\r
+ if((psumr*psuml)<0.0){\r
+ roots++;\r
+\r
+ psumm=psuml;\r
+ for(k=0;k<=nb;k++){\r
+ xm = (xl+xr)/2; /* bisect the interval */\r
+ psumm=cheb_poly_eva(pt,xm,lpcrdr);\r
+ if(psumm*psuml>0.){\r
+ psuml=psumm;\r
+ xl=xm;\r
+ }\r
+ else{\r
+ psumr=psumm;\r
+ xr=xm;\r
+ }\r
+ }\r
+\r
+ /* once zero is found, reset initial interval to xr */\r
+ freq[j] = (xm);\r
+ xl = xm;\r
+ flag = 0; /* reset flag for next search */\r
+ }\r
+ else{\r
+ psuml=temp_psumr;\r
+ xl=temp_xr;\r
+ }\r
+ }\r
+ }\r
+ free(P); /* free memory space */\r
+ free(Q);\r
+\r
+ /* convert from x domain to radians */\r
+\r
+ for(i=0; i<lpcrdr; i++) {\r
+ freq[i] = acos(freq[i]);\r
+ }\r
+\r
+ return(roots);\r
+}\r
+\r
+/*---------------------------------------------------------------------------*\\r
+\r
+ FUNCTION....: lsp_to_lpc()\r
+ AUTHOR......: David Rowe\r
+ DATE CREATED: 24/2/93\r
+\r
+ This function converts LSP coefficients to LPC coefficients. In the\r
+ Speex code we worked out a wayto simplify this significantly.\r
+\r
+\*---------------------------------------------------------------------------*/\r
+\r
+void lsp_to_lpc(float *freq, float *ak, int lpcrdr)\r
+/* float *freq array of LSP frequencies in radians */\r
+/* float *ak array of LPC coefficients */\r
+/* int lpcrdr order of LPC coefficients */\r
+\r
+\r
+{\r
+ int i,j;\r
+ float xout1,xout2,xin1,xin2;\r
+ float *Wp;\r
+ float *pw,*n1,*n2,*n3,*n4;\r
+ int m = lpcrdr/2;\r
+\r
+ /* convert from radians to the x=cos(w) domain */\r
+\r
+ for(i=0; i<lpcrdr; i++)\r
+ freq[i] = cos(freq[i]);\r
+\r
+ if((Wp = (float *) malloc((4*m+2)*sizeof(float))) == NULL){\r
+ printf("not enough memory to allocate buffer\n");\r
+ exit(1);\r
+ }\r
+ pw = Wp;\r
+\r
+ /* initialise contents of array */\r
+\r
+ for(i=0;i<=4*m+1;i++){ /* set contents of buffer to 0 */\r
+ *pw++ = 0.0;\r
+ }\r
+\r
+ /* Set pointers up */\r
+\r
+ pw = Wp;\r
+ xin1 = 1.0;\r
+ xin2 = 1.0;\r
+\r
+ /* reconstruct P(z) and Q(z) by cascading second order polynomials\r
+ in form 1 - 2xz(-1) +z(-2), where x is the LSP coefficient */\r
+\r
+ for(j=0;j<=lpcrdr;j++){\r
+ for(i=0;i<m;i++){\r
+ n1 = pw+(i*4);\r
+ n2 = n1 + 1;\r
+ n3 = n2 + 1;\r
+ n4 = n3 + 1;\r
+ xout1 = xin1 - 2*(freq[2*i]) * *n1 + *n2;\r
+ xout2 = xin2 - 2*(freq[2*i+1]) * *n3 + *n4;\r
+ *n2 = *n1;\r
+ *n4 = *n3;\r
+ *n1 = xin1;\r
+ *n3 = xin2;\r
+ xin1 = xout1;\r
+ xin2 = xout2;\r
+ }\r
+ xout1 = xin1 + *(n4+1);\r
+ xout2 = xin2 - *(n4+2);\r
+ ak[j] = (xout1 + xout2)*0.5;\r
+ *(n4+1) = xin1;\r
+ *(n4+2) = xin2;\r
+\r
+ xin1 = 0.0;\r
+ xin2 = 0.0;\r
+ }\r
+ free(Wp);\r
+}\r
+\r
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: lsp.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 24/2/93
+
+
+ This file contains functions for LPC to LSP conversion and LSP to
+ LPC conversion. Note that the LSP coefficients are not in radians
+ format but in the x domain of the unit circle.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef __LSP__
+#define __LSP__
+
+int lpc_to_lsp (float *a, int lpcrdr, float *freq, int nb, float delta);
+void lsp_to_lpc(float *freq, float *ak, int lpcrdr);
+
+#endif
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: nlp.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/3/93
+
+ Non Linear Pitch (NLP) estimation functions.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "defines.h"
+#include "nlp.h"
+#include "dump.h"
+#include "four1.h"
+
+#include <assert.h>
+#include <math.h>
+#include <stdlib.h>
+
+/*---------------------------------------------------------------------------*\
+
+ DEFINES
+
+\*---------------------------------------------------------------------------*/
+
+#define PMAX_M 600 /* maximum NLP analysis window size */
+#define COEFF 0.95 /* notch filter parameter */
+#define PE_FFT_SIZE 512 /* DFT size for pitch estimation */
+#define DEC 5 /* decimation factor */
+#define SAMPLE_RATE 8000
+#define PI 3.141592654 /* mathematical constant */
+#define T 0.1 /* threshold for local minima candidate */
+#define F0_MAX 500
+#define CNLP 0.3 /* post processor constant */
+#define NLP_NTAP 48 /* Decimation LPF order */
+
+/*---------------------------------------------------------------------------*\
+
+ GLOBALS
+
+\*---------------------------------------------------------------------------*/
+
+/* 48 tap 600Hz low pass FIR filter coefficients */
+
+float nlp_fir[] = {
+ -1.0818124e-03,
+ -1.1008344e-03,
+ -9.2768838e-04,
+ -4.2289438e-04,
+ 5.5034190e-04,
+ 2.0029849e-03,
+ 3.7058509e-03,
+ 5.1449415e-03,
+ 5.5924666e-03,
+ 4.3036754e-03,
+ 8.0284511e-04,
+ -4.8204610e-03,
+ -1.1705810e-02,
+ -1.8199275e-02,
+ -2.2065282e-02,
+ -2.0920610e-02,
+ -1.2808831e-02,
+ 3.2204775e-03,
+ 2.6683811e-02,
+ 5.5520624e-02,
+ 8.6305944e-02,
+ 1.1480192e-01,
+ 1.3674206e-01,
+ 1.4867556e-01,
+ 1.4867556e-01,
+ 1.3674206e-01,
+ 1.1480192e-01,
+ 8.6305944e-02,
+ 5.5520624e-02,
+ 2.6683811e-02,
+ 3.2204775e-03,
+ -1.2808831e-02,
+ -2.0920610e-02,
+ -2.2065282e-02,
+ -1.8199275e-02,
+ -1.1705810e-02,
+ -4.8204610e-03,
+ 8.0284511e-04,
+ 4.3036754e-03,
+ 5.5924666e-03,
+ 5.1449415e-03,
+ 3.7058509e-03,
+ 2.0029849e-03,
+ 5.5034190e-04,
+ -4.2289438e-04,
+ -9.2768838e-04,
+ -1.1008344e-03,
+ -1.0818124e-03
+};
+
+typedef struct {
+ float sq[PMAX_M]; /* squared speech samples */
+ float mem_x,mem_y; /* memory for notch filter */
+ float mem_fir[NLP_NTAP]; /* decimation FIR filter memory */
+} NLP;
+
+float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax);
+float post_process_sub_multiples(COMP Fw[],
+ int pmin, int pmax, float gmax, int gmax_bin,
+ float *prev_Wo);
+
+/*---------------------------------------------------------------------------*\
+
+ nlp_create()
+
+ Initialisation function for NLP pitch estimator.
+
+\*---------------------------------------------------------------------------*/
+
+void *nlp_create()
+{
+ NLP *nlp;
+ int i;
+
+ nlp = (NLP*)malloc(sizeof(NLP));
+ if (nlp == NULL)
+ return NULL;
+
+ for(i=0; i<PMAX_M; i++)
+ nlp->sq[i] = 0.0;
+ nlp->mem_x = 0.0;
+ nlp->mem_y = 0.0;
+ for(i=0; i<NLP_NTAP; i++)
+ nlp->mem_fir[i] = 0.0;
+
+ return (void*)nlp;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ nlp_destory()
+
+ Initialisation function for NLP pitch estimator.
+
+\*---------------------------------------------------------------------------*/
+
+void nlp_destroy(void *nlp_state)
+{
+ assert(nlp_state != NULL);
+ free(nlp_state);
+}
+
+/*---------------------------------------------------------------------------*\
+
+ nlp()
+
+ Determines the pitch in samples using the Non Linear Pitch (NLP)
+ algorithm [1]. Returns the fundamental in Hz. Note that the actual
+ pitch estimate is for the centre of the M sample Sn[] vector, not
+ the current N sample input vector. This is (I think) a delay of 2.5
+ frames with N=80 samples. You should align further analysis using
+ this pitch estimate to be centred on the middle of Sn[].
+
+ Two post processors have been tried, the MBE version (as discussed
+ in [1]), and a post processor that checks sub-multiples. Both
+ suffer occasional gross pitch errors (i.e. neither are perfect). In
+ the presence of background noise the sub-multiple algorithm tends
+ towards low F0 which leads to better sounding background noise than
+ the MBE post processor.
+
+ A good way to test and develop the NLP pitch estimator is using the
+ tnlp (codec2/unittest) and the codec2/octave/plnlp.m Octave script.
+
+ A pitch tracker searching a few frames forward and backward in time
+ would be a useful addition.
+
+ References:
+
+ [1] http://www.itr.unisa.edu.au/~steven/thesis/dgr.pdf Chapter 4
+
+\*---------------------------------------------------------------------------*/
+
+float nlp(
+ void *nlp_state,
+ float Sn[], /* input speech vector */
+ int n, /* frames shift (no. new samples in Sn[]) */
+ int m, /* analysis window size */
+ int pmin, /* minimum pitch value */
+ int pmax, /* maximum pitch value */
+ float *pitch, /* estimated pitch period in samples */
+ COMP Sw[], /* Freq domain version of Sn[] */
+ float *prev_Wo
+)
+{
+ NLP *nlp;
+ float notch; /* current notch filter output */
+ COMP Fw[PE_FFT_SIZE]; /* DFT of squared signal */
+ float gmax;
+ int gmax_bin;
+ int i,j;
+ float best_f0;
+
+ assert(nlp_state != NULL);
+ nlp = (NLP*)nlp_state;
+
+ /* Square, notch filter at DC, and LP filter vector */
+
+ for(i=m-n; i<M; i++) /* square latest speech samples */
+ nlp->sq[i] = Sn[i]*Sn[i];
+
+ for(i=m-n; i<m; i++) { /* notch filter at DC */
+ notch = nlp->sq[i] - nlp->mem_x;
+ notch += COEFF*nlp->mem_y;
+ nlp->mem_x = nlp->sq[i];
+ nlp->mem_y = notch;
+ nlp->sq[i] = notch;
+ }
+
+ for(i=m-n; i<m; i++) { /* FIR filter vector */
+
+ for(j=0; j<NLP_NTAP-1; j++)
+ nlp->mem_fir[j] = nlp->mem_fir[j+1];
+ nlp->mem_fir[NLP_NTAP-1] = nlp->sq[i];
+
+ nlp->sq[i] = 0.0;
+ for(j=0; j<NLP_NTAP; j++)
+ nlp->sq[i] += nlp->mem_fir[j]*nlp_fir[j];
+ }
+
+ /* Decimate and DFT */
+
+ for(i=0; i<PE_FFT_SIZE; i++) {
+ Fw[i].real = 0.0;
+ Fw[i].imag = 0.0;
+ }
+ for(i=0; i<m/DEC; i++) {
+ Fw[i].real = nlp->sq[i*DEC]*(0.5 - 0.5*cos(2*PI*i/(m/DEC-1)));
+ }
+ dump_dec(Fw);
+ four1(&Fw[-1].imag,PE_FFT_SIZE,1);
+ for(i=0; i<PE_FFT_SIZE; i++)
+ Fw[i].real = Fw[i].real*Fw[i].real + Fw[i].imag*Fw[i].imag;
+
+ dump_sq(nlp->sq);
+ dump_Fw(Fw);
+
+ /* find global peak */
+
+ gmax = 0.0;
+ gmax_bin = PE_FFT_SIZE*DEC/pmax;
+ for(i=PE_FFT_SIZE*DEC/pmax; i<=PE_FFT_SIZE*DEC/pmin; i++) {
+ if (Fw[i].real > gmax) {
+ gmax = Fw[i].real;
+ gmax_bin = i;
+ }
+ }
+
+ best_f0 = post_process_sub_multiples(Fw, pmin, pmax, gmax, gmax_bin,
+ prev_Wo);
+
+ /* Shift samples in buffer to make room for new samples */
+
+ for(i=0; i<m-n; i++)
+ nlp->sq[i] = nlp->sq[i+n];
+
+ /* return pitch and F0 estimate */
+
+ *pitch = (float)SAMPLE_RATE/best_f0;
+ return(best_f0);
+}
+
+/*---------------------------------------------------------------------------*\
+
+ post_process_sub_multiples()
+
+ Given the global maximma of Fw[] we search interger submultiples for
+ local maxima. If local maxima exist and they are above an
+ experimentally derived threshold (OK a magic number I pulled out of
+ the air) we choose the submultiple as the F0 estimate.
+
+ The rational for this is that the lowest frequency peak of Fw[]
+ should be F0, as Fw[] can be considered the autocorrelation function
+ of Sw[] (the speech spectrum). However sometimes due to phase
+ effects the lowest frequency maxima may not be the global maxima.
+
+ This works OK in practice and favours low F0 values in the presence
+ of background noise which means the sinusoidal codec does an OK job
+ of synthesising the background noise. High F0 in background noise
+ tends to sound more periodic introducing annoying artifacts.
+
+\*---------------------------------------------------------------------------*/
+
+float post_process_sub_multiples(COMP Fw[],
+ int pmin, int pmax, float gmax, int gmax_bin,
+ float *prev_Wo)
+{
+ int min_bin, cmax_bin;
+ int mult;
+ float thresh, best_f0;
+ int b, bmin, bmax, lmax_bin;
+ float lmax, cmax;
+ int prev_f0_bin;
+
+ /* post process estimate by searching submultiples */
+
+ mult = 2;
+ min_bin = PE_FFT_SIZE*DEC/pmax;
+ cmax_bin = gmax_bin;
+ prev_f0_bin = *prev_Wo*(4000.0/PI)*(PE_FFT_SIZE*DEC)/SAMPLE_RATE;
+
+ while(gmax_bin/mult >= min_bin) {
+
+ b = gmax_bin/mult; /* determine search interval */
+ bmin = 0.8*b;
+ bmax = 1.2*b;
+ if (bmin < min_bin)
+ bmin = min_bin;
+
+ /* lower threshold to favour previous frames pitch estimate,
+ this is a form of pitch tracking */
+
+ if ((prev_f0_bin > bmin) && (prev_f0_bin < bmax))
+ thresh = CNLP*0.5*gmax;
+ else
+ thresh = CNLP*gmax;
+
+ lmax = 0;
+ lmax_bin = bmin;
+ for (b=bmin; b<=bmax; b++) /* look for maximum in interval */
+ if (Fw[b].real > lmax) {
+ lmax = Fw[b].real;
+ lmax_bin = b;
+ }
+
+ if (lmax > thresh)
+ if ((lmax > Fw[lmax_bin-1].real) && (lmax > Fw[lmax_bin+1].real)) {
+ cmax = lmax;
+ cmax_bin = lmax_bin;
+ }
+
+ mult++;
+ }
+
+ best_f0 = (float)cmax_bin*SAMPLE_RATE/(PE_FFT_SIZE*DEC);
+
+ return best_f0;
+}
+
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: nlp.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/3/93
+
+ Non Linear Pitch (NLP) estimation functions.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __NLP__
+#define __NLP__
+
+void *nlp_create();
+void nlp_destroy(void *nlp_state);
+float nlp(void *nlp_state, float Sn[], int n, int m, int pmin, int pmax,
+ float *pitch, COMP Sw[], float *prev_Wo);
+float test_candidate_mbe(COMP Sw[], float f0, COMP Sw_[]);
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2010 Perens LLC <bruce@perens.com>
+
+ 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 3 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, see <http://www.gnu.org/licenses/>.
+
+ */
+#include "defines.h"
+#include "quantise.h"
+#include <stdio.h>
+
+/* Compile-time constants */
+/* Size of unsigned char in bits. Assumes 8 bits-per-char. */
+static const unsigned int WordSize = 8;
+
+/* Mask to pick the bit component out of bitIndex. */
+static const unsigned int IndexMask = 0x7;
+
+/* Used to pick the word component out of bitIndex. */
+static const unsigned int ShiftRight = 3;
+
+/** Pack a bit field into a bit string, encoding the field in Gray code.
+ *
+ * The output is an array of unsigned char data. The fields are efficiently
+ * packed into the bit string. The Gray coding is a naive attempt to reduce
+ * the effect of single-bit errors, we expect to do a better job as the
+ * codec develops.
+ *
+ * This code would be simpler if it just set one bit at a time in the string,
+ * but would hit the same cache line more often. I'm not sure the complexity
+ * gains us anything here.
+ *
+ * Although field is currently of int type rather than unsigned for
+ * compatibility with the rest of the code, indices are always expected to
+ * be >= 0.
+ */
+void
+pack(
+ unsigned char * bitArray, /* The output bit string. */
+ unsigned int * bitIndex, /* Index into the string in BITS, not bytes.*/
+ int field, /* The bit field to be packed. */
+ unsigned int fieldWidth/* Width of the field in BITS, not bytes. */
+ )
+{
+ /* Convert the field to Gray code */
+ field = (field >> 1) ^ field;
+
+ do {
+ unsigned int bI = *bitIndex;
+ unsigned int bitsLeft = WordSize - (bI & IndexMask);
+ unsigned int sliceWidth =
+ bitsLeft < fieldWidth ? bitsLeft : fieldWidth;
+ unsigned int wordIndex = bI >> ShiftRight;
+
+ bitArray[wordIndex] |=
+ ((unsigned char)((field >> (fieldWidth - sliceWidth))
+ << (bitsLeft - sliceWidth)));
+
+ *bitIndex = bI + sliceWidth;
+ fieldWidth -= sliceWidth;
+ } while ( fieldWidth != 0 );
+}
+
+/** Unpack a field from a bit string, converting from Gray code to binary.
+ *
+ */
+int
+unpack(
+ const unsigned char * bitArray, /* The input bit string. */
+ unsigned int * bitIndex, /* Index into the string in BITS, not bytes.*/
+ unsigned int fieldWidth/* Width of the field in BITS, not bytes. */
+ )
+{
+ unsigned int field = 0;
+
+ do {
+ unsigned int bI = *bitIndex;
+ unsigned int bitsLeft = WordSize - (bI & IndexMask);
+ unsigned int sliceWidth =
+ bitsLeft < fieldWidth ? bitsLeft : fieldWidth;
+
+ field |= (((bitArray[bI >> ShiftRight] >> (bitsLeft - sliceWidth)) & ((1 << sliceWidth) - 1)) << (fieldWidth - sliceWidth));
+
+ *bitIndex = bI + sliceWidth;
+ fieldWidth -= sliceWidth;
+ } while ( fieldWidth != 0 );
+
+ /* Convert from Gray code to binary. Works for maximum 8-bit fields. */
+ unsigned int t = field ^ (field >> 8);
+ t ^= (t >> 4);
+ t ^= (t >> 2);
+ t ^= (t >> 1);
+ return t;
+}
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: phase.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 1/2/09
+
+ Functions for modelling and synthesising phase.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "defines.h"
+#include "phase.h"
+#include "four1.h"
+
+#include <assert.h>
+#include <math.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define VTHRESH 4.0
+
+/*---------------------------------------------------------------------------*\
+
+ aks_to_H()
+
+ Samples the complex LPC synthesis filter spectrum at the harmonic
+ frequencies.
+
+\*---------------------------------------------------------------------------*/
+
+void aks_to_H(
+ MODEL *model, /* model parameters */
+ float aks[], /* LPC's */
+ float G, /* energy term */
+ COMP H[], /* complex LPC spectral samples */
+ int order
+)
+{
+ COMP Pw[FFT_DEC]; /* power spectrum */
+ int i,m; /* loop variables */
+ int am,bm; /* limits of current band */
+ float r; /* no. rads/bin */
+ float Em; /* energy in band */
+ float Am; /* spectral amplitude sample */
+ int b; /* centre bin of harmonic */
+ float phi_; /* phase of LPC spectra */
+
+ r = TWO_PI/(FFT_DEC);
+
+ /* Determine DFT of A(exp(jw)) ------------------------------------------*/
+
+ for(i=0; i<FFT_DEC; i++) {
+ Pw[i].real = 0.0;
+ Pw[i].imag = 0.0;
+ }
+
+ for(i=0; i<=order; i++)
+ Pw[i].real = aks[i];
+
+ four1(&Pw[-1].imag,FFT_DEC,-1);
+
+ /* Sample magnitude and phase at harmonics */
+
+ for(m=1; m<=model->L; m++) {
+ am = floor((m - 0.5)*model->Wo/r + 0.5);
+ bm = floor((m + 0.5)*model->Wo/r + 0.5);
+ b = floor(m*model->Wo/r + 0.5);
+
+ Em = 0.0;
+ for(i=am; i<bm; i++)
+ Em += G/(Pw[i].real*Pw[i].real + Pw[i].imag*Pw[i].imag);
+ Am = sqrt(fabs(Em/(bm-am)));
+
+ phi_ = -atan2(Pw[b].imag,Pw[b].real);
+ H[m].real = Am*cos(phi_);
+ H[m].imag = Am*sin(phi_);
+ }
+}
+
+
+/*---------------------------------------------------------------------------*\
+
+ phase_synth_zero_order()
+
+ Synthesises phases based on SNR and a rule based approach. No phase
+ parameters are required apart from the SNR (which can be reduced to a
+ 1 bit V/UV decision per frame).
+
+ The phase of each harmonic is modelled as the phase of a LPC
+ synthesis filter excited by an impulse. Unlike the first order
+ model the position of the impulse is not transmitted, so we create
+ an excitation pulse train using a rule based approach.
+
+ Consider a pulse train with a pulse starting time n=0, with pulses
+ repeated at a rate of Wo, the fundamental frequency. A pulse train
+ in the time domain is equivalent to harmonics in the frequency
+ domain. We can make an excitation pulse train using a sum of
+ sinsusoids:
+
+ for(m=1; m<=L; m++)
+ ex[n] = cos(m*Wo*n)
+
+ Note: the Octave script ../octave/phase.m is an example of this if
+ you would like to try making a pulse train.
+
+ The phase of each excitation harmonic is:
+
+ arg(E[m]) = mWo
+
+ where E[m] are the complex excitation (freq domain) samples,
+ arg(x), just returns the phase of a complex sample x.
+
+ As we don't transmit the pulse position for this model, we need to
+ synthesise it. Now the excitation pulses occur at a rate of Wo.
+ This means the phase of the first harmonic advances by N samples
+ over a synthesis frame of N samples. For example if Wo is pi/20
+ (200 Hz), then over a 10ms frame (N=80 samples), the phase of the
+ first harmonic would advance (pi/20)*80 = 4*pi or two complete
+ cycles.
+
+ We generate the excitation phase of the fundamental (first
+ harmonic):
+
+ arg[E[1]] = Wo*N;
+
+ We then relate the phase of the m-th excitation harmonic to the
+ phase of the fundamental as:
+
+ arg(E[m]) = m*arg(E[1])
+
+ This E[m] then gets passed through the LPC synthesis filter to
+ determine the final harmonic phase.
+
+ For a while there were prolems with low pitched males like hts1
+ sounding "clicky". The synthesied time domain waveform also looked
+ clicky. Many methods were tried to improve the sounds quality of
+ low pitched males. Finally adding a small amount of jitter to each
+ harmonic worked.
+
+ The current result sounds very close to the original phases, with
+ only 1 voicing bit per frame. For example hts1a using original
+ amplitudes and this phase model produces speech hard to distinguish
+ from speech synthesise with the orginal phases. The sound quality
+ of this patrtiallyuantised codec (nb original amplitudes) is higher
+ than g729, even though all the phase information has been
+ discarded.
+
+ NOTES:
+
+ 1/ This synthesis model is effectvely the same as simple LPC-10
+ vocoders, and yet sounds much better. Why?
+
+ 2/ I am pretty sure the Lincoln Lab sinusoidal coding guys (like xMBE
+ also from MIT) first described this zero phase model, I need to look
+ up the paper.
+
+ 3/ Note that this approach could cause some discontinuities in
+ the phase at the edge of synthesis frames, as no attempt is made
+ to make sure that the phase tracks are continuous (the excitation
+ phases are continuous, but not the final phases after filtering
+ by the LPC spectra). Technically this is a bad thing. However
+ this may actually be a good thing, disturbing the phase tracks a
+ bit. More research needed, e.g. test a synthesis model that adds
+ a small delta-W to make phase tracks line up for voiced
+ harmonics.
+
+ 4/ Why does this sound so great with 1 V/UV decision? Conventional
+ wisdom says mixed voicing is required for high qaulity speech.
+
+\*---------------------------------------------------------------------------*/
+
+void phase_synth_zero_order(
+ MODEL *model,
+ float aks[],
+ float *ex_phase /* excitation phase of fundamental */
+)
+{
+ int m;
+ float new_phi;
+ COMP Ex[MAX_AMP]; /* excitation samples */
+ COMP A_[MAX_AMP]; /* synthesised harmonic samples */
+ COMP H[MAX_AMP]; /* LPC freq domain samples */
+ float G;
+ float jitter;
+
+ G = 1.0;
+ aks_to_H(model,aks,G,H,LPC_ORD);
+
+ /*
+ Update excitation fundamental phase track, this sets the position
+ of each pitch pulse during voiced speech. After much experiment
+ I found that using just this frame Wo improved quality for UV
+ sounds compared to interpolating two frames Wo like this:
+
+ ex_phase[0] += (*prev_Wo+mode->Wo)*N/2;
+ */
+
+ ex_phase[0] += (model->Wo)*N;
+ ex_phase[0] -= TWO_PI*floor(ex_phase[0]/TWO_PI + 0.5);
+
+ for(m=1; m<=model->L; m++) {
+
+ /* generate excitation */
+
+ if (model->voiced) {
+ /* This method of adding jitter really helped remove the clicky
+ sound in low pitched makes like hts1a. This moves the onset
+ of each harmonic over at +/- 0.25 of a sample.
+ */
+ jitter = 0.25*(1.0 - 2.0*rand()/RAND_MAX);
+ Ex[m].real = cos(ex_phase[0]*m - jitter*model->Wo*m);
+ Ex[m].imag = sin(ex_phase[0]*m - jitter*model->Wo*m);
+ }
+ else {
+
+ /* When a few samples were tested I found that LPC filter
+ phase is not needed in the unvoiced case, but no harm in
+ keeping it.
+ */
+ float phi = TWO_PI*(float)rand()/RAND_MAX;
+ Ex[m].real = cos(phi);
+ Ex[m].imag = sin(phi);
+ }
+
+ /* filter using LPC filter */
+
+ A_[m].real = H[m].real*Ex[m].real - H[m].imag*Ex[m].imag;
+ A_[m].imag = H[m].imag*Ex[m].real + H[m].real*Ex[m].imag;
+
+ /* modify sinusoidal phase */
+
+ new_phi = atan2(A_[m].imag, A_[m].real+1E-12);
+ model->phi[m] = new_phi;
+ }
+
+}
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: phase.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 1/2/09
+
+ Functions for modelling phase.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __PHASE__
+#define __PHASE__
+
+void phase_synth_zero_order(MODEL *model, float aks[], float *ex_phase);
+
+#endif
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: postfilter.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 13/09/09
+
+ Postfilter to improve sound quality for speech with high levels of
+ background noise. Unlike mixed-excitation models requires no bits
+ to be transmitted to handle background noise.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#include "defines.h"
+#include "dump.h"
+#include "postfilter.h"
+
+/*---------------------------------------------------------------------------*\
+
+ DEFINES
+
+\*---------------------------------------------------------------------------*/
+
+#define BG_THRESH 40.0 /* only consider low levels signals for bg_est */
+#define BG_BETA 0.1 /* averaging filter constant */
+
+/*---------------------------------------------------------------------------*\
+
+ postfilter()
+
+ The post filter is designed to help with speech corrupted by
+ background noise. The zero phase model tends to make speech with
+ background noise sound "clicky". With high levels of background
+ noise the low level inter-formant parts of the spectrum will contain
+ noise rather than speech harmonics, so modelling them as voiced
+ (i.e. a continuous, non-random phase track) is inaccurate.
+
+ Some codecs (like MBE) have a mixed voicing model that breaks the
+ spectrum into voiced and unvoiced regions. Several bits/frame
+ (5-12) are required to transmit the frequency selective voicing
+ information. Mixed excitation also requires accurate voicing
+ estimation (parameter estimators always break occasionally under
+ exceptional condition).
+
+ In our case we use a post filter approach which requires no
+ additional bits to be transmitted. The decoder measures the average
+ level of the background noise during unvoiced frames. If a harmonic
+ is less than this level it is made unvoiced by randomising it's
+ phases.
+
+ This idea is rather experimental. Some potential problems that may
+ happen:
+
+ 1/ If someone says "aaaaaaaahhhhhhhhh" will background estimator track
+ up to speech level? This would be a bad thing.
+
+ 2/ If background noise suddenly dissapears from the source speech does
+ estimate drop quickly? What is noise suddenly re-appears?
+
+ 3/ Background noise with a non-flat sepctrum. Current algorithm just
+ comsiders scpetrum as a whole, but this could be broken up into
+ bands, each with their own estimator.
+
+ 4/ Males and females with the same level of background noise. Check
+ performance the same. Changing Wo affects width of each band, may
+ affect bg energy estimates.
+
+ 5/ Not sure what happens during long periods of voiced speech
+ e.g. "sshhhhhhh"
+
+\*---------------------------------------------------------------------------*/
+
+void postfilter(
+ MODEL *model,
+ float *bg_est
+)
+{
+ int m, uv;
+ float e;
+
+ /* determine average energy across spectrum */
+
+ e = 0.0;
+ for(m=1; m<=model->L; m++)
+ e += model->A[m]*model->A[m];
+
+ e = 10.0*log10(e/model->L);
+
+ /* If beneath threhold, update bg estimate. The idea
+ of the threshold is to prevent updating during high level
+ speech. */
+
+ if ((e < BG_THRESH) && !model->voiced)
+ *bg_est = *bg_est*(1.0 - BG_BETA) + e*BG_BETA;
+
+ /* now mess with phases during voiced frames to make any harmonics
+ less then our background estimate unvoiced.
+ */
+
+ uv = 0;
+ if (model->voiced)
+ for(m=1; m<=model->L; m++)
+ if (20.0*log10(model->A[m]) < *bg_est) {
+ model->phi[m] = TWO_PI*(float)rand()/RAND_MAX;
+ uv++;
+ }
+
+ dump_bg(e, *bg_est, 100.0*uv/model->L);
+
+}
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: postfilter.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 13/09/09
+
+ Postfilter header file.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __POSTFILTER__
+#define __POSTFILTER__
+
+void postfilter(MODEL *model, float *bg_est);
+
+#endif
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: quantise.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 31/5/92
+
+ Quantisation functions for the sinusoidal coder.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <assert.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "defines.h"
+#include "dump.h"
+#include "quantise.h"
+#include "lpc.h"
+#include "lsp.h"
+#include "four1.h"
+#include "codebook.h"
+
+#define LSP_DELTA1 0.01 /* grid spacing for LSP root searches */
+#define MAX_CB 20 /* max number of codebooks */
+
+/* describes each codebook */
+
+typedef struct {
+ int k; /* dimension of vector */
+ int log2m; /* number of bits in m */
+ int m; /* elements in codebook */
+ float *fn; /* file name of text file storing the VQ */
+} LSP_CB;
+
+/* lsp_q describes entire quantiser made up of several codebooks */
+
+#ifdef OLDER
+/* 10+10+6+6 = 32 bit LSP difference split VQ */
+
+LSP_CB lsp_q[] = {
+ {3, 1024, "/usr/src/freeswitch/libs/libcodec2-1.0/unittest/lspd123.txt"},
+ {3, 1024, "/usr/src/freeswitch/libs/libcodec2-1.0/unittest/lspd456.txt"},
+ {2, 64, "/usr/src/freeswitch/libs/libcodec2-1.0/unittest/lspd78.txt"},
+ {2, 64, "/usr/src/freeswitch/libs/libcodec2-1.0/unittest/lspd910.txt"},
+ {0, 0, ""}
+};
+#endif
+
+LSP_CB lsp_q[] = {
+ {1,4,16, codebook_lsp1 },
+ {1,4,16, codebook_lsp2 },
+ {1,4,16, codebook_lsp3 },
+ {1,4,16, codebook_lsp4 },
+ {1,4,16, codebook_lsp5 },
+ {1,4,16, codebook_lsp6 },
+ {1,4,16, codebook_lsp7 },
+ {1,3,8, codebook_lsp8 },
+ {1,3,8, codebook_lsp9 },
+ {1,2,4, codebook_lsp10 },
+ {0,0,0, NULL },
+};
+
+/* ptr to each codebook */
+
+static float *plsp_cb[MAX_CB];
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION HEADERS
+
+\*---------------------------------------------------------------------------*/
+
+float speech_to_uq_lsps(float lsp[], float ak[], float Sn[], float w[],
+ int order);
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTIONS
+
+\*---------------------------------------------------------------------------*/
+
+int lsp_bits(int i) {
+ return lsp_q[i].log2m;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ quantise_uniform
+
+ Simulates uniform quantising of a float.
+
+\*---------------------------------------------------------------------------*/
+
+void quantise_uniform(float *val, float min, float max, int bits)
+{
+ int levels = 1 << (bits-1);
+ float norm;
+ int index;
+
+ /* hard limit to quantiser range */
+
+ printf("min: %f max: %f val: %f ", min, max, val[0]);
+ if (val[0] < min) val[0] = min;
+ if (val[0] > max) val[0] = max;
+
+ norm = (*val - min)/(max-min);
+ printf("%f norm: %f ", val[0], norm);
+ index = fabs(levels*norm + 0.5);
+
+ *val = min + index*(max-min)/levels;
+
+ printf("index %d val_: %f\n", index, val[0]);
+}
+
+/*---------------------------------------------------------------------------*\
+
+ lspd_quantise
+
+ Simulates differential lsp quantiser
+
+\*---------------------------------------------------------------------------*/
+
+void lsp_quantise(
+ float lsp[],
+ float lsp_[],
+ int order
+)
+{
+ int i;
+ float dlsp[LPC_MAX];
+ float dlsp_[LPC_MAX];
+
+ dlsp[0] = lsp[0];
+ for(i=1; i<order; i++)
+ dlsp[i] = lsp[i] - lsp[i-1];
+
+ for(i=0; i<order; i++)
+ dlsp_[i] = dlsp[i];
+
+ quantise_uniform(&dlsp_[0], 0.1, 0.5, 5);
+
+ lsp_[0] = dlsp_[0];
+ for(i=1; i<order; i++)
+ lsp_[i] = lsp_[i-1] + dlsp_[i];
+}
+
+/*---------------------------------------------------------------------------*\
+
+ scan_line()
+
+ This function reads a vector of floats from a line in a text file.
+
+\*---------------------------------------------------------------------------*/
+
+void scan_line(FILE *fp, float f[], int n)
+/* FILE *fp; file ptr to text file */
+/* float f[]; array of floats to return */
+/* int n; number of floats in line */
+{
+ char s[MAX_STR];
+ char *ps,*pe;
+ int i;
+
+ fgets(s,MAX_STR,fp);
+ ps = pe = s;
+ for(i=0; i<n; i++) {
+ while( isspace(*pe)) pe++;
+ while( !isspace(*pe)) pe++;
+ sscanf(ps,"%f",&f[i]);
+ ps = pe;
+ }
+}
+
+/*---------------------------------------------------------------------------*\
+
+ load_cb
+
+ Loads a single codebook (LSP vector quantiser) into memory.
+
+\*---------------------------------------------------------------------------*/
+
+void load_cb(float *source, float *cb, int k, int m)
+{
+ int lines;
+ int i;
+
+ lines = 0;
+ for(i=0; i<m; i++) {
+ cb[k*lines++] = source[i];
+ }
+}
+
+/*---------------------------------------------------------------------------*\
+
+ quantise_init
+
+ Loads the entire LSP quantiser comprised of several vector quantisers
+ (codebooks).
+
+\*---------------------------------------------------------------------------*/
+
+void quantise_init()
+{
+ int i,k,m;
+
+ i = 0;
+ while(lsp_q[i].k) {
+ k = lsp_q[i].k;
+ m = lsp_q[i].m;
+ plsp_cb[i] = (float*)malloc(sizeof(float)*k*m);
+ assert(plsp_cb[i] != NULL);
+ load_cb(lsp_q[i].fn, plsp_cb[i], k, m);
+ i++;
+ assert(i < MAX_CB);
+ }
+}
+
+/*---------------------------------------------------------------------------*\
+
+ quantise
+
+ Quantises vec by choosing the nearest vector in codebook cb, and
+ returns the vector index. The squared error of the quantised vector
+ is added to se.
+
+\*---------------------------------------------------------------------------*/
+
+long quantise(float cb[], float vec[], float w[], int k, int m, float *se)
+/* float cb[][K]; current VQ codebook */
+/* float vec[]; vector to quantise */
+/* float w[]; weighting vector */
+/* int k; dimension of vectors */
+/* int m; size of codebook */
+/* float *se; accumulated squared error */
+{
+ float e; /* current error */
+ long besti; /* best index so far */
+ float beste; /* best error so far */
+ long j;
+ int i;
+
+ besti = 0;
+ beste = 1E32;
+ for(j=0; j<m; j++) {
+ e = 0.0;
+ for(i=0; i<k; i++)
+ e += pow((cb[j*k+i]-vec[i])*w[i],2.0);
+ if (e < beste) {
+ beste = e;
+ besti = j;
+ }
+ }
+
+ *se += beste;
+
+ return(besti);
+}
+
+static float gmin=PI;
+
+float get_gmin(void) { return gmin; }
+
+void min_lsp_dist(float lsp[], int order)
+{
+ int i;
+
+ for(i=1; i<order; i++)
+ if ((lsp[i]-lsp[i-1]) < gmin)
+ gmin = lsp[i]-lsp[i-1];
+}
+
+void check_lsp_order(float lsp[], int lpc_order)
+{
+ int i;
+ float tmp;
+
+ for(i=1; i<lpc_order; i++)
+ if (lsp[i] < lsp[i-1]) {
+ printf("swap %d\n",i);
+ tmp = lsp[i-1];
+ lsp[i-1] = lsp[i]-0.05;
+ lsp[i] = tmp+0.05;
+ }
+}
+
+void force_min_lsp_dist(float lsp[], int lpc_order)
+{
+ int i;
+
+ for(i=1; i<lpc_order; i++)
+ if ((lsp[i]-lsp[i-1]) < 0.01) {
+ lsp[i] += 0.01;
+ }
+}
+
+/*---------------------------------------------------------------------------*\
+
+ lpc_model_amplitudes
+
+ Derive a LPC model for amplitude samples then estimate amplitude samples
+ from this model with optional LSP quantisation.
+
+ Returns the spectral distortion for this frame.
+
+\*---------------------------------------------------------------------------*/
+
+float lpc_model_amplitudes(
+ float Sn[], /* Input frame of speech samples */
+ float w[],
+ MODEL *model, /* sinusoidal model parameters */
+ int order, /* LPC model order */
+ int lsp_quant, /* optional LSP quantisation if non-zero */
+ float ak[] /* output aks */
+)
+{
+ float Wn[M];
+ float R[LPC_MAX+1];
+ float E;
+ int i,j;
+ float snr;
+ float lsp[LPC_MAX];
+ float lsp_hz[LPC_MAX];
+ float lsp_[LPC_MAX];
+ int roots; /* number of LSP roots found */
+ int index;
+ float se;
+ int k,m;
+ float *cb;
+ float wt[LPC_MAX];
+
+ for(i=0; i<M; i++)
+ Wn[i] = Sn[i]*w[i];
+ autocorrelate(Wn,R,M,order);
+ levinson_durbin(R,ak,order);
+
+ E = 0.0;
+ for(i=0; i<=order; i++)
+ E += ak[i]*R[i];
+
+ for(i=0; i<order; i++)
+ wt[i] = 1.0;
+
+ if (lsp_quant) {
+ roots = lpc_to_lsp(ak, order, lsp, 5, LSP_DELTA1);
+ if (roots != order)
+ printf("LSP roots not found\n");
+
+ /* convert from radians to Hz to make quantisers more
+ human readable */
+
+ for(i=0; i<order; i++)
+ lsp_hz[i] = (4000.0/PI)*lsp[i];
+
+ /* simple uniform scalar quantisers */
+
+ for(i=0; i<10; i++) {
+ k = lsp_q[i].k;
+ m = lsp_q[i].m;
+ cb = plsp_cb[i];
+ index = quantise(cb, &lsp_hz[i], wt, k, m, &se);
+ lsp_hz[i] = cb[index*k];
+ }
+
+ /* experiment: simulating uniform quantisation error
+ for(i=0; i<order; i++)
+ lsp[i] += PI*(12.5/4000.0)*(1.0 - 2.0*(float)rand()/RAND_MAX);
+ */
+
+ for(i=0; i<order; i++)
+ lsp[i] = (PI/4000.0)*lsp_hz[i];
+
+ /* Bandwidth Expansion (BW). Prevents any two LSPs getting too
+ close together after quantisation. We know from experiment
+ that LSP quantisation errors < 12.5Hz (25Hz setp size) are
+ inaudible so we use that as the minimum LSP separation.
+ */
+
+ for(i=1; i<5; i++) {
+ if (lsp[i] - lsp[i-1] < PI*(12.5/4000.0))
+ lsp[i] = lsp[i-1] + PI*(12.5/4000.0);
+ }
+
+ /* as quantiser gaps increased, larger BW expansion was required
+ to prevent twinkly noises */
+
+ for(i=5; i<8; i++) {
+ if (lsp[i] - lsp[i-1] < PI*(25.0/4000.0))
+ lsp[i] = lsp[i-1] + PI*(25.0/4000.0);
+ }
+ for(i=8; i<order; i++) {
+ if (lsp[i] - lsp[i-1] < PI*(75.0/4000.0))
+ lsp[i] = lsp[i-1] + PI*(75.0/4000.0);
+ }
+
+ for(j=0; j<order; j++)
+ lsp_[j] = lsp[j];
+
+ lsp_to_lpc(lsp_, ak, order);
+ dump_lsp(lsp);
+ }
+
+ dump_E(E);
+ #ifdef SIM_QUANT
+ /* simulated LPC energy quantisation */
+ {
+ float e = 10.0*log10(E);
+ e += 2.0*(1.0 - 2.0*(float)rand()/RAND_MAX);
+ E = pow(10.0,e/10.0);
+ }
+ #endif
+
+ aks_to_M2(ak,order,model,E,&snr, 1); /* {ak} -> {Am} LPC decode */
+
+ return snr;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ aks_to_M2()
+
+ Transforms the linear prediction coefficients to spectral amplitude
+ samples. This function determines A(m) from the average energy per
+ band using an FFT.
+
+\*---------------------------------------------------------------------------*/
+
+void aks_to_M2(
+ float ak[], /* LPC's */
+ int order,
+ MODEL *model, /* sinusoidal model parameters for this frame */
+ float E, /* energy term */
+ float *snr, /* signal to noise ratio for this frame in dB */
+ int dump /* true to dump sample to dump file */
+)
+{
+ COMP Pw[FFT_DEC]; /* power spectrum */
+ int i,m; /* loop variables */
+ int am,bm; /* limits of current band */
+ float r; /* no. rads/bin */
+ float Em; /* energy in band */
+ float Am; /* spectral amplitude sample */
+ float signal, noise;
+
+ r = TWO_PI/(FFT_DEC);
+
+ /* Determine DFT of A(exp(jw)) --------------------------------------------*/
+
+ for(i=0; i<FFT_DEC; i++) {
+ Pw[i].real = 0.0;
+ Pw[i].imag = 0.0;
+ }
+
+ for(i=0; i<=order; i++)
+ Pw[i].real = ak[i];
+ four1(&Pw[-1].imag,FFT_DEC,1);
+
+ /* Determine power spectrum P(w) = E/(A(exp(jw))^2 ------------------------*/
+
+ for(i=0; i<FFT_DEC/2; i++)
+ Pw[i].real = E/(Pw[i].real*Pw[i].real + Pw[i].imag*Pw[i].imag);
+ if (dump)
+ dump_Pw(Pw);
+
+ /* Determine magnitudes by linear interpolation of P(w) -------------------*/
+
+ signal = noise = 0.0;
+ for(m=1; m<=model->L; m++) {
+ am = floor((m - 0.5)*model->Wo/r + 0.5);
+ bm = floor((m + 0.5)*model->Wo/r + 0.5);
+ Em = 0.0;
+
+ for(i=am; i<bm; i++)
+ Em += Pw[i].real;
+ Am = sqrt(Em);
+
+ signal += pow(model->A[m],2.0);
+ noise += pow(model->A[m] - Am,2.0);
+ model->A[m] = Am;
+ }
+ *snr = 10.0*log10(signal/noise);
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: encode_Wo()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
+
+ Encodes Wo using a WO_LEVELS quantiser.
+
+\*---------------------------------------------------------------------------*/
+
+int encode_Wo(float Wo)
+{
+ int index;
+ float Wo_min = TWO_PI/P_MAX;
+ float Wo_max = TWO_PI/P_MIN;
+ float norm;
+
+ norm = (Wo - Wo_min)/(Wo_max - Wo_min);
+ index = floor(WO_LEVELS * norm + 0.5);
+ if (index < 0 ) index = 0;
+ if (index > (WO_LEVELS-1)) index = WO_LEVELS-1;
+
+ return index;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: decode_Wo()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
+
+ Decodes Wo using a WO_LEVELS quantiser.
+
+\*---------------------------------------------------------------------------*/
+
+float decode_Wo(int index)
+{
+ float Wo_min = TWO_PI/P_MAX;
+ float Wo_max = TWO_PI/P_MIN;
+ float step;
+ float Wo;
+
+ step = (Wo_max - Wo_min)/WO_LEVELS;
+ Wo = Wo_min + step*(index);
+
+ return Wo;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: speech_to_uq_lsps()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
+
+ Analyse a windowed frame of time domain speech to determine LPCs
+ which are the converted to LSPs for quantisation and transmission
+ over the channel.
+
+\*---------------------------------------------------------------------------*/
+
+float speech_to_uq_lsps(float lsp[],
+ float ak[],
+ float Sn[],
+ float w[],
+ int order
+)
+{
+ int i, roots;
+ float Wn[M];
+ float R[LPC_MAX+1];
+ float E;
+
+ for(i=0; i<M; i++)
+ Wn[i] = Sn[i]*w[i];
+ autocorrelate(Wn, R, M, order);
+ levinson_durbin(R, ak, order);
+
+ E = 0.0;
+ for(i=0; i<=order; i++)
+ E += ak[i]*R[i];
+
+ roots = lpc_to_lsp(ak, order, lsp, 5, LSP_DELTA1);
+ // assert(roots == order);
+
+ return E;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: encode_lsps()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
+
+ From a vector of unquantised (floating point) LSPs finds the quantised
+ LSP indexes.
+
+\*---------------------------------------------------------------------------*/
+
+void encode_lsps(int indexes[], float lsp[], int order)
+{
+ int i,k,m;
+ float wt[1];
+ float lsp_hz[LPC_MAX];
+ float *cb, se;
+
+ /* convert from radians to Hz so we can use human readable
+ frequencies */
+
+ for(i=0; i<order; i++)
+ lsp_hz[i] = (4000.0/PI)*lsp[i];
+
+ /* simple uniform scalar quantisers */
+
+ wt[0] = 1.0;
+ for(i=0; i<order; i++) {
+ k = lsp_q[i].k;
+ m = lsp_q[i].m;
+ cb = plsp_cb[i];
+ indexes[i] = quantise(cb, &lsp_hz[i], wt, k, m, &se);
+ }
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: decode_lsps()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
+
+ From a vector of quantised LSP indexes, returns the quantised
+ (floating point) LSPs.
+
+\*---------------------------------------------------------------------------*/
+
+void decode_lsps(float lsp[], int indexes[], int order)
+{
+ int i,k;
+ float lsp_hz[LPC_MAX];
+ float *cb;
+
+ for(i=0; i<order; i++) {
+ k = lsp_q[i].k;
+ cb = plsp_cb[i];
+ lsp_hz[i] = cb[indexes[i]*k];
+ }
+
+ /* convert back to radians */
+
+ for(i=0; i<order; i++)
+ lsp[i] = (PI/4000.0)*lsp_hz[i];
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: bw_expand_lsps()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
+
+ Applies Bandwidth Expansion (BW) to a vector of LSPs. Prevents any
+ two LSPs getting too close together after quantisation. We know
+ from experiment that LSP quantisation errors < 12.5Hz (25Hz setp
+ size) are inaudible so we use that as the minimum LSP separation.
+
+\*---------------------------------------------------------------------------*/
+
+void bw_expand_lsps(float lsp[],
+ int order
+)
+{
+ int i;
+
+ for(i=1; i<5; i++) {
+ if (lsp[i] - lsp[i-1] < PI*(12.5/4000.0))
+ lsp[i] = lsp[i-1] + PI*(12.5/4000.0);
+ }
+
+ /* As quantiser gaps increased, larger BW expansion was required
+ to prevent twinkly noises. This may need more experiment for
+ different quanstisers.
+ */
+
+ for(i=5; i<8; i++) {
+ if (lsp[i] - lsp[i-1] < PI*(25.0/4000.0))
+ lsp[i] = lsp[i-1] + PI*(25.0/4000.0);
+ }
+ for(i=8; i<order; i++) {
+ if (lsp[i] - lsp[i-1] < PI*(75.0/4000.0))
+ lsp[i] = lsp[i-1] + PI*(75.0/4000.0);
+ }
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: need_lpc_correction()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
+
+ Determine if we need LPC correction of first harmonic.
+
+\*---------------------------------------------------------------------------*/
+
+int need_lpc_correction(MODEL *model, float ak[], float E)
+{
+ MODEL tmp;
+ float snr,E1;
+
+ /* Find amplitudes so we can check if we need LPC correction.
+ TODO: replace call to aks_to_M2() by a single DFT calculation
+ of E/A(exp(jWo)) to make much more efficient. We only need
+ A[1].
+ */
+
+ memcpy(&tmp, model, sizeof(MODEL));
+ aks_to_M2(ak, LPC_ORD, &tmp, E, &snr, 0);
+
+ /*
+ Attenuate fundamental by 30dB if F0 < 150 Hz and LPC modelling
+ error for A[1] is larger than 6dB.
+
+ LPC modelling often makes big errors on 1st harmonic, for example
+ when the fundamental has been removed by analog high pass
+ filtering before sampling. However on unfiltered speech from
+ high quality sources we would like to keep the fundamental to
+ maintain the speech quality. So we check the error in A[1] and
+ attenuate it if the error is large to avoid annoying low
+ frequency energy after LPC modelling.
+
+ This requires a single bit to quantise, on top of the other
+ spectral magnitude bits (i.e. LSP bits + 1 total).
+ */
+
+ E1 = fabs(20.0*log10(model->A[1]) - 20.0*log10(tmp.A[1]));
+ if (E1 > 6.0)
+ return 1;
+ else
+ return 0;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: apply_lpc_correction()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
+
+ Apply first harmonic LPC correction at decoder.
+
+\*---------------------------------------------------------------------------*/
+
+void apply_lpc_correction(MODEL *model, int lpc_correction)
+{
+ if (lpc_correction) {
+ if (model->Wo < (PI*150.0/4000)) {
+ model->A[1] *= 0.032;
+ }
+ }
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: encode_energy()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
+
+ Encodes LPC energy using an E_LEVELS quantiser.
+
+\*---------------------------------------------------------------------------*/
+
+int encode_energy(float e)
+{
+ int index;
+ float e_min = E_MIN_DB;
+ float e_max = E_MAX_DB;
+ float norm;
+
+ e = 10.0*log10(e);
+ norm = (e - e_min)/(e_max - e_min);
+ index = floor(E_LEVELS * norm + 0.5);
+ if (index < 0 ) index = 0;
+ if (index > (E_LEVELS-1)) index = E_LEVELS-1;
+
+ return index;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: decode_energy()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
+
+ Decodes energy using a WO_BITS quantiser.
+
+\*---------------------------------------------------------------------------*/
+
+float decode_energy(int index)
+{
+ float e_min = E_MIN_DB;
+ float e_max = E_MAX_DB;
+ float step;
+ float e;
+
+ step = (e_max - e_min)/E_LEVELS;
+ e = e_min + step*(index);
+ e = pow(10.0,e/10.0);
+
+ return e;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: encode_amplitudes()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
+
+ Time domain LPC is used model the amplitudes which are then
+ converted to LSPs and quantised. So we don't actually encode the
+ amplitudes directly, rather we derive an equivalent representation
+ from the time domain speech.
+
+\*---------------------------------------------------------------------------*/
+
+void encode_amplitudes(int lsp_indexes[],
+ int *lpc_correction,
+ int *energy_index,
+ MODEL *model,
+ float Sn[],
+ float w[])
+{
+ float lsps[LPC_ORD];
+ float ak[LPC_ORD+1];
+ float e;
+
+ e = speech_to_uq_lsps(lsps, ak, Sn, w, LPC_ORD);
+ encode_lsps(lsp_indexes, lsps, LPC_ORD);
+ *lpc_correction = need_lpc_correction(model, ak, e);
+ *energy_index = encode_energy(e);
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: decode_amplitudes()
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/2010
+
+ Given the amplitude quantiser indexes recovers the harmonic
+ amplitudes.
+
+\*---------------------------------------------------------------------------*/
+
+float decode_amplitudes(MODEL *model,
+ float ak[],
+ int lsp_indexes[],
+ int lpc_correction,
+ int energy_index
+)
+{
+ float lsps[LPC_ORD];
+ float e;
+ float snr;
+
+ decode_lsps(lsps, lsp_indexes, LPC_ORD);
+ bw_expand_lsps(lsps, LPC_ORD);
+ lsp_to_lpc(lsps, ak, LPC_ORD);
+ e = decode_energy(energy_index);
+ aks_to_M2(ak, LPC_ORD, model, e, &snr, 1);
+ apply_lpc_correction(model, lpc_correction);
+
+ return snr;
+}
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: quantise.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 31/5/92
+
+ Quantisation functions for the sinusoidal coder.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __QUANTISE__
+#define __QUANTISE__
+
+#define WO_BITS 7
+#define WO_LEVELS (1<<WO_BITS)
+#define E_BITS 5
+#define E_LEVELS (1<<E_BITS)
+#define E_MIN_DB -10.0
+#define E_MAX_DB 40.0
+
+void quantise_init();
+float lpc_model_amplitudes(float Sn[], float w[], MODEL *model, int order,
+ int lsp,float ak[]);
+void aks_to_M2(float ak[], int order, MODEL *model, float E, float *snr,
+ int dump);
+float get_gmin(void);
+
+int encode_Wo(float Wo);
+float decode_Wo(int index);
+
+void encode_lsps(int indexes[], float lsp[], int order);
+void decode_lsps(float lsp[], int indexes[], int order);
+
+int encode_energy(float e);
+float decode_energy(int index);
+
+void encode_amplitudes(int lsp_indexes[],
+ int *lpc_correction,
+ int *energy_index,
+ MODEL *model,
+ float Sn[],
+ float w[]);
+
+float decode_amplitudes(MODEL *model,
+ float ak[],
+ int lsp_indexes[],
+ int lpc_correction,
+ int energy_index);
+
+void pack(unsigned char * bits, unsigned int *nbit, int index, unsigned int index_bits);
+int unpack(const unsigned char * bits, unsigned int *nbit, unsigned int index_bits);
+
+int lsp_bits(int i);
+
+int need_lpc_correction(MODEL *model, float ak[], float E);
+void apply_lpc_correction(MODEL *model, int lpc_correction);
+float speech_to_uq_lsps(float lsp[],
+ float ak[],
+ float Sn[],
+ float w[],
+ int order
+ );
+void bw_expand_lsps(float lsp[],
+ int order
+ );
+void decode_lsps(float lsp[], int indexes[], int order);
+
+#endif
--- /dev/null
+#!/bin/sh
+# sim.sh
+# David Rowe 10 Sep 2009
+
+# Process a source file using the codec 2 simulation. An output
+# speech file is generated for each major processing step, from the
+# unquantised siusoidal model to fully quantised. This way we can
+# listen to the effect of each processing step. Use listensim.sh to
+# test the output files.
+
+../src/c2sim ../raw/$1.raw -o $1_uq.raw
+../src/c2sim ../raw/$1.raw --phase0 -o $1_phase0.raw --postfilter
+../src/c2sim ../raw/$1.raw --lpc 10 -o $1_lpc10.raw
+../src/c2sim ../raw/$1.raw --lpc 10 --lsp -o $1_lsp.raw
+../src/c2sim ../raw/$1.raw --phase0 --lpc 10 -o $1_phase0_lpc10.raw --postfilter
+../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp -o $1_phase0_lsp.raw --postfilter
+../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp -o $1_phase0_lsp_dec.raw --postfilter --dec
+
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: sine.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 19/8/2010
+
+ Sinusoidal analysis and synthesis functions.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 1990-2010 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/*---------------------------------------------------------------------------*\
+
+ INCLUDES
+
+\*---------------------------------------------------------------------------*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#include "defines.h"
+#include "sine.h"
+#include "four1.h"
+
+/*---------------------------------------------------------------------------*\
+
+ HEADERS
+
+\*---------------------------------------------------------------------------*/
+
+void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax,
+ float pstep);
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTIONS
+
+\*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: make_analysis_window
+ AUTHOR......: David Rowe
+ DATE CREATED: 11/5/94
+
+ Init function that generates the time domain analysis window and it's DFT.
+
+\*---------------------------------------------------------------------------*/
+
+void make_analysis_window(float w[],COMP W[])
+{
+ float m;
+ COMP temp;
+ int i,j;
+
+ /*
+ Generate Hamming window centered on M-sample pitch analysis window
+
+ 0 M/2 M-1
+ |-------------|-------------|
+ |-------|-------|
+ NW samples
+
+ All our analysis/synthsis is centred on the M/2 sample.
+ */
+
+ m = 0.0;
+ for(i=0; i<M/2-NW/2; i++)
+ w[i] = 0.0;
+ for(i=M/2-NW/2,j=0; i<M/2+NW/2; i++,j++) {
+ w[i] = 0.5 - 0.5*cos(TWO_PI*j/(NW-1));
+ m += w[i]*w[i];
+ }
+ for(i=M/2+NW/2; i<M; i++)
+ w[i] = 0.0;
+
+ /* Normalise - makes freq domain amplitude estimation straight
+ forward */
+
+ m = 1.0/sqrt(m*FFT_ENC);
+ for(i=0; i<M; i++) {
+ w[i] *= m;
+ }
+
+ /*
+ Generate DFT of analysis window, used for later processing. Note
+ we modulo FFT_ENC shift the time domain window w[], this makes the
+ imaginary part of the DFT W[] equal to zero as the shifted w[] is
+ even about the n=0 time axis if NW is odd. Having the imag part
+ of the DFT W[] makes computation easier.
+
+ 0 FFT_ENC-1
+ |-------------------------|
+
+ ----\ /----
+ \ /
+ \ / <- shifted version of window w[n]
+ \ /
+ \ /
+ -------
+
+ |---------| |---------|
+ NW/2 NW/2
+ */
+
+ for(i=0; i<FFT_ENC; i++) {
+ W[i].real = 0.0;
+ W[i].imag = 0.0;
+ }
+ for(i=0; i<NW/2; i++)
+ W[i].real = w[i+M/2];
+ for(i=FFT_ENC-NW/2,j=M/2-NW/2; i<FFT_ENC; i++,j++)
+ W[i].real = w[j];
+
+ four1(&W[-1].imag,FFT_ENC,-1); /* "Numerical Recipes in C" FFT */
+
+ /*
+ Re-arrange W[] to be symmetrical about FFT_ENC/2. Makes later
+ analysis convenient.
+
+ Before:
+
+
+ 0 FFT_ENC-1
+ |----------|---------|
+ __ _
+ \ /
+ \_______________/
+
+ After:
+
+ 0 FFT_ENC-1
+ |----------|---------|
+ ___
+ / \
+ ________/ \_______
+
+ */
+
+
+ for(i=0; i<FFT_ENC/2; i++) {
+ temp.real = W[i].real;
+ temp.imag = W[i].imag;
+ W[i].real = W[i+FFT_ENC/2].real;
+ W[i].imag = W[i+FFT_ENC/2].imag;
+ W[i+FFT_ENC/2].real = temp.real;
+ W[i+FFT_ENC/2].imag = temp.imag;
+ }
+
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: dft_speech
+ AUTHOR......: David Rowe
+ DATE CREATED: 27/5/94
+
+ Finds the DFT of the current speech input speech frame.
+
+\*---------------------------------------------------------------------------*/
+
+void dft_speech(COMP Sw[], float Sn[], float w[])
+{
+ int i;
+
+ for(i=0; i<FFT_ENC; i++) {
+ Sw[i].real = 0.0;
+ Sw[i].imag = 0.0;
+ }
+
+ /* Centre analysis window on time axis, we need to arrange input
+ to FFT this way to make FFT phases correct */
+
+ /* move 2nd half to start of FFT input vector */
+
+ for(i=0; i<NW/2; i++)
+ Sw[i].real = Sn[i+M/2]*w[i+M/2];
+
+ /* move 1st half to end of FFT input vector */
+
+ for(i=0; i<NW/2; i++)
+ Sw[FFT_ENC-NW/2+i].real = Sn[i+M/2-NW/2]*w[i+M/2-NW/2];
+
+ four1(&Sw[-1].imag,FFT_ENC,-1);
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: two_stage_pitch_refinement
+ AUTHOR......: David Rowe
+ DATE CREATED: 27/5/94
+
+ Refines the current pitch estimate using the harmonic sum pitch
+ estimation technique.
+
+\*---------------------------------------------------------------------------*/
+
+void two_stage_pitch_refinement(MODEL *model, COMP Sw[])
+{
+ float pmin,pmax,pstep; /* pitch refinment minimum, maximum and step */
+
+ /* Coarse refinement */
+
+ pmax = TWO_PI/model->Wo + 5;
+ pmin = TWO_PI/model->Wo - 5;
+ pstep = 1.0;
+ hs_pitch_refinement(model,Sw,pmin,pmax,pstep);
+
+ /* Fine refinement */
+
+ pmax = TWO_PI/model->Wo + 1;
+ pmin = TWO_PI/model->Wo - 1;
+ pstep = 0.25;
+ hs_pitch_refinement(model,Sw,pmin,pmax,pstep);
+
+ /* Limit range */
+
+ if (model->Wo < TWO_PI/P_MAX)
+ model->Wo = TWO_PI/P_MAX;
+ if (model->Wo > TWO_PI/P_MIN)
+ model->Wo = TWO_PI/P_MIN;
+
+ model->L = floor(PI/model->Wo);
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: hs_pitch_refinement
+ AUTHOR......: David Rowe
+ DATE CREATED: 27/5/94
+
+ Harmonic sum pitch refinement function.
+
+ pmin pitch search range minimum
+ pmax pitch search range maximum
+ step pitch search step size
+ model current pitch estimate in model.Wo
+
+ model refined pitch estimate in model.Wo
+
+\*---------------------------------------------------------------------------*/
+
+void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, float pstep)
+{
+ int m; /* loop variable */
+ int b; /* bin for current harmonic centre */
+ float E; /* energy for current pitch*/
+ float Wo; /* current "test" fundamental freq. */
+ float Wom; /* Wo that maximises E */
+ float Em; /* mamimum energy */
+ float r; /* number of rads/bin */
+ float p; /* current pitch */
+
+ /* Initialisation */
+
+ model->L = PI/model->Wo; /* use initial pitch est. for L */
+ Wom = model->Wo;
+ Em = 0.0;
+ r = TWO_PI/FFT_ENC;
+
+ /* Determine harmonic sum for a range of Wo values */
+
+ for(p=pmin; p<=pmax; p+=pstep) {
+ E = 0.0;
+ Wo = TWO_PI/p;
+
+ /* Sum harmonic magnitudes */
+
+ for(m=1; m<=model->L; m++) {
+ b = floor(m*Wo/r + 0.5);
+ E += Sw[b].real*Sw[b].real + Sw[b].imag*Sw[b].imag;
+ }
+
+ /* Compare to see if this is a maximum */
+
+ if (E > Em) {
+ Em = E;
+ Wom = Wo;
+ }
+ }
+
+ model->Wo = Wom;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: estimate_amplitudes
+ AUTHOR......: David Rowe
+ DATE CREATED: 27/5/94
+
+ Estimates the complex amplitudes of the harmonics.
+
+\*---------------------------------------------------------------------------*/
+
+void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[])
+{
+ int i,m; /* loop variables */
+ int am,bm; /* bounds of current harmonic */
+ int b; /* DFT bin of centre of current harmonic */
+ float den; /* denominator of amplitude expression */
+ float r; /* number of rads/bin */
+ int offset;
+ COMP Am;
+
+ r = TWO_PI/FFT_ENC;
+
+ for(m=1; m<=model->L; m++) {
+ den = 0.0;
+ am = floor((m - 0.5)*model->Wo/r + 0.5);
+ bm = floor((m + 0.5)*model->Wo/r + 0.5);
+ b = floor(m*model->Wo/r + 0.5);
+
+ /* Estimate ampltude of harmonic */
+
+ den = 0.0;
+ Am.real = Am.imag = 0.0;
+ for(i=am; i<bm; i++) {
+ den += Sw[i].real*Sw[i].real + Sw[i].imag*Sw[i].imag;
+ offset = i + FFT_ENC/2 - floor(m*model->Wo/r + 0.5);
+ Am.real += Sw[i].real*W[offset].real;
+ Am.imag += Sw[i].imag*W[offset].real;
+ }
+
+ model->A[m] = sqrt(den);
+
+ /* Estimate phase of harmonic */
+
+ model->phi[m] = atan2(Sw[b].imag,Sw[b].real);
+ }
+}
+
+/*---------------------------------------------------------------------------*\
+
+ est_voicing_mbe()
+
+ Returns the error of the MBE cost function for a fiven F0.
+
+ Note: I think a lot of the operations below can be simplified as
+ W[].imag = 0 and has been normalised such that den always equals 1.
+
+\*---------------------------------------------------------------------------*/
+
+float est_voicing_mbe(
+ MODEL *model,
+ COMP Sw[],
+ COMP W[],
+ float f0,
+ COMP Sw_[] /* DFT of all voiced synthesised signal for f0 */
+ /* useful for debugging/dump file */
+)
+{
+ int i,l,al,bl,m; /* loop variables */
+ COMP Am; /* amplitude sample for this band */
+ int offset; /* centers Hw[] about current harmonic */
+ float den; /* denominator of Am expression */
+ float error; /* accumulated error between originl and synthesised */
+ float Wo; /* current "test" fundamental freq. */
+ int L;
+ float sig, snr;
+
+ sig = 0.0;
+ for(l=1; l<=model->L/4; l++) {
+ sig += model->A[l]*model->A[l];
+ }
+
+ for(i=0; i<FFT_ENC; i++) {
+ Sw_[i].real = 0.0;
+ Sw_[i].imag = 0.0;
+ }
+
+ L = floor((FS/2.0)/f0);
+ Wo = f0*(TWO_PI/FS);
+
+ error = 0.0;
+
+ /* Just test across the harmonics in the first 1000 Hz (L/4) */
+
+ for(l=1; l<=L/4; l++) {
+ Am.real = 0.0;
+ Am.imag = 0.0;
+ den = 0.0;
+ al = ceil((l - 0.5)*Wo*FFT_ENC/TWO_PI);
+ bl = ceil((l + 0.5)*Wo*FFT_ENC/TWO_PI);
+
+ /* Estimate amplitude of harmonic assuming harmonic is totally voiced */
+
+ for(m=al; m<bl; m++) {
+ offset = FFT_ENC/2 + m - l*Wo*FFT_ENC/TWO_PI + 0.5;
+ Am.real += Sw[m].real*W[offset].real + Sw[m].imag*W[offset].imag;
+ Am.imag += Sw[m].imag*W[offset].real - Sw[m].real*W[offset].imag;
+ den += W[offset].real*W[offset].real + W[offset].imag*W[offset].imag;
+ }
+
+ Am.real = Am.real/den;
+ Am.imag = Am.imag/den;
+
+ /* Determine error between estimated harmonic and original */
+
+ for(m=al; m<bl; m++) {
+ offset = FFT_ENC/2 + m - l*Wo*FFT_ENC/TWO_PI + 0.5;
+ Sw_[m].real = Am.real*W[offset].real - Am.imag*W[offset].imag;
+ Sw_[m].imag = Am.real*W[offset].imag + Am.imag*W[offset].real;
+ error += (Sw[m].real - Sw_[m].real)*(Sw[m].real - Sw_[m].real);
+ error += (Sw[m].imag - Sw_[m].imag)*(Sw[m].imag - Sw_[m].imag);
+ }
+ }
+
+ snr = 10.0*log10(sig/error);
+ if (snr > V_THRESH)
+ model->voiced = 1;
+ else
+ model->voiced = 0;
+
+ return snr;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: make_synthesis_window
+ AUTHOR......: David Rowe
+ DATE CREATED: 11/5/94
+
+ Init function that generates the trapezoidal (Parzen) sythesis window.
+
+\*---------------------------------------------------------------------------*/
+
+void make_synthesis_window(float Pn[])
+{
+ int i;
+ float win;
+
+ /* Generate Parzen window in time domain */
+
+ win = 0.0;
+ for(i=0; i<N/2-TW; i++)
+ Pn[i] = 0.0;
+ win = 0.0;
+ for(i=N/2-TW; i<N/2+TW; win+=1.0/(2*TW), i++ )
+ Pn[i] = win;
+ for(i=N/2+TW; i<3*N/2-TW; i++)
+ Pn[i] = 1.0;
+ win = 1.0;
+ for(i=3*N/2-TW; i<3*N/2+TW; win-=1.0/(2*TW), i++)
+ Pn[i] = win;
+ for(i=3*N/2+TW; i<2*N; i++)
+ Pn[i] = 0.0;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: synthesise
+ AUTHOR......: David Rowe
+ DATE CREATED: 20/2/95
+
+ Synthesise a speech signal in the frequency domain from the
+ sinusodal model parameters. Uses overlap-add a triangular window to
+ smoothly interpolate betwen frames.
+
+\*---------------------------------------------------------------------------*/
+
+void synthesise(
+ float Sn_[], /* time domain synthesised signal */
+ MODEL *model, /* ptr to model parameters for this frame */
+ float Pn[], /* time domain Parzen window */
+ int shift /* used to handle transition frames */
+)
+{
+ int i,l,j,b; /* loop variables */
+ COMP Sw_[FFT_DEC]; /* DFT of synthesised signal */
+
+ if (shift) {
+ /* Update memories */
+
+ for(i=0; i<N-1; i++) {
+ Sn_[i] = Sn_[i+N];
+ }
+ Sn_[N-1] = 0.0;
+ }
+
+ for(i=0; i<FFT_DEC; i++) {
+ Sw_[i].real = 0.0;
+ Sw_[i].imag = 0.0;
+ }
+
+ /* Now set up frequency domain synthesised speech */
+
+ for(l=1; l<=model->L; l++) {
+ b = floor(l*model->Wo*FFT_DEC/TWO_PI + 0.5);
+ Sw_[b].real = model->A[l]*cos(model->phi[l]);
+ Sw_[b].imag = model->A[l]*sin(model->phi[l]);
+ Sw_[FFT_DEC-b].real = Sw_[b].real;
+ Sw_[FFT_DEC-b].imag = -Sw_[b].imag;
+ }
+
+ /* Perform inverse DFT */
+
+ four1(&Sw_[-1].imag,FFT_DEC,1);
+
+ /* Overlap add to previous samples */
+
+ for(i=0; i<N-1; i++) {
+ Sn_[i] += Sw_[FFT_DEC-N+1+i].real*Pn[i];
+ }
+
+ if (shift)
+ for(i=N-1,j=0; i<2*N; i++,j++)
+ Sn_[i] = Sw_[j].real*Pn[i];
+ else
+ for(i=N-1,j=0; i<2*N; i++,j++)
+ Sn_[i] += Sw_[j].real*Pn[i];
+}
+
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: sine.h
+ AUTHOR......: David Rowe
+ DATE CREATED: 1/11/94
+
+ Header file for sinusoidal analysis and synthesis functions.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2.1, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __SINE__
+#define __SINE__
+
+void make_analysis_window(float w[], COMP W[]);
+void dft_speech(COMP Sw[], float Sn[], float w[]);
+void two_stage_pitch_refinement(MODEL *model, COMP Sw[]);
+void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[]);
+float est_voicing_mbe(MODEL *model, COMP Sw[], COMP W[], float f0, COMP Sw_[]);
+void make_synthesis_window(float Pn[]);
+void synthesise(float Sn_[], MODEL *model, float Pn[], int shift);
+
+#endif
--- /dev/null
+AM_CFLAGS = -I../src -g -DFLOATING_POINT -DVAR_ARRAYS
+AUTOMAKE_OPTS = gnu
+NAME = libcodec2
+AM_CPPFLAGS = $(AM_CFLAGS)
+
+bin_PROGRAMS = genres genlsp extract vqtrain tnlp tinterp tquant tcodec2
+
+
+genres_SOURCES = genres.c ../src/lpc.c ../src/codebook.c
+genres_LDADD = $(lib_LTLIBRARIES)
+genres_LDFLAGS = $(LIBS)
+
+genlsp_SOURCES = genlsp.c ../src/lpc.c ../src/lsp.c ../src/codebook.c
+genlsp_LDADD = $(lib_LTLIBRARIES)
+genlsp_LDFLAGS = $(LIBS)
+
+extract_SOURCES = extract.c ../src/codebook.c
+extract_LDADD = $(lib_LTLIBRARIES)
+extract_LDFLAGS = $(LIBS)
+
+vqtrain_SOURCES = vqtrain.c ../src/codebook.c
+vqtrain_LDADD = $(lib_LTLIBRARIES)
+vqtrain_LDFLAGS = $(LIBS)
+
+tnlp_SOURCES = tnlp.c ../src/sine.c ../src/nlp.c ../src/four1.c ../src/dump.c ../src/codebook.c
+tnlp_LDADD = $(lib_LTLIBRARIES)
+tnlp_LDFLAGS = $(LIBS)
+
+tinterp_SOURCES = tinterp.c ../src/sine.c ../src/four1.c ../src/interp.c ../src/codebook.c
+tinterp_LDADD = $(lib_LTLIBRARIES)
+tinterp_LDFLAGS = $(LIBS)
+
+tquant_SOURCES = tquant.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/four1.c ../src/codebook.c
+tquant_LDADD = $(lib_LTLIBRARIES)
+tquant_LDFLAGS = $(LIBS)
+
+tcodec2_SOURCES = tcodec2.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/four1.c \
+../src/codec2.c ../src/sine.c ../src/nlp.c ../src/postfilter.c ../src/phase.c ../src/interp.c ../src/pack.c ../src/codebook.c
+tcodec2_LDADD = $(lib_LTLIBRARIES)
+tcodec2_LDFLAGS = $(LIBS)
+
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = genres$(EXEEXT) genlsp$(EXEEXT) extract$(EXEEXT) \
+ vqtrain$(EXEEXT) tnlp$(EXEEXT) tinterp$(EXEEXT) \
+ tquant$(EXEEXT) tcodec2$(EXEEXT)
+subdir = unittest
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_extract_OBJECTS = extract.$(OBJEXT) codebook.$(OBJEXT)
+extract_OBJECTS = $(am_extract_OBJECTS)
+extract_DEPENDENCIES =
+am_genlsp_OBJECTS = genlsp.$(OBJEXT) lpc.$(OBJEXT) lsp.$(OBJEXT) \
+ codebook.$(OBJEXT)
+genlsp_OBJECTS = $(am_genlsp_OBJECTS)
+genlsp_DEPENDENCIES =
+am_genres_OBJECTS = genres.$(OBJEXT) lpc.$(OBJEXT) codebook.$(OBJEXT)
+genres_OBJECTS = $(am_genres_OBJECTS)
+genres_DEPENDENCIES =
+am_tcodec2_OBJECTS = tcodec2.$(OBJEXT) quantise.$(OBJEXT) \
+ lpc.$(OBJEXT) lsp.$(OBJEXT) dump.$(OBJEXT) four1.$(OBJEXT) \
+ codec2.$(OBJEXT) sine.$(OBJEXT) nlp.$(OBJEXT) \
+ postfilter.$(OBJEXT) phase.$(OBJEXT) interp.$(OBJEXT) \
+ pack.$(OBJEXT) codebook.$(OBJEXT)
+tcodec2_OBJECTS = $(am_tcodec2_OBJECTS)
+tcodec2_DEPENDENCIES =
+am_tinterp_OBJECTS = tinterp.$(OBJEXT) sine.$(OBJEXT) four1.$(OBJEXT) \
+ interp.$(OBJEXT) codebook.$(OBJEXT)
+tinterp_OBJECTS = $(am_tinterp_OBJECTS)
+tinterp_DEPENDENCIES =
+am_tnlp_OBJECTS = tnlp.$(OBJEXT) sine.$(OBJEXT) nlp.$(OBJEXT) \
+ four1.$(OBJEXT) dump.$(OBJEXT) codebook.$(OBJEXT)
+tnlp_OBJECTS = $(am_tnlp_OBJECTS)
+tnlp_DEPENDENCIES =
+am_tquant_OBJECTS = tquant.$(OBJEXT) quantise.$(OBJEXT) lpc.$(OBJEXT) \
+ lsp.$(OBJEXT) dump.$(OBJEXT) four1.$(OBJEXT) \
+ codebook.$(OBJEXT)
+tquant_OBJECTS = $(am_tquant_OBJECTS)
+tquant_DEPENDENCIES =
+am_vqtrain_OBJECTS = vqtrain.$(OBJEXT) codebook.$(OBJEXT)
+vqtrain_OBJECTS = $(am_vqtrain_OBJECTS)
+vqtrain_DEPENDENCIES =
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(extract_SOURCES) $(genlsp_SOURCES) $(genres_SOURCES) \
+ $(tcodec2_SOURCES) $(tinterp_SOURCES) $(tnlp_SOURCES) \
+ $(tquant_SOURCES) $(vqtrain_SOURCES)
+DIST_SOURCES = $(extract_SOURCES) $(genlsp_SOURCES) $(genres_SOURCES) \
+ $(tcodec2_SOURCES) $(tinterp_SOURCES) $(tnlp_SOURCES) \
+ $(tquant_SOURCES) $(vqtrain_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AM_CFLAGS = -I../src -g -DFLOATING_POINT -DVAR_ARRAYS
+AUTOMAKE_OPTS = gnu
+NAME = libcodec2
+AM_CPPFLAGS = $(AM_CFLAGS)
+genres_SOURCES = genres.c ../src/lpc.c ../src/codebook.c
+genres_LDADD = $(lib_LTLIBRARIES)
+genres_LDFLAGS = $(LIBS)
+genlsp_SOURCES = genlsp.c ../src/lpc.c ../src/lsp.c ../src/codebook.c
+genlsp_LDADD = $(lib_LTLIBRARIES)
+genlsp_LDFLAGS = $(LIBS)
+extract_SOURCES = extract.c ../src/codebook.c
+extract_LDADD = $(lib_LTLIBRARIES)
+extract_LDFLAGS = $(LIBS)
+vqtrain_SOURCES = vqtrain.c ../src/codebook.c
+vqtrain_LDADD = $(lib_LTLIBRARIES)
+vqtrain_LDFLAGS = $(LIBS)
+tnlp_SOURCES = tnlp.c ../src/sine.c ../src/nlp.c ../src/four1.c ../src/dump.c ../src/codebook.c
+tnlp_LDADD = $(lib_LTLIBRARIES)
+tnlp_LDFLAGS = $(LIBS)
+tinterp_SOURCES = tinterp.c ../src/sine.c ../src/four1.c ../src/interp.c ../src/codebook.c
+tinterp_LDADD = $(lib_LTLIBRARIES)
+tinterp_LDFLAGS = $(LIBS)
+tquant_SOURCES = tquant.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/four1.c ../src/codebook.c
+tquant_LDADD = $(lib_LTLIBRARIES)
+tquant_LDFLAGS = $(LIBS)
+tcodec2_SOURCES = tcodec2.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/four1.c \
+../src/codec2.c ../src/sine.c ../src/nlp.c ../src/postfilter.c ../src/phase.c ../src/interp.c ../src/pack.c ../src/codebook.c
+
+tcodec2_LDADD = $(lib_LTLIBRARIES)
+tcodec2_LDFLAGS = $(LIBS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu unittest/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu unittest/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+extract$(EXEEXT): $(extract_OBJECTS) $(extract_DEPENDENCIES)
+ @rm -f extract$(EXEEXT)
+ $(LINK) $(extract_LDFLAGS) $(extract_OBJECTS) $(extract_LDADD) $(LIBS)
+genlsp$(EXEEXT): $(genlsp_OBJECTS) $(genlsp_DEPENDENCIES)
+ @rm -f genlsp$(EXEEXT)
+ $(LINK) $(genlsp_LDFLAGS) $(genlsp_OBJECTS) $(genlsp_LDADD) $(LIBS)
+genres$(EXEEXT): $(genres_OBJECTS) $(genres_DEPENDENCIES)
+ @rm -f genres$(EXEEXT)
+ $(LINK) $(genres_LDFLAGS) $(genres_OBJECTS) $(genres_LDADD) $(LIBS)
+tcodec2$(EXEEXT): $(tcodec2_OBJECTS) $(tcodec2_DEPENDENCIES)
+ @rm -f tcodec2$(EXEEXT)
+ $(LINK) $(tcodec2_LDFLAGS) $(tcodec2_OBJECTS) $(tcodec2_LDADD) $(LIBS)
+tinterp$(EXEEXT): $(tinterp_OBJECTS) $(tinterp_DEPENDENCIES)
+ @rm -f tinterp$(EXEEXT)
+ $(LINK) $(tinterp_LDFLAGS) $(tinterp_OBJECTS) $(tinterp_LDADD) $(LIBS)
+tnlp$(EXEEXT): $(tnlp_OBJECTS) $(tnlp_DEPENDENCIES)
+ @rm -f tnlp$(EXEEXT)
+ $(LINK) $(tnlp_LDFLAGS) $(tnlp_OBJECTS) $(tnlp_LDADD) $(LIBS)
+tquant$(EXEEXT): $(tquant_OBJECTS) $(tquant_DEPENDENCIES)
+ @rm -f tquant$(EXEEXT)
+ $(LINK) $(tquant_LDFLAGS) $(tquant_OBJECTS) $(tquant_LDADD) $(LIBS)
+vqtrain$(EXEEXT): $(vqtrain_OBJECTS) $(vqtrain_DEPENDENCIES)
+ @rm -f vqtrain$(EXEEXT)
+ $(LINK) $(vqtrain_LDFLAGS) $(vqtrain_OBJECTS) $(vqtrain_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/codebook.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/codec2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extract.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/four1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genlsp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genres.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/phase.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/postfilter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quantise.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sine.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcodec2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinterp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnlp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tquant.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vqtrain.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+codebook.o: ../src/codebook.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codebook.o -MD -MP -MF "$(DEPDIR)/codebook.Tpo" -c -o codebook.o `test -f '../src/codebook.c' || echo '$(srcdir)/'`../src/codebook.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/codebook.Tpo" "$(DEPDIR)/codebook.Po"; else rm -f "$(DEPDIR)/codebook.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/codebook.c' object='codebook.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codebook.o `test -f '../src/codebook.c' || echo '$(srcdir)/'`../src/codebook.c
+
+codebook.obj: ../src/codebook.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codebook.obj -MD -MP -MF "$(DEPDIR)/codebook.Tpo" -c -o codebook.obj `if test -f '../src/codebook.c'; then $(CYGPATH_W) '../src/codebook.c'; else $(CYGPATH_W) '$(srcdir)/../src/codebook.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/codebook.Tpo" "$(DEPDIR)/codebook.Po"; else rm -f "$(DEPDIR)/codebook.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/codebook.c' object='codebook.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codebook.obj `if test -f '../src/codebook.c'; then $(CYGPATH_W) '../src/codebook.c'; else $(CYGPATH_W) '$(srcdir)/../src/codebook.c'; fi`
+
+lpc.o: ../src/lpc.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lpc.o -MD -MP -MF "$(DEPDIR)/lpc.Tpo" -c -o lpc.o `test -f '../src/lpc.c' || echo '$(srcdir)/'`../src/lpc.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lpc.Tpo" "$(DEPDIR)/lpc.Po"; else rm -f "$(DEPDIR)/lpc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/lpc.c' object='lpc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lpc.o `test -f '../src/lpc.c' || echo '$(srcdir)/'`../src/lpc.c
+
+lpc.obj: ../src/lpc.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lpc.obj -MD -MP -MF "$(DEPDIR)/lpc.Tpo" -c -o lpc.obj `if test -f '../src/lpc.c'; then $(CYGPATH_W) '../src/lpc.c'; else $(CYGPATH_W) '$(srcdir)/../src/lpc.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lpc.Tpo" "$(DEPDIR)/lpc.Po"; else rm -f "$(DEPDIR)/lpc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/lpc.c' object='lpc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lpc.obj `if test -f '../src/lpc.c'; then $(CYGPATH_W) '../src/lpc.c'; else $(CYGPATH_W) '$(srcdir)/../src/lpc.c'; fi`
+
+lsp.o: ../src/lsp.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsp.o -MD -MP -MF "$(DEPDIR)/lsp.Tpo" -c -o lsp.o `test -f '../src/lsp.c' || echo '$(srcdir)/'`../src/lsp.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lsp.Tpo" "$(DEPDIR)/lsp.Po"; else rm -f "$(DEPDIR)/lsp.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/lsp.c' object='lsp.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsp.o `test -f '../src/lsp.c' || echo '$(srcdir)/'`../src/lsp.c
+
+lsp.obj: ../src/lsp.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsp.obj -MD -MP -MF "$(DEPDIR)/lsp.Tpo" -c -o lsp.obj `if test -f '../src/lsp.c'; then $(CYGPATH_W) '../src/lsp.c'; else $(CYGPATH_W) '$(srcdir)/../src/lsp.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lsp.Tpo" "$(DEPDIR)/lsp.Po"; else rm -f "$(DEPDIR)/lsp.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/lsp.c' object='lsp.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsp.obj `if test -f '../src/lsp.c'; then $(CYGPATH_W) '../src/lsp.c'; else $(CYGPATH_W) '$(srcdir)/../src/lsp.c'; fi`
+
+quantise.o: ../src/quantise.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT quantise.o -MD -MP -MF "$(DEPDIR)/quantise.Tpo" -c -o quantise.o `test -f '../src/quantise.c' || echo '$(srcdir)/'`../src/quantise.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/quantise.Tpo" "$(DEPDIR)/quantise.Po"; else rm -f "$(DEPDIR)/quantise.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/quantise.c' object='quantise.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o quantise.o `test -f '../src/quantise.c' || echo '$(srcdir)/'`../src/quantise.c
+
+quantise.obj: ../src/quantise.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT quantise.obj -MD -MP -MF "$(DEPDIR)/quantise.Tpo" -c -o quantise.obj `if test -f '../src/quantise.c'; then $(CYGPATH_W) '../src/quantise.c'; else $(CYGPATH_W) '$(srcdir)/../src/quantise.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/quantise.Tpo" "$(DEPDIR)/quantise.Po"; else rm -f "$(DEPDIR)/quantise.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/quantise.c' object='quantise.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o quantise.obj `if test -f '../src/quantise.c'; then $(CYGPATH_W) '../src/quantise.c'; else $(CYGPATH_W) '$(srcdir)/../src/quantise.c'; fi`
+
+dump.o: ../src/dump.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dump.o -MD -MP -MF "$(DEPDIR)/dump.Tpo" -c -o dump.o `test -f '../src/dump.c' || echo '$(srcdir)/'`../src/dump.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dump.Tpo" "$(DEPDIR)/dump.Po"; else rm -f "$(DEPDIR)/dump.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/dump.c' object='dump.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dump.o `test -f '../src/dump.c' || echo '$(srcdir)/'`../src/dump.c
+
+dump.obj: ../src/dump.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dump.obj -MD -MP -MF "$(DEPDIR)/dump.Tpo" -c -o dump.obj `if test -f '../src/dump.c'; then $(CYGPATH_W) '../src/dump.c'; else $(CYGPATH_W) '$(srcdir)/../src/dump.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dump.Tpo" "$(DEPDIR)/dump.Po"; else rm -f "$(DEPDIR)/dump.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/dump.c' object='dump.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dump.obj `if test -f '../src/dump.c'; then $(CYGPATH_W) '../src/dump.c'; else $(CYGPATH_W) '$(srcdir)/../src/dump.c'; fi`
+
+four1.o: ../src/four1.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT four1.o -MD -MP -MF "$(DEPDIR)/four1.Tpo" -c -o four1.o `test -f '../src/four1.c' || echo '$(srcdir)/'`../src/four1.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/four1.Tpo" "$(DEPDIR)/four1.Po"; else rm -f "$(DEPDIR)/four1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/four1.c' object='four1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o four1.o `test -f '../src/four1.c' || echo '$(srcdir)/'`../src/four1.c
+
+four1.obj: ../src/four1.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT four1.obj -MD -MP -MF "$(DEPDIR)/four1.Tpo" -c -o four1.obj `if test -f '../src/four1.c'; then $(CYGPATH_W) '../src/four1.c'; else $(CYGPATH_W) '$(srcdir)/../src/four1.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/four1.Tpo" "$(DEPDIR)/four1.Po"; else rm -f "$(DEPDIR)/four1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/four1.c' object='four1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o four1.obj `if test -f '../src/four1.c'; then $(CYGPATH_W) '../src/four1.c'; else $(CYGPATH_W) '$(srcdir)/../src/four1.c'; fi`
+
+codec2.o: ../src/codec2.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codec2.o -MD -MP -MF "$(DEPDIR)/codec2.Tpo" -c -o codec2.o `test -f '../src/codec2.c' || echo '$(srcdir)/'`../src/codec2.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/codec2.Tpo" "$(DEPDIR)/codec2.Po"; else rm -f "$(DEPDIR)/codec2.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/codec2.c' object='codec2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codec2.o `test -f '../src/codec2.c' || echo '$(srcdir)/'`../src/codec2.c
+
+codec2.obj: ../src/codec2.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codec2.obj -MD -MP -MF "$(DEPDIR)/codec2.Tpo" -c -o codec2.obj `if test -f '../src/codec2.c'; then $(CYGPATH_W) '../src/codec2.c'; else $(CYGPATH_W) '$(srcdir)/../src/codec2.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/codec2.Tpo" "$(DEPDIR)/codec2.Po"; else rm -f "$(DEPDIR)/codec2.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/codec2.c' object='codec2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codec2.obj `if test -f '../src/codec2.c'; then $(CYGPATH_W) '../src/codec2.c'; else $(CYGPATH_W) '$(srcdir)/../src/codec2.c'; fi`
+
+sine.o: ../src/sine.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sine.o -MD -MP -MF "$(DEPDIR)/sine.Tpo" -c -o sine.o `test -f '../src/sine.c' || echo '$(srcdir)/'`../src/sine.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sine.Tpo" "$(DEPDIR)/sine.Po"; else rm -f "$(DEPDIR)/sine.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/sine.c' object='sine.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sine.o `test -f '../src/sine.c' || echo '$(srcdir)/'`../src/sine.c
+
+sine.obj: ../src/sine.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sine.obj -MD -MP -MF "$(DEPDIR)/sine.Tpo" -c -o sine.obj `if test -f '../src/sine.c'; then $(CYGPATH_W) '../src/sine.c'; else $(CYGPATH_W) '$(srcdir)/../src/sine.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sine.Tpo" "$(DEPDIR)/sine.Po"; else rm -f "$(DEPDIR)/sine.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/sine.c' object='sine.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sine.obj `if test -f '../src/sine.c'; then $(CYGPATH_W) '../src/sine.c'; else $(CYGPATH_W) '$(srcdir)/../src/sine.c'; fi`
+
+nlp.o: ../src/nlp.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nlp.o -MD -MP -MF "$(DEPDIR)/nlp.Tpo" -c -o nlp.o `test -f '../src/nlp.c' || echo '$(srcdir)/'`../src/nlp.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/nlp.Tpo" "$(DEPDIR)/nlp.Po"; else rm -f "$(DEPDIR)/nlp.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/nlp.c' object='nlp.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nlp.o `test -f '../src/nlp.c' || echo '$(srcdir)/'`../src/nlp.c
+
+nlp.obj: ../src/nlp.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nlp.obj -MD -MP -MF "$(DEPDIR)/nlp.Tpo" -c -o nlp.obj `if test -f '../src/nlp.c'; then $(CYGPATH_W) '../src/nlp.c'; else $(CYGPATH_W) '$(srcdir)/../src/nlp.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/nlp.Tpo" "$(DEPDIR)/nlp.Po"; else rm -f "$(DEPDIR)/nlp.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/nlp.c' object='nlp.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nlp.obj `if test -f '../src/nlp.c'; then $(CYGPATH_W) '../src/nlp.c'; else $(CYGPATH_W) '$(srcdir)/../src/nlp.c'; fi`
+
+postfilter.o: ../src/postfilter.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT postfilter.o -MD -MP -MF "$(DEPDIR)/postfilter.Tpo" -c -o postfilter.o `test -f '../src/postfilter.c' || echo '$(srcdir)/'`../src/postfilter.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/postfilter.Tpo" "$(DEPDIR)/postfilter.Po"; else rm -f "$(DEPDIR)/postfilter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/postfilter.c' object='postfilter.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o postfilter.o `test -f '../src/postfilter.c' || echo '$(srcdir)/'`../src/postfilter.c
+
+postfilter.obj: ../src/postfilter.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT postfilter.obj -MD -MP -MF "$(DEPDIR)/postfilter.Tpo" -c -o postfilter.obj `if test -f '../src/postfilter.c'; then $(CYGPATH_W) '../src/postfilter.c'; else $(CYGPATH_W) '$(srcdir)/../src/postfilter.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/postfilter.Tpo" "$(DEPDIR)/postfilter.Po"; else rm -f "$(DEPDIR)/postfilter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/postfilter.c' object='postfilter.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o postfilter.obj `if test -f '../src/postfilter.c'; then $(CYGPATH_W) '../src/postfilter.c'; else $(CYGPATH_W) '$(srcdir)/../src/postfilter.c'; fi`
+
+phase.o: ../src/phase.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phase.o -MD -MP -MF "$(DEPDIR)/phase.Tpo" -c -o phase.o `test -f '../src/phase.c' || echo '$(srcdir)/'`../src/phase.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/phase.Tpo" "$(DEPDIR)/phase.Po"; else rm -f "$(DEPDIR)/phase.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/phase.c' object='phase.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phase.o `test -f '../src/phase.c' || echo '$(srcdir)/'`../src/phase.c
+
+phase.obj: ../src/phase.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phase.obj -MD -MP -MF "$(DEPDIR)/phase.Tpo" -c -o phase.obj `if test -f '../src/phase.c'; then $(CYGPATH_W) '../src/phase.c'; else $(CYGPATH_W) '$(srcdir)/../src/phase.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/phase.Tpo" "$(DEPDIR)/phase.Po"; else rm -f "$(DEPDIR)/phase.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/phase.c' object='phase.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phase.obj `if test -f '../src/phase.c'; then $(CYGPATH_W) '../src/phase.c'; else $(CYGPATH_W) '$(srcdir)/../src/phase.c'; fi`
+
+interp.o: ../src/interp.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT interp.o -MD -MP -MF "$(DEPDIR)/interp.Tpo" -c -o interp.o `test -f '../src/interp.c' || echo '$(srcdir)/'`../src/interp.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/interp.Tpo" "$(DEPDIR)/interp.Po"; else rm -f "$(DEPDIR)/interp.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/interp.c' object='interp.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o interp.o `test -f '../src/interp.c' || echo '$(srcdir)/'`../src/interp.c
+
+interp.obj: ../src/interp.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT interp.obj -MD -MP -MF "$(DEPDIR)/interp.Tpo" -c -o interp.obj `if test -f '../src/interp.c'; then $(CYGPATH_W) '../src/interp.c'; else $(CYGPATH_W) '$(srcdir)/../src/interp.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/interp.Tpo" "$(DEPDIR)/interp.Po"; else rm -f "$(DEPDIR)/interp.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/interp.c' object='interp.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o interp.obj `if test -f '../src/interp.c'; then $(CYGPATH_W) '../src/interp.c'; else $(CYGPATH_W) '$(srcdir)/../src/interp.c'; fi`
+
+pack.o: ../src/pack.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pack.o -MD -MP -MF "$(DEPDIR)/pack.Tpo" -c -o pack.o `test -f '../src/pack.c' || echo '$(srcdir)/'`../src/pack.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pack.Tpo" "$(DEPDIR)/pack.Po"; else rm -f "$(DEPDIR)/pack.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/pack.c' object='pack.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pack.o `test -f '../src/pack.c' || echo '$(srcdir)/'`../src/pack.c
+
+pack.obj: ../src/pack.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pack.obj -MD -MP -MF "$(DEPDIR)/pack.Tpo" -c -o pack.obj `if test -f '../src/pack.c'; then $(CYGPATH_W) '../src/pack.c'; else $(CYGPATH_W) '$(srcdir)/../src/pack.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pack.Tpo" "$(DEPDIR)/pack.Po"; else rm -f "$(DEPDIR)/pack.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/pack.c' object='pack.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pack.obj `if test -f '../src/pack.c'; then $(CYGPATH_W) '../src/pack.c'; else $(CYGPATH_W) '$(srcdir)/../src/pack.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- /dev/null
+/*--------------------------------------------------------------------------*\
+
+ FILE........: extract.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/2/95
+
+ This program extracts a float file of vectors from a text file
+ of vectors. The float files are easier to process quickly
+ during VQ training. A subset of the text file VQ may be
+ extracted to faciltate split VQ of scaler VQ design.
+
+\*--------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#define MAX_STR 256 /* maximum string length */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+void scan_line(FILE *fp, float f[], int n);
+
+int main(int argc, char *argv[]) {
+ FILE *ftext; /* text file of vectors */
+ FILE *ffloat; /* float file of vectors */
+ int st,en; /* start and end values of vector to copy */
+ float *buf; /* ptr to vector read from ftext */
+ long lines; /* lines read so far */
+
+ if (argc != 5) {
+ printf("usage: extract TextFile FloatFile start end\n");
+ exit(0);
+ }
+
+ /* read command line arguments and open files */
+
+ ftext = fopen(argv[1],"rt");
+ if (ftext == NULL) {
+ printf("Error opening text file: %s\n",argv[1]);
+ exit(1);
+ }
+
+ ffloat = fopen(argv[2],"wb");
+ if (ffloat == NULL) {
+ printf("Error opening float file: %s\n",argv[2]);
+ exit(1);
+ }
+
+ st = atoi(argv[3]);
+ en = atoi(argv[4]);
+
+ buf = (float*)malloc(en*sizeof(float));
+ if (buf == NULL) {
+ printf("Error in malloc()\n");
+ exit(1);
+ }
+
+ lines = 0;
+ while(!feof(ftext)) {
+ scan_line(ftext, buf, en);
+ fwrite(&buf[st-1], sizeof(float), en-st+1, ffloat);
+ printf("\r%ld lines",lines++);
+ }
+ printf("\n");
+
+ /* clean up and exit */
+
+ free(buf);
+ fclose(ftext);
+ fclose(ffloat);
+
+ return 0;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: scan_line()
+
+ AUTHOR......: David Rowe
+ DATE CREATED: 20/2/95
+
+ This function reads a vector of floats from a line in a text file.
+
+\*---------------------------------------------------------------------------*/
+
+void scan_line(FILE *fp, float f[], int n)
+/* FILE *fp; file ptr to text file */
+/* float f[]; array of floats to return */
+/* int n; number of floats in line */
+{
+ char s[MAX_STR];
+ char *ps,*pe;
+ int i;
+
+ fgets(s,MAX_STR,fp);
+ ps = pe = s;
+ for(i=0; i<n; i++) {
+ while( isspace(*pe)) pe++;
+ while( !isspace(*pe)) pe++;
+ sscanf(ps,"%f",&f[i]);
+ ps = pe;
+ }
+}
+
--- /dev/null
+/*--------------------------------------------------------------------------*\
+
+ FILE........: genlsp.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/2/95
+
+ This program genrates a text file of LSP vectors from an input
+ speech file.
+
+\*--------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#define P 10 /* LP order */
+#define LSP_DELTA1 0.05 /* grid spacing for LSP root searches */
+#define NW 279 /* frame size in samples */
+#define N 80 /* frame to frame shift */
+#define THRESH 40.0 /* threshold energy/sample for frame inclusion */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "lpc.h" /* LPC analysis functions */
+#include "lsp.h" /* LSP encode/decode functions */
+
+int switch_present(sw,argc,argv)
+ char sw[]; /* switch in string form */
+ int argc; /* number of command line arguments */
+ char *argv[]; /* array of command line arguments in string form */
+{
+ int i; /* loop variable */
+
+ for(i=1; i<argc; i++)
+ if (!strcmp(sw,argv[i]))
+ return(i);
+
+ return 0;
+}
+
+int main(int argc, char *argv[]) {
+ FILE *fspc; /* input file ptr for test database */
+ FILE *flsp; /* output text file of LSPs */
+ short buf[N]; /* input frame of speech samples */
+ float Sn[NW]; /* float input speech samples */
+ float ak[P+1]; /* LPCs for current frame */
+ float lsp[P]; /* LSPs for current frame */
+ float E; /* frame energy */
+ long af; /* number frames with "active" speech */
+ float Eres; /* LPC residual energy */
+ int i;
+ int roots;
+ int unstables;
+ int lspd;
+
+ /* Initialise ------------------------------------------------------*/
+
+ if (argc < 3) {
+ printf("usage: gentest RawFile LSPTextFile [--lspd]\n");
+ exit(0);
+ }
+
+ /* Open files */
+
+ fspc = fopen(argv[1],"rb");
+ if (fspc == NULL) {
+ printf("Error opening input SPC file: %s",argv[1]);
+ exit(1);
+ }
+
+ flsp = fopen(argv[2],"wt");
+ if (flsp == NULL) {
+ printf("Error opening output LSP file: %s",argv[2]);
+ exit(1);
+ }
+
+ lspd = switch_present("--lspd", argc, argv);
+
+ for(i=0; i<NW; i++)
+ Sn[i] = 0.0;
+
+ /* Read SPC file, and determine aks[] for each frame ------------------*/
+
+ af = 0;
+ unstables = 0;
+ while(fread(buf,sizeof(short),N,fspc) == N) {
+
+ for(i=0; i<NW-N; i++)
+ Sn[i] = Sn[i+N];
+ E = 0.0;
+ for(i=0; i<N; i++) {
+ Sn[i+NW-N] = buf[i];
+ E += Sn[i]*Sn[i];
+ }
+
+ E = 0.0;
+ for(i=0; i<NW; i++) {
+ E += Sn[i]*Sn[i];
+ }
+ E = 10.0*log10(E/NW);
+
+ /* If energy high enough, include this frame */
+
+ if (E > THRESH) {
+ af++;
+ printf("Active Frame: %ld unstables: %d\n",af, unstables);
+
+ find_aks(Sn, ak, NW, P, &Eres);
+ roots = lpc_to_lsp(&ak[1], P , lsp, 5, LSP_DELTA1);
+ if (roots == P) {
+ if (lspd) {
+ fprintf(flsp,"%f ",lsp[0]);
+ for(i=1; i<P; i++)
+ fprintf(flsp,"%f ",lsp[i]-lsp[i-1]);
+ fprintf(flsp,"\n");
+ }
+ else {
+ for(i=0; i<P; i++)
+ fprintf(flsp,"%f ",lsp[i]);
+ fprintf(flsp,"\n");
+ }
+ }
+ else
+ unstables++;
+ }
+ }
+
+ fclose(fspc);
+ fclose(flsp);
+
+ return 0;
+}
+
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: genres.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 24/8/09
+
+ Generates a file of LPC residual samples from original speech.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <lpc.h>
+
+#define N 160
+#define P 10
+
+int main(int argc, char *argv[])
+{
+ FILE *fin,*fres; /* input and output files */
+ short buf[N]; /* buffer of 16 bit speech samples */
+ float Sn[P+N]; /* input speech samples */
+ float res[N]; /* residual after LPC filtering */
+ float E;
+ float ak[P+1]; /* LP coeffs */
+
+ int frames; /* frames processed so far */
+ int i; /* loop variables */
+
+ if (argc < 3) {
+ printf("usage: %s InputFile ResidualFile\n", argv[0]);
+ exit(0);
+ }
+
+ /* Open files */
+
+ if ((fin = fopen(argv[1],"rb")) == NULL) {
+ printf("Error opening input file: %s\n",argv[1]);
+ exit(0);
+ }
+
+ if ((fres = fopen(argv[2],"wb")) == NULL) {
+ printf("Error opening output residual file: %s\n",argv[2]);
+ exit(0);
+ }
+
+ /* Initialise */
+
+ frames = 0;
+ for(i=0; i<P; i++) {
+ Sn[i] = 0.0;
+ }
+
+ /* Main loop */
+
+ while( (fread(buf,sizeof(short),N,fin)) == N) {
+ frames++;
+ for(i=0; i<N; i++)
+ Sn[P+i] = (float)buf[i];
+
+ /* Determine {ak} and filter to find residual */
+
+ find_aks(&Sn[P], ak, N, P, &E);
+ inverse_filter(&Sn[P], ak, N, res, P);
+ for(i=0; i<N; i++)
+ buf[i] = (short)res[i];
+ fwrite(buf,sizeof(short),N,fres);
+ }
+
+ fclose(fin);
+ fclose(fres);
+
+ return 0;
+}
--- /dev/null
+225
+250
+275
+300
+325
+350
+375
+400
+425
+450
+475
+500
+525
+550
+575
+600
--- /dev/null
+2900
+3100
+3300
+3500
+
--- /dev/null
+325
+350
+375
+400
+425
+450
+475
+500
+525
+550
+575
+600
+625
+650
+675
+700
--- /dev/null
+500
+550
+600
+650
+700
+750
+800
+850
+900
+950
+1000
+1050
+1100
+1150
+1200
+1250
--- /dev/null
+700
+800
+900
+1000
+1100
+1200
+1300
+1400
+1500
+1600
+1700
+1800
+1900
+2000
+2100
+2200
--- /dev/null
+ 950
+1050
+1150
+1250
+1350
+1450
+1550
+1650
+1750
+1850
+1950
+2050
+2150
+2250
+2350
+2450
+
+
--- /dev/null
+1100
+1200
+1300
+1400
+1500
+1600
+1700
+1800
+1900
+2000
+2100
+2200
+2300
+2400
+2500
+2600
+
+
--- /dev/null
+1500
+1600
+1700
+1800
+1900
+2000
+2100
+2200
+2300
+2400
+2500
+2600
+2700
+2800
+2900
+3000
+
+
--- /dev/null
+2300
+2400
+2500
+2600
+2700
+2800
+2900
+3000
+
+
--- /dev/null
+2500
+2600
+2700
+2800
+2900
+3000
+3100
+3200
+
+
--- /dev/null
+0.263308 0.108769 0.321376
+0.258448 0.055984 0.230859
+0.266067 0.060719 0.217388
+0.280055 0.057994 0.244228
+0.266912 0.064695 0.265145
+0.271651 0.079610 0.259575
+0.226822 0.156621 0.158998
+0.156949 0.052659 0.212653
+0.166041 0.209329 0.265886
+0.308633 0.053423 0.276948
+0.332112 0.035457 0.286972
+0.339533 0.040123 0.272290
+0.330792 0.023602 0.274813
+0.316456 0.037932 0.249650
+0.287286 0.046071 0.242200
+0.261514 0.049979 0.284344
+0.214376 0.103675 0.338804
+0.188651 0.116868 0.328440
+0.177177 0.072134 0.154176
+0.199766 0.183234 0.706565
+0.350628 0.229826 0.529061
+0.297560 0.045946 0.288017
+0.314602 0.041640 0.200681
+0.348282 0.038714 0.240448
+0.381632 0.043026 0.229469
+0.401854 0.029415 0.202430
+0.408573 0.044563 0.177371
+0.424312 0.067150 0.184192
+0.428423 0.056620 0.165082
+0.443482 0.038789 0.168832
+0.432034 0.046019 0.195869
+0.472514 0.052971 0.175566
+0.445147 0.060539 0.186875
+0.447305 0.043459 0.217896
+0.418837 0.064057 0.224309
+0.394427 0.072473 0.216686
+0.372086 0.031878 0.245392
+0.335537 0.047914 0.232315
+0.307720 0.076985 0.263440
+0.212588 0.199799 0.241274
+0.177978 0.061936 0.419219
+0.184726 0.071514 0.295235
+0.179928 0.120561 0.197113
+0.194093 0.091120 0.307566
+0.238704 0.088264 0.256089
+0.256704 0.056376 0.272029
+0.245826 0.056285 0.221666
+0.252157 0.069875 0.209436
+0.293844 0.058822 0.205688
+0.333145 0.032022 0.198412
+0.374122 0.058501 0.198354
+0.388622 0.055018 0.174356
+0.402915 0.069231 0.171417
+0.409007 0.055048 0.195699
+0.393180 0.068521 0.192734
+0.378148 0.042573 0.211319
+0.364531 0.032711 0.200555
+0.346684 0.053755 0.199507
+0.303076 0.088318 0.231307
+0.308105 0.120302 0.271168
+0.275060 0.183236 0.280609
+0.191607 0.254478 0.333707
+0.415869 0.157513 0.330550
+0.466958 0.126641 0.345873
+0.393315 0.137590 0.278630
+0.367297 0.215695 0.295962
+0.209423 0.343791 0.353190
+0.239247 0.069127 0.351070
+0.219601 0.067725 0.316134
+0.183085 0.108910 0.288046
+0.141405 0.106410 0.374917
+0.340773 0.180383 0.280306
+0.324313 0.206337 0.392025
+0.377497 0.310052 0.251511
+0.369942 0.206976 0.403513
+0.391822 0.165248 0.458238
+0.402392 0.132235 0.391573
+0.363609 0.109018 0.385179
+0.393092 0.150649 0.690282
+0.248424 0.072260 0.403322
+0.258842 0.062838 0.331583
+0.277543 0.023397 0.334487
+0.259767 0.019332 0.283729
+0.277333 0.022787 0.286736
+0.278562 0.034487 0.253401
+0.294439 0.029548 0.223983
+0.306420 0.021466 0.246669
+0.311799 0.029621 0.232167
+0.314573 0.026307 0.211228
+0.322046 0.036979 0.185969
+0.340920 0.051908 0.181885
+0.378651 0.100615 0.150541
+0.362534 0.107177 0.127000
+0.366188 0.118540 0.096115
+0.335906 0.123585 0.100436
+0.289660 0.136844 0.121618
+0.234449 0.115458 0.142944
+0.234687 0.112186 0.213379
+0.218786 0.097113 0.246862
+0.230751 0.090415 0.225856
+0.249914 0.071568 0.228974
+0.239316 0.089091 0.205158
+0.235823 0.092666 0.179934
+0.260464 0.077785 0.193877
+0.245534 0.073180 0.169632
+0.285464 0.081401 0.206102
+0.272122 0.072806 0.177335
+0.256928 0.066768 0.151148
+0.259615 0.074334 0.119038
+0.285004 0.089415 0.117455
+0.326626 0.085390 0.097219
+0.322959 0.072295 0.114366
+0.342931 0.060610 0.112868
+0.349890 0.057216 0.138586
+0.347363 0.058881 0.164623
+0.358032 0.064472 0.175272
+0.357807 0.072462 0.156002
+0.336895 0.066119 0.134206
+0.337276 0.073707 0.151129
+0.326144 0.057722 0.152109
+0.287242 0.055461 0.172280
+0.233531 0.070892 0.220511
+0.247128 0.049358 0.274502
+0.224586 0.046013 0.357086
+0.229675 0.045704 0.405370
+0.272311 0.072851 0.349441
+0.262378 0.048277 0.301490
+0.272410 0.052304 0.234698
+0.296903 0.047644 0.225221
+0.308756 0.052127 0.222936
+0.336122 0.044504 0.193011
+0.365030 0.064659 0.137103
+0.372444 0.036236 0.135129
+0.379957 0.052989 0.104509
+0.395033 0.063805 0.099117
+0.395331 0.016167 0.079401
+0.361374 0.077860 0.067214
+0.366584 0.051942 0.030922
+0.417962 0.076156 0.084209
+0.376593 0.111196 0.068356
+0.321411 0.091882 0.063007
+0.335365 0.070341 0.082301
+0.348707 0.075437 0.099469
+0.292758 0.061200 0.121062
+0.277998 0.061337 0.145208
+0.272000 0.072048 0.230783
+0.206511 0.121757 0.280188
+0.162259 0.031322 0.393199
+0.200906 0.088613 0.124277
+0.184134 0.084894 0.197393
+0.290246 0.077754 0.223919
+0.263962 0.059362 0.091101
+0.317773 0.055238 0.129435
+0.356413 0.042508 0.107483
+0.365057 0.023078 0.085620
+0.411914 0.048078 0.093016
+0.419049 0.030016 0.101357
+0.436160 0.024666 0.066348
+0.436704 0.046967 0.092223
+0.494088 0.068777 0.102742
+0.470076 0.075909 0.074128
+0.451110 0.088014 0.089431
+0.487849 0.092611 0.051933
+0.533716 0.041322 0.035398
+0.457297 0.061196 0.094392
+0.434718 0.062690 0.099115
+0.432830 0.099336 0.064658
+0.445522 0.032508 0.029007
+0.435059 0.064532 0.071763
+0.400424 0.095239 0.052280
+0.394880 0.061922 0.073728
+0.341705 0.050045 0.060238
+0.382169 0.078170 0.085591
+0.375733 0.095367 0.086298
+0.367753 0.093088 0.107387
+0.355679 0.126981 0.119866
+0.183195 0.178369 0.154227
+0.215939 0.281661 0.137611
+0.255382 0.232429 0.090575
+0.294261 0.198828 0.092855
+0.358379 0.158423 0.138468
+0.380219 0.176473 0.110948
+0.305047 0.161007 0.139954
+0.262435 0.236041 0.144567
+0.354204 0.222414 0.107065
+0.345190 0.184018 0.124352
+0.338177 0.204525 0.067254
+0.305092 0.238787 0.094788
+0.351980 0.224928 0.156944
+0.345016 0.185595 0.192659
+0.337844 0.184025 0.160326
+0.359544 0.217341 0.327157
+0.357648 0.230240 0.366907
+0.395642 0.165926 0.261342
+0.343546 0.156618 0.223511
+0.361635 0.096729 0.184236
+0.415440 0.076743 0.154942
+0.431066 0.076513 0.121105
+0.451174 0.082936 0.112437
+0.495682 0.125322 0.083250
+0.457920 0.105206 0.069372
+0.428288 0.096431 0.099719
+0.402112 0.089533 0.102279
+0.374406 0.069315 0.151993
+0.341303 0.072495 0.181235
+0.288181 0.130601 0.149994
+0.437823 0.194847 0.236998
+0.517891 0.162410 0.219232
+0.458004 0.239400 0.097958
+0.500390 0.177654 0.095729
+0.362675 0.278449 0.190598
+0.273868 0.085220 0.143261
+0.337997 0.064583 0.239703
+0.368143 0.045688 0.271347
+0.379949 0.029454 0.196794
+0.353352 0.028491 0.129485
+0.352112 0.017867 0.185794
+0.346936 0.025652 0.201147
+0.313751 0.022409 0.193629
+0.310985 0.028334 0.172877
+0.224772 0.055169 0.272269
+0.241855 0.030040 0.280276
+0.228564 0.021920 0.257200
+0.227718 0.054195 0.234162
+0.238926 0.054818 0.264076
+0.237314 0.075502 0.320709
+0.270880 0.085558 0.331728
+0.256455 0.080580 0.308559
+0.287309 0.097558 0.267753
+0.290763 0.080224 0.284406
+0.283022 0.068509 0.295506
+0.275270 0.069930 0.316990
+0.303843 0.092797 0.344720
+0.295250 0.075062 0.317300
+0.304161 0.067487 0.286738
+0.324174 0.057767 0.264031
+0.327890 0.076403 0.220917
+0.357965 0.072263 0.193322
+0.369869 0.059126 0.176957
+0.380683 0.051077 0.189741
+0.377526 0.045779 0.169338
+0.362044 0.051634 0.203021
+0.349094 0.041532 0.208466
+0.350344 0.021300 0.239499
+0.325966 0.026791 0.230178
+0.322013 0.042984 0.214929
+0.290199 0.049255 0.255248
+0.268860 0.057260 0.292111
+0.254110 0.065897 0.262323
+0.240555 0.081414 0.242131
+0.214107 0.099448 0.291511
+0.227603 0.116971 0.293158
+0.242687 0.099576 0.273347
+0.212057 0.080928 0.206493
+0.216818 0.054102 0.208481
+0.244560 0.059543 0.241185
+0.244893 0.055478 0.253047
+0.252424 0.044367 0.250846
+0.232805 0.046411 0.221492
+0.259503 0.030997 0.257981
+0.258163 0.036285 0.290086
+0.255400 0.060582 0.318764
+0.231850 0.078839 0.288307
+0.236986 0.070470 0.304299
+0.213303 0.073593 0.296093
+0.205272 0.040867 0.334217
+0.186676 0.036373 0.251392
+0.217783 0.043270 0.241924
+0.214511 0.052788 0.255946
+0.208572 0.053861 0.286926
+0.242888 0.106360 0.347276
+0.288960 0.124946 0.201239
+0.342775 0.093960 0.144984
+0.377197 0.085376 0.129922
+0.412166 0.088434 0.132108
+0.390249 0.076679 0.114031
+0.383989 0.062449 0.122055
+0.387523 0.079554 0.156435
+0.379580 0.077513 0.179594
+0.314430 0.087760 0.175421
+0.294579 0.101436 0.212711
+0.307017 0.089327 0.197301
+0.305232 0.075488 0.208874
+0.313937 0.065084 0.223413
+0.318828 0.066585 0.241867
+0.319064 0.044985 0.234334
+0.327293 0.054936 0.224270
+0.313956 0.059037 0.208250
+0.320067 0.067497 0.178744
+0.325844 0.051785 0.249839
+0.291419 0.140846 0.176356
+0.304736 0.257499 0.321206
+0.412538 0.193653 0.527310
+0.464326 0.177155 0.484639
+0.388370 0.247578 0.270502
+0.309708 0.243245 0.219685
+0.267637 0.120670 0.182524
+0.333329 0.064619 0.195862
+0.337853 0.035063 0.182235
+0.363054 0.041039 0.161560
+0.346506 0.045356 0.166242
+0.343175 0.032640 0.168740
+0.329834 0.040738 0.160952
+0.327688 0.025263 0.170543
+0.337286 0.032068 0.148672
+0.352876 0.027518 0.154928
+0.355731 0.040489 0.143599
+0.360021 0.052552 0.125346
+0.379432 0.019637 0.116855
+0.389556 0.033257 0.172091
+0.388615 0.005982 0.167184
+0.380871 0.031560 0.161735
+0.370428 0.034266 0.174805
+0.364127 0.028565 0.187409
+0.354946 0.032953 0.173018
+0.355197 0.019611 0.169606
+0.317361 0.028988 0.147085
+0.272330 0.043511 0.120042
+0.266965 0.057786 0.178702
+0.218195 0.094896 0.158774
+0.210802 0.102337 0.189513
+0.233979 0.076536 0.270353
+0.202083 0.169732 0.380558
+0.239441 0.172991 0.265931
+0.276190 0.226470 0.297090
+0.261790 0.365551 0.166357
+0.291971 0.099794 0.304947
+0.299131 0.063916 0.222310
+0.286582 0.041561 0.230600
+0.291056 0.054960 0.304060
+0.275948 0.057784 0.330696
+0.309766 0.028970 0.340314
+0.294102 0.043690 0.317927
+0.309171 0.030830 0.307374
+0.307411 0.020232 0.279361
+0.330913 0.034844 0.243337
+0.332192 0.027616 0.212354
+0.350338 0.039211 0.192995
+0.354502 0.055994 0.189121
+0.341296 0.073283 0.165587
+0.313181 0.094281 0.118029
+0.258194 0.134394 0.161487
+0.211766 0.110672 0.388399
+0.180619 0.089602 0.393854
+0.207652 0.057423 0.402186
+0.248737 0.121119 0.265945
+0.257647 0.145656 0.128647
+0.273116 0.146530 0.091939
+0.258193 0.186626 0.065391
+0.306617 0.177781 0.064168
+0.347651 0.163069 0.074409
+0.357362 0.133103 0.066344
+0.284876 0.117297 0.059904
+0.329676 0.124514 0.067178
+0.347508 0.100037 0.082550
+0.223342 0.163723 0.106806
+0.242615 0.106352 0.107873
+0.278081 0.104596 0.093439
+0.308805 0.106582 0.092192
+0.299730 0.076828 0.096766
+0.240110 0.112476 0.067117
+0.231410 0.073181 0.088404
+0.187246 0.100727 0.078664
+0.193716 0.126844 0.159078
+0.094366 0.454024 0.291647
+0.440203 0.228612 0.310365
+0.456753 0.186484 0.299839
+0.308520 0.205526 0.313406
+0.228109 0.069024 0.190235
+0.251018 0.045216 0.163280
+0.273421 0.051226 0.164458
+0.293630 0.030524 0.175355
+0.298281 0.027483 0.155763
+0.301235 0.032609 0.127618
+0.295114 0.036459 0.089043
+0.321284 0.052688 0.103598
+0.323611 0.031672 0.118877
+0.338816 0.045778 0.089024
+0.310812 0.060414 0.075229
+0.277050 0.068429 0.061631
+0.331845 0.057911 0.166403
+0.357599 0.078369 0.229133
+0.267510 0.109542 0.134427
+0.288685 0.206571 0.249532
+0.359999 0.229179 0.199289
+0.400078 0.178102 0.233727
+0.416741 0.100494 0.304150
+0.427570 0.154323 0.369992
+0.256414 0.275755 0.244236
+0.175186 0.345607 0.170933
+0.324895 0.207437 0.260709
+0.314928 0.217055 0.179225
+0.375454 0.184067 0.158251
+0.461676 0.155360 0.119282
+0.421915 0.134009 0.232978
+0.373661 0.177682 0.207681
+0.135194 0.242891 0.321398
+0.321335 0.077009 0.197895
+0.338990 0.031707 0.225496
+0.324230 0.087363 0.236806
+0.270364 0.162874 0.154703
+0.241859 0.198105 0.177328
+0.257345 0.254782 0.195962
+0.199872 0.236295 0.186694
+0.245869 0.190731 0.141457
+0.335308 0.137010 0.136606
+0.408226 0.106606 0.149159
+0.428609 0.091994 0.166467
+0.472127 0.089046 0.165746
+0.498132 0.086762 0.208918
+0.481551 0.029402 0.264176
+0.482803 0.039294 0.214899
+0.446093 0.026027 0.128251
+0.407029 0.046922 0.066767
+0.365305 0.060238 0.090360
+0.383768 0.048819 0.140115
+0.370504 0.054257 0.143952
+0.358656 0.050846 0.152415
+0.343721 0.051667 0.150554
+0.352689 0.037849 0.181895
+0.387896 0.023860 0.226017
+0.385152 0.026671 0.273998
+0.389716 0.042722 0.253226
+0.390426 0.060857 0.236081
+0.391309 0.070621 0.271022
+0.365299 0.052628 0.227580
+0.349302 0.056899 0.217929
+0.334019 0.044267 0.204909
+0.322675 0.052532 0.195847
+0.331578 0.059559 0.211188
+0.337346 0.044211 0.217457
+0.349988 0.042267 0.223684
+0.349544 0.052704 0.234279
+0.362448 0.055041 0.249180
+0.361727 0.044749 0.216369
+0.348153 0.069352 0.209682
+0.337217 0.045887 0.252731
+0.331050 0.046309 0.303014
+0.315984 0.081682 0.302052
+0.284402 0.070739 0.237853
+0.160928 0.095527 0.301120
+0.243864 0.253123 0.323982
+0.277572 0.092148 0.227598
+0.287300 0.089141 0.248731
+0.266347 0.080300 0.293693
+0.251289 0.087932 0.356317
+0.229821 0.046012 0.383514
+0.211823 0.052236 0.376683
+0.227721 0.066729 0.381682
+0.211191 0.099568 0.361644
+0.250163 0.058192 0.302916
+0.238782 0.062404 0.276585
+0.226470 0.067801 0.245403
+0.201436 0.085254 0.282160
+0.219802 0.088189 0.275429
+0.195729 0.096373 0.259539
+0.239596 0.069924 0.258877
+0.252931 0.058961 0.285795
+0.198265 0.083733 0.337224
+0.154613 0.036968 0.351381
+0.177337 0.021450 0.364380
+0.179088 0.025299 0.334012
+0.159295 0.027232 0.308317
+0.188645 0.046948 0.354951
+0.239592 0.093448 0.325226
+0.260247 0.055024 0.254124
+0.271796 0.061114 0.279167
+0.277210 0.043283 0.292067
+0.285919 0.056460 0.283294
+0.294039 0.048722 0.271710
+0.284689 0.041537 0.264456
+0.295141 0.036382 0.263883
+0.297060 0.034184 0.245546
+0.293229 0.029850 0.279750
+0.281186 0.022593 0.265907
+0.277293 0.025365 0.243586
+0.258324 0.031845 0.190247
+0.259675 0.040360 0.270911
+0.247039 0.037888 0.299431
+0.208028 0.109870 0.417382
+0.143955 0.352665 0.276035
+0.219494 0.404511 0.278305
+0.352442 0.182051 0.309356
+0.405915 0.135088 0.307030
+0.369146 0.162615 0.410960
+0.433703 0.099514 0.369783
+0.285682 0.219583 0.351837
+0.205221 0.076512 0.429524
+0.209111 0.064178 0.357358
+0.213614 0.027846 0.368032
+0.211762 0.020177 0.348034
+0.239715 0.025079 0.308549
+0.181970 0.021514 0.274842
+0.207709 0.021261 0.265212
+0.224222 0.023951 0.292046
+0.205208 0.035452 0.292259
+0.228577 0.040117 0.304294
+0.185628 0.027511 0.302807
+0.208356 0.024577 0.316996
+0.164632 0.053682 0.299398
+0.154684 0.059791 0.276709
+0.163141 0.113219 0.252962
+0.145021 0.179019 0.408733
+0.214761 0.213412 0.297524
+0.308714 0.266575 0.390462
+0.419920 0.278106 0.288387
+0.436034 0.199545 0.357313
+0.451619 0.349524 0.419884
+0.351454 0.399809 0.460027
+0.360729 0.263047 0.612763
+0.418659 0.158631 0.284739
+0.456406 0.261108 0.373714
+0.424203 0.185874 0.316636
+0.400414 0.220266 0.453220
+0.368427 0.288074 0.412510
+0.343373 0.311195 0.490064
+0.395724 0.120734 0.436366
+0.344054 0.121619 0.347531
+0.272067 0.060489 0.198795
+0.301511 0.071935 0.185958
+0.309917 0.058524 0.190423
+0.300737 0.068082 0.171283
+0.295951 0.070752 0.150988
+0.296628 0.093980 0.139509
+0.302790 0.088637 0.162273
+0.289209 0.107492 0.167687
+0.257493 0.099688 0.159880
+0.265074 0.094624 0.181755
+0.266152 0.102270 0.207499
+0.269178 0.081363 0.277388
+0.234937 0.089620 0.382405
+0.183980 0.071956 0.466773
+0.219287 0.038089 0.431341
+0.202243 0.025685 0.466386
+0.158633 0.040859 0.449110
+0.165286 0.038598 0.497265
+0.170922 0.081097 0.523174
+0.255371 0.073482 0.249855
+0.294450 0.061848 0.264223
+0.304183 0.048479 0.179739
+0.310850 0.055590 0.165979
+0.311457 0.049670 0.147335
+0.330971 0.043725 0.142906
+0.338014 0.047764 0.127744
+0.367458 0.069305 0.112055
+0.365012 0.080855 0.169084
+0.360471 0.123986 0.145022
+0.219106 0.213898 0.129019
+0.206939 0.158987 0.242265
+0.246130 0.209339 0.215908
+0.281650 0.212707 0.204391
+0.368421 0.137607 0.310718
+0.416555 0.186663 0.125862
+0.490086 0.115875 0.145587
+0.582071 0.084161 0.206439
+0.516409 0.100131 0.260412
+0.209178 0.109586 0.221433
+0.269122 0.077905 0.211916
+0.300134 0.057524 0.238951
+0.303992 0.045603 0.260036
+0.322399 0.041910 0.267995
+0.316911 0.039992 0.287154
+0.327515 0.024597 0.301819
+0.326525 0.038109 0.322430
+0.341705 0.034554 0.344489
+0.315359 0.057607 0.326479
+0.311192 0.052833 0.302654
+0.297687 0.053640 0.333832
+0.310295 0.070962 0.376051
+0.287143 0.033181 0.414809
+0.248935 0.044304 0.319914
+0.246203 0.096450 0.292594
+0.203226 0.299903 0.287677
+0.450787 0.226937 0.192194
+0.429364 0.129302 0.269024
+0.457446 0.111038 0.290750
+0.498339 0.083336 0.319890
+0.424246 0.121867 0.333939
+0.180169 0.212830 0.368602
+0.241118 0.059711 0.365439
+0.224747 0.101688 0.488165
+0.246281 0.034903 0.465119
+0.214101 0.041638 0.545771
+0.172272 0.040285 0.598901
+0.204244 0.073643 0.382078
+0.146978 0.063294 0.389213
+0.382561 0.211691 0.242082
+0.362189 0.175671 0.247243
+0.318033 0.195181 0.218764
+0.318069 0.292363 0.228042
+0.255232 0.340570 0.247263
+0.224048 0.079338 0.358775
+0.236448 0.054617 0.310908
+0.239437 0.046635 0.344813
+0.243703 0.031212 0.389996
+0.226767 0.019507 0.406603
+0.238177 0.018267 0.376086
+0.218586 0.029858 0.389601
+0.197366 0.025585 0.402150
+0.181994 0.030716 0.427478
+0.190316 0.080557 0.359194
+0.190657 0.107271 0.458600
+0.155050 0.289997 0.417618
+0.187166 0.466579 0.426216
+0.327820 0.426769 0.326883
+0.298164 0.333603 0.351558
+0.222925 0.307747 0.580913
+0.198007 0.195365 0.578080
+0.210838 0.132715 0.542845
+0.231681 0.145101 0.436671
+0.232264 0.139358 0.387084
+0.255424 0.134975 0.350235
+0.269033 0.107837 0.261451
+0.321432 0.091599 0.275752
+0.380638 0.048055 0.299763
+0.405177 0.039883 0.236148
+0.423159 0.034218 0.181764
+0.453693 0.035502 0.198420
+0.464601 0.056361 0.119659
+0.481653 0.094843 0.109332
+0.543887 0.077760 0.119617
+0.510174 0.067882 0.146075
+0.506307 0.045510 0.174226
+0.488336 0.037550 0.110817
+0.414503 0.071944 0.106334
+0.383441 0.044148 0.118702
+0.368264 0.023699 0.150335
+0.307715 0.072824 0.135304
+0.294683 0.031017 0.196791
+0.275515 0.032364 0.181864
+0.235271 0.050178 0.178346
+0.215182 0.042335 0.185990
+0.209160 0.034271 0.223795
+0.228156 0.042936 0.260040
+0.223438 0.035509 0.277441
+0.180634 0.048455 0.281545
+0.197426 0.043630 0.273470
+0.205039 0.042828 0.313134
+0.223919 0.042287 0.320436
+0.223789 0.049071 0.285841
+0.214087 0.074972 0.257980
+0.221706 0.055601 0.498696
+0.248886 0.066833 0.445954
+0.213931 0.250226 0.256738
+0.405740 0.215131 0.170840
+0.328009 0.225653 0.293796
+0.402298 0.209079 0.214184
+0.399981 0.190690 0.264499
+0.363176 0.143635 0.492934
+0.411671 0.175359 0.406973
+0.483187 0.170802 0.394002
+0.431046 0.230553 0.250015
+0.389736 0.164181 0.297007
+0.397937 0.264402 0.341441
+0.395597 0.192289 0.302742
+0.343285 0.064916 0.354126
+0.350910 0.048799 0.290592
+0.347107 0.053302 0.266173
+0.361248 0.035141 0.231596
+0.353263 0.036751 0.257156
+0.332918 0.021247 0.255062
+0.360739 0.026445 0.281881
+0.367061 0.033022 0.325980
+0.350245 0.030285 0.303678
+0.327460 0.062073 0.283904
+0.264953 0.154809 0.315348
+0.324552 0.162784 0.438341
+0.429845 0.118138 0.486718
+0.437485 0.201399 0.415841
+0.427985 0.188146 0.278007
+0.298482 0.166884 0.350707
+0.267071 0.100408 0.291668
+0.274139 0.048797 0.268746
+0.281772 0.064356 0.267733
+0.214424 0.106076 0.312509
+0.331917 0.145161 0.280800
+0.354727 0.078392 0.279286
+0.371871 0.063102 0.214163
+0.396773 0.045559 0.209831
+0.421855 0.036944 0.214993
+0.420483 0.038557 0.160983
+0.436158 0.046191 0.146786
+0.453173 0.052302 0.137395
+0.481122 0.055096 0.145895
+0.465610 0.080732 0.136565
+0.449280 0.063650 0.159070
+0.438899 0.073552 0.140745
+0.432289 0.052628 0.119653
+0.420075 0.055923 0.142166
+0.415632 0.042002 0.128100
+0.412222 0.024997 0.139031
+0.391770 0.036632 0.146635
+0.393909 0.035907 0.188207
+0.368782 0.042784 0.188583
+0.363114 0.026468 0.218028
+0.375379 0.033356 0.364183
+0.345201 0.072563 0.316474
+0.306150 0.169779 0.294978
+0.484261 0.214170 0.267057
+0.406809 0.237896 0.384323
+0.392655 0.344627 0.332547
+0.326695 0.369933 0.207731
+0.407366 0.219126 0.278777
+0.398951 0.222770 0.323388
+0.464580 0.171047 0.338723
+0.397575 0.158165 0.591424
+0.420764 0.281705 0.506598
+0.473997 0.277563 0.218714
+0.336638 0.220260 0.461195
+0.342381 0.160051 0.377158
+0.246975 0.040158 0.263418
+0.239553 0.054919 0.205493
+0.252654 0.036861 0.224388
+0.253305 0.022395 0.239997
+0.271057 0.036266 0.237408
+0.273993 0.028386 0.214558
+0.242393 0.034220 0.204126
+0.236256 0.038163 0.247591
+0.209356 0.079325 0.234462
+0.194870 0.063640 0.214830
+0.244111 0.043255 0.236907
+0.264016 0.045660 0.223915
+0.260253 0.048634 0.207679
+0.251574 0.057245 0.189983
+0.263437 0.063508 0.241134
+0.271436 0.069219 0.251311
+0.261483 0.087406 0.246475
+0.250589 0.076269 0.277050
+0.244799 0.069765 0.292298
+0.232217 0.055247 0.331780
+0.216197 0.056278 0.342299
+0.176402 0.053897 0.380149
+0.224991 0.078406 0.337659
+0.231780 0.062395 0.422354
+0.189766 0.154959 0.437237
+0.204459 0.136309 0.307237
+0.260264 0.045977 0.240046
+0.269789 0.046212 0.252599
+0.274164 0.035012 0.302447
+0.230060 0.090744 0.305382
+0.166096 0.140832 0.294885
+0.154169 0.268532 0.226818
+0.349563 0.262265 0.343630
+0.354489 0.268911 0.296625
+0.375822 0.171148 0.332545
+0.476794 0.136744 0.259507
+0.399929 0.118339 0.259498
+0.271716 0.130588 0.469224
+0.305172 0.032898 0.454218
+0.308690 0.042473 0.417566
+0.288698 0.024952 0.300569
+0.290810 0.015293 0.221283
+0.268986 0.033267 0.147285
+0.237334 0.048825 0.120734
+0.228777 0.055634 0.150103
+0.204334 0.073034 0.174915
+0.208027 0.057339 0.236310
+0.198897 0.066784 0.271433
+0.202506 0.057603 0.300680
+0.222788 0.058041 0.300819
+0.233042 0.055613 0.290225
+0.246512 0.042508 0.284706
+0.260946 0.032017 0.314281
+0.280743 0.031362 0.358053
+0.305375 0.031854 0.387510
+0.269256 0.025479 0.381275
+0.245952 0.040037 0.364854
+0.268189 0.040204 0.323075
+0.275163 0.050477 0.311422
+0.265688 0.064899 0.301225
+0.239306 0.268505 0.378907
+0.312398 0.266259 0.164624
+0.480542 0.174554 0.171654
+0.552172 0.158933 0.144993
+0.458784 0.141655 0.212248
+0.428648 0.163482 0.164911
+0.350278 0.208056 0.235462
+0.359219 0.250780 0.234338
+0.336572 0.248935 0.259563
+0.293959 0.257267 0.267935
+0.238555 0.202335 0.370163
+0.245646 0.069245 0.336645
+0.261452 0.055228 0.352020
+0.268939 0.054326 0.369767
+0.286819 0.048101 0.382083
+0.271280 0.052949 0.401336
+0.248193 0.051118 0.385676
+0.239973 0.026597 0.429200
+0.214644 0.060995 0.454583
+0.220676 0.083808 0.406302
+0.250805 0.126260 0.297366
+0.334644 0.192200 0.346535
+0.381125 0.159560 0.367527
+0.340438 0.157087 0.328361
+0.277244 0.160062 0.390717
+0.292870 0.052195 0.355769
+0.345623 0.035855 0.396258
+0.374273 0.031225 0.447159
+0.276809 0.033552 0.581647
+0.224359 0.099923 0.647568
+0.333303 0.049949 0.516785
+0.312970 0.123739 0.396509
+0.238621 0.146067 0.231297
+0.165305 0.049204 0.329040
+0.278324 0.199829 0.426235
+0.253210 0.337113 0.436856
+0.206203 0.578084 0.277516
+0.309249 0.169748 0.538897
+0.332333 0.091215 0.435451
+0.279107 0.030067 0.502383
+0.259234 0.086196 0.546189
+0.267603 0.068953 0.484586
+0.265845 0.064849 0.423640
+0.281793 0.086538 0.401598
+0.264889 0.079521 0.377251
+0.266400 0.115068 0.375961
+0.205215 0.130153 0.360079
+0.229061 0.160330 0.306438
+0.189984 0.185082 0.324728
+0.229945 0.128947 0.326026
+0.253837 0.089731 0.266618
+0.255704 0.088487 0.224765
+0.286792 0.092177 0.188518
+0.320841 0.097300 0.214002
+0.333689 0.106637 0.185748
+0.333838 0.086680 0.174199
+0.319590 0.093878 0.148540
+0.340092 0.115413 0.159425
+0.351543 0.092448 0.163319
+0.342527 0.091358 0.203951
+0.331816 0.119469 0.305761
+0.280244 0.128802 0.290044
+0.304101 0.105074 0.248131
+0.338603 0.080077 0.255476
+0.309197 0.057247 0.254671
+0.300156 0.070286 0.244369
+0.286353 0.065888 0.254045
+0.258600 0.108479 0.234651
+0.224997 0.109225 0.266261
+0.195413 0.126245 0.250545
+0.281750 0.062811 0.213758
+0.303917 0.051829 0.203332
+0.317902 0.072075 0.155470
+0.327787 0.081576 0.130690
+0.355867 0.073091 0.127604
+0.358901 0.085628 0.142860
+0.347105 0.087525 0.122878
+0.333158 0.110155 0.130534
+0.305063 0.115625 0.125246
+0.311381 0.117013 0.156404
+0.308163 0.112438 0.188106
+0.269326 0.130721 0.245640
+0.216982 0.085835 0.320106
+0.212607 0.057787 0.321804
+0.198387 0.073638 0.315780
+0.186044 0.054189 0.321956
+0.163325 0.054977 0.246522
+0.182868 0.034089 0.225316
+0.180488 0.047224 0.190814
+0.157011 0.029435 0.267719
+0.233375 0.081439 0.132706
+0.274801 0.044742 0.195953
+0.306673 0.028692 0.261583
+0.305705 0.037574 0.221126
+0.303135 0.045524 0.239984
+0.282405 0.040832 0.282276
+0.283758 0.040311 0.339897
+0.234144 0.030246 0.331245
+0.216669 0.066311 0.278480
+0.190170 0.097245 0.230782
+0.168054 0.072931 0.353984
+0.179260 0.077851 0.328143
+0.174966 0.076302 0.231521
+0.175667 0.078095 0.272008
+0.189384 0.067503 0.247983
+0.214139 0.046101 0.272932
+0.233914 0.045467 0.277783
+0.244588 0.049198 0.296792
+0.256730 0.043153 0.334920
+0.257759 0.032742 0.347498
+0.285465 0.026853 0.316266
+0.271270 0.033933 0.272250
+0.276680 0.045231 0.220594
+0.288564 0.042172 0.209508
+0.292675 0.047892 0.190494
+0.308407 0.037952 0.274706
+0.318522 0.038643 0.364714
+0.247803 0.111933 0.190722
+0.233404 0.144416 0.275805
+0.249166 0.193532 0.320038
+0.310797 0.319086 0.285728
+0.360867 0.217696 0.267229
+0.373286 0.186187 0.279616
+0.387949 0.127631 0.343667
+0.415183 0.073517 0.405553
+0.454532 0.127629 0.417735
+0.448768 0.149562 0.299421
+0.512886 0.163940 0.302645
+0.392881 0.193813 0.357648
+0.261675 0.259539 0.466201
+0.234490 0.096500 0.443213
+0.258238 0.062531 0.385246
+0.260465 0.035885 0.401811
+0.261667 0.036601 0.432964
+0.281564 0.058277 0.447718
+0.247830 0.105619 0.413321
+0.195343 0.165737 0.277588
+0.216014 0.219408 0.421047
+0.169087 0.221263 0.482537
+0.227429 0.183042 0.484872
+0.260935 0.291958 0.298961
+0.224112 0.158830 0.343758
+0.284726 0.056334 0.226615
+0.294599 0.051973 0.149180
+0.325047 0.051628 0.179937
+0.356402 0.049165 0.175911
+0.376165 0.058355 0.163522
+0.397813 0.057225 0.144147
+0.393141 0.044994 0.129534
+0.402884 0.044005 0.110816
+0.407746 0.063560 0.121868
+0.403282 0.071499 0.138498
+0.406901 0.052769 0.156323
+0.400491 0.038429 0.161151
+0.391847 0.058654 0.157748
+0.385015 0.067309 0.137188
+0.377336 0.045050 0.152108
+0.362722 0.055345 0.162513
+0.315826 0.042890 0.168139
+0.283083 0.080878 0.165981
+0.285489 0.067464 0.191727
+0.145248 0.070726 0.324069
+0.399799 0.255914 0.214022
+0.429920 0.159068 0.250011
+0.439445 0.183575 0.202417
+0.398499 0.258210 0.143533
+0.465245 0.169443 0.256422
+0.422318 0.358987 0.185421
+0.253220 0.222325 0.265472
+0.210594 0.307630 0.214541
+0.175040 0.446152 0.193737
+0.226217 0.379009 0.100408
+0.340833 0.306077 0.113355
+0.265242 0.294847 0.105075
+0.276714 0.304171 0.186038
+0.390551 0.100132 0.539154
+0.297133 0.125853 0.333330
+0.196927 0.178243 0.197378
+0.257580 0.128441 0.214041
+0.229792 0.130115 0.182553
+0.170106 0.162513 0.231148
+0.164595 0.106934 0.342563
+0.175852 0.127587 0.392165
+0.157779 0.134743 0.489792
+0.152201 0.097943 0.432539
+0.162413 0.153705 0.347737
+0.277299 0.150900 0.266126
+0.266806 0.172668 0.234574
+0.318579 0.167283 0.249262
+0.347916 0.107363 0.231007
+0.372857 0.090140 0.210306
+0.384342 0.113638 0.196678
+0.404131 0.095394 0.183804
+0.384612 0.121810 0.167672
+0.322944 0.132564 0.210257
+0.290364 0.146204 0.223432
+0.264192 0.157656 0.193948
+0.233485 0.163743 0.200412
+0.207187 0.138320 0.212342
+0.225556 0.124901 0.244775
+0.239106 0.105732 0.239571
+0.287733 0.114294 0.228538
+0.340176 0.100254 0.107080
+0.389066 0.103998 0.122846
+0.444975 0.102241 0.133970
+0.415860 0.114565 0.114926
+0.453877 0.120214 0.107920
+0.403927 0.096306 0.080457
+0.421740 0.122693 0.079588
+0.450640 0.144936 0.071884
+0.393762 0.136866 0.060204
+0.381369 0.180962 0.064094
+0.417859 0.160286 0.072990
+0.381221 0.146156 0.087738
+0.393977 0.119086 0.094996
+0.414356 0.146006 0.109031
+0.435031 0.134052 0.138616
+0.396483 0.123711 0.134754
+0.382302 0.141141 0.123735
+0.353663 0.145826 0.104587
+0.332036 0.171052 0.104051
+0.311513 0.199338 0.131723
+0.285181 0.190876 0.163180
+0.274455 0.184371 0.123920
+0.301600 0.169794 0.109397
+0.311406 0.141832 0.086234
+0.321738 0.140580 0.119486
+0.327427 0.145551 0.158359
+0.310737 0.168048 0.174012
+0.297873 0.175289 0.197738
+0.319909 0.123865 0.237833
+0.344952 0.122697 0.263042
+0.371611 0.111286 0.281178
+0.378247 0.099648 0.307710
+0.394570 0.079100 0.338162
+0.416351 0.038242 0.333196
+0.417830 0.042111 0.293185
+0.430829 0.039852 0.251519
+0.427375 0.079094 0.261696
+0.452757 0.101221 0.232921
+0.431060 0.088368 0.204739
+0.384616 0.086474 0.244279
+0.416919 0.124304 0.189584
+0.448928 0.116694 0.166079
+0.402548 0.157029 0.204021
+0.405248 0.099612 0.223420
+0.394667 0.126257 0.226234
+0.393587 0.155514 0.157489
+0.388278 0.150483 0.241885
+0.363290 0.151279 0.275569
+0.369461 0.131040 0.246673
+0.365592 0.135952 0.213237
+0.355959 0.141295 0.179707
+0.320616 0.134892 0.181918
--- /dev/null
+0.347624 0.090959 0.454834
+0.446215 0.124000 0.370817
+0.409839 0.143155 0.295004
+0.440759 0.090281 0.296885
+0.465214 0.048451 0.542712
+0.471598 0.086037 0.483358
+0.372213 0.179217 0.438123
+0.592442 0.166741 0.433982
+0.399563 0.151320 0.400160
+0.479513 0.108517 0.258405
+0.485953 0.066923 0.193914
+0.548002 0.077271 0.152336
+0.565599 0.143205 0.140294
+0.558550 0.201462 0.109620
+0.607051 0.211633 0.152670
+0.670273 0.190261 0.139432
+0.430187 0.478301 0.135903
+0.148336 0.680821 0.114594
+0.185120 0.925628 0.147625
+0.249453 0.196637 0.241588
+0.179636 0.162617 0.313756
+0.586115 0.159387 0.307418
+0.472213 0.142351 0.245426
+0.384650 0.125831 0.240183
+0.332192 0.095235 0.255403
+0.300937 0.083633 0.239104
+0.282901 0.084036 0.324663
+0.264823 0.053630 0.355336
+0.262817 0.057144 0.308867
+0.235162 0.063366 0.290788
+0.225952 0.074491 0.259080
+0.250763 0.056393 0.263298
+0.261983 0.035121 0.221390
+0.232025 0.071049 0.211475
+0.251247 0.084420 0.177652
+0.317549 0.092361 0.194930
+0.376276 0.108869 0.213490
+0.407707 0.134249 0.200956
+0.324354 0.161579 0.180522
+0.155666 0.212650 0.191861
+0.276764 0.149348 0.164832
+0.232067 0.140034 0.296200
+0.202557 0.227413 0.232181
+0.213631 0.254317 0.286816
+0.230290 0.348972 0.223799
+0.073922 0.234044 0.444311
+0.165732 0.157286 0.377940
+0.143741 0.116266 0.367517
+0.170743 0.108278 0.335489
+0.204941 0.105478 0.323687
+0.232372 0.096166 0.294273
+0.249692 0.106680 0.233431
+0.247681 0.098716 0.205549
+0.285627 0.093674 0.181026
+0.273729 0.071657 0.199517
+0.324046 0.078751 0.174477
+0.320316 0.099534 0.141530
+0.305721 0.138944 0.194222
+0.307697 0.112445 0.306832
+0.263996 0.168409 0.279904
+0.209440 0.206560 0.352981
+0.207167 0.322235 0.237881
+0.248742 0.300747 0.244987
+0.244240 0.372015 0.250098
+0.311161 0.424673 0.225040
+0.297068 0.321411 0.313296
+0.379598 0.254957 0.371188
+0.432562 0.150907 0.250569
+0.490914 0.159011 0.203063
+0.459581 0.210629 0.184517
+0.365981 0.161992 0.242609
+0.273934 0.337911 0.234642
+0.303721 0.505646 0.388642
+0.245707 0.638533 0.280329
+0.225268 0.652879 0.192438
+0.258619 0.514447 0.279012
+0.316225 0.442602 0.335354
+0.376736 0.486777 0.308274
+0.327223 0.324066 0.242576
+0.485431 0.280997 0.355045
+0.572007 0.122510 0.240640
+0.616966 0.130938 0.227853
+0.513791 0.196874 0.180058
+0.466626 0.182542 0.223111
+0.402779 0.115602 0.343902
+0.375184 0.115227 0.402459
+0.273038 0.096940 0.441549
+0.286064 0.098337 0.549602
+0.246440 0.074548 0.556880
+0.236129 0.064941 0.588188
+0.209837 0.057975 0.532197
+0.259255 0.105430 0.407552
+0.302610 0.088086 0.382011
+0.330261 0.083490 0.318869
+0.339807 0.116430 0.207260
+0.296092 0.172928 0.144366
+0.253885 0.186664 0.166529
+0.277668 0.172442 0.196902
+0.314677 0.169787 0.285051
+0.278732 0.261731 0.151343
+0.192094 0.380939 0.072290
+0.164268 0.445241 0.088517
+0.213885 0.495691 0.078607
+0.244315 0.538432 0.099402
+0.213845 0.607105 0.091577
+0.286835 0.597563 0.087259
+0.318522 0.532846 0.080556
+0.284601 0.472920 0.105552
+0.326441 0.404994 0.109082
+0.361786 0.342944 0.134275
+0.405219 0.182087 0.266692
+0.339703 0.133107 0.349810
+0.318105 0.105264 0.418487
+0.268618 0.127749 0.519300
+0.210097 0.094867 0.551063
+0.184708 0.182810 0.698480
+0.158544 0.111449 0.634672
+0.170413 0.071464 0.657281
+0.171397 0.082903 0.699070
+0.201223 0.064064 0.627255
+0.180269 0.136502 0.501476
+0.221574 0.070933 0.434092
+0.211382 0.073149 0.481703
+0.114169 0.100113 0.915283
+0.146052 0.246456 0.633652
+0.275922 0.245082 0.498471
+0.266161 0.247382 0.434042
+0.302721 0.126115 0.373389
+0.300980 0.138225 0.249755
+0.290909 0.136927 0.286352
+0.350897 0.109421 0.304023
+0.386165 0.088656 0.245381
+0.382333 0.105625 0.151256
+0.421477 0.091637 0.128128
+0.404884 0.121558 0.102941
+0.322205 0.220312 0.077762
+0.283695 0.260465 0.065194
+0.383440 0.199544 0.094240
+0.480839 0.209932 0.141564
+0.441391 0.230279 0.141240
+0.362251 0.290803 0.099062
+0.301174 0.368993 0.092277
+0.377409 0.363282 0.091280
+0.337772 0.461506 0.076775
+0.373032 0.519469 0.124106
+0.314757 0.552002 0.139769
+0.250607 0.492442 0.145557
+0.335493 0.328724 0.166487
+0.534645 0.644574 0.182718
+0.488781 0.353657 0.328925
+0.554548 0.233808 0.376737
+0.492450 0.553839 0.367700
+0.394815 0.210972 0.142784
+0.238589 0.303384 0.080013
+0.224147 0.255123 0.068313
+0.256497 0.235171 0.099373
+0.297511 0.154648 0.113728
+0.305673 0.117198 0.107972
+0.290657 0.090218 0.126335
+0.258861 0.096775 0.145361
+0.259983 0.099517 0.110715
+0.118646 0.148765 0.076387
+0.145023 0.105727 0.109695
+0.181102 0.134847 0.077805
+0.211445 0.088585 0.101849
+0.198248 0.105956 0.172142
+0.180296 0.129252 0.141319
+0.221042 0.083049 0.144665
+0.212791 0.063744 0.179816
+0.167506 0.115897 0.208529
+0.205822 0.062715 0.241237
+0.172651 0.083940 0.183620
+0.124447 0.084470 0.196419
+0.186739 0.063095 0.269351
+0.160093 0.104677 0.295459
+0.143447 0.142741 0.276552
+0.123263 0.196627 0.476282
+0.108325 0.605694 0.334137
+0.285290 0.315781 0.362135
+0.353244 0.270895 0.333924
+0.263653 0.300345 0.291813
+0.208575 0.465618 0.269759
+0.220467 0.418879 0.223504
+0.146022 0.320151 0.302772
+0.183727 0.325046 0.366600
+0.171236 0.313334 0.429997
+0.247905 0.276696 0.319839
+0.127071 0.396634 0.387451
+0.073374 0.373431 0.434696
+0.210963 0.363358 0.326782
+0.268129 0.366304 0.302607
+0.276157 0.386117 0.406186
+0.340781 0.360413 0.321075
+0.431904 0.276036 0.404829
+0.495040 0.225348 0.450453
+0.262250 0.219954 0.192843
+0.261002 0.142204 0.241314
+0.278943 0.115884 0.204352
+0.260726 0.138775 0.101751
+0.183464 0.210049 0.109076
+0.162266 0.261270 0.088046
+0.236604 0.196725 0.126686
+0.316678 0.196107 0.179685
+0.243299 0.306025 0.151947
+0.400615 0.162590 0.232750
+0.372639 0.216589 0.209970
+0.140820 0.222509 0.129726
+0.097670 0.184209 0.193834
+0.193869 0.127067 0.282177
+0.208523 0.142275 0.352114
+0.126584 0.151378 0.342813
+0.235628 0.172984 0.215508
+0.249437 0.175207 0.390557
+0.255433 0.127918 0.372391
+0.359147 0.151917 0.290168
+0.351722 0.205430 0.115799
+0.267453 0.279897 0.108704
+0.350766 0.239207 0.087893
+0.318117 0.273230 0.085462
+0.381113 0.237724 0.065900
+0.219080 0.256349 0.369571
+0.196609 0.194954 0.411062
+0.213051 0.139071 0.398959
+0.244873 0.146332 0.435157
+0.235630 0.181860 0.511397
+0.292860 0.209424 0.147620
+0.331811 0.148006 0.093985
+0.293049 0.144326 0.069176
+0.281985 0.195922 0.077879
+0.228381 0.205538 0.080972
+0.235938 0.163446 0.071037
+0.168487 0.195102 0.072566
+0.199465 0.163509 0.108306
+0.255681 0.174779 0.108553
+0.302851 0.083047 0.155297
+0.321466 0.113845 0.176969
+0.338191 0.096339 0.224480
+0.360544 0.065938 0.241459
+0.378601 0.057338 0.276674
+0.368373 0.076055 0.310651
+0.344437 0.070848 0.286673
+0.376329 0.104163 0.278687
+0.355476 0.110470 0.243634
+0.362002 0.085143 0.260003
+0.411330 0.051881 0.247678
+0.414240 0.068326 0.276653
+0.410484 0.082208 0.354845
+0.418149 0.061438 0.388696
+0.433860 0.142628 0.438577
+0.495950 0.091923 0.413338
+0.434164 0.131070 0.325030
+0.347126 0.153569 0.402577
+0.458076 0.093458 0.443701
+0.495375 0.120909 0.562539
+0.589514 0.080183 0.512524
+0.531194 0.063220 0.328711
+0.499017 0.059249 0.243179
+0.530991 0.079568 0.259341
+0.585658 0.077791 0.416801
+0.536002 0.122366 0.473100
+0.511945 0.062231 0.459896
+0.486451 0.116847 0.370233
+0.481843 0.144265 0.420622
+0.407554 0.241229 0.282167
+0.320925 0.282038 0.252246
+0.225131 0.374849 0.479590
+0.228011 0.237458 0.622277
+0.261961 0.179596 0.806264
+0.076218 0.139692 1.043456
+0.151340 0.328626 0.887716
+0.337210 0.198192 0.379580
+0.460842 0.167548 0.160717
+0.477628 0.229247 0.072684
+0.451350 0.203095 0.091994
+0.420022 0.110903 0.058632
+0.449733 0.161924 0.093239
+0.411145 0.163560 0.078750
+0.435222 0.142044 0.126205
+0.420083 0.099757 0.203874
+0.370276 0.131184 0.131964
+0.354905 0.098162 0.185357
+0.354880 0.098109 0.151202
+0.355875 0.081150 0.202714
+0.329850 0.070604 0.206228
+0.326647 0.063899 0.235204
+0.330171 0.045901 0.207938
+0.329941 0.047031 0.176438
+0.337293 0.074879 0.140863
+0.368014 0.066698 0.168744
+0.300423 0.104975 0.266224
+0.156403 0.547850 0.093121
+0.288125 0.304080 0.176781
+0.210923 0.180445 0.267334
+0.236880 0.217374 0.275212
+0.213759 0.376162 0.184946
+0.372297 0.209676 0.309731
+0.445389 0.226789 0.291673
+0.519740 0.112223 0.265429
+0.472434 0.174961 0.115646
+0.417682 0.274453 0.070003
+0.458596 0.258372 0.047548
+0.455272 0.274496 0.086373
+0.444215 0.318398 0.074804
+0.427749 0.360899 0.081827
+0.369149 0.335197 0.063361
+0.408385 0.324949 0.072860
+0.384052 0.298347 0.060899
+0.373725 0.264760 0.080748
+0.352145 0.176148 0.080707
+0.310910 0.188712 0.108730
+0.250319 0.151051 0.140139
+0.238071 0.144852 0.173219
+0.228573 0.106294 0.172491
+0.217371 0.097639 0.248280
+0.253003 0.069144 0.233568
+0.256968 0.055968 0.160406
+0.235219 0.115044 0.075964
+0.336525 0.077151 0.097771
+0.295976 0.059336 0.123351
+0.324309 0.059429 0.397350
+0.348266 0.106120 0.501358
+0.340380 0.127511 0.440305
+0.275937 0.136374 0.468843
+0.266087 0.282816 0.379226
+0.228482 0.306643 0.416738
+0.246227 0.200955 0.450023
+0.318533 0.209335 0.569205
+0.413909 0.089360 0.618461
+0.382377 0.110800 0.185218
+0.298919 0.076922 0.206253
+0.295486 0.062198 0.170334
+0.220572 0.123944 0.132661
+0.199126 0.138104 0.199012
+0.150799 0.164435 0.128584
+0.141718 0.112651 0.157620
+0.218667 0.109546 0.215544
+0.255989 0.086240 0.259903
+0.300656 0.046011 0.269817
+0.291157 0.059173 0.236624
+0.310810 0.077525 0.293206
+0.314641 0.049528 0.310313
+0.279240 0.086840 0.353600
+0.165264 0.103047 0.417338
+0.208135 0.117070 0.429435
+0.232791 0.103415 0.462895
+0.271864 0.129281 0.319815
+0.366981 0.141852 0.212178
+0.373262 0.242359 0.117112
+0.422067 0.278600 0.123501
+0.338944 0.345572 0.098531
+0.308216 0.428668 0.066433
+0.271454 0.398601 0.070491
+0.278913 0.492798 0.060932
+0.247776 0.441372 0.071561
+0.343570 0.386117 0.081017
+0.461654 0.239819 0.108222
+0.430485 0.272031 0.176591
+0.408685 0.297320 0.097183
+0.485213 0.284632 0.069179
+0.461397 0.373449 0.100410
+0.671420 0.378029 0.088090
+0.808405 0.276010 0.102934
+0.704869 0.430068 0.070162
+0.554941 0.507594 0.125272
+0.359919 0.301913 0.230542
+0.251847 0.314817 0.199777
+0.293156 0.307596 0.224547
+0.356977 0.402190 0.240191
+0.290117 0.743767 0.395678
+0.392248 0.703453 0.280630
+0.476220 0.520924 0.129796
+0.527212 0.411812 0.063633
+0.542919 0.358453 0.095274
+0.556482 0.315834 0.117993
+0.482078 0.326051 0.096336
+0.420379 0.426709 0.088736
+0.369052 0.415845 0.093306
+0.437630 0.334794 0.118496
+0.466644 0.293770 0.233791
+0.508918 0.228596 0.222776
+0.484639 0.121415 0.212331
+0.443499 0.096268 0.231387
+0.511197 0.174015 0.270205
+0.352556 0.283611 0.272015
+0.293392 0.425947 0.162990
+0.332821 0.275494 0.174376
+0.298858 0.241340 0.192968
+0.305188 0.294785 0.139588
+0.375530 0.449251 0.144064
+0.292345 0.781183 0.254538
+0.358461 0.243978 0.182222
+0.415777 0.244409 0.238222
+0.467064 0.146980 0.298146
+0.416339 0.232371 0.189786
+0.191873 0.319957 0.083328
+0.203436 0.360141 0.135797
+0.374532 0.135837 0.364913
+0.268287 0.102231 0.714801
+0.254501 0.146265 0.649860
+0.218848 0.270739 0.467287
+0.188426 0.170744 0.462937
+0.245247 0.107864 0.332378
+0.122418 0.152546 0.533111
+0.079016 0.314882 0.596442
+0.126964 0.240808 0.550476
+0.075791 0.140645 0.502026
+0.093230 0.113111 0.626546
+0.172159 0.080636 0.831021
+0.068199 0.206815 0.906033
+0.062132 0.233971 0.778223
+0.074593 0.142563 0.751383
+0.109526 0.088462 0.775006
+0.124547 0.075148 0.714916
+0.219269 0.045432 0.388959
+0.127591 0.145316 0.230824
+0.075140 0.099358 0.462657
+0.064338 0.123266 0.563272
+0.078238 0.117014 0.688975
+0.084643 0.135331 0.834358
+0.139739 0.180181 0.788226
+0.146212 0.130036 0.742469
+0.142021 0.071166 0.618520
+0.264581 0.062830 0.446908
+0.320084 0.063118 0.350973
+0.396868 0.104191 0.308665
+0.464396 0.100744 0.190844
+0.474587 0.135638 0.122223
+0.505265 0.164031 0.083774
+0.508671 0.149050 0.116783
+0.494586 0.165303 0.148019
+0.472521 0.133399 0.178996
+0.472105 0.087004 0.224228
+0.446638 0.121806 0.273503
+0.367261 0.095789 0.337281
+0.359383 0.069161 0.376118
+0.283834 0.061745 0.401507
+0.233699 0.158991 0.567659
+0.131424 0.169028 0.614621
+0.073539 0.165230 0.608024
+0.084229 0.293229 0.506663
+0.148758 0.720830 0.237339
+0.256384 0.243042 0.348749
+0.395262 0.183863 0.343968
+0.381026 0.153580 0.322679
+0.344857 0.169307 0.357051
+0.180931 0.274934 0.267210
+0.133417 0.315317 0.364657
+0.184162 0.267604 0.330168
+0.220026 0.283042 0.231767
+0.259555 0.237606 0.232106
+0.276933 0.249820 0.287878
+0.349980 0.282625 0.421991
+0.481016 0.212218 0.325727
+0.458797 0.184528 0.274070
+0.484482 0.148105 0.341873
+0.526047 0.155385 0.400111
+0.526136 0.175193 0.328794
+0.556038 0.116326 0.373700
+0.437912 0.183108 0.320129
+0.154855 0.684819 0.527786
+0.142128 0.492151 0.711010
+0.062256 0.311531 0.691655
+0.180612 0.307234 0.730728
+0.152739 0.786052 0.357275
+0.421748 0.155971 0.355152
+0.513427 0.140653 0.180397
+0.503293 0.090152 0.226204
+0.470923 0.079454 0.290961
+0.458356 0.094363 0.377705
+0.447899 0.062986 0.355100
+0.490749 0.048144 0.340535
+0.490854 0.079767 0.368968
+0.568302 0.078153 0.271815
+0.574387 0.098205 0.200963
+0.644881 0.089413 0.208920
+0.636596 0.088651 0.058559
+0.553118 0.323894 0.063352
+0.583298 0.295978 0.091612
+0.606749 0.318066 0.058865
+0.487005 0.454915 0.177572
+0.329222 0.315592 0.285150
+0.299399 0.277718 0.282728
+0.302006 0.358174 0.148859
+0.334243 0.327319 0.350426
+0.291480 0.333984 0.274831
+0.383078 0.333489 0.255643
+0.406396 0.413215 0.258302
+0.479588 0.360631 0.169112
+0.594135 0.255844 0.137076
+0.847445 0.093619 0.248967
+0.810961 0.161433 0.181118
+0.732094 0.308294 0.140083
+0.623878 0.379968 0.070210
+0.567617 0.374818 0.060450
+0.664229 0.294886 0.104059
+0.645906 0.246204 0.135086
+0.673058 0.227775 0.100138
+0.659455 0.250925 0.067423
+0.627904 0.283712 0.067938
+0.581249 0.267066 0.063458
+0.617716 0.219403 0.068390
+0.599018 0.303403 0.166919
+0.450459 0.568624 0.270030
+0.497221 0.226918 0.270466
+0.411324 0.232483 0.331049
+0.320406 0.443850 0.269652
+0.187291 0.561422 0.165638
+0.294572 0.343681 0.200707
+0.326397 0.258546 0.286441
+0.279400 0.306226 0.260735
+0.193123 0.385992 0.258247
+0.342327 0.381838 0.147491
+0.433089 0.378484 0.207774
+0.362956 0.347448 0.222551
+0.361638 0.480201 0.226996
+0.384522 0.377667 0.186341
+0.427881 0.296866 0.282612
+0.563327 0.229524 0.304696
+0.567170 0.247155 0.202733
+0.585411 0.220038 0.115594
+0.519250 0.229429 0.071582
+0.466406 0.348495 0.062605
+0.474052 0.430997 0.059085
+0.456952 0.434321 0.092489
+0.443242 0.479322 0.066114
+0.424170 0.532398 0.074007
+0.394911 0.475416 0.086889
+0.452632 0.411710 0.140813
+0.403571 0.307690 0.141199
+0.330609 0.309675 0.202639
+0.162152 0.333000 0.246273
+0.104212 0.372786 0.256919
+0.136824 0.521324 0.228461
+0.104865 0.608493 0.187863
+0.112234 0.499159 0.140580
+0.103176 0.394350 0.106114
+0.097342 0.431118 0.194462
+0.199846 0.166342 0.150206
+0.257308 0.138618 0.204462
+0.377777 0.076428 0.214777
+0.396461 0.078672 0.186686
+0.412491 0.083042 0.157354
+0.409492 0.113963 0.166822
+0.402656 0.132414 0.136860
+0.384318 0.169269 0.141277
+0.379760 0.142363 0.169790
+0.434051 0.125795 0.180081
+0.291493 0.229394 0.111634
+0.413319 0.193400 0.112837
+0.413655 0.226896 0.114264
+0.433596 0.176677 0.130118
+0.324845 0.251559 0.120351
+0.359504 0.214180 0.154811
+0.415838 0.197748 0.221624
+0.330767 0.232694 0.237892
+0.283703 0.199163 0.276558
+0.402389 0.264705 0.562024
+0.405915 0.068161 0.722076
+0.408789 0.081683 0.224705
+0.412949 0.070850 0.318290
+0.383543 0.088037 0.376585
+0.413842 0.087764 0.457480
+0.394697 0.085379 0.526908
+0.326022 0.124012 0.545103
+0.360363 0.103599 0.573651
+0.374875 0.071392 0.577138
+0.426542 0.064067 0.485994
+0.414344 0.062295 0.436129
+0.357597 0.053368 0.442984
+0.352690 0.061527 0.481466
+0.435965 0.091560 0.330005
+0.452104 0.173696 0.389629
+0.240811 0.227686 0.399164
+0.387054 0.212876 0.250823
+0.348481 0.199112 0.239045
+0.406692 0.124037 0.262865
+0.364589 0.130457 0.265840
+0.418494 0.152965 0.158070
+0.525395 0.176045 0.224438
+0.649496 0.162294 0.265624
+0.577476 0.087708 0.311571
+0.635120 0.080693 0.336377
+0.695460 0.066421 0.421660
+0.621358 0.149936 0.353147
+0.567838 0.187842 0.239684
+0.610053 0.188465 0.189601
+0.290729 0.370305 0.245506
+0.474752 0.256582 0.192554
+0.523264 0.281951 0.174076
+0.487445 0.266791 0.140722
+0.418187 0.308871 0.224831
+0.542461 0.339261 0.179909
+0.660046 0.325237 0.064232
+0.699190 0.263381 0.081222
+0.771760 0.141829 0.114068
+0.849307 0.167518 0.110492
+0.768620 0.215479 0.101016
+0.943168 0.112917 0.126022
+0.700213 0.207371 0.114043
+0.520214 0.355040 0.056977
+0.501121 0.416740 0.097933
+0.413408 0.446710 0.207348
+0.316233 0.501402 0.172782
+0.422015 0.299620 0.334807
+0.467201 0.278473 0.294606
+0.449356 0.314132 0.169959
+0.383191 0.318048 0.185054
+0.263466 0.409830 0.258522
+0.344203 0.180472 0.319223
+0.362266 0.169616 0.180383
+0.341699 0.182702 0.146822
+0.335987 0.174976 0.210809
+0.395083 0.165288 0.194206
+0.465646 0.099187 0.323536
+0.462006 0.053739 0.310921
+0.455068 0.081078 0.262737
+0.418012 0.119395 0.233351
+0.345448 0.135789 0.188425
+0.351492 0.162596 0.117706
+0.344759 0.149410 0.147248
+0.314307 0.134967 0.151339
+0.286415 0.116093 0.164754
+0.277756 0.126139 0.130984
+0.361188 0.110945 0.070191
+0.361209 0.201107 0.056536
+0.284536 0.314088 0.069545
+0.432086 0.300442 0.045010
+0.395858 0.449191 0.053920
+0.358265 0.503243 0.063399
+0.373607 0.577103 0.071048
+0.277978 0.673759 0.088057
+0.361589 0.613722 0.123032
+0.384724 0.684712 0.091070
+0.459571 0.724691 0.081391
+0.440636 0.611416 0.071085
+0.491405 0.544525 0.066202
+0.495390 0.482599 0.069217
+0.585200 0.253363 0.096585
+0.538917 0.276943 0.073936
+0.500464 0.315306 0.054544
+0.664338 0.150817 0.196704
+0.500195 0.080074 0.282262
+0.530558 0.067443 0.375424
+0.440087 0.352641 0.277248
+0.390681 0.267263 0.209143
+0.359333 0.241690 0.261267
+0.370447 0.247920 0.308405
+0.336215 0.226039 0.305830
+0.195785 0.339497 0.283349
+0.151348 0.445352 0.258280
+0.266713 0.219848 0.307969
+0.218114 0.294964 0.285277
+0.174107 0.381064 0.212437
+0.155914 0.377087 0.116389
+0.134386 0.253742 0.304443
+0.151029 0.213087 0.353221
+0.217483 0.140058 0.241820
+0.242753 0.116518 0.270671
+0.285332 0.068762 0.270927
+0.317498 0.078582 0.264060
+0.277862 0.110739 0.250417
+0.308456 0.109889 0.221582
+0.276315 0.089684 0.226545
+0.333980 0.135929 0.231792
+0.334591 0.166897 0.259283
+0.397876 0.537888 0.188209
+0.290878 0.394567 0.198465
+0.163752 0.435990 0.173066
+0.191115 0.481622 0.133956
+0.260636 0.377095 0.197277
+0.338080 0.235880 0.426527
+0.378463 0.127767 0.454089
+0.385046 0.056905 0.498118
+0.374068 0.049953 0.405294
+0.271022 0.098818 0.289459
+0.182680 0.217988 0.292618
+0.225435 0.235809 0.318205
+0.177229 0.103515 0.463042
+0.175834 0.055640 0.486987
+0.183210 0.062875 0.440837
+0.226003 0.097193 0.366732
+0.251396 0.070201 0.393377
+0.234201 0.074576 0.326442
+0.223004 0.066314 0.353857
+0.186211 0.106789 0.245913
+0.151535 0.094840 0.253435
+0.195080 0.089425 0.287492
+0.162720 0.067083 0.227111
+0.196415 0.076298 0.212223
+0.180505 0.083889 0.141164
+0.246234 0.066099 0.131760
+0.282666 0.087223 0.081269
+0.340580 0.122366 0.117784
+0.376555 0.091363 0.111974
+0.393102 0.087543 0.417517
+0.297217 0.163487 0.549749
+0.362450 0.174227 0.634258
+0.323933 0.627863 0.231764
+0.327261 0.458545 0.128228
+0.345717 0.429564 0.187171
+0.260069 0.337062 0.335170
+0.306881 0.385334 0.293359
+0.271898 0.457259 0.215823
+0.259289 0.441347 0.303200
+0.363305 0.398019 0.291679
+0.291795 0.279053 0.324220
+0.294547 0.262771 0.399943
+0.371243 0.306137 0.366069
+0.382008 0.339743 0.307443
+0.438316 0.228950 0.367986
+0.537463 0.298231 0.257224
+0.645494 0.307091 0.289935
+0.669328 0.320508 0.177252
+0.616771 0.434999 0.131058
+0.565925 0.511230 0.217275
+0.568203 0.409220 0.089091
+0.577548 0.394258 0.217345
+0.648943 0.237348 0.200174
+0.599721 0.237036 0.256373
+0.754878 0.197561 0.266084
+0.714487 0.175657 0.200087
+0.710745 0.237411 0.165014
+0.720827 0.339743 0.072832
+0.545081 0.459358 0.071144
+0.346804 0.807739 0.104644
+0.216743 0.762837 0.120249
+0.197697 0.658146 0.387627
+0.165912 0.499878 0.549502
+0.241754 0.317091 0.529186
+0.169200 0.553212 0.416930
+0.320751 0.621112 0.366138
+0.337485 0.556049 0.269330
+0.250664 0.574848 0.514561
+0.140209 0.430307 0.459246
+0.162363 0.246323 0.477493
+0.381402 0.092797 0.469234
+0.459381 0.155970 0.481903
+0.442539 0.088546 0.414977
+0.408686 0.121373 0.498045
+0.329248 0.153610 0.482630
+0.331997 0.142511 0.315883
+0.221799 0.396419 0.292101
+0.176966 0.273274 0.211951
+0.203478 0.286430 0.129390
+0.216827 0.258314 0.184043
+0.234488 0.175930 0.313819
+0.311501 0.270429 0.211948
+0.294432 0.162487 0.229611
+0.329328 0.117112 0.277223
+0.416641 0.099298 0.274074
+0.554873 0.155235 0.201501
+0.569426 0.189358 0.155950
+0.539367 0.241198 0.105444
+0.501517 0.357700 0.084370
+0.545573 0.281564 0.125541
+0.514425 0.301811 0.096910
+0.460345 0.293995 0.114532
+0.487409 0.345311 0.229900
+0.412521 0.355808 0.145545
+0.509374 0.347915 0.128813
+0.629454 0.215821 0.104369
+0.658561 0.176420 0.084630
+0.700668 0.136656 0.112851
+0.667071 0.122890 0.157514
+0.612182 0.148628 0.155034
+0.539605 0.176739 0.090625
+0.590039 0.124542 0.106912
+0.629817 0.100757 0.139713
+0.604716 0.105384 0.173581
+0.720555 0.111138 0.330763
+0.245112 0.336634 0.265337
+0.226689 0.424271 0.348303
+0.329654 0.359100 0.261678
+0.379459 0.286999 0.299860
+0.342863 0.299943 0.318446
+0.330710 0.371149 0.198420
+0.285053 0.275836 0.238793
+0.361749 0.196487 0.281140
+0.406042 0.191956 0.297341
+0.445690 0.223770 0.237164
+0.393133 0.274606 0.262027
+0.544286 0.142320 0.276324
+0.619365 0.107015 0.281186
+0.607150 0.081004 0.243243
+0.678787 0.091345 0.263915
+0.734877 0.105834 0.242728
+0.694254 0.100473 0.181406
+0.758976 0.109087 0.167450
+0.565683 0.217978 0.071529
+0.445274 0.395501 0.058069
+0.484692 0.379794 0.062350
+0.214619 0.245836 0.117895
+0.246969 0.229441 0.150311
+0.385481 0.258270 0.151377
+0.353085 0.290950 0.141139
+0.535642 0.170306 0.146284
+0.446113 0.090546 0.161019
+0.348613 0.118759 0.163942
+0.256859 0.116937 0.175945
+0.095533 0.124223 0.128081
+0.104333 0.215306 0.075249
+0.100294 0.187881 0.135738
+0.148622 0.275139 0.167339
+0.078452 0.360587 0.329967
+0.127610 0.289917 0.238589
+0.148272 0.316966 0.121487
+0.085461 0.330668 0.163259
+0.142401 0.216090 0.250904
+0.175731 0.166076 0.233510
+0.152278 0.156198 0.181459
+0.193328 0.210638 0.148227
+0.207811 0.191064 0.188672
+0.296438 0.161485 0.325233
+0.306068 0.199688 0.322695
+0.342566 0.219355 0.346721
+0.291750 0.188465 0.494566
+0.352065 0.234211 0.491138
+0.383860 0.596099 0.458394
+0.386344 0.202868 0.380113
+0.399359 0.282461 0.474285
+0.322622 0.279134 0.358938
+0.347701 0.262331 0.223429
+0.424998 0.191838 0.164353
+0.451151 0.131623 0.217203
+0.456273 0.120859 0.149404
+0.490554 0.108928 0.157243
+0.517816 0.130242 0.142810
+0.500090 0.217505 0.103504
+0.514504 0.191274 0.118656
+0.554806 0.122508 0.163126
+0.442524 0.162708 0.199911
+0.388949 0.157852 0.109288
+0.504477 0.095186 0.125173
+0.477591 0.066576 0.138585
+0.452216 0.100773 0.107700
+0.485286 0.127587 0.074852
+0.488827 0.194629 0.066040
+0.426576 0.237428 0.067677
+0.340727 0.291206 0.061076
+0.243435 0.361855 0.071906
+0.382323 0.324483 0.098684
+0.414425 0.354228 0.048282
+0.401390 0.400107 0.040249
+0.403756 0.393196 0.073045
+0.357685 0.422727 0.054290
+0.376221 0.373641 0.056815
+0.334172 0.375680 0.054225
+0.296174 0.361326 0.050408
+0.326273 0.330339 0.064557
+0.420692 0.255904 0.094806
+0.421944 0.199537 0.068849
+0.326830 0.232006 0.153704
+0.301454 0.201485 0.233060
+0.258842 0.191789 0.343414
+0.294282 0.195861 0.362979
+0.286399 0.234317 0.360778
+0.319442 0.214047 0.274131
+0.333404 0.220264 0.204146
+0.386995 0.195077 0.182131
+0.404880 0.215968 0.423836
+0.477146 0.435211 0.260239
+0.532189 0.227684 0.146512
+0.568278 0.159946 0.110703
+0.605267 0.174809 0.088477
+0.624009 0.142924 0.112772
+0.652905 0.148818 0.139204
+0.714256 0.157313 0.148093
+0.720760 0.199261 0.080657
+0.741518 0.278514 0.083257
+0.566298 0.527298 0.062699
+0.445052 0.597589 0.130277
+0.526449 0.626948 0.074424
+0.801938 0.367141 0.075543
+0.916524 0.255963 0.112835
+0.645568 0.521635 0.064144
+0.608913 0.448818 0.064142
+0.629099 0.328544 0.099333
+0.620582 0.182449 0.132128
+0.590707 0.148356 0.186809
+0.543143 0.102875 0.300062
+0.527847 0.116107 0.336959
+0.499887 0.117763 0.297680
+0.508919 0.134512 0.236929
+0.531706 0.109558 0.239043
+0.541620 0.120673 0.208110
+0.517661 0.098274 0.183512
+0.449983 0.054085 0.247178
+0.575793 0.062186 0.355346
+0.489231 0.203337 0.380285
+0.340551 0.340643 0.414281
+0.210167 0.526078 0.337705
+0.284920 0.525512 0.222620
+0.208797 0.499630 0.207868
+0.267127 0.583546 0.176083
+0.228186 0.428672 0.171167
+0.258450 0.355455 0.160617
+0.273653 0.409657 0.120028
+0.264098 0.344696 0.111979
+0.222486 0.415597 0.112772
+0.199350 0.325482 0.185961
+0.294632 0.157878 0.367064
+0.346967 0.102272 0.381014
+0.324707 0.101328 0.346674
+0.300669 0.154767 0.427674
+0.297977 0.190730 0.402531
+0.322781 0.242743 0.378056
+0.419505 0.654624 0.200084
+0.318601 0.692538 0.162850
+0.178499 0.579044 0.270280
+0.195204 0.388057 0.398083
+0.241827 0.349617 0.379452
+0.315199 0.303795 0.489292
+0.380392 0.178450 0.504430
+0.414296 0.143625 0.555054
+0.339645 0.110851 0.633101
+0.315159 0.082478 0.583218
+0.337965 0.059219 0.531018
+0.321096 0.080831 0.498225
+0.307444 0.107476 0.461283
+0.278693 0.093535 0.490594
+0.252057 0.083619 0.514079
+0.224412 0.111350 0.505414
+0.169223 0.083911 0.512845
+0.208880 0.083504 0.402948
+0.187837 0.073111 0.335010
+0.206755 0.055269 0.311264
+0.156291 0.062835 0.298062
+0.156028 0.064082 0.415247
+0.129754 0.074279 0.474540
+0.183725 0.101044 0.375452
+0.181248 0.060180 0.378248
+0.178353 0.183494 0.547763
+0.303398 0.241676 0.322364
+0.263082 0.269825 0.205102
+0.295290 0.241493 0.251070
+0.310143 0.206645 0.446008
+0.249752 0.262630 0.261739
+0.225039 0.305225 0.344815
+0.153658 0.404495 0.314509
+0.142025 0.474338 0.358307
+0.228656 0.455858 0.431304
+0.360261 0.434834 0.461602
+0.432447 0.356868 0.399441
+0.405888 0.423867 0.341787
+0.307752 0.379122 0.354664
+0.495951 0.255588 0.098194
+0.590320 0.364141 0.130834
+0.523157 0.411325 0.142398
+0.622815 0.267082 0.098576
+0.586226 0.337718 0.086861
+0.396476 0.396958 0.127666
+0.278385 0.309875 0.439028
+0.210412 0.240403 0.530267
+0.142154 0.341782 0.515974
+0.236712 0.330636 0.302147
+0.313995 0.313085 0.102247
+0.536878 0.123790 0.095432
+0.546579 0.066696 0.222251
+0.528723 0.046496 0.288028
+0.490438 0.079978 0.328045
+0.416715 0.108530 0.389254
+0.350888 0.083964 0.417653
+0.307331 0.062124 0.473629
+0.274119 0.115537 0.597408
+0.226906 0.099518 0.609696
+0.147094 0.067376 0.550921
+0.178994 0.061997 0.585308
+0.132607 0.110425 0.587137
+0.110327 0.099682 0.549983
+0.068912 0.202205 0.534312
+0.065072 0.231313 0.620174
+0.080325 0.190639 0.689245
+0.127351 0.125355 0.674554
+0.110891 0.072596 0.663783
+0.097157 0.070549 0.589126
+0.106411 0.082418 0.509171
+0.125632 0.088198 0.439270
+0.126006 0.083980 0.396385
+0.144132 0.069483 0.352444
+0.105337 0.088013 0.358993
+0.119785 0.099438 0.312550
+0.070842 0.142954 0.331889
+0.071861 0.089577 0.402256
+0.108923 0.084005 0.258422
+0.092866 0.123378 0.193507
+0.088292 0.071041 0.315009
+0.063561 0.165270 0.420738
+0.074840 0.133173 0.262739
+0.089400 0.194231 0.262021
+0.079851 0.205849 0.344821
+0.157143 0.146865 0.421765
+0.125245 0.208011 0.414350
+0.174337 0.251983 0.396703
+0.084886 0.272191 0.354568
+0.110693 0.292372 0.436834
+0.211165 0.375835 0.619400
+0.062966 0.412899 0.552075
+0.081388 0.529721 0.443287
+0.081245 0.483334 0.304728
+0.138084 0.348639 0.182624
+0.103443 0.309738 0.080859
+0.104109 0.260851 0.123996
+0.091414 0.251910 0.196193
+0.076304 0.263206 0.278157
+0.134332 0.188036 0.301992
+0.107220 0.138757 0.409882
+0.128381 0.129478 0.471249
+0.160195 0.115412 0.544945
+0.191115 0.149126 0.609196
+0.184568 0.103795 0.587575
+0.248953 0.058854 0.636286
+0.192984 0.081624 0.751367
+0.220001 0.099182 0.668267
+0.223085 0.059316 0.689244
+0.276099 0.046871 0.774911
+0.314266 0.073942 0.676716
+0.296234 0.076044 0.626027
+0.279541 0.049108 0.565247
+0.285398 0.057887 0.519502
+0.243492 0.048975 0.483027
+0.309314 0.059143 0.435497
+0.387586 0.051625 0.354348
+0.397104 0.047268 0.326093
+0.434850 0.059475 0.193227
--- /dev/null
+0.281245 0.072824
+0.339645 0.060014
+0.409277 0.064576
+0.523095 0.061305
+0.230096 0.211887
+0.207683 0.332701
+0.284308 0.308783
+0.140378 0.711570
+0.174527 0.127827
+0.352952 0.235323
+0.370502 0.190103
+0.402932 0.159641
+0.347927 0.146360
+0.296583 0.131013
+0.223266 0.153607
+0.197020 0.420964
+0.116898 0.516163
+0.119488 0.109699
+0.111778 0.278792
+0.578302 0.202919
+0.414620 0.214613
+0.305886 0.397131
+0.332819 0.101995
+0.378387 0.086890
+0.382898 0.121331
+0.453255 0.063910
+0.426851 0.114357
+0.460512 0.099039
+0.479185 0.134529
+0.496434 0.084061
+0.573538 0.071989
+0.531672 0.120071
+0.591529 0.134458
+0.511033 0.180023
+0.448004 0.171478
+0.322286 0.187786
+0.297869 0.238597
+0.242424 0.263223
+0.175075 0.260064
+0.201034 0.074025
+0.268571 0.522305
+0.344104 0.296771
+0.409613 0.271732
+0.173676 0.190087
+0.115603 0.193700
+0.115269 0.373202
+0.407643 0.637929
+0.439428 0.478964
+0.567749 0.389060
+0.551502 0.271892
+0.639284 0.075639
+0.665511 0.286926
+0.720983 0.084070
+0.795786 0.214436
+0.832583 0.095102
+0.671796 0.164706
+0.983554 0.136778
+0.812831 0.368808
+0.644281 0.515306
+0.480389 0.316998
+0.403689 0.360441
+0.476736 0.232898
+0.248084 0.111421
+0.273953 0.180184
--- /dev/null
+0.678062 0.043120
+0.472775 0.257353
+0.522878 0.127961
+0.628034 0.038788
+0.480545 0.057725
+0.437201 0.064479
+0.327854 0.073645
+0.308168 0.135691
+0.390919 0.172150
+0.362940 0.121889
+0.384688 0.065511
+0.419078 0.117947
+0.468913 0.116759
+0.507838 0.089601
+0.555567 0.052196
+0.521040 0.052787
+0.589645 0.043616
+0.985285 0.088227
+0.724020 0.177911
+0.129928 0.130564
+0.120671 0.249971
+0.266520 0.077658
+0.685157 0.083387
+0.673088 0.130951
+0.726463 0.107217
+0.779587 0.130439
+0.652097 0.060232
+0.616365 0.062903
+0.614893 0.095188
+0.671203 0.264629
+0.657805 0.188243
+0.647995 0.095077
+0.581225 0.110398
+0.573894 0.254912
+0.531176 0.201073
+0.544230 0.353796
+0.621094 0.138556
+0.717028 0.053894
+0.890269 0.071236
+1.100420 0.115118
+0.492946 0.167302
+0.387836 0.249419
+0.929411 0.210459
+0.389735 0.351413
+0.273341 0.443161
+0.453321 0.457227
+0.303206 0.300360
+0.563261 0.148813
+0.789479 0.244432
+0.817080 0.062843
+0.852058 0.150352
+0.760492 0.059787
+0.711233 0.355546
+0.598869 0.189758
+0.583624 0.073653
+0.548949 0.089569
+0.445394 0.183962
+0.333115 0.197087
+0.246232 0.142290
+0.263973 0.216087
+0.185969 0.192135
+0.205425 0.302232
+0.195923 0.088343
+0.148277 0.406699
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: lsptest.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 24/8/09
+
+ Test Speech LPC to LSP conversion and quantisation.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <lpc.h>
+#include <lsp.h>
+#include <sd.h>
+
+#define N 160
+#define P 10
+
+#define LPC_FLOOR 0.0002 /* autocorrelation floor */
+#define LSP_DELTA1 0.2 /* grid spacing for LSP root searches */
+#define NDFT 256 /* DFT size for SD calculation */
+
+/* Speex lag window */
+
+const float lag_window[11] = {
+ 1.00000, 0.99716, 0.98869, 0.97474, 0.95554, 0.93140, 0.90273, 0.86998,
+ 0.83367, 0.79434, 0.75258
+};
+
+/*---------------------------------------------------------------------------*\
+
+ find_aks_for_lsp()
+
+ This function takes a frame of samples, and determines the linear
+ prediction coefficients for that frame of samples. Modified version of
+ find_aks from lpc.c to include autocorrelation noise floor and lag window
+ to match Speex processing steps prior to LSP conversion.
+
+\*---------------------------------------------------------------------------*/
+
+void find_aks_for_lsp(
+ float Sn[], /* Nsam samples with order sample memory */
+ float a[], /* order+1 LPCs with first coeff 1.0 */
+ int Nsam, /* number of input speech samples */
+ int order, /* order of the LPC analysis */
+ float *E /* residual energy */
+)
+{
+ float Wn[N]; /* windowed frame of Nsam speech samples */
+ float R[P+1]; /* order+1 autocorrelation values of Sn[] */
+ int i;
+
+ hanning_window(Sn,Wn,Nsam);
+
+ autocorrelate(Wn,R,Nsam,order);
+ R[0] += LPC_FLOOR;
+ assert(order == 10); /* lag window only defined for order == 10 */
+ for(i=0; i<=order; i++)
+ R[i] *= lag_window[i];
+ levinson_durbin(R,a,order);
+
+ *E = 0.0;
+ for(i=0; i<=order; i++)
+ *E += a[i]*R[i];
+ if (*E < 0.0)
+ *E = 1E-12;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ MAIN
+
+\*---------------------------------------------------------------------------*/
+
+int main(int argc, char *argv[])
+{
+ FILE *fin; /* input speech files */
+ short buf[N]; /* buffer of 16 bit speech samples */
+ float Sn[P+N]; /* input speech samples */
+ float E;
+ float ak[P+1]; /* LP coeffs */
+ float ak_[P+1]; /* quantised LP coeffs */
+ float lsp[P];
+ float lsp_[P]; /* quantised LSPs */
+ int roots; /* number of LSP roots found */
+ int frames; /* frames processed so far */
+ int i; /* loop variables */
+
+ SpeexBits bits;
+
+ float sd; /* SD for this frame */
+ float totsd; /* accumulated SD so far */
+ int gt2,gt4; /* number of frames > 2 and 4 dB SD */
+ int unstables; /* number of unstable LSP frames */
+
+ if (argc < 2) {
+ printf("usage: %s InputFile\n", argv[0]);
+ exit(0);
+ }
+
+ /* Open files */
+
+ if ((fin = fopen(argv[1],"rb")) == NULL) {
+ printf("Error opening input file: %s\n",argv[1]);
+ exit(0);
+ }
+
+ /* Initialise */
+
+ frames = 0;
+ for(i=0; i<P; i++) {
+ Sn[i] = 0.0;
+ }
+ ak_[0] = 1.0;
+
+ speex_bits_init(&bits);
+
+ totsd = 0.0;
+ unstables = 0;
+ gt2 = 0; gt4 = 0;
+
+ /* Main loop */
+
+ while( (fread(buf,sizeof(short),N,fin)) == N) {
+ frames++;
+ for(i=0; i<N; i++)
+ Sn[P+i] = (float)buf[i];
+
+ /* convert to LSP domain and back */
+
+ find_aks(&Sn[P], ak, N, P, &E);
+ roots = lpc_to_lsp(&ak[1], P , lsp, 10, LSP_DELTA1, NULL);
+ if (roots == P) {
+
+ speex_bits_reset(&bits);
+ lsp_quant_lbr(lsp, lsp_, P, &bits);
+ lsp_to_lpc(lsp_, &ak_[1], P, NULL);
+
+ /* measure spectral distortion */
+ sd = spectral_dist(ak, ak_, P, NDFT);
+ if (sd > 2.0) gt2++;
+ if (sd > 4.0) gt4++;
+ totsd += sd;
+ }
+ else
+ unstables++;
+ }
+
+ fclose(fin);
+
+ printf("frames = %d Av sd = %3.2f dB", frames, totsd/frames);
+ printf(" >2 dB %3.2f%% >4 dB %3.2f%% unstables: %d\n",gt2*100.0/frames,
+ gt4*100.0/frames, unstables);
+
+ return 0;
+}
+
--- /dev/null
+/*--------------------------------------------------------------------------*\
+
+ FILE........: sd.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 20/7/93
+
+ Function to determine spectral distortion between two sets of LPCs.
+
+\*--------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#define MAX_N 2048 /* maximum DFT size */
+
+#include <math.h>
+#include "four1.h"
+#include "comp.h"
+#include "sd.h"
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: spectral_dist()
+
+ AUTHOR......: David Rowe
+ DATE CREATED: 20/7/93
+
+ This function returns the soectral distoertion between two
+ sets of LPCs.
+
+\*---------------------------------------------------------------------------*/
+
+float spectral_dist(float ak1[], float ak2[], int p, int n)
+/* float ak1[]; unquantised set of p+1 LPCs */
+/* float ak2[]; quantised set of p+1 LPCs */
+/* int p; LP order */
+/* int n; DFT size to use for SD calculations (power of 2) */
+{
+ COMP A1[MAX_N]; /* DFT of ak1[] */
+ COMP A2[MAX_N]; /* DFT of ak2[] */
+ float P1,P2; /* power of current bin */
+ float sd;
+ int i;
+
+ for(i=0; i<n; i++) {
+ A1[i].real = 0.0;
+ A1[i].imag = 0.0;
+ A2[i].real = 0.0;
+ A2[i].imag = 0.0;
+ }
+
+ for(i=0; i<p+1; i++) {
+ A1[i].real = ak1[i];
+ A2[i].real = ak2[i];
+ }
+
+ four1(&A1[-1].imag,n,-1);
+ four1(&A2[-1].imag,n,-1);
+
+ sd = 0.0;
+ for(i=0; i<n; i++) {
+ P1 = A1[i].real*A1[i].real + A1[i].imag*A1[i].imag;
+ P2 = A2[i].real*A2[i].real + A2[i].imag*A2[i].imag;
+ sd += pow(log10(P2/P1),2.0);
+ }
+ sd = 10.0*sqrt(sd/n); /* sd in dB */
+
+ return(sd);
+}
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: tcodec2.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 24/8/10
+
+ Test program for codec2.c functions.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2010 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "defines.h"
+#include "codec2.h"
+#include "quantise.h"
+#include "interp.h"
+
+/* CODEC2 struct copies from codec2.c to help with testing */
+
+typedef struct {
+ float Sn[M]; /* input speech */
+ float w[M]; /* time domain hamming window */
+ COMP W[FFT_ENC]; /* DFT of w[] */
+ float Pn[2*N]; /* trapezoidal synthesis window */
+ float Sn_[2*N]; /* synthesised speech */
+ float prev_Wo; /* previous frame's pitch estimate */
+ float ex_phase; /* excitation model phase track */
+ float bg_est; /* background noise estimate for post filter */
+ MODEL prev_model; /* model parameters from 20ms ago */
+} CODEC2;
+
+void analyse_one_frame(CODEC2 *c2, MODEL *model, short speech[]);
+void synthesise_one_frame(CODEC2 *c2, short speech[], MODEL *model, float ak[]);
+
+int test1()
+{
+ FILE *fin, *fout;
+ short buf[N];
+ void *c2;
+ CODEC2 *c3;
+ MODEL model;
+ float ak[LPC_ORD+1];
+ float lsps[LPC_ORD];
+
+ c2 = codec2_create();
+ c3 = (CODEC2*)c2;
+
+ fin = fopen("../raw/hts1a.raw", "rb");
+ assert(fin != NULL);
+ fout = fopen("hts1a_test.raw", "wb");
+ assert(fout != NULL);
+
+ while(fread(buf, sizeof(short), N, fin) == N) {
+ analyse_one_frame(c3, &model, buf);
+ speech_to_uq_lsps(lsps, ak, c3->Sn, c3->w, LPC_ORD);
+ synthesise_one_frame(c3, buf, &model, ak);
+ fwrite(buf, sizeof(short), N, fout);
+ }
+
+ codec2_destroy(c2);
+
+ fclose(fin);
+ fclose(fout);
+
+ return 0;
+}
+
+int test2()
+{
+ FILE *fin, *fout;
+ short buf[2*N];
+ void *c2;
+ CODEC2 *c3;
+ MODEL model, model_interp;
+ float ak[LPC_ORD+1];
+ int voiced1, voiced2;
+ int lsp_indexes[LPC_ORD];
+ int lpc_correction;
+ int energy_index;
+ int Wo_index;
+ char bits[CODEC2_BITS_PER_FRAME];
+ int nbit;
+ int i;
+
+ c2 = codec2_create();
+ c3 = (CODEC2*)c2;
+
+ fin = fopen("../raw/hts1a.raw", "rb");
+ assert(fin != NULL);
+ fout = fopen("hts1a_test.raw", "wb");
+ assert(fout != NULL);
+
+ while(fread(buf, sizeof(short), 2*N, fin) == 2*N) {
+ /* first 10ms analysis frame - we just want voicing */
+
+ analyse_one_frame(c3, &model, buf);
+ voiced1 = model.voiced;
+
+ /* second 10ms analysis frame */
+
+ analyse_one_frame(c3, &model, &buf[N]);
+ voiced2 = model.voiced;
+
+ Wo_index = encode_Wo(model.Wo);
+ encode_amplitudes(lsp_indexes,
+ &lpc_correction,
+ &energy_index,
+ &model,
+ c3->Sn,
+ c3->w);
+ nbit = 0;
+ pack(bits, &nbit, Wo_index, WO_BITS);
+ for(i=0; i<LPC_ORD; i++) {
+ pack(bits, &nbit, lsp_indexes[i], lsp_bits(i));
+ }
+ pack(bits, &nbit, lpc_correction, 1);
+ pack(bits, &nbit, energy_index, E_BITS);
+ pack(bits, &nbit, voiced1, 1);
+ pack(bits, &nbit, voiced2, 1);
+
+ nbit = 0;
+ Wo_index = unpack(bits, &nbit, WO_BITS);
+ for(i=0; i<LPC_ORD; i++) {
+ lsp_indexes[i] = unpack(bits, &nbit, lsp_bits(i));
+ }
+ lpc_correction = unpack(bits, &nbit, 1);
+ energy_index = unpack(bits, &nbit, E_BITS);
+ voiced1 = unpack(bits, &nbit, 1);
+ voiced2 = unpack(bits, &nbit, 1);
+
+ model.Wo = decode_Wo(Wo_index);
+ model.L = PI/model.Wo;
+ decode_amplitudes(&model,
+ ak,
+ lsp_indexes,
+ lpc_correction,
+ energy_index);
+
+ model.voiced = voiced2;
+ model_interp.voiced = voiced1;
+ interpolate(&model_interp, &c3->prev_model, &model);
+
+ synthesise_one_frame(c3, buf, &model_interp, ak);
+ synthesise_one_frame(c3, &buf[N], &model, ak);
+
+ memcpy(&c3->prev_model, &model, sizeof(MODEL));
+ fwrite(buf, sizeof(short), 2*N, fout);
+ }
+
+ codec2_destroy(c2);
+
+ fclose(fin);
+ fclose(fout);
+
+ return 0;
+}
+
+int test3()
+{
+ FILE *fin, *fout, *fbits;
+ short buf1[2*N];
+ short buf2[2*N];
+ char bits[CODEC2_BITS_PER_FRAME];
+ void *c2;
+
+ c2 = codec2_create();
+
+ fin = fopen("../raw/hts1a.raw", "rb");
+ assert(fin != NULL);
+ fout = fopen("hts1a_test.raw", "wb");
+ assert(fout != NULL);
+ fbits = fopen("hts1a_test3.bit", "wb");
+ assert(fout != NULL);
+
+ while(fread(buf1, sizeof(short), 2*N, fin) == 2*N) {
+ codec2_encode(c2, bits, buf1);
+ fwrite(bits, sizeof(char), CODEC2_BITS_PER_FRAME, fbits);
+ codec2_decode(c2, buf2, bits);
+ fwrite(buf2, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fout);
+ }
+
+ codec2_destroy(c2);
+
+ fclose(fin);
+ fclose(fout);
+ fclose(fbits);
+
+ return 0;
+}
+
+int main() {
+ test3();
+ return 0;
+}
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: tcontphase.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 11/9/09
+
+ Test program for developing continuous phase track synthesis algorithm.
+ However while developing this it was discovered that synthesis_mixed()
+ worked just as well.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#define N 80 /* frame size */
+#define F 160 /* frames to synthesis */
+#define P 10 /* LPC order */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "sine.h"
+#include "dump.h"
+#include "synth.h"
+#include "phase.h"
+
+int frames;
+
+float ak[] = {
+ 1.000000,
+-1.455836,
+ 1.361841,
+-0.879267,
+ 0.915985,
+-1.002202,
+ 0.944103,
+-0.743094,
+ 1.053356,
+-0.817491,
+ 0.431222
+};
+
+
+/*---------------------------------------------------------------------------*\
+
+ switch_present()
+
+ Searches the command line arguments for a "switch". If the switch is
+ found, returns the command line argument where it ws found, else returns
+ NULL.
+
+\*---------------------------------------------------------------------------*/
+
+int switch_present(sw,argc,argv)
+ char sw[]; /* switch in string form */
+ int argc; /* number of command line arguments */
+ char *argv[]; /* array of command line arguments in string form */
+{
+ int i; /* loop variable */
+
+ for(i=1; i<argc; i++)
+ if (!strcmp(sw,argv[i]))
+ return(i);
+
+ return 0;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ MAIN
+
+\*---------------------------------------------------------------------------*/
+
+int main(argc,argv)
+int argc;
+char *argv[];
+{
+ FILE *fout;
+ short buf[N];
+ int i,j;
+ int dump;
+ float phi_prev[MAX_AMP];
+ float Wo_prev, ex_phase, G;
+ //float ak[P+1];
+ COMP H[MAX_AMP];
+ float f0;
+
+ if (argc < 3) {
+ printf("\nusage: tcontphase OutputRawSpeechFile F0\n");
+ exit(0);
+ }
+
+ /* Output file */
+
+ if ((fout = fopen(argv[1],"wb")) == NULL) {
+ printf("Error opening output speech file: %s\n",argv[1]);
+ exit(1);
+ }
+
+ f0 = atof(argv[2]);
+
+ dump = switch_present("--dump",argc,argv);
+ if (dump)
+ dump_on(argv[dump+1]);
+
+ init_decoder();
+
+ for(i=0; i<MAX_AMP; i++)
+ phi_prev[i] = 0.0;
+ Wo_prev = 0.0;
+
+ model.Wo = PI*(f0/4000.0);
+ G = 1000.0;
+ model.L = floor(PI/model.Wo);
+
+ //aks_to_H(&model, ak, G , H, P);
+ //for(i=1; i<=model.L; i++)
+ model.A[i] = sqrt(H[i].real*H[i].real + H[i].imag*H[i].imag);
+ //printf("L = %d\n", model.L);
+ //model.L = 10;
+ for(i=1; i<=model.L; i++) {
+ model.A[i] = 1000/model.L;
+ model.phi[i] = 0;
+ H[i].real = 1.0; H[i].imag = 0.0;
+ }
+
+ //ak[0] = 1.0;
+ //for(i=1; i<=P; i++)
+ // ak[i] = 0.0;
+
+ frames = 0;
+ for(j=0; j<F; j++) {
+ frames++;
+
+ #ifdef SWAP
+ /* lets make phases bounce around from frame to frame. This
+ could happen if H[m] is varying, for example due to frame
+ to frame Wo variations, or non-stationary speech.
+ Continous model generally results in smooth phase track
+ under these circumstances. */
+ if (j%2){
+ H[1].real = 1.0; H[1].imag = 0.0;
+ model.phi[1] = 0.0;
+ }
+ else {
+ H[1].real = 0.0; H[1].imag = 1.0;
+ model.phi[1] = PI/2;
+ }
+ #endif
+
+ //#define CONT
+ #ifdef CONT
+ synthesise_continuous_phase(Pn, &model, Sn_, 1, &Wo_prev, phi_prev);
+ #else
+ phase_synth_zero_order(5.0, H, &Wo_prev, &ex_phase);
+ synthesise_mixed(Pn,&model,Sn_,1);
+ #endif
+
+ for(i=0; i<N; i++)
+ buf[i] = Sn_[i];
+ fwrite(buf,sizeof(short),N,fout);
+ }
+
+ fclose(fout);
+ if (dump) dump_off();
+
+ return 0;
+}
+
+
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: tinterp.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/10
+
+ Tests interpolation functions.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2010 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <ctype.h>
+
+#include "defines.h"
+#include "sine.h"
+#include "interp.h"
+
+void make_amp(MODEL *model, float f0, float cdB, float mdBHz)
+{
+ int i;
+ float mdBrad = mdBHz*FS/TWO_PI;
+
+ model->Wo = f0*TWO_PI/FS;
+ model->L = PI/model->Wo;
+ for(i=0; i<=model->L; i++)
+ model->A[i] = pow(10.0,(cdB + (float)i*model->Wo*mdBrad)/20.0);
+ model->voiced = 1;
+}
+
+void write_amp(char file[], MODEL *model)
+{
+ FILE *f;
+ int i;
+
+ f = fopen(file,"wt");
+ for(i=1; i<=model->L; i++)
+ fprintf(f, "%f\t%f\n", model->Wo*i, model->A[i]);
+ fclose(f);
+}
+
+char *get_next_float(char *s, float *num)
+{
+ char *p = s;
+ char tmp[MAX_STR];
+
+ while(*p && !isspace(*p))
+ p++;
+ memcpy(tmp, s, p-s);
+ tmp[p-s] = 0;
+ *num = atof(tmp);
+
+ return p+1;
+}
+
+char *get_next_int(char *s, int *num)
+{
+ char *p = s;
+ char tmp[MAX_STR];
+
+ while(*p && !isspace(*p))
+ p++;
+ memcpy(tmp, s, p-s);
+ tmp[p-s] = 0;
+ *num = atoi(tmp);
+
+ return p+1;
+}
+
+void load_amp(MODEL *model, char file[], int frame)
+{
+ FILE *f;
+ int i;
+ char s[1024];
+ char *ps;
+
+ f = fopen(file,"rt");
+
+ for(i=0; i<frame; i++)
+ fgets(s, 1023, f);
+
+ ps = s;
+ ps = get_next_float(ps, &model->Wo);
+ ps = get_next_int(ps, &model->L);
+ for(i=1; i<=model->L; i++)
+ ps = get_next_float(ps, &model->A[i]);
+
+ fclose(f);
+}
+
+int main() {
+ MODEL prev, next, interp;
+
+ //make_amp(&prev, 50.0, 60.0, 6E-3);
+ //make_amp(&next, 50.0, 40.0, 6E-3);
+ load_amp(&prev, "../src/hts1a_model.txt", 32);
+ load_amp(&next, "../src/hts1a_model.txt", 34);
+
+ interp.voiced = 1;
+ interpolate(&interp, &prev, &next);
+
+ write_amp("tinterp_prev.txt", &prev);
+ write_amp("tinterp_interp.txt", &interp);
+ write_amp("tinterp_next.txt", &next);
+
+ return 0;
+}
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: tnlp.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/3/93
+
+ Test program for non linear pitch estimation functions.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#define N 80 /* frame size */
+#define M 320 /* pitch analysis window size */
+#define PITCH_MIN 20
+#define PITCH_MAX 160
+#define TNLP
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#include "defines.h"
+#include "dump.h"
+#include "sine.h"
+#include "nlp.h"
+
+int frames;
+
+/*---------------------------------------------------------------------------*\
+
+ switch_present()
+
+ Searches the command line arguments for a "switch". If the switch is
+ found, returns the command line argument where it ws found, else returns
+ NULL.
+
+\*---------------------------------------------------------------------------*/
+
+int switch_present(sw,argc,argv)
+ char sw[]; /* switch in string form */
+ int argc; /* number of command line arguments */
+ char *argv[]; /* array of command line arguments in string form */
+{
+ int i; /* loop variable */
+
+ for(i=1; i<argc; i++)
+ if (!strcmp(sw,argv[i]))
+ return(i);
+
+ return 0;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ MAIN
+
+\*---------------------------------------------------------------------------*/
+
+int main(argc,argv)
+int argc;
+char *argv[];
+{
+ FILE *fin,*fout;
+ short buf[N];
+ float Sn[M]; /* float input speech samples */
+ COMP Sw[FFT_ENC]; /* DFT of Sn[] */
+ float w[M]; /* time domain hamming window */
+ COMP W[FFT_ENC]; /* DFT of w[] */
+ float pitch;
+ int i;
+ int dump;
+ float prev_Wo;
+ void *nlp_states;
+
+ if (argc < 3) {
+ printf("\nusage: tnlp InputRawSpeechFile OutputPitchTextFile "
+ "[--dump DumpFile]\n");
+ exit(0);
+ }
+
+ /* Input file */
+
+ if ((fin = fopen(argv[1],"rb")) == NULL) {
+ printf("Error opening input speech file: %s\n",argv[1]);
+ exit(1);
+ }
+
+ /* Output file */
+
+ if ((fout = fopen(argv[2],"wt")) == NULL) {
+ printf("Error opening output text file: %s\n",argv[2]);
+ exit(1);
+ }
+
+ dump = switch_present("--dump",argc,argv);
+ if (dump)
+ dump_on(argv[dump+1]);
+
+ nlp_states = nlp_create();
+ make_analysis_window(w,W);
+
+ frames = 0;
+ prev_Wo = 0;
+ while(fread(buf,sizeof(short),N,fin)) {
+ printf("%d\n", frames++);
+
+ /* Update input speech buffers */
+
+ for(i=0; i<M-N; i++)
+ Sn[i] = Sn[i+N];
+ for(i=0; i<N; i++)
+ Sn[i+M-N] = buf[i];
+ dft_speech(Sw, Sn, w);
+ dump_Sn(Sn); dump_Sw(Sw);
+
+ nlp(nlp_states,Sn,N,M,PITCH_MIN,PITCH_MAX,&pitch,Sw,&prev_Wo);
+ prev_Wo = TWO_PI/pitch;
+
+ fprintf(fout,"%f\n",pitch);
+ }
+
+ fclose(fin);
+ fclose(fout);
+ if (dump) dump_off();
+ nlp_destroy(nlp_states);
+
+ return 0;
+}
+
+
--- /dev/null
+/*---------------------------------------------------------------------------*\
+
+ FILE........: tquant.c
+ AUTHOR......: David Rowe
+ DATE CREATED: 22/8/10
+
+ Generates quantisation curves for plotting on Octave.
+
+\*---------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2010 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#include "defines.h"
+#include "dump.h"
+#include "quantise.h"
+
+int test_Wo_quant();
+int test_lsp_quant();
+int test_lsp(int lsp_number, int levels, float max_error_hz);
+int test_energy_quant(int levels, float max_error_dB);
+
+int main() {
+ quantise_init();
+ test_Wo_quant();
+ test_lsp_quant();
+ test_energy_quant(E_LEVELS, 0.5*(E_MAX_DB - E_MIN_DB)/E_LEVELS);
+
+ return 0;
+}
+
+int test_lsp_quant() {
+ test_lsp( 1, 16, 12.5);
+ test_lsp( 2, 16, 12.5);
+ test_lsp( 3, 16, 25);
+ test_lsp( 4, 16, 50);
+ test_lsp( 5, 16, 50);
+ test_lsp( 6, 16, 50);
+ test_lsp( 7, 16, 50);
+ test_lsp( 8, 8, 50);
+ test_lsp( 9, 8, 50);
+ test_lsp(10, 4, 100);
+
+ return 0;
+}
+
+int test_energy_quant(int levels, float max_error_dB) {
+ FILE *fe;
+ float e,e_dec, error, low_e, high_e;
+ int index, index_in, index_out, i;
+
+ /* check 1:1 match between input and output levels */
+
+ for(i=0; i<levels; i++) {
+ index_in = i;
+ e = decode_energy(index_in);
+ index_out = encode_energy(e);
+ if (index_in != index_out) {
+ printf("edB: %f index_in: %d index_out: %d\n",
+ 10.0*log10(e), index_in, index_out);
+ exit(0);
+ }
+ }
+
+ /* check error over range of quantiser */
+
+ low_e = decode_energy(0);
+ high_e = decode_energy(levels-1);
+ fe = fopen("energy_err.txt", "wt");
+
+ for(e=low_e; e<high_e; e +=(high_e-low_e)/1000.0) {
+ index = encode_energy(e);
+ e_dec = decode_energy(index);
+ error = 10.0*log10(e) - 10.0*log10(e_dec);
+ fprintf(fe, "%f\n", error);
+ if (fabs(error) > max_error_dB) {
+ printf("error: %f %f\n", error, max_error_dB);
+ exit(0);
+ }
+ }
+
+ fclose(fe);
+ return 0;
+}
+
+int test_lsp(int lsp_number, int levels, float max_error_hz) {
+ float lsp[LPC_ORD];
+ int indexes_in[LPC_ORD];
+ int indexes_out[LPC_ORD];
+ int indexes[LPC_ORD];
+ int i;
+ float lowf, highf, f, error;
+ char s[MAX_STR];
+ FILE *flsp;
+ float max_error_rads;
+
+ lsp_number--;
+ max_error_rads = max_error_hz*TWO_PI/FS;
+
+ for(i=0; i<LPC_ORD; i++)
+ indexes_in[i] = 0;
+
+ for(i=0; i<levels; i++) {
+ indexes_in[lsp_number] = i;
+ decode_lsps(lsp, indexes_in, LPC_ORD);
+ encode_lsps(indexes_out, lsp,LPC_ORD);
+ if (indexes_in[lsp_number] != indexes_out[lsp_number]) {
+ printf("freq: %f index_in: %d index_out: %d\n",
+ lsp[lsp_number]+1, indexes_in[lsp_number],
+ indexes_out[lsp_number]);
+ exit(0);
+ }
+ }
+
+ for(i=0; i<LPC_ORD; i++)
+ indexes[i] = 0;
+ indexes[lsp_number] = 0;
+ decode_lsps(lsp, indexes, LPC_ORD);
+ lowf = lsp[lsp_number];
+ indexes[lsp_number] = levels - 1;
+ decode_lsps(lsp, indexes, LPC_ORD);
+ highf = lsp[lsp_number];
+ sprintf(s,"lsp%d_err.txt", lsp_number+1);
+ flsp = fopen(s, "wt");
+
+ for(f=lowf; f<highf; f +=(highf-lowf)/1000.0) {
+ lsp[lsp_number] = f;
+ encode_lsps(indexes, lsp, LPC_ORD);
+ decode_lsps(lsp, indexes, LPC_ORD);
+ error = f - lsp[lsp_number];
+ fprintf(flsp, "%f\n", error);
+ if (fabs(error) > max_error_rads) {
+ printf("%d error: %f %f\n", lsp_number+1, error, max_error_rads);
+ exit(0);
+ }
+ }
+
+ fclose(flsp);
+
+ printf("OK\n");
+
+ return 0;
+}
+
+int test_Wo_quant() {
+ int c;
+ FILE *f;
+ float Wo,Wo_dec, error, step_size;
+ int index, index_in, index_out;
+
+ /* output Wo quant curve for plotting */
+
+ f = fopen("quant_pitch.txt","wt");
+
+ for(Wo=0.9*(TWO_PI/P_MAX); Wo<=1.1*(TWO_PI/P_MIN); Wo += 0.001) {
+ index = encode_Wo(Wo);
+ fprintf(f, "%f %d\n", Wo, index);
+ }
+
+ fclose(f);
+
+ /* check for all Wo codes we get 1:1 match between encoder
+ and decoder Wo levels */
+
+ for(c=0; c<WO_LEVELS; c++) {
+ index_in = c;
+ Wo = decode_Wo(index_in);
+ index_out = encode_Wo(Wo);
+ if (index_in != index_out)
+ printf(" Wo %f index_in %d index_out %d\n", Wo,
+ index_in, index_out);
+ }
+
+ /* measure quantisation error stats and compare to expected. Also
+ plot histogram of error file to check. */
+
+ f = fopen("quant_pitch_err.txt","wt");
+ step_size = ((TWO_PI/P_MIN) - (TWO_PI/P_MAX))/WO_LEVELS;
+
+ for(Wo=TWO_PI/P_MAX; Wo<0.99*TWO_PI/P_MIN; Wo += 0.0001) {
+ index = encode_Wo(Wo);
+ Wo_dec = decode_Wo(index);
+ error = Wo - Wo_dec;
+ if (fabs(error) > (step_size/2.0)) {
+ printf("error: %f step_size/2: %f\n", error, step_size/2.0);
+ exit(0);
+ }
+ fprintf(f,"%f\n",error);
+ }
+ printf("OK\n");
+
+ fclose(f);
+ return 0;
+}
--- /dev/null
+/*--------------------------------------------------------------------------*\
+
+ FILE........: VQTRAIN.C
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/2/95
+
+ This program trains vector quantisers using K dimensional Lloyd-Max
+ method.
+
+\*--------------------------------------------------------------------------*/
+
+/*
+ Copyright (C) 2009 David Rowe
+
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 2, as
+ published by the Free Software Foundation. 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 Lesser General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/*-----------------------------------------------------------------------*\
+
+ INCLUDES
+
+\*-----------------------------------------------------------------------*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <ctype.h>
+
+/*-----------------------------------------------------------------------*\
+
+ DEFINES
+
+\*-----------------------------------------------------------------------*/
+
+#define DELTAQ 0.01 /* quiting distortion */
+#define MAX_STR 80 /* maximum string length */
+
+/*-----------------------------------------------------------------------*\
+
+ FUNCTION PROTOTYPES
+
+\*-----------------------------------------------------------------------*/
+
+void zero(float v[], int k);
+void acc(float v1[], float v2[], int k);
+void norm(float v[], int k, long n);
+long quantise(float cb[], float vec[], int k, int m, float *se);
+
+/*-----------------------------------------------------------------------*\
+
+ MAIN
+
+\*-----------------------------------------------------------------------*/
+
+int main(int argc, char *argv[]) {
+ long k,m; /* dimension and codebook size */
+ float *vec; /* current vector */
+ float *cb; /* vector codebook */
+ float *cent; /* centroids for each codebook entry */
+ long *n; /* number of vectors in this interval */
+ long J; /* number of vectors in training set */
+ long i,j;
+ long ind; /* index of current vector */
+ float se; /* squared error for this iteration */
+ float Dn,Dn_1; /* current and previous iterations distortion */
+ float delta; /* improvement in distortion */
+ FILE *ftrain; /* file containing training set */
+ FILE *fvq; /* file containing vector quantiser */
+
+ /* Interpret command line arguments */
+
+ if (argc != 5) {
+ printf("usage: vqtrain TrainFile K M VQFile\n");
+ exit(0);
+ }
+
+ /* Open training file */
+
+ ftrain = fopen(argv[1],"rb");
+ if (ftrain == NULL) {
+ printf("Error opening training database file: %s\n",argv[1]);
+ exit(1);
+ }
+
+ /* determine k and m, and allocate arrays */
+
+ k = atol(argv[2]);
+ m = atol(argv[3]);
+ printf("dimension K=%ld number of entries M=%ld\n", k,m);
+ vec = (float*)malloc(sizeof(float)*k);
+ cb = (float*)malloc(sizeof(float)*k*m);
+ cent = (float*)malloc(sizeof(float)*k*m);
+ n = (long*)malloc(sizeof(long)*m);
+ if (cb == NULL || cb == NULL || cent == NULL || vec == NULL) {
+ printf("Error in malloc.\n");
+ exit(1);
+ }
+
+ /* determine size of training set */
+
+ J = 0;
+ while(fread(vec, sizeof(float), k, ftrain) == k)
+ J++;
+ printf("J=%ld entries in training set\n", J);
+
+ /* set up initial codebook state from samples of training set */
+
+ rewind(ftrain);
+ fread(cb, sizeof(float), k*m, ftrain);
+
+ /* main loop */
+
+ Dn = 1E32;
+ j = 1;
+ do {
+ Dn_1 = Dn;
+
+ /* zero centroids */
+
+ for(i=0; i<m; i++) {
+ zero(¢[i*k], k);
+ n[i] = 0;
+ }
+
+ /* quantise training set */
+
+ se = 0.0;
+ rewind(ftrain);
+ for(i=0; i<J; i++) {
+ fread(vec, sizeof(float), k, ftrain);
+ ind = quantise(cb, vec, k, m, &se);
+ n[ind]++;
+ acc(¢[ind*k], vec, k);
+ }
+ Dn = se/J;
+ delta = (Dn_1-Dn)/Dn;
+
+ printf("\r Iteration %ld, Dn = %f, Delta = %e\n", j, Dn, delta);
+ j++;
+
+ /* determine new codebook from centriods */
+
+ if (delta > DELTAQ)
+ for(i=0; i<m; i++) {
+ if (n[i] != 0) {
+ norm(¢[i*k], k, n[i]);
+ memcpy(&cb[i*k], ¢[i*k], k*sizeof(float));
+ }
+ }
+
+ } while (delta > DELTAQ);
+
+ /* save codebook to disk */
+
+ fvq = fopen(argv[4],"wt");
+ if (fvq == NULL) {
+ printf("Error opening VQ file: %s\n",argv[4]);
+ exit(1);
+ }
+
+ for(j=0; j<m; j++) {
+ for(i=0; i<k; i++)
+ fprintf(fvq,"%f ",cb[j*k+i]);
+ fprintf(fvq,"\n");
+ }
+ fclose(fvq);
+
+ return 0;
+}
+
+/*-----------------------------------------------------------------------*\
+
+ FUNCTIONS
+
+\*-----------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: zero()
+
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/2/95
+
+ Zeros a vector of length k.
+
+\*---------------------------------------------------------------------------*/
+
+void zero(float v[], int k)
+/* float v[]; ptr to start of vector */
+/* int k; lngth of vector */
+{
+ int i;
+
+ for(i=0; i<k; i++)
+ v[i] = 0.0;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: acc()
+
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/2/95
+
+ Adds k dimensional vectors v1 to v2 and stores the result back in v1.
+
+\*---------------------------------------------------------------------------*/
+
+void acc(float v1[], float v2[], int k)
+/* float v1[]; ptr to start of vector to accumulate */
+/* float v2[]; ptr to start of vector to add */
+/* int k; dimension of vectors */
+{
+ int i;
+
+ for(i=0; i<k; i++)
+ v1[i] += v2[i];
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: norm()
+
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/2/95
+
+ Divides each element in k dimensional vector v by n.
+
+\*---------------------------------------------------------------------------*/
+
+void norm(float v[], int k, long n)
+/* float v[]; ptr to start of vector */
+/* int k; dimension of vectors */
+/* int n; normalising factor */
+{
+ int i;
+
+ for(i=0; i<k; i++)
+ v[i] /= n;
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: quantise()
+
+ AUTHOR......: David Rowe
+ DATE CREATED: 23/2/95
+
+ Quantises vec by choosing the nearest vector in codebook cb, and
+ returns the vector index. The squared error of the quantised vector
+ is added to se.
+
+\*---------------------------------------------------------------------------*/
+
+long quantise(float cb[], float vec[], int k, int m, float *se)
+/* float cb[][K]; current VQ codebook */
+/* float vec[]; vector to quantise */
+/* int k; dimension of vectors */
+/* int m; size of codebook */
+/* float *se; accumulated squared error */
+{
+ float e; /* current error */
+ long besti; /* best index so far */
+ float beste; /* best error so far */
+ long j;
+ int i;
+
+ besti = 0;
+ beste = 1E32;
+ for(j=0; j<m; j++) {
+ e = 0.0;
+ for(i=0; i<k; i++)
+ e += pow(cb[j*k+i]-vec[i],2.0);
+ if (e < beste) {
+ beste = e;
+ besti = j;
+ }
+ }
+
+ *se += beste;
+
+ return(besti);
+}
+
BASE=../../../..
-CODEC2_DIR=$(switch_srcdir)/libs/libcodec2-1.0
-CODEC2_BUILDDIR=$(switch_builddir)/libs/libcodec2-1.0
+CODEC2_DIR=$(switch_srcdir)/libs/libcodec2
+CODEC2_BUILDDIR=$(switch_builddir)/libs/libcodec2
CODEC2LA=$(CODEC2_BUILDDIR)/src/libcodec2.la
LOCAL_CFLAGS=-I$(CODEC2_DIR)/include -I$(CODEC2_BUILDDIR)/src