+ The FreeDV API for digital voice over radio. FreeDV is an open source digital voice protocol that integrates modems, codecs, and FEC [README_freedv](README_freedv.md)
We are currently conducting a major re-development of Codec 2, new speech coding, modems, and FreeDV modes are under active development. We have limited resources available for maintenance or development on features that may soon be replaced (with the exception of major bugs). We'd rather put our efforts into new features! Modes and Features we are not actively maintaining at present, and likely to be superseded in the near future include:
The code supporting these modes won't be going away any time soon (and we will continue to include any modes/code in popular use), but we have chosen not to actively develop it at this time.
If you have a Feature Request, please answer the questions in the [Feature Request Form](https://freedv.org/wp-content/uploads/sites/8/2024/03/FreeDV-027-Feature-Request-Form-V1.1.pdf), and submit your answers as a GitHub Issue.
Before writing any code or submitting a PR - **please discuss** the PR with developers by raising a GitHub Issue. We have many years of experience and a carefully considered plan for Codec 2 development, and can guide you on work that will most benefit this project.
2. Experimental work, code used for algorithm development, should probably go into some other repo.
3. Only widely used “production” code goes in codec2. If it has an user base of <2(e.g.personalprojects,earlyR&D)-itshouldprobablybeapplicationcodeorafork.
For Windows applications (built with MSVC or any compiler) we recommend linking with our [cross-compiled](#building-for-windows) Codec 2 DLLs. This lets you enjoy the benefits of our carefully developed, tested and maintained codebase without having to develop and maintain your own fork.
We have standardized on C99 and develop and test using gcc on a Linux platform. Our focus needs to be on what’s unique about our project – the speech codec and modem waveforms, and we lack the resources to support multiple compilers. If you want to build Codec 2 using a non-standard compiler like MSVC and certain embedded compilers you will need to maintain your own Codec 2 fork (a very large commitment). If you decide to fork Codec 2 to a non C99 compiler - please ensure you port the ctests and that they all pass. If the tests have not been ported or do not pass - it's not Codec 2.
+ See `demo` directory for simple examples of using Codec and the FreeDV API.
+ `c2demo` encodes a file of speech samples, then decodes them and saves the result.
+ `c2enc` encodes a file of speech samples to a compressed file of encoded bits. `c2dec` decodes a compressed file of bits to a file of speech samples.
+ `c2sim` is a simulation/development version of Codec 2. It allows selective use of the various Codec 2 algorithms. For example switching phase modelling or quantisation on and off.
+ `freedv_tx`&`freedv_rx` are command line implementations of the FreeDV protocol, which combines Codec 2, modems, and Forward Error Correction (FEC).
+ `cohpsk_*` are coherent PSK (COHPSK) HF modem command line programs.
+ `fdmdv_*` are differential PSK HF modem command line programs (README_fdmdv).
+ `fsk_*` are command line programs for a non-coherent FSK modem (README_fsk).
+ `ldpc_*` are LDPC encoder/decoder command line programs, based on the CML library.
+ `ofdm_*` are OFDM PSK HF modem command line programs (README_ofdm).
## Building and Running Unit Tests
CTest is used as a test framework, with support from [GNU Octave](https://www.gnu.org/software/octave/) scripts.
1. Install GNU Octave and libraries on Ubuntu with:
This will create a working `libcodec2.dll` file for use with other applications (e.g. FreeDV GUI which is in wide spread use on Windows). Please note the utility/development command line applications (e.g. `freedv_rx.exe`) may not work exactly the same on the Windows CLI compared to running on a Unix machine/shell. For example pipes may not function as expected, and ctests are not supported. Our primary development and test environment is Linux, and we lack the resources to support and maintain these applications for other operating systems.
1. Add Codec 2 to the target_link_libraries in the same file.
## Building Codec 2 for Microcontrollers
Codec 2 requires a hardware Floating Point Unit (FPU) to run in real time.
Two build options have been added to support building on microcontrollers:
1. Setting the `cmake` variable MICROCONTROLLER_BUILD disables position independent code (-fPIC is not used). This was required for the IMRT1052 used in Teensy 4/4.1).
1. On ARM machines, setting the C Flag \_\_EMBEDDED\_\_ and linking with the ARM CMSIS library will improve performance on ARM-based microcontrollers. \_\_REAL\_\_ and FDV\_ARM\_MATH are additional ARM-specific options that can be set to improve performance if required, especially with OFDM modes.
A CMakeLists.txt example for a microcontroller is below:
To build Debian packages, simply run the "cpack" command after running "make". This will generate the following packages:
+ codec2: Contains the .so and .a files for linking/executing applications dependent on Codec2.
* codec2-dev: Contains the header files for development using Codec2.
Once generated, they can be installed with "dpkg -i" (once LPCNet is installed). If LPCNet is not desired, CMakeLists.txt can be modified to remove that dependency.