├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── encodings.xml
├── gradle.xml
├── markdown-navigator.xml
├── markdown-navigator
│ └── profiles_settings.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── LICENSE
├── README.md
├── appcodec2demo
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── prototypemanager
│ │ └── ustadmobile
│ │ └── com
│ │ └── appcodec2demo
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ ├── audio.c2
│ │ ├── demo.c2
│ │ ├── video1-1300.c2
│ │ ├── video1-1600.c2
│ │ ├── video1-2400.c2
│ │ ├── video1.zip
│ │ ├── video2-1300.c2
│ │ ├── video2-2400-cod2noextension
│ │ ├── video2-2400-cod2noextension.raw
│ │ ├── video2-2400.c2
│ │ ├── video2-3200.c2
│ │ └── video2-3200.c2.raw
│ ├── java
│ │ └── com
│ │ │ └── ustadmobile
│ │ │ └── codec2
│ │ │ └── demo
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── prototypemanager
│ └── ustadmobile
│ └── com
│ └── appcodec2demo
│ └── ExampleUnitTest.java
├── build.gradle
├── buildconfig.default.properties
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── libcodec2-android
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── ustadmobile
│ │ └── codec2
│ │ ├── ExampleInstrumentedTest.java
│ │ └── TestCodec2Decode.java
│ ├── codec2
│ ├── CMakeLists.txt
│ ├── COPYING
│ ├── INSTALL
│ ├── README
│ ├── README_fdmdv.txt
│ ├── README_fsk.txt
│ ├── README_ofdm.txt
│ ├── cmake
│ │ ├── GetDependencies.cmake.in
│ │ ├── config.h.in
│ │ └── version.h.in
│ ├── codec2.pc.in
│ ├── debian
│ │ ├── changelog
│ │ ├── codec2.doc-base.EX
│ │ ├── codec2.install
│ │ ├── codec21.dirs
│ │ ├── codec21.install
│ │ ├── compat
│ │ ├── control
│ │ ├── copyright
│ │ ├── docs
│ │ ├── libcodec2-dev.dirs
│ │ ├── libcodec2-dev.install
│ │ ├── libcodec2.install
│ │ ├── rules
│ │ └── source
│ │ │ └── format
│ ├── octave
│ │ ├── 2400ab_frame_design.ods
│ │ ├── H2064_516_sparse.mat
│ │ ├── HRA_112_112.txt
│ │ ├── HRA_112_56.txt
│ │ ├── HRA_56_28.txt
│ │ ├── HRA_56_56.txt
│ │ ├── Mat2Hrows.m
│ │ ├── adc_plot_spec.m
│ │ ├── adc_sfdr_ut.m
│ │ ├── adcres.m
│ │ ├── autotest.m
│ │ ├── av_imp.m
│ │ ├── bandpasssampling.m
│ │ ├── bfq19ssa.m
│ │ ├── bpf.m
│ │ ├── bpsk.m
│ │ ├── c2wideband_batch.m
│ │ ├── c2wideband_const.m
│ │ ├── c2wideband_fbf.m
│ │ ├── c2wideband_map
│ │ ├── cbphase.m
│ │ ├── cellmodem.m
│ │ ├── ciccomp.m
│ │ ├── closed_quant_slope.m
│ │ ├── cma.m
│ │ ├── cml.patch
│ │ ├── codec2_demo.m
│ │ ├── cohpsk.m
│ │ ├── cohpsk_ch_fading.m
│ │ ├── cohpsk_demod_plot.m
│ │ ├── cohpsk_frame_design.ods
│ │ ├── cohpsk_plots.m
│ │ ├── crc16.m
│ │ ├── cspec.m
│ │ ├── dacres.m
│ │ ├── dec_pager.m
│ │ ├── df_mixer.m
│ │ ├── diff_codec.m
│ │ ├── doppler_spread.m
│ │ ├── doppler_spread_ut.m
│ │ ├── estsnr.m
│ │ ├── fdmdv.m
│ │ ├── fdmdv_demod.m
│ │ ├── fdmdv_demod_c.m
│ │ ├── fdmdv_demod_coh.m
│ │ ├── fdmdv_mod.m
│ │ ├── fdmdv_sweep.m
│ │ ├── fdmdv_ut.m
│ │ ├── fdmdv_ut_coh.m
│ │ ├── fdmdv_ut_freq_off.m
│ │ ├── fm.m
│ │ ├── fm_radio_filt_model.txt
│ │ ├── fmfsk.m
│ │ ├── fsk.m
│ │ ├── fsk4.m
│ │ ├── fsk_basic.m
│ │ ├── fsk_basic_alt.m
│ │ ├── fsk_cont_phase.m
│ │ ├── fsk_eme.m
│ │ ├── fsk_horus.m
│ │ ├── fsk_horus_2fsk.m
│ │ ├── fsk_horus_stream.m
│ │ ├── fsk_lib.m
│ │ ├── fskdemodgui.py
│ │ ├── fuzzy_gray.m
│ │ ├── gen_complex_short.m
│ │ ├── gen_rn_coeffs.m
│ │ ├── glottal.m
│ │ ├── gmsk.m
│ │ ├── gp_interleaver.m
│ │ ├── hackrf_dc.m
│ │ ├── hackrf_twotone.m
│ │ ├── hackrf_uc.m
│ │ ├── handvq.m
│ │ ├── hf_modem_curves.m
│ │ ├── hf_sim.m
│ │ ├── hfper.m
│ │ ├── horus_high_speed.bin
│ │ ├── horus_msg.txt
│ │ ├── horus_payload_rtty.txt
│ │ ├── horus_tx_bits_binary.txt
│ │ ├── hp_filt.m
│ │ ├── impulse_noise.m
│ │ ├── kmeans2.m
│ │ ├── kmeans_tests.m
│ │ ├── ldpc.m
│ │ ├── ldpc_fsk_lib.m
│ │ ├── ldpc_gen_h_file.m
│ │ ├── ldpc_qpsk.m
│ │ ├── ldpc_short.m
│ │ ├── ldpcdec.m
│ │ ├── ldpcenc.m
│ │ ├── ldpcut.m
│ │ ├── linreg.m
│ │ ├── load_comp.m
│ │ ├── load_hackrf.m
│ │ ├── load_raw.m
│ │ ├── lpcauto.m
│ │ ├── lpcpf.m
│ │ ├── lsp.m
│ │ ├── lsp_pdf.m
│ │ ├── lspvar.m
│ │ ├── lspwarp.m
│ │ ├── mag_to_phase.m
│ │ ├── make_hilb.m
│ │ ├── make_ssbfilt.m
│ │ ├── mancyfsk.m
│ │ ├── melstats.m
│ │ ├── melvq.m
│ │ ├── mfsk.m
│ │ ├── newamp.m
│ │ ├── newamp1_batch.m
│ │ ├── newamp1_compare.m
│ │ ├── newamp1_fbf.m
│ │ ├── newamp_batch.m
│ │ ├── newamp_fbf.m
│ │ ├── nf_from_gr.m
│ │ ├── nf_from_stdio.m
│ │ ├── ofdm_demod_c.m
│ │ ├── ofdm_dev.m
│ │ ├── ofdm_ldpc_rx.m
│ │ ├── ofdm_ldpc_tx.m
│ │ ├── ofdm_lib.m
│ │ ├── ofdm_load_const.m
│ │ ├── ofdm_rs.m
│ │ ├── ofdm_rx.m
│ │ ├── ofdm_tx.m
│ │ ├── open_quant_slope.m
│ │ ├── oqpsk.m
│ │ ├── phase.m
│ │ ├── phase2.m
│ │ ├── phasesecord.m
│ │ ├── pitch_test.m
│ │ ├── pl.m
│ │ ├── pl2.m
│ │ ├── plamp.m
│ │ ├── plinterp.m
│ │ ├── pllpcpf.m
│ │ ├── pllsp.m
│ │ ├── pllspdt.m
│ │ ├── plnlp.m
│ │ ├── plot_specgram.m
│ │ ├── plphase.m
│ │ ├── plpitch.m
│ │ ├── plppe.m
│ │ ├── plsub.m
│ │ ├── plvoicing.m
│ │ ├── png.m
│ │ ├── postfilter.m
│ │ ├── pulse.m
│ │ ├── qpsk.m
│ │ ├── rfdesign.m
│ │ ├── s_param_rf.m
│ │ ├── sample_clock_offset.m
│ │ ├── save_array_c_header.m
│ │ ├── save_raw.m
│ │ ├── sd.m
│ │ ├── spec.m
│ │ ├── tcohpsk.m
│ │ ├── tdetphase.m
│ │ ├── telem_upload.py
│ │ ├── test_cohpsk.m
│ │ ├── test_cohpsk_ch.m
│ │ ├── test_dqpsk.m
│ │ ├── test_dqpsk2.m
│ │ ├── test_dsss.m
│ │ ├── test_dsss_pilot.m
│ │ ├── test_fec.m
│ │ ├── test_foff.m
│ │ ├── test_ftrack.m
│ │ ├── test_ldpc_fsk_lib.m
│ │ ├── test_ml.m
│ │ ├── test_pilot.m
│ │ ├── test_qpsk.m
│ │ ├── test_qpsk2.m
│ │ ├── test_qpsk3.m
│ │ ├── tfdmdv.m
│ │ ├── tfmfsk.m
│ │ ├── tfsk.m
│ │ ├── tfsk_2400a.m
│ │ ├── tget_spec.m
│ │ ├── tlinreg.m
│ │ ├── tnewamp1.m
│ │ ├── tofdm.m
│ │ ├── tpapr.m
│ │ ├── tqpsk.m
│ │ ├── train_120_1.txt
│ │ ├── train_120_2.txt
│ │ ├── trellis.m
│ │ ├── twod_fbf.m
│ │ ├── twomixer.m
│ │ ├── twotone.m
│ │ ├── twotone1.m
│ │ ├── tximage.m
│ │ ├── undersample.m
│ │ ├── vhf_pa.m
│ │ ├── vq
│ │ ├── vq_construct_indep_mg.m
│ │ ├── vq_construct_mg.m
│ │ ├── vq_nm_xx_11_40_hpf150
│ │ ├── vq_pager.m
│ │ ├── vq_search_gain.m
│ │ ├── vq_search_mse.m
│ │ ├── vq_search_para.m
│ │ ├── vq_search_sg.m
│ │ ├── vq_search_slope.m
│ │ ├── xormixer.m
│ │ └── yafsk.m
│ ├── raw
│ │ ├── b0067.raw
│ │ ├── cq_ref.raw
│ │ ├── cross.raw
│ │ ├── cross_melp2400.raw
│ │ ├── f2400.raw
│ │ ├── forig.raw
│ │ ├── forig_ambe2000.raw
│ │ ├── forig_g729a.raw
│ │ ├── forig_gsm13k.raw
│ │ ├── forig_speex_8k.raw
│ │ ├── g3plx.raw
│ │ ├── hts.raw
│ │ ├── hts1.raw
│ │ ├── hts1a.raw
│ │ ├── hts1a_ambe2000.raw
│ │ ├── hts1a_g729a.raw
│ │ ├── hts1a_gsm13k.raw
│ │ ├── hts1a_melp.raw
│ │ ├── hts1a_speex_8k.raw
│ │ ├── hts2.raw
│ │ ├── hts2a.raw
│ │ ├── hts2a_ambe2000.raw
│ │ ├── hts2a_g729a.raw
│ │ ├── hts2a_gsm13k.raw
│ │ ├── hts2a_melp.raw
│ │ ├── hts2a_speex_8k.raw
│ │ ├── k6hx.raw
│ │ ├── kristoff.raw
│ │ ├── m2400.raw
│ │ ├── mmt1.raw
│ │ ├── mmt1_ambe2000.raw
│ │ ├── mmt1_g729a.raw
│ │ ├── mmt1_gsm13k.raw
│ │ ├── mmt1_speex_8k.raw
│ │ ├── morig.raw
│ │ ├── morig_ambe2000.raw
│ │ ├── morig_g729a.raw
│ │ ├── morig_gsm13k.raw
│ │ ├── morig_speex_8k.raw
│ │ ├── sine1k_2Hz_spread.raw
│ │ ├── sine1k_2ms_delay_2Hz_spread.raw
│ │ ├── speech_orig_16k.wav
│ │ ├── ve9qrp.raw
│ │ ├── ve9qrp_10s.raw
│ │ └── vk5qi.raw
│ ├── script
│ │ ├── menu.sh
│ │ ├── playraw.sh
│ │ ├── raw2wav.sh
│ │ ├── separate_all.sh
│ │ └── wav2raw.sh
│ ├── src
│ │ ├── CMakeLists.txt
│ │ ├── H2064_516_sparse.h
│ │ ├── HRA_112_112.h
│ │ ├── _kiss_fft_guts.h
│ │ ├── ampexp.c
│ │ ├── ampexp.h
│ │ ├── bpf.h
│ │ ├── bpfb.h
│ │ ├── c2dec.c
│ │ ├── c2demo.c
│ │ ├── c2enc.c
│ │ ├── c2file.h
│ │ ├── c2sim.c
│ │ ├── c2wideband.c
│ │ ├── c2wideband.h
│ │ ├── c2wideband_map.h
│ │ ├── codebook.c
│ │ ├── codebook
│ │ │ ├── c2wideband_map.txt
│ │ │ ├── dlsp1.txt
│ │ │ ├── dlsp10.txt
│ │ │ ├── dlsp2.txt
│ │ │ ├── dlsp3.txt
│ │ │ ├── dlsp4.txt
│ │ │ ├── dlsp5.txt
│ │ │ ├── dlsp6.txt
│ │ │ ├── dlsp7.txt
│ │ │ ├── dlsp8.txt
│ │ │ ├── dlsp9.txt
│ │ │ ├── gecb.txt
│ │ │ ├── lsp1.txt
│ │ │ ├── lsp10.txt
│ │ │ ├── lsp2.txt
│ │ │ ├── lsp3.txt
│ │ │ ├── lsp4.txt
│ │ │ ├── lsp5.txt
│ │ │ ├── lsp6.txt
│ │ │ ├── lsp7.txt
│ │ │ ├── lsp8.txt
│ │ │ ├── lsp8910.txt
│ │ │ ├── lsp9.txt
│ │ │ ├── lspdt.txt
│ │ │ ├── lspdt1-10.txt
│ │ │ ├── lspdt1.txt
│ │ │ ├── lspdt10.txt
│ │ │ ├── lspdt2.txt
│ │ │ ├── lspdt3.txt
│ │ │ ├── lspdt4.txt
│ │ │ ├── lspdt5.txt
│ │ │ ├── lspdt6.txt
│ │ │ ├── lspdt7.txt
│ │ │ ├── lspdt8.txt
│ │ │ ├── lspdt9.txt
│ │ │ ├── lspjvm1.txt
│ │ │ ├── lspjvm2.txt
│ │ │ ├── lspjvm3.txt
│ │ │ ├── lspmelvq1.txt
│ │ │ ├── lspmelvq2.txt
│ │ │ ├── lspmelvq3.txt
│ │ │ ├── lspres_bw1.txt
│ │ │ ├── lspres_bw2.txt
│ │ │ ├── lspres_centre1.txt
│ │ │ ├── lspres_centre2.txt
│ │ │ ├── lspvqanssi1.txt
│ │ │ ├── lspvqanssi2.txt
│ │ │ ├── lspvqanssi3.txt
│ │ │ ├── lspvqanssi4.txt
│ │ │ ├── lspvqexp1.txt
│ │ │ ├── lspvqexp2.txt
│ │ │ ├── lspvqexp3.txt
│ │ │ ├── mel1.txt
│ │ │ ├── mel2.txt
│ │ │ ├── mel3.txt
│ │ │ ├── mel4.txt
│ │ │ ├── mel5.txt
│ │ │ ├── mel6.txt
│ │ │ ├── newamp1_energy_q.txt
│ │ │ ├── train_120_1.txt
│ │ │ └── train_120_2.txt
│ │ ├── codebookd.c
│ │ ├── codebookdt.c
│ │ ├── codebookge.c
│ │ ├── codebookjvm.c
│ │ ├── codebooknewamp1.c
│ │ ├── codebooknewamp1_energy.c
│ │ ├── codebookres.c
│ │ ├── codebookvq.c
│ │ ├── codec2.c
│ │ ├── codec2.h
│ │ ├── codec2_cohpsk.h
│ │ ├── codec2_fdmdv.h
│ │ ├── codec2_fft.c
│ │ ├── codec2_fft.h
│ │ ├── codec2_fifo.h
│ │ ├── codec2_fm.h
│ │ ├── codec2_internal.h
│ │ ├── codec2_ofdm.h
│ │ ├── cohpsk.c
│ │ ├── cohpsk_ch.c
│ │ ├── cohpsk_defs.h
│ │ ├── cohpsk_demod.c
│ │ ├── cohpsk_get_test_bits.c
│ │ ├── cohpsk_internal.h
│ │ ├── cohpsk_mod.c
│ │ ├── cohpsk_put_test_bits.c
│ │ ├── comp.h
│ │ ├── comp_prim.h
│ │ ├── dct2.c
│ │ ├── dct2.h
│ │ ├── defines.h
│ │ ├── drs232.c
│ │ ├── drs232_ldpc.c
│ │ ├── dump.c
│ │ ├── dump.h
│ │ ├── fdmdv.c
│ │ ├── fdmdv_channel.c
│ │ ├── fdmdv_demod.c
│ │ ├── fdmdv_get_test_bits.c
│ │ ├── fdmdv_interleave.c
│ │ ├── fdmdv_internal.h
│ │ ├── fdmdv_mod.c
│ │ ├── fdmdv_put_test_bits.c
│ │ ├── fec_dec.c
│ │ ├── fec_enc.c
│ │ ├── fifo.c
│ │ ├── fm.c
│ │ ├── fm_demod.c
│ │ ├── fm_fir_coeff.h
│ │ ├── fmfsk.c
│ │ ├── fmfsk.h
│ │ ├── fmfsk_demod.c
│ │ ├── fmfsk_mod.c
│ │ ├── fq20.sh
│ │ ├── freedv_api.c
│ │ ├── freedv_api.h
│ │ ├── freedv_api_internal.h
│ │ ├── freedv_data_channel.c
│ │ ├── freedv_data_channel.h
│ │ ├── freedv_rx.c
│ │ ├── freedv_tx.c
│ │ ├── freedv_vhf_framing.c
│ │ ├── freedv_vhf_framing.h
│ │ ├── fsk.c
│ │ ├── fsk.h
│ │ ├── fsk_demod.c
│ │ ├── fsk_get_test_bits.c
│ │ ├── fsk_mod.c
│ │ ├── fsk_mod_ext_vco.c
│ │ ├── fsk_put_test_bits.c
│ │ ├── generate_codebook.c
│ │ ├── generate_wideband_map.c
│ │ ├── golay23.c
│ │ ├── golay23.h
│ │ ├── golaydectable.h
│ │ ├── golayenctable.h
│ │ ├── gp_interleaver.c
│ │ ├── gp_interleaver.h
│ │ ├── hanning.h
│ │ ├── horus_api.c
│ │ ├── horus_api.h
│ │ ├── horus_demod.c
│ │ ├── horus_l2.c
│ │ ├── horus_l2.h
│ │ ├── ht_coeff.h
│ │ ├── insert_errors.c
│ │ ├── interldpc.c
│ │ ├── interldpc.h
│ │ ├── interp.c
│ │ ├── interp.h
│ │ ├── kiss_fft.c
│ │ ├── kiss_fft.h
│ │ ├── kiss_fftr.c
│ │ ├── kiss_fftr.h
│ │ ├── ldpc_dec.c
│ │ ├── ldpc_enc.c
│ │ ├── linreg.c
│ │ ├── linreg.h
│ │ ├── listensim.sh
│ │ ├── lpc.c
│ │ ├── lpc.h
│ │ ├── lsp.c
│ │ ├── lsp.h
│ │ ├── machdep.h
│ │ ├── mbest.c
│ │ ├── mbest.h
│ │ ├── modem_probe.c
│ │ ├── modem_probe.h
│ │ ├── modem_stats.c
│ │ ├── modem_stats.h
│ │ ├── mpdecode_core.c
│ │ ├── mpdecode_core.h
│ │ ├── newamp1.c
│ │ ├── newamp1.h
│ │ ├── nlp.c
│ │ ├── nlp.h
│ │ ├── noise_samples.h
│ │ ├── octave.c
│ │ ├── octave.h
│ │ ├── ofdm.c
│ │ ├── ofdm_bpf_coeff.h
│ │ ├── ofdm_demod.c
│ │ ├── ofdm_get_test_bits.c
│ │ ├── ofdm_internal.h
│ │ ├── ofdm_mod.c
│ │ ├── ofdm_put_test_bits.c
│ │ ├── os.h
│ │ ├── pack.c
│ │ ├── phase.c
│ │ ├── phase.h
│ │ ├── phaseexp.c
│ │ ├── phaseexp.h
│ │ ├── pilot_coeff.h
│ │ ├── pilots_coh.h
│ │ ├── postfilter.c
│ │ ├── postfilter.h
│ │ ├── quantise.c
│ │ ├── quantise.h
│ │ ├── resample.c
│ │ ├── rn.h
│ │ ├── rn_coh.h
│ │ ├── rxdec_coeff.h
│ │ ├── sim.sh
│ │ ├── sine.c
│ │ ├── sine.h
│ │ ├── ssbfilt_coeff.h
│ │ ├── tdma.c
│ │ ├── tdma.h
│ │ ├── test_bits.h
│ │ ├── test_bits_coh.h
│ │ ├── test_bits_ofdm.h
│ │ ├── varicode.c
│ │ ├── varicode.h
│ │ ├── varicode_table.h
│ │ ├── vhf_deframe_c2.c
│ │ └── vhf_frame_c2.c
│ ├── stm32
│ │ ├── CMakeLists.txt
│ │ ├── MENU.txt
│ │ ├── Makefile
│ │ ├── README.txt
│ │ ├── cmake
│ │ │ ├── arm_header.cmake
│ │ │ └── arm_toolchain.cmake
│ │ ├── inc
│ │ │ ├── debugblinky.h
│ │ │ ├── gdb_stdio.h
│ │ │ ├── iir_duc.h
│ │ │ ├── iir_tuner.h
│ │ │ ├── menu.h
│ │ │ ├── morse.h
│ │ │ ├── new_i2c.h
│ │ │ ├── sfx.h
│ │ │ ├── si53xx.h
│ │ │ ├── sine.h
│ │ │ ├── sm1000_leds_switches.h
│ │ │ ├── sounds.h
│ │ │ ├── stm32f4_adc.h
│ │ │ ├── stm32f4_adc_tuner.h
│ │ │ ├── stm32f4_dac.h
│ │ │ ├── stm32f4_dacduc.h
│ │ │ ├── stm32f4_usb_vcp.h
│ │ │ ├── stm32f4_vrom.h
│ │ │ ├── stm32f4xx_conf.h
│ │ │ ├── tm_stm32f4_gpio.h
│ │ │ ├── tm_stm32f4_mco_output.h
│ │ │ ├── tone.h
│ │ │ └── tot.h
│ │ ├── src
│ │ │ ├── adc_rec.c
│ │ │ ├── adc_rec_usb.c
│ │ │ ├── adc_sd.c
│ │ │ ├── adc_sfdr_ut.c
│ │ │ ├── adcdac_ut.c
│ │ │ ├── codec2_profile.c
│ │ │ ├── dac_it.c
│ │ │ ├── dac_play.c
│ │ │ ├── dac_ut.c
│ │ │ ├── dac_ut_fast.c
│ │ │ ├── debugblinky.c
│ │ │ ├── fast_dac_ut.c
│ │ │ ├── fdmdv_dump_rt.c
│ │ │ ├── fdmdv_profile.c
│ │ │ ├── fft_test.c
│ │ │ ├── freedv_rx_profile.c
│ │ │ ├── freedv_tx_profile.c
│ │ │ ├── gdb_stdio.c
│ │ │ ├── iir_duc.c
│ │ │ ├── iir_tuner.c
│ │ │ ├── init.c
│ │ │ ├── mco_ut.c
│ │ │ ├── menu.c
│ │ │ ├── morse.c
│ │ │ ├── new_i2c.c
│ │ │ ├── power_ut.c
│ │ │ ├── sfx.c
│ │ │ ├── si5351_ut.c
│ │ │ ├── si53xx.c
│ │ │ ├── sine.c
│ │ │ ├── sm1000_leds_switches.c
│ │ │ ├── sm1000_leds_switches_ut.c
│ │ │ ├── sm1000_main.c
│ │ │ ├── sm2000_adc_dump.c
│ │ │ ├── sm2000_rxdemo.c
│ │ │ ├── sm2000_stw.c
│ │ │ ├── sounds.c
│ │ │ ├── startup_stm32f4xx.s
│ │ │ ├── stm32f4_adc.c
│ │ │ ├── stm32f4_adc_tuner.c
│ │ │ ├── stm32f4_dac.c
│ │ │ ├── stm32f4_dacduc.c
│ │ │ ├── stm32f4_dacloduc.c
│ │ │ ├── stm32f4_machdep.c
│ │ │ ├── stm32f4_pwm.c
│ │ │ ├── stm32f4_usb_vcp.c
│ │ │ ├── stm32f4_vrom.c
│ │ │ ├── system_stm32f4xx.c
│ │ │ ├── timer_ut.c
│ │ │ ├── tm_stm32f4_gpio.c
│ │ │ ├── tm_stm32f4_mco_output.c
│ │ │ ├── tone.c
│ │ │ ├── tot.c
│ │ │ ├── tuner_ut.c
│ │ │ ├── usb_vcp_ut.c
│ │ │ └── usb_vsp_ut.c
│ │ ├── stlink
│ │ │ ├── elfsym.c
│ │ │ ├── elfsym.h
│ │ │ └── stlink.patch
│ │ ├── stm32_flash.ld
│ │ ├── stm32_ram.ld
│ │ ├── usb_conf
│ │ │ ├── usb_bsp.c
│ │ │ ├── usb_bsp.h
│ │ │ ├── usb_conf.h
│ │ │ ├── usbd_conf.h
│ │ │ ├── usbd_desc.c
│ │ │ ├── usbd_desc.h
│ │ │ └── usbd_usr.c
│ │ └── usb_lib
│ │ │ ├── cdc
│ │ │ ├── usbd_cdc_core.c
│ │ │ ├── usbd_cdc_core.h
│ │ │ ├── usbd_cdc_vcp.c
│ │ │ └── usbd_cdc_vcp.h
│ │ │ ├── core
│ │ │ ├── usbd_core.c
│ │ │ ├── usbd_core.h
│ │ │ ├── usbd_def.h
│ │ │ ├── usbd_ioreq.c
│ │ │ ├── usbd_ioreq.h
│ │ │ ├── usbd_req.c
│ │ │ ├── usbd_req.h
│ │ │ └── usbd_usr.h
│ │ │ └── otg
│ │ │ ├── usb_core.c
│ │ │ ├── usb_core.h
│ │ │ ├── usb_dcd.c
│ │ │ ├── usb_dcd.h
│ │ │ ├── usb_dcd_int.c
│ │ │ ├── usb_dcd_int.h
│ │ │ ├── usb_defines.h
│ │ │ └── usb_regs.h
│ ├── unittest
│ │ ├── CMakeLists.txt
│ │ ├── Makefile.am
│ │ ├── Makefile.in
│ │ ├── README
│ │ ├── c2validate.c
│ │ ├── c2validate.h
│ │ ├── create_interleaver.c
│ │ ├── de.c
│ │ ├── dvdongle2.c
│ │ ├── extract.c
│ │ ├── fdmdv_mem.c
│ │ ├── ge_train.c
│ │ ├── genampdata.c
│ │ ├── genlsp.c
│ │ ├── genphdata.c
│ │ ├── genres.c
│ │ ├── hts1a.h
│ │ ├── hts1a_1300.h
│ │ ├── lsp1.txt
│ │ ├── lsp10.txt
│ │ ├── lsp2.txt
│ │ ├── lsp3.txt
│ │ ├── lsp4.txt
│ │ ├── lsp45678910.txt
│ │ ├── lsp5.txt
│ │ ├── lsp6.txt
│ │ ├── lsp7.txt
│ │ ├── lsp8.txt
│ │ ├── lsp9.txt
│ │ ├── lspd456.txt
│ │ ├── lspd678910.txt
│ │ ├── lspd78.txt
│ │ ├── lspd910.txt
│ │ ├── lspjnd5-10.txt
│ │ ├── mksine.c
│ │ ├── polar2rect.c
│ │ ├── pre.c
│ │ ├── raw2h.c
│ │ ├── run_tests.sh
│ │ ├── scalarlsptest.c
│ │ ├── sd.c
│ │ ├── sd.h
│ │ ├── speexlsptest.c
│ │ ├── speexnoisesup.c
│ │ ├── t16_8.c
│ │ ├── t16_8_short.c
│ │ ├── t48_8.c
│ │ ├── t_helpers.c
│ │ ├── t_helpers.h
│ │ ├── tc2wideband.c
│ │ ├── tcodec2.c
│ │ ├── tcohpsk.c
│ │ ├── tcontphase.c
│ │ ├── tdct2.c
│ │ ├── tdec.c
│ │ ├── tdeframer.c
│ │ ├── test_cohpsk_ch.c
│ │ ├── tfdmdv.c
│ │ ├── tfifo.c
│ │ ├── tfmfsk.c
│ │ ├── tfreedv_data_channel.c
│ │ ├── tfsk.c
│ │ ├── tinterp.c
│ │ ├── tlininterp.c
│ │ ├── tlspsens.c
│ │ ├── tnewamp1.c
│ │ ├── tnlp.c
│ │ ├── tofdm.c
│ │ ├── tprede.c
│ │ ├── tquant.c
│ │ ├── tsrc.c
│ │ ├── vq_train_jvm.c
│ │ └── vqtrain.c
│ └── wav
│ │ ├── all.wav
│ │ ├── cross.wav
│ │ ├── cross_melp2400.wav
│ │ ├── f2400.wav
│ │ ├── forig.wav
│ │ ├── forig_ambe2000.wav
│ │ ├── forig_speex_8k.wav
│ │ ├── hts1a.wav
│ │ ├── hts1a_ambe2000.wav
│ │ ├── hts1a_c2_v0.1.wav
│ │ ├── hts1a_c2_v0.1a.wav
│ │ ├── hts1a_g729a.wav
│ │ ├── hts1a_lpc10.wav
│ │ ├── hts1a_speex_8k.wav
│ │ ├── hts2a.wav
│ │ ├── hts2a_ambe2000.wav
│ │ ├── hts2a_c2_v0.1.wav
│ │ ├── hts2a_c2_v0.1a.wav
│ │ ├── hts2a_g729a.wav
│ │ ├── hts2a_lpc10.wav
│ │ ├── hts2a_speex_8k.wav
│ │ ├── m2400.wav
│ │ ├── mmt1.wav
│ │ ├── mmt1_ambe2000.wav
│ │ ├── mmt1_c2_v01a.wav
│ │ ├── mmt1_lpc10.wav
│ │ ├── mmt1_speex_8k.wav
│ │ ├── morig.wav
│ │ ├── morig_ambe2000.wav
│ │ ├── morig_speex_8k.wav
│ │ ├── ve9qrp.wav
│ │ ├── vk5qi.wav
│ │ ├── x200_ext.wav
│ │ └── x200_int.wav
│ ├── main
│ ├── AndroidManifest.xml
│ ├── cpp
│ │ ├── CMakeLists.txt
│ │ ├── Codec2JNI.cpp
│ │ └── codec2
│ │ │ ├── codec2.h
│ │ │ ├── codec2
│ │ │ └── version.h
│ │ │ ├── codec2_fdmdv.h
│ │ │ ├── comp.h
│ │ │ ├── kiss_fft.h
│ │ │ ├── modem_stats.h
│ │ │ └── varicode.h
│ ├── java
│ │ └── com
│ │ │ └── ustadmobile
│ │ │ └── codec2
│ │ │ ├── Codec2.java
│ │ │ └── Codec2Decoder.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── ustadmobile
│ └── codec2
│ └── ExampleUnitTest.java
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | buildconfig.local.properties
15 |
16 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Codec2 Android Library
2 |
3 | This is an early version of an Android library for Codec2. It will compile Codec2's original source
4 | code for the specified android native platforms (ABIs eg x86_64, armeabi-v7a, etc) using Gradle and
5 | compile an aar file. It provides JNI intefaces that can be used to access decode Codec2 files.
6 |
7 | ## Credits
8 |
9 | This is an Android wrapper for Codec2 developed by David Rowe et. al, used under the LGPL license.
10 | See [http://www.rowetel.com/?page_id=452](http://www.rowetel.com/?page_id=452). This project also
11 | uses elements of a previous wrapper by Ahmed Obaidi used under the LGPL license. See
12 | [https://github.com/AhmedObaidi/codec2-android](https://github.com/AhmedObaidi/codec2-android).
13 |
14 | ## Building
15 |
16 | By default the aar will build for x86_64 and armeabi-v7a. You can change this by changing the
17 | buildconfig. Copy buildconfig.default.properties to buildconfig.local.properties and adjust
18 |
19 | ## Publish
20 |
21 | This project uses a Maven publishing plugin. Simply use:
22 |
23 | ./gradlew libcodec2-android:publish
24 |
25 | You can set the publishing directory property in buildconfig properties (as above) using the
26 | property repo.dir
27 |
28 | ## Android API Level
29 |
30 | Unfortunately, at the moment this library requires API 23+. This is because Android's NDK does not
31 | support compiling various complex.h math functions on prior API versions. See the
32 | [Bionic Release Status](https://android.googlesource.com/platform/bionic/+/master/docs/status.md)
33 | for details.
34 |
35 |
36 |
--------------------------------------------------------------------------------
/appcodec2demo/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/appcodec2demo/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 | compileOptions {
7 | sourceCompatibility JavaVersion.VERSION_1_8
8 | targetCompatibility JavaVersion.VERSION_1_8
9 | }
10 |
11 |
12 | defaultConfig {
13 | applicationId "prototypemanager.ustadmobile.com.appcodec2demo"
14 | minSdkVersion 23
15 | targetSdkVersion 28
16 | versionCode 1
17 | versionName "1.0"
18 |
19 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
20 |
21 | }
22 |
23 | buildTypes {
24 | release {
25 | minifyEnabled false
26 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
27 | }
28 | }
29 |
30 | }
31 |
32 | dependencies {
33 | implementation fileTree(dir: 'libs', include: ['*.jar'])
34 |
35 | implementation 'com.android.support:appcompat-v7:28.0.0'
36 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
37 |
38 | implementation project(":libcodec2-android")
39 | testImplementation 'junit:junit:4.12'
40 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
41 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
42 | }
43 |
--------------------------------------------------------------------------------
/appcodec2demo/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/appcodec2demo/src/androidTest/java/prototypemanager/ustadmobile/com/appcodec2demo/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package prototypemanager.ustadmobile.com.appcodec2demo;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.assertEquals;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("prototypemanager.ustadmobile.com.appcodec2demo", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/appcodec2demo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/appcodec2demo/src/main/assets/audio.c2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/assets/audio.c2
--------------------------------------------------------------------------------
/appcodec2demo/src/main/assets/demo.c2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/assets/demo.c2
--------------------------------------------------------------------------------
/appcodec2demo/src/main/assets/video1-1300.c2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/assets/video1-1300.c2
--------------------------------------------------------------------------------
/appcodec2demo/src/main/assets/video1-1600.c2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/assets/video1-1600.c2
--------------------------------------------------------------------------------
/appcodec2demo/src/main/assets/video1-2400.c2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/assets/video1-2400.c2
--------------------------------------------------------------------------------
/appcodec2demo/src/main/assets/video1.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/assets/video1.zip
--------------------------------------------------------------------------------
/appcodec2demo/src/main/assets/video2-1300.c2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/assets/video2-1300.c2
--------------------------------------------------------------------------------
/appcodec2demo/src/main/assets/video2-2400-cod2noextension:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/assets/video2-2400-cod2noextension
--------------------------------------------------------------------------------
/appcodec2demo/src/main/assets/video2-2400-cod2noextension.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/assets/video2-2400-cod2noextension.raw
--------------------------------------------------------------------------------
/appcodec2demo/src/main/assets/video2-2400.c2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/assets/video2-2400.c2
--------------------------------------------------------------------------------
/appcodec2demo/src/main/assets/video2-3200.c2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/assets/video2-3200.c2
--------------------------------------------------------------------------------
/appcodec2demo/src/main/assets/video2-3200.c2.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/assets/video2-3200.c2.raw
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/appcodec2demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AppCodec2Demo
3 |
4 |
--------------------------------------------------------------------------------
/appcodec2demo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/appcodec2demo/src/test/java/prototypemanager/ustadmobile/com/appcodec2demo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package prototypemanager.ustadmobile.com.appcodec2demo;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertEquals;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | google()
6 | jcenter()
7 |
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.5.0'
11 |
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | ext.buildConfigProperties = new Properties()
18 | ext.buildConfigProperties.load(new FileInputStream(project.file("buildconfig.default.properties")))
19 | if(project.file("buildconfig.local.properties").exists()) {
20 | ext.buildConfigProperties.load(new FileInputStream(project.file("buildconfig.local.properties")))
21 | }
22 |
23 | ext.ABI_FILTERS = ext.buildConfigProperties["abi.filters"]
24 |
25 |
26 | group = "com.ustadmobile.codec2"
27 | version = "0.8-SNAPSHOT64-2"
28 |
29 | allprojects {
30 | repositories {
31 | google()
32 | jcenter()
33 |
34 | }
35 | }
36 |
37 | task clean(type: Delete) {
38 | delete rootProject.buildDir
39 | }
40 |
--------------------------------------------------------------------------------
/buildconfig.default.properties:
--------------------------------------------------------------------------------
1 | #When publishing with maven, this sets the directory to publish to
2 | repo.dir=../codec2-repo
3 |
4 | #Native versions to build (ABI filters)
5 | abi.filters=x86_64;armeabi-v7a;arm64-v8a
6 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
16 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Sep 20 00:28:51 EEST 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/libcodec2-android/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | **/.cxx
3 |
4 |
--------------------------------------------------------------------------------
/libcodec2-android/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/libcodec2-android/src/androidTest/java/com/ustadmobile/codec2/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.ustadmobile.codec2;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.assertEquals;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.ustadmobile.codec2", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/libcodec2-android/src/androidTest/java/com/ustadmobile/codec2/TestCodec2Decode.java:
--------------------------------------------------------------------------------
1 | package com.ustadmobile.codec2;
2 |
3 | public class TestCodec2Decode {
4 |
5 |
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/cmake/GetDependencies.cmake.in:
--------------------------------------------------------------------------------
1 | # As this script is run in a new cmake instance, it does not have access to
2 | # the existing cache variables. Pass them in via the configure_file command.
3 | set(CMAKE_BINARY_DIR @CMAKE_BINARY_DIR@)
4 | set(CMAKE_SOURCE_DIR @CMAKE_SOURCE_DIR@)
5 | set(UNIX @UNIX@)
6 | set(WIN32 @WIN32@)
7 | set(CMAKE_CROSSCOMPILING @CMAKE_CROSSCOMPILING@)
8 | set(CMAKE_FIND_LIBRARY_SUFFIXES @CMAKE_FIND_LIBRARY_SUFFIXES@)
9 | set(CMAKE_FIND_LIBRARY_PREFIXES @CMAKE_FIND_LIBRARY_PREFIXES@)
10 | set(CMAKE_SYSTEM_LIBRARY_PATH @CMAKE_SYSTEM_LIBRARY_PATH@)
11 | set(CMAKE_FIND_ROOT_PATH @CMAKE_FIND_ROOT_PATH@)
12 | set(CODEC2_DLL ${CMAKE_BINARY_DIR}/src/libcodec2.dll)
13 |
14 | include(${CMAKE_SOURCE_DIR}/cmake/GetPrerequisites.cmake)
15 | get_prerequisites(${CODEC2_DLL} _deps 1 0 "" "")
16 | foreach(_runtime ${_deps})
17 | message("Looking for ${_runtime}")
18 | find_library(RUNTIME_${_runtime} ${_runtime})
19 | message("${RUNTIME_${_runtime}}")
20 | if(RUNTIME_${_runtime})
21 | file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin"
22 | TYPE EXECUTABLE FILES "${RUNTIME_${_runtime}}")
23 | endif()
24 | endforeach()
25 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/cmake/config.h.in:
--------------------------------------------------------------------------------
1 | /*--------------------------------------------------------------------------
2 | ** This file is autogenerated from config.h.in
3 | ** during the cmake configuration of your project. If you need to make changes
4 | ** edit the original file NOT THIS FILE.
5 | ** --------------------------------------------------------------------------*/
6 | #ifndef _CONFIGURATION_HEADER_GUARD_H_
7 | #define _CONFIGURATION_HEADER_GUARD_H_
8 |
9 | #define SIZEOF_INT @SIZEOF_INT@
10 | #cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@
11 | #cmakedefine HAVE_STRING_H @HAVE_STRING_H@
12 | #cmakedefine HAVE_FLOOR @HAVE_FLOOR@
13 | #cmakedefine HAVE_CEIL @HAVE_CEIL@
14 | #cmakedefine HAVE_MEMSET @HAVE_MEMSET@
15 | #cmakedefine HAVE_POW @HAVE_POW@
16 | #cmakedefine HAVE_SQRT @HAVE_SQRT@
17 | #cmakedefine HAVE_SIN @HAVE_SIN@
18 | #cmakedefine HAVE_COS @HAVE_COS@
19 | #cmakedefine HAVE_ATAN2 @HAVE_ATAN2@
20 | #cmakedefine HAVE_LOG10 @HAVE_LOG10@
21 | #cmakedefine HAVE_ROUND @HAVE_ROUND@
22 | #cmakedefine HAVE_GETOPT @HAVE_GETOPT@
23 | #endif
24 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/cmake/version.h.in:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: version.h
4 | AUTHOR......: Tomas Härdin
5 | DATE CREATED: 03 November 2017
6 |
7 | Codec 2 VERSION #defines
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2017 Tomas Härdin
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | //this functions both as an include guard and your typical HAVE macro
29 | #ifndef CODEC2_HAVE_VERSION
30 | #define CODEC2_HAVE_VERSION
31 |
32 | #define CODEC2_VERSION_MAJOR @CODEC2_VERSION_MAJOR@
33 | #define CODEC2_VERSION_MINOR @CODEC2_VERSION_MINOR@
34 | #cmakedefine CODEC2_VERSION_PATCH @CODEC2_VERSION_PATCH@
35 | #define CODEC2_VERSION "@CODEC2_VERSION@"
36 |
37 | #endif //CODEC2_HAVE_VERSION
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/codec2.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@CMAKE_INSTALL_PREFIX@
2 | libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
3 | includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/codec2
4 |
5 | Name: codec2
6 | Description: A speech codec for 2400 bit/s and below
7 | Requires:
8 | Version: @CODEC2_VERSION@
9 | Libs: -L${libdir} -lcodec2
10 | Cflags: -I${includedir}
11 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/debian/changelog:
--------------------------------------------------------------------------------
1 | codec2 (0.4-150830) unstable; urgency=low
2 |
3 | * Subversion snapshot of tag 0.4.
4 |
5 | -- Stuart Longland Sun, 30 Aug 2015 08:57:09 +1000
6 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/debian/codec2.doc-base.EX:
--------------------------------------------------------------------------------
1 | Document: codec2
2 | Title: Debian codec2 Manual
3 | Author:
4 | Abstract: This manual describes what codec2 is
5 | and how it can be used to
6 | manage online manuals on Debian systems.
7 | Section: unknown
8 |
9 | Format: debiandoc-sgml
10 | Files: /usr/share/doc/codec2/codec2.sgml.gz
11 |
12 | Format: postscript
13 | Files: /usr/share/doc/codec2/codec2.ps.gz
14 |
15 | Format: text
16 | Files: /usr/share/doc/codec2/codec2.text.gz
17 |
18 | Format: HTML
19 | Index: /usr/share/doc/codec2/html/index.html
20 | Files: /usr/share/doc/codec2/html/*.html
21 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/debian/codec2.install:
--------------------------------------------------------------------------------
1 | usr/bin/*
2 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/debian/codec21.dirs:
--------------------------------------------------------------------------------
1 | usr/lib
2 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/debian/codec21.install:
--------------------------------------------------------------------------------
1 | usr/lib/lib*.so.*
2 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/debian/compat:
--------------------------------------------------------------------------------
1 | 9
2 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/debian/control:
--------------------------------------------------------------------------------
1 | Source: codec2
2 | Priority: optional
3 | Maintainer: Stuart Longland
4 | Build-Depends: debhelper (>= 9), cmake, libspeexdsp-dev
5 | Standards-Version: 3.9.5
6 | Section: libs
7 | Homepage: http://www.freedv.org
8 |
9 | Package: libcodec2-dev
10 | Section: libdevel
11 | Architecture: any
12 | Depends: libcodec2 (= ${binary:Version}), ${misc:Depends}
13 | Description: Codec 2: ultra-low bitrate voice codec. Headers.
14 | Codec 2 is an ultra-low bitrate (sub 4kbps) voice codec
15 | for use in radio frequency communications applications.
16 | .
17 | This package provides the headers.
18 |
19 | Package: libcodec2
20 | Architecture: any
21 | Depends: ${shlibs:Depends}, ${misc:Depends}, libspeexdsp1
22 | Description: Codec 2: ultra-low bitrate voice codec. Library.
23 | Codec 2 is an ultra-low bitrate (sub 4kbps) voice codec
24 | for use in radio frequency communications applications.
25 | .
26 | This package provides the runtime library.
27 |
28 | Package: codec2
29 | Architecture: any
30 | Depends: libcodec2 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
31 | Description: Codec 2: ultra-low bitrate voice codec. Utilities.
32 | Codec 2 is an ultra-low bitrate (sub 4kbps) voice codec
33 | for use in radio frequency communications applications.
34 | .
35 | This package provides some command line utilities for encoding
36 | and decoding codec2.
37 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/debian/docs:
--------------------------------------------------------------------------------
1 | NEWS
2 | README
3 | README_fdmdv.txt
4 | AUTHORS
5 | ChangeLog
6 | INSTALL
7 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/debian/libcodec2-dev.dirs:
--------------------------------------------------------------------------------
1 | usr/lib
2 | usr/include
3 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/debian/libcodec2-dev.install:
--------------------------------------------------------------------------------
1 | usr/include/*
2 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/debian/libcodec2.install:
--------------------------------------------------------------------------------
1 | usr/lib/*
2 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/debian/rules:
--------------------------------------------------------------------------------
1 | #!/usr/bin/make -f
2 | # See debhelper(7) (uncomment to enable)
3 | # output every command that modifies files on the build system.
4 | #DH_VERBOSE = 1
5 |
6 | # see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
7 | DPKG_EXPORT_BUILDFLAGS = 1
8 | include /usr/share/dpkg/default.mk
9 |
10 | # see FEATURE AREAS in dpkg-buildflags(1)
11 | #export DEB_BUILD_MAINT_OPTIONS = hardening=+all
12 |
13 | # see ENVIRONMENT in dpkg-buildflags(1)
14 | # package maintainers to append CFLAGS
15 | #export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
16 | # package maintainers to append LDFLAGS
17 | #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
18 |
19 |
20 | # main packaging script based on dh7 syntax
21 | %:
22 | dh $@ --buildsystem=cmake
23 |
24 |
25 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/debian/source/format:
--------------------------------------------------------------------------------
1 | 3.0 (quilt)
2 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/2400ab_frame_design.ods:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/octave/2400ab_frame_design.ods
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/Mat2Hrows.m:
--------------------------------------------------------------------------------
1 | function [Hrows Hcols] = Mat2Hrows(HRA);
2 |
3 | H = full(HRA);
4 | [Nr Nc] = size(H);
5 |
6 | H= H(:,1:Nc-Nr);
7 | [Nr Nc] = size(H);
8 |
9 |
10 |
11 | Max_colwt = max(sum(H));
12 | Max_rowwt = max(sum(H'));
13 | Hcols = zeros(Nc, Max_colwt);
14 | Hrows = zeros(Nr, Max_rowwt);
15 |
16 | for i = 1:Nr
17 | nz = find(H(i,:));
18 | Hrows(i,1:length(nz)) = nz;
19 | end
20 |
21 | H = H';
22 | for i = 1:Nc
23 | nz = find(H(i,:));
24 | Hcols(i,1:length(nz)) = nz;
25 | end
26 |
27 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/adc_sfdr_ut.m:
--------------------------------------------------------------------------------
1 | % adc_sfdr_ut.m
2 | % David Rowe Aug 2015
3 | %
4 | % Processes data collected from STM32F4 or SFDR testing of ADC
5 |
6 | s = load_raw("~/stlink/adc.raw");
7 | Fs = 2E6;
8 | N = 1024;
9 | num_frames = length(s)/N;
10 | h = hanning(N);
11 | XdB = zeros(N/2,1);
12 |
13 | for i=1:num_frames
14 | x = s((i-1)*N+1:i*N);
15 | X = fft(x .* h);
16 | XdB += 20*log10(abs(X(1:N/2)));
17 | end
18 |
19 | XdB /= num_frames;
20 | XdB -= max(20*log10(N));
21 |
22 | figure(1)
23 | clf
24 | plot((0:N/2-1)*Fs/(1000*N), XdB)
25 | grid
26 | ylabel('Amplitude dB')
27 | xlabel('Frequency (kHz)');
28 | axis([0 Fs/(2*1000) -30 80])
29 |
30 | figure(2)
31 | clf
32 | plot(s)
33 |
34 |
35 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/adcres.m:
--------------------------------------------------------------------------------
1 | % adcres.m
2 | % David Rowe 18 Feb 2015
3 | %
4 | % ADC resamping simulation, IIR tuner development.
5 |
6 | % [ ] quantisation of ADC
7 | % [ ] SNR at ADC input, SNR at resampler output
8 | % [X] decimation to 50 kHz
9 | % [X] 40dB ish rejection (test)
10 | % [X] visualise pass band flatness
11 |
12 | graphics_toolkit ("gnuplot");
13 |
14 | fs = 2E6;
15 | f1 = 500E3;
16 | f2 = f1 + 8E3;
17 | f3 = f1 - 7E3;
18 | f4 = f1 - 207E3;
19 | t = (0:(fs-1));
20 | M = 45;
21 | beta1 = 0.999;
22 | beta2 = 1 - (1-beta1)*M;
23 |
24 | s1 = [fs zeros(1,fs-1)]; % noise floor, continuous interferers
25 | s2 = 100*4*cos(t*2*pi*f2/fs); % wanted signal 40dB above interferers
26 | s3 = 100*2*cos(t*2*pi*f3/fs);
27 | s4 = 100*2*cos(t*2*pi*f4/fs); % interferer at same level
28 | s = s1 + s2 + s3 + s4;
29 |
30 | s2 = filter(1,[1 0 beta1],s); % BPF at fs/4
31 | s3 = s2(1:M:length(s2)); % decimate
32 | s4 = filter([1 0 beta2],1,s3); % flatten filter response again
33 |
34 | figure(1)
35 | subplot(211)
36 | plot(20*log10(abs(fft(s)/fs)))
37 | grid
38 | axis([0 fs/2 -10 50])
39 | title('Input to ADC');
40 | subplot(212)
41 | plot(20*log10(abs(fft(s2/fs))))
42 | grid
43 | axis([0 fs/2 -10 70])
44 | title('After BPF');
45 |
46 | figure(2)
47 | subplot(211)
48 | plot(20*log10(abs(fft(s3)/fs)))
49 | grid
50 | axis([0 fs/2/M -10 50])
51 | title('After Decimation');
52 | subplot(212)
53 | plot(20*log10(abs(fft(s4)/fs)))
54 | grid
55 | title('After Equaliser');
56 | axis([0 fs/2/M -10 50])
57 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/av_imp.m:
--------------------------------------------------------------------------------
1 | % av_imp.m
2 | % David Rowe Aug 2012
3 | % Averages the impulse response samples
4 |
5 | function imp = av_imp(imp_filename, period_in_secs, st, en)
6 | f = fopen(imp_filename,"rb");
7 | s = fread(f, Inf, "short")';
8 |
9 | Fs = 8000;
10 | n = period_in_secs * Fs;
11 |
12 | [r c] = size(s);
13 |
14 | imp = zeros(1,n);
15 | for i=1:n:c-n
16 | imp = imp + s(i:i+n-1);
17 | endfor
18 |
19 | % user supplies start and end samples after viweing plot
20 |
21 | if (nargin == 4)
22 | imp = imp(st:en);
23 | end
24 |
25 | % normalise
26 |
27 | imp /= sqrt(sum(imp .^ 2));
28 |
29 | [h w] = freqz(imp, 1, 4000);
30 |
31 | figure(1);
32 | clf;
33 | plot(imp);
34 |
35 | figure(2);
36 | clf;
37 | subplot(211)
38 | plot(10*log10(abs(h)))
39 | subplot(212)
40 | plot(angle(h))
41 |
42 | endfunction
43 |
44 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/bandpasssampling.m:
--------------------------------------------------------------------------------
1 | % bandpasssampling.m
2 | % David Rowe 23 Feb 2015
3 | %
4 | % Band pass sampling example
5 |
6 | graphics_toolkit ("gnuplot");
7 |
8 | t = 0:1E-3:1-1E-3;
9 | f1 = 5;
10 | f2 = 105;
11 |
12 | x = 1:10:length(s1);
13 |
14 | s1 = cos(2*pi*f1*t);
15 | s1_sampled = s1(x);
16 |
17 | s2 = cos(2*pi*f2*t);
18 | s2_sampled = s2(x);
19 |
20 | figure(1)
21 | subplot(211)
22 | plot(t,s1)
23 | title('5Hz signal sampled at 100 Hz');
24 | subplot(212)
25 | stem(x*1E-3, s1_sampled,'r')
26 | xlabel('Time (s)');
27 |
28 | figure(2)
29 | subplot(211)
30 | plot(t,s2)
31 | title('105Hz signal sampled at 100 Hz');
32 | subplot(212)
33 | stem(x*1E-3, s2_sampled,'r')
34 | xlabel('Time (s)');
35 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/bpf.m:
--------------------------------------------------------------------------------
1 | % bpf.m
2 | % David Rowe April 2015
3 | %
4 | % Design 400-2600 Hz BPF and save coeffs
5 |
6 | 1;
7 |
8 | function write_c_array(filename, arrayname, vec)
9 |
10 | m = length(vec);
11 |
12 | f=fopen(filename,"wt");
13 | fprintf(f,"#define %s_N %d\n\n", toupper(arrayname), m);
14 | fprintf(f,"float %s[]={\n", arrayname);
15 | for r=1:m
16 | if r < m
17 | fprintf(f, " %f,\n", vec(r));
18 | else
19 | fprintf(f, " %f\n};", vec(r));
20 | end
21 | end
22 |
23 | fclose(f);
24 | endfunction
25 |
26 | b=firls(100,[0 250 300 2600 2700 4000]/4000,[0.01 0.01 1 1 0.01 0.01]);
27 | freqz(b)
28 | write_c_array("../src/bpfb.h", "bpfb", b)
29 |
30 | % C header file of noise samples so C version gives extacly the same results
31 |
32 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/c2wideband_const.m:
--------------------------------------------------------------------------------
1 | % c2wideband_const.m
2 | % David Rowe July 2017
3 | %
4 | % Constants for wideband Codec 2, bit like #define for C
5 |
6 | Fs = 16000; % sampel rate in Hz
7 | K = 30; % number of Mel spaced amplitude samples
8 |
9 | Tf = 0.01; % frame period in seconds
10 |
11 | dec = 2; % decimation factor. 10ms update of the core
12 | % sinusuodial codec is rather fast and reducing it to
13 | % 20ms makes very little difference in quality, but
14 | % halves the data going into the DCT/quantisation.
15 | % While the DCT should encode highly correlated data
16 | % like 10ms frame efficiently, there is some noise in
17 | % the core paraneters estimation so nice to use a lower
18 | % frame rate if possible.
19 |
20 | Nt = 8; % number of blocks in time. Trade off between latency
21 | % and coding efficiency. If the DCT has larger blocks to
22 | % play with it can remove more correlation, up to a limit
23 | % where the data is no longer correlated in time or freq.
24 | % Also set to match LDPC code frame size
25 |
26 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/closed_quant_slope.m:
--------------------------------------------------------------------------------
1 | function b = closed_quant_slope(b)
2 | b(1) = max(0.5, b(1));
3 | end
4 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/cohpsk_ch_fading.m:
--------------------------------------------------------------------------------
1 | % cohpsk_ch_fading.m
2 | % David Rowe
3 | % April 2018
4 |
5 | % function to write float fading samples for use by C programs
6 |
7 | function cohpsk_ch_fading(raw_file_name, Fs, dopplerSpreadHz, len_samples)
8 | spread = doppler_spread(dopplerSpreadHz, Fs, len_samples);
9 | spread_2ms = doppler_spread(dopplerSpreadHz, Fs, len_samples);
10 | hf_gain = 1.0/sqrt(var(spread)+var(spread_2ms));
11 | printf("hf_gain: %f\n", hf_gain);
12 |
13 | % interleave real imag samples
14 |
15 | inter = zeros(1,len_samples*4);
16 | inter(1:4) = hf_gain;
17 | for i=1:len_samples
18 | inter(i*4+1) = real(spread(i));
19 | inter(i*4+2) = imag(spread(i));
20 | inter(i*4+3) = real(spread_2ms(i));
21 | inter(i*4+4) = imag(spread_2ms(i));
22 | end
23 | f = fopen(raw_file_name,"wb");
24 | fwrite(f, inter, "float32");
25 | fclose(f);
26 | endfunction
27 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/cohpsk_frame_design.ods:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/octave/cohpsk_frame_design.ods
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/cspec.m:
--------------------------------------------------------------------------------
1 | % cspec.m
2 | % David Rowe Aug 2012
3 | % Used to compare spectromgrams while experimenting with phase
4 |
5 | function cspec(s1,s2)
6 | f1 = fopen(s1,"rb");
7 | s1 = fread(f1,Inf,"short");
8 | f2 = fopen(s2,"rb");
9 | s2 = fread(f2,Inf,"short");
10 |
11 | Fs = 8000;
12 | spec_win = 512;
13 |
14 | state = 's1';
15 | do
16 | if strcmp(state,'s1')
17 | spec(s1,Fs,spec_win);
18 | %title(s1);
19 | end
20 | if strcmp(state,'s2')
21 | spec(s2,Fs,spec_win);
22 | %title(s2);
23 | end
24 | if strcmp(state,'diff')
25 | spec(s1-s2,Fs,spec_win);
26 | %title("difference");
27 | end
28 |
29 | printf("\rstate: %s space-toggle d-diff q-quit", state);
30 | fflush(stdout);
31 | k = kbhit();
32 |
33 | if k == ' '
34 | if strcmp(state,"diff")
35 | next_state = 's1';
36 | end
37 | if strcmp(state,"s1")
38 | next_state = 's2';
39 | end
40 | if strcmp(state,'s2')
41 | next_state = 's1';
42 | end
43 | end
44 |
45 | if k == 'd'
46 | next_state = 'diff';
47 | end
48 |
49 | state = next_state;
50 | until (k == 'q')
51 |
52 | printf("\n");
53 |
54 | endfunction
55 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/doppler_spread.m:
--------------------------------------------------------------------------------
1 | % doppler_spread.m
2 | % David Rowe Jan 2016
3 | %
4 | % Returns gausssian filtered doppler spreading function samples for HF channel
5 | % modelling. Used PathSim technical guide as a reference - thanks Moe!
6 |
7 | function [spread_FsHz states] = doppler_spread(dopplerSpreadHz, FsHz, Nsam)
8 |
9 | % start with low Fs so we can work with a reasonable filter length
10 |
11 | sigma = dopplerSpreadHz/2;
12 | lowFs = 10*dopplerSpreadHz;
13 | Ntaps = 100;
14 | Nsam_low = Nsam*lowFs/FsHz + Ntaps; % fill filter memory
15 |
16 | % generate gaussian freq response and design filter
17 |
18 | x = 0:0.1:lowFs/2;
19 | y = (1/(sigma*sqrt(2*pi)))*exp(-(x.^2)/(2*sigma*sigma));
20 | b = fir2(Ntaps-1, x/(lowFs/2), y);
21 |
22 | % generate the spreading samples
23 |
24 | spread_lowFs = filter(b,1,randn(1,Nsam_low) + j*randn(1,Nsam_low));
25 |
26 | % resample to FsHz, scaling for desired spreadFreqHz
27 |
28 | spread_FsHz = resample(spread_lowFs(Ntaps+1:Nsam_low), FsHz, lowFs);
29 |
30 | % return some states for optional unit testing
31 | states.x = x;
32 | states.y = y;
33 | states.b = b;
34 |
35 | endfunction
36 |
37 |
38 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/doppler_spread_ut.m:
--------------------------------------------------------------------------------
1 | % doppler_spread_ut.m
2 | % David Rowe Jan 2016
3 | %
4 | % Unit test script for doppler_spread
5 |
6 | f = 1;
7 | Fs = 8000;
8 | N = Fs*10;
9 |
10 | [spread states] = doppler_spread(f, Fs, N);
11 |
12 | % use spreading samples to modulate 1000Hz sine wave
13 | % You can listen to this with: sine1k_1Hz.raw
14 |
15 | % $ play -t raw -r 8000 -s -2
16 | s = cos(2*pi*(1:N)*1000/Fs);
17 | s = s .* spread;
18 | s = real(s)*5000;
19 | fs = fopen("sine1k_1Hz.raw","wb"); fwrite(fs,s,"short"); fclose(fs);
20 |
21 | % Some plots
22 |
23 | x = states.x; y = states.y; b = states.b;
24 |
25 | H = freqz(b,1,x);
26 |
27 | figure(1)
28 | clf
29 | subplot(211)
30 | plot(x,y,';target;')
31 | title('Gaussian Filter Freq Resp Lin');
32 | legend('boxoff');
33 | subplot(212)
34 | plot(x,20*log10(y),';target;')
35 | hold on;
36 | plot(x,20*log10(y),'g+;actual;')
37 | hold off;
38 | axis([0 f*10/2 -60 0])
39 | title('Gaussian Filter Freq Resp dB');
40 | xlabel('Freq (Hz)');
41 | legend('boxoff');
42 |
43 | figure(2);
44 | subplot(211)
45 | plot(abs(spread))
46 | title('Spreading Function Magnitude');
47 | subplot(212)
48 | plot(s)
49 | title('1000Hz Sine Wave');
50 | xlabel('Time (samples)')
51 |
52 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/fdmdv_mod.m:
--------------------------------------------------------------------------------
1 | % fdmdv_mod.m
2 | %
3 | % Modulator function for FDMDV modem, uses test frames as input and
4 | % outputs a raw file of 16 bit shorts at a sample rate of 8 kHz.
5 | %
6 | % Copyright David Rowe 2012
7 | % This program is distributed under the terms of the GNU General Public License
8 | % Version 2
9 | %
10 |
11 | function tx_fdm = fdmdv_mod(rawfilename, nbits)
12 |
13 | fdmdv; % include modem code
14 |
15 | frames = floor(nbits/(Nc*Nb))
16 | tx_fdm = [];
17 | gain = 1000; % Scale up to 16 bit shorts
18 | prev_tx_symbols = ones(Nc+1,1); prev_tx_symbols(Nc+1) = 2;
19 |
20 | for i=1:frames
21 | tx_bits = get_test_bits(Nc*Nb);
22 | tx_symbols = bits_to_qpsk(prev_tx_symbols, tx_bits,'dqpsk');
23 | prev_tx_symbols = tx_symbols;
24 | tx_baseband = tx_filter(tx_symbols);
25 | tx_fdm = [tx_fdm real(fdm_upconvert(tx_baseband))];
26 | end
27 |
28 | tx_fdm *= gain;
29 | fout = fopen(rawfilename,"wb");
30 | fwrite(fout, tx_fdm, "short");
31 | fclose(fout);
32 | endfunction
33 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/fdmdv_sweep.m:
--------------------------------------------------------------------------------
1 | % fdmdv_sweep.m
2 | % David Rowe Feb 2013
3 | % Produces a raw file that sweeps between 1000 and 2000 Hz to test freq
4 | % response of transmitters.
5 |
6 | secs=10;
7 | fmin=1000;
8 | fmax=2000;
9 | Fs=8000;
10 | rms = 4200; % roughly RMS value of fdmdv signal
11 | amp = sqrt(2)*rms;
12 | nsamples=Fs*secs;
13 | theta = 0;
14 | s=zeros(1,nsamples);
15 |
16 | for i=1:nsamples
17 | f(i) = fmin + i*(fmax-fmin)/nsamples;
18 | w = 2*pi*f(i)/Fs;
19 | theta += w;
20 | theta -= 2*pi*floor(theta/(2*pi));
21 | s(i) = amp*cos(theta);
22 | end
23 |
24 | figure(1)
25 | clf
26 | plot(s(1:100));
27 | fout = fopen("1k_2k_sweep.raw", "wb");
28 | fwrite(fout, s, "short");
29 | fclose(fout);
30 |
31 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/fsk_basic.m:
--------------------------------------------------------------------------------
1 | % fsk_basic.m
2 | % David Rowe 30 sep 2016
3 | %
4 | % Basic non-coherence FSK modem simulation to illustrate principles
5 | % and compare to ideal
6 |
7 | rand('seed',1);
8 | randn('seed',1);
9 |
10 | Fs = 9600; % sample rate
11 | f1 = 1200;
12 | f2 = 2400;
13 | Rs = 1200; % symbol rate
14 | Ts = Fs/Rs; % length of each symbol in samples
15 | Nbits = 10000;
16 | EbNodB = 9;
17 |
18 | tx_bits = round(rand(1,Nbits));
19 |
20 | % continuous phase FSK modulator
21 |
22 | w1 = 2*pi*f1/Fs;
23 | w2 = 2*pi*f2/Fs;
24 | tx_phase = 0;
25 | tx = zeros(1,Ts*Nbits);
26 |
27 | for i=1:Nbits
28 | for k=1:Ts
29 | if tx_bits(i)
30 | tx_phase += w2;
31 | else
32 | tx_phase += w1;
33 | end
34 | tx((i-1)*Ts+k) = exp(j*tx_phase);
35 | end
36 | end
37 |
38 | % AWGN channel noise
39 |
40 | EbNo = 10^(EbNodB/10);
41 | variance = Fs/(Rs*EbNo);
42 | noise = sqrt(variance/2)*(randn(1,Nbits*Ts) + j*randn(1,Nbits*Ts));
43 | rx = tx + noise;
44 |
45 | % integrate and dump demodulator
46 |
47 | rx_bits = zeros(1,Nbits);
48 | for i=1:Nbits
49 | arx_symb = rx((i-1)*Ts + (1:Ts));
50 | filt1 = sum(exp(-j*w1*(1:Ts)) .* arx_symb);
51 | filt2 = sum(exp(-j*w2*(1:Ts)) .* arx_symb);
52 | rx_bits(i) = filt2 > filt1;
53 | end
54 |
55 | Nerrors = sum(xor(tx_bits, rx_bits));
56 | ber = Nerrors/Nbits;
57 | printf("EbNodB: %4.1f Nerrors: %d BER: %1.3f\n", EbNodB, Nerrors, ber);
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/gen_complex_short.m:
--------------------------------------------------------------------------------
1 | % gen_complex_short.m
2 | %
3 | % David Rowe Feb 2017
4 | %
5 | % Generates a complex short signal for HackRF testing.
6 |
7 | Fs = 8E3;
8 | T = 10;
9 | A = 32000;
10 | f = 1000;
11 |
12 | N = T*Fs;
13 | t = 0:N-1;
14 | s = A*exp(j*2*pi*t*f/Fs);
15 | scomp = zeros(1,2*N);
16 | scomp(1:2:2*N) = real(s);
17 | scomp(2:2:2*N) = imag(s);
18 | save_raw("twotone.iq16",scomp);
19 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/gen_rn_coeffs.m:
--------------------------------------------------------------------------------
1 | % gen_rn_coeffs.m
2 | % David Rowe 13 april 2012
3 | %
4 | % Generate root raised cosine (Root Nyquist) filter coefficients
5 | % thanks http://www.dsplog.com/db-install/wp-content/uploads/2008/05/raised_cosine_filter.m
6 |
7 | function coeffs = gen_rn_coeffs(alpha, T, Rs, Nsym, M)
8 |
9 | Ts = 1/Rs;
10 |
11 | n = -Nsym*Ts/2:T:Nsym*Ts/2;
12 | Nfilter = Nsym*M;
13 | Nfiltertiming = M+Nfilter+M;
14 |
15 | sincNum = sin(pi*n/Ts); % numerator of the sinc function
16 | sincDen = (pi*n/Ts); % denominator of the sinc function
17 | sincDenZero = find(abs(sincDen) < 10^-10);
18 | sincOp = sincNum./sincDen;
19 | sincOp(sincDenZero) = 1; % sin(pix/(pix) =1 for x =0
20 |
21 | cosNum = cos(alpha*pi*n/Ts);
22 | cosDen = (1-(2*alpha*n/Ts).^2);
23 | cosDenZero = find(abs(cosDen)<10^-10);
24 | cosOp = cosNum./cosDen;
25 | cosOp(cosDenZero) = pi/4;
26 | gt_alpha5 = sincOp.*cosOp;
27 | Nfft = 4096;
28 | GF_alpha5 = fft(gt_alpha5,Nfft)/M;
29 |
30 | % sqrt causes stop band to be amplified, this hack pushes it down again
31 |
32 | for i=1:Nfft
33 | if (abs(GF_alpha5(i)) < 0.02)
34 | GF_alpha5(i) *= 0.001;
35 | endif
36 | end
37 | GF_alpha5_root = sqrt(abs(GF_alpha5)) .* exp(j*angle(GF_alpha5));
38 | ifft_GF_alpha5_root = ifft(GF_alpha5_root);
39 | coeffs = real((ifft_GF_alpha5_root(1:Nfilter)));
40 | endfunction
41 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/glottal.m:
--------------------------------------------------------------------------------
1 | % glottal.m
2 | % David Rowe 12 Sep 2009
3 | % Matlab script to generate the phase spectra of a glottal pulse
4 |
5 | % lpc10 pulse from spandsp. When the file glottal.c was used as a part of the
6 | % excitation phase component in phase.c, phase_synth_zero_order(), no difference
7 | % in speech quality was apparent. So left out of code for now.
8 |
9 | sh=12
10 | 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];
11 | kexc = shift(kexc,sh);
12 | kexc = [kexc(1:sh) zeros(1,512-25) kexc(sh+1:25)];
13 | figure(1)
14 | clf
15 | plot(kexc)
16 | figure(2)
17 | G = fft(kexc);
18 | subplot(211)
19 | plot((1:256)*(4000/256),unwrap(angle(G(1:256))))
20 | subplot(212)
21 | plot(20*log10(abs(G)))
22 |
23 | f=fopen("glottal.c","wt");
24 | fprintf(f,"const float glottal[]={\n");
25 | for m=1:255
26 | fprintf(f," %f,\n",angle(G(m)));
27 | endfor
28 | fprintf(f," %f};\n",angle(G(256)));
29 | fclose(f);
30 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/gp_interleaver.m:
--------------------------------------------------------------------------------
1 | % gp_interleaver.m
2 | %
3 | % David Rowe May 2017
4 | %
5 | % Golden Prime Interleaver. My interprestation of "On the Analysis and
6 | % Design of Good Algebraic Interleavers", Xie et al,eq (5).
7 |
8 | 1;
9 |
10 | % Choose b for Golden Prime Interleaver. b is chosen to be the
11 | % closest integer, which is relatively prime to N, to the Golden
12 | % section of N.
13 |
14 | function b = choose_interleaver_b(Nbits)
15 |
16 | p = primes(Nbits);
17 | i = 1;
18 | while(p(i) < Nbits/1.62)
19 | i++;
20 | end
21 | b = p(i);
22 | assert(gcd(b,Nbits) == 1, "b and Nbits must be co-prime");
23 | end
24 |
25 |
26 | function interleaved_frame = gp_interleave(frame)
27 | Nbits = length(frame);
28 | b = choose_interleaver_b(Nbits);
29 | interleaved_frame = zeros(1,Nbits);
30 | for i=1:Nbits
31 | j = mod((b*(i-1)), Nbits);
32 | interleaved_frame(j+1) = frame(i);
33 | end
34 | endfunction
35 |
36 |
37 | function frame = gp_deinterleave(interleaved_frame)
38 | Nbits = length(interleaved_frame);
39 | b = choose_interleaver_b(Nbits);
40 | frame = zeros(1,Nbits);
41 | for i=1:Nbits
42 | j = mod((b*(i-1)), Nbits);
43 | frame(i) = interleaved_frame(j+1);
44 | end
45 | endfunction
46 |
47 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/hackrf_dc.m:
--------------------------------------------------------------------------------
1 | % hackrf_dc.m
2 | %
3 | % David Rowe Nov 2015
4 | %
5 | % Downconverts a HackRF IQ sample file to a lower sample rate
6 | %
7 | % To sample a -60dB signal:
8 | % $ hackrf_transfer -r df1.iq -f 439200000 -n 10000000 -l 20 -g 40play file at 10.7MHz used:
9 | % octave:25> d = hackrf_dc("df1.iq")
10 |
11 | function d = hackrf_dc(infilename)
12 | Fs1 = 10E6; % input sample rate to HackRF
13 | Fs2 = 96E3; % output sample rate
14 | fc = 700E3; % offset to shift input by, HackRF doesn't like signals in the centre
15 |
16 | s1 = load_hackrf(infilename);
17 | ls1 = length(s1);
18 | ls1 = 20*Fs1;
19 | t = 0:ls1-1;
20 |
21 | % shift down to baseband from Fc, not sure of rot90 rather than trasnpose operator '
22 | % to avoid unwanted complex conj
23 |
24 | s2 = rot90(s1(1:ls1)) .* exp(-j*2*pi*t*fc/Fs1);
25 | d = resample(s2, Fs2, Fs1);
26 | end
27 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/hackrf_twotone.m:
--------------------------------------------------------------------------------
1 | % hackrf_twotone.m
2 | %
3 | % David Rowe Nov 2015
4 | %
5 | % Generates a two tone test signal that can be played out of HackRF
6 | %
7 | % To play file at 10.7MHz used:
8 | % $ hackrf_transfer -t ../octave/twotone.iq -f 10000000 -a 0 -x 47
9 | %
10 | % However 2nd harmonic at 21.4 was only -32dBC so not really useful for my application
11 | % in testing an ADC
12 |
13 | Fs = 8E6;
14 | fc = 2E6;
15 | f1 = fc;
16 | f2 = fc+1E3;
17 | A = 127;
18 | T = 2;
19 |
20 | N = T*Fs;
21 | t = 0:N-1;
22 | %s = A*exp(j*2*pi*t*f1/Fs) + A*exp(j*2*pi*t*f2/Fs);
23 | s = A*exp(j*2*pi*t*f2/Fs);
24 | save_hackrf("twotone.iq",s);
25 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/hackrf_uc.m:
--------------------------------------------------------------------------------
1 | % hackrf_uc.m
2 | %
3 | % David Rowe Nov 2015
4 | %
5 | % Upconverts a real baseband sample file to a file suitable for input into a HackRF
6 | %
7 | % To play file at 10.7MHz used:
8 | % octave:25> hackrf_uc("fsk_10M.iq","fsk_horus_rx_1200_96k.raw")
9 | % $ hackrf_transfer -t ../octave/fsk_10M.iq -f 10000000 -a 1 -x 40
10 |
11 | function hackrf_uc(outfilename, infilename)
12 | pkg load signal;
13 | Fs1 = 48E3; % input sample rate
14 | Fs2 = 10E6; % output sample rate to HackRF
15 | fc = 700E3-24E3; % offset to shift to, HackRF doesn't like signals in the centre
16 | A = 100; % amplitude of signal after upc-nversion (max 127)
17 | N = Fs1*20;
18 |
19 | fin = fopen(infilename,"rb");
20 | printf("1\n");
21 | s1 = fread(fin,"short");
22 | printf("1\n");
23 | fclose(fin);
24 | printf("1\n");
25 | ls1 = length(s1);
26 | printf("1\n");
27 | N = ls1;
28 | % single sided freq shifts, we don't want DSB
29 | printf("1\n");
30 | s1 = hilbert(s1(1:N));
31 |
32 | % upsample to Fs2
33 |
34 | M = Fs2/Fs1;
35 | s2 = resample(s1(1:N),Fs2,Fs1);
36 | ls2 = length(s2);
37 | mx = max(abs(s2));
38 | t = 0:ls2-1;
39 | printf("2\n");
40 | % shift up to Fc, note use of rot90 rather than trasnpose operator '
41 | % as we don't want complex conj, that would shift down in freq
42 |
43 | sout = rot90((A/mx)*s2) .* exp(j*2*pi*t*fc/Fs2);
44 |
45 | save_hackrf(outfilename,sout);
46 |
47 | end
48 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/hfper.m:
--------------------------------------------------------------------------------
1 | % hfper.m
2 | % David Rowe 2 June 2014
3 | % Quick and dirty HF PER calculator/simulator
4 |
5 | function hfper(ber, nbits, ntrials)
6 |
7 | % Raw PER with no FEC --------------------------------------
8 |
9 | nper = 0;
10 | for i=1:ntrials
11 | nerr = sum(rand(1,nbits) < ber);
12 | if nerr >0
13 | nper++;
14 | end
15 | end
16 | printf("Raw PER..................: %0.3f\n", nper/ntrials);
17 |
18 | % Half rate block code, e.g. Golay (23,12) with 3 bit error
19 | % correcting capability
20 |
21 | % Golay (23,12) that can correct 3 errors (fails at 4) ------
22 |
23 | ncodeword = 23;
24 | ncorrect = 3;
25 | nper = 0;
26 | for i=1:ntrials
27 | nerr = sum(rand(1,ncodeword) < ber);
28 | if nerr > ncorrect
29 | nper++;
30 | end
31 | end
32 | printf("One Golay codeword.......: %0.3f\n", nper/ntrials);
33 |
34 | % Several Golay codewords concatenated ----------------------
35 |
36 | m = floor(nbits/12); % number of codewords
37 |
38 | nper = 0;
39 | for i=1:ntrials
40 |
41 | % test each codeword in packet, if any of the codewords has > 4
42 | % errors, entire packet is a dud
43 |
44 | no_errors = 1;
45 | for k=1:m
46 | nerr = sum(rand(1,ncodeword) < ber);
47 | if (nerr > ncorrect) && no_errors
48 | nper++;
49 | no_errors = 0;
50 | end
51 | end
52 |
53 | end
54 | printf("Packet protected by Golay: %0.3f\n", nper/ntrials);
55 |
56 | endfunction
57 |
58 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/horus_tx_bits_binary.txt:
--------------------------------------------------------------------------------
1 | 0 0 1 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 1 1 0 0 1 0 1 1 0 1 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 0 1 0 1 1 1 0 1 1 1 0 0 0 1 0 1 0 1 0 1 1 0 1 1 1 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 1 1 1 1 1 1 1 1 0 1 0 0 0 1 1 0 1 1 0 0 1 0 0 1 1 0 1 1 0 1 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0 1 1 1 0 1 0 1 1 1 1 1 0 0 1 0 1 1 0 0 0 0 1 0 1 0 0 0 1 1 0 1 0 0 0 1 1 0 0 1 1 0 1 0 1 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 0 0 0 0 0 0 0 1 1 0 1 0 1 1 0 1 1 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1 0 1 1 0 1 1 1 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 1 0 1 0 0 1 1 0 1 0 1 1 1 0 0 1 0 0 1 1 1 0 0 0 1 1 0 0 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 0 1 1 0 1 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 0 0 1 0 0 0
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/hp_filt.m:
--------------------------------------------------------------------------------
1 | % hp_filt.m
2 | % David Rowe 20 Feb 2012
3 |
4 | function hp_filt(in_file, out_file)
5 | fin = fopen(in_file,"rb");
6 | s = fread(fin,Inf,"short");
7 | b = fir1(256, 300/4000, "high");
8 | freqz(b);
9 | s_hpf = filter(b,1,s);
10 | fout = fopen(out_file,"wb");
11 | fwrite(fout, s_hpf, "short");
12 | endfunction
13 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/linreg.m:
--------------------------------------------------------------------------------
1 | % linreg.m
2 | % David Rowe April 2015
3 | %
4 | % Based on:
5 | % http://stackoverflow.com/questions/5083465/fast-efficient-least-squares-fit-algorithm-in-c
6 | %
7 | % finds y = mx + b to best fit n points x and y
8 |
9 | function [m b] = linreg(x,y,n)
10 | sumx = 0.0; % sum of x
11 | sumx2 = 0.0; % sum of x^2
12 | sumxy = 0.0; % sum of x * y
13 | sumy = 0.0; % sum of y
14 | sumy2 = 0.0; % sum of y**2
15 |
16 | for i=1:n
17 | sumx += x(i);
18 | sumx2 += x(i)^2;
19 | sumxy += x(i) * y(i);
20 | sumy += y(i);
21 | sumy2 += y(i)^2;
22 | end
23 |
24 | denom = (n * sumx2 - sumx*sumx);
25 |
26 | if denom == 0
27 | % singular matrix. can't solve the problem.
28 | m = 0;
29 | b = 0;
30 | else
31 | m = (n * sumxy - sumx * sumy) / denom;
32 | b = (sumy * sumx2 - sumx * sumxy) / denom;
33 | end
34 |
35 | endfunction
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/load_comp.m:
--------------------------------------------------------------------------------
1 | % load_comp.m
2 | % David Rowe Sep 2015
3 |
4 | function s = load_comp(fn)
5 | fs=fopen(fn,"rb");
6 | s = fread(fs,Inf,"float32");
7 | ls = length(s);
8 | s = s(1:2:ls) + j*s(2:2:ls);
9 | endfunction
10 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/load_hackrf.m:
--------------------------------------------------------------------------------
1 | % load_hackrf.m
2 | %
3 | % David Rowe Oct 2015
4 |
5 | function s = load_hackrf(fn)
6 | fs = fopen(fn,"rb");
7 | iq = fread(fs,Inf,"schar");
8 | fclose(fs);
9 | l = length(iq);
10 | s = iq(1:2:l) + j*iq(2:2:l);
11 | endfunction
12 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/load_raw.m:
--------------------------------------------------------------------------------
1 | % load_raw.m
2 | % David Rowe 7 Oct 2009
3 |
4 | function s = load_raw(fn)
5 | fs=fopen(fn,"rb");
6 | s = fread(fs,Inf,"short");
7 | plot(s)
8 | endfunction
9 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/lpcpf.m:
--------------------------------------------------------------------------------
1 | % lpcpf.m
2 | % David Rowe Aug 27 2012
3 | % Experiments with LPC post filtering
4 |
5 | function lpcpf(ak_filename, f)
6 | aks = load(ak_filename);
7 |
8 | ak = aks(f,:);
9 | [tmp p] = size(ak);
10 | p -= 1;
11 |
12 | A = freqz(1,ak, 4000);
13 | AdB = 20*log10(abs(A));
14 |
15 | gamma = 0.5;
16 | gammas = gamma .^ (0:p);
17 | W = freqz(ak .* gammas,1, 4000);
18 | WdB = 20*log10(abs(W));
19 |
20 | beta = 0.2;
21 | R = abs(freqz(ak .* gammas, ak, 4000));
22 | %P = (R/max(R)) .^ beta;
23 | P = R .^ beta;
24 | AP = abs(A) .* P;
25 |
26 | eA = sum(abs(A) .^ 2);
27 | eAP = sum(AP .^ 2);
28 | gain = sqrt(eA/eAP)
29 | AP *= gain;
30 |
31 | PdB = 20*log10(P);
32 |
33 | APdB = 20*log10(AP);
34 | 10*log10(sum(AP .^ 2))/10*log10(sum(abs(A) .^ 2))
35 |
36 | figure(1);
37 | clf;
38 | plot(AdB);
39 | hold on;
40 | plot(WdB,'g');
41 | plot(PdB,'r');
42 | plot(APdB,'b.');
43 | hold off;
44 |
45 | endfunction
46 |
47 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/lsp.m:
--------------------------------------------------------------------------------
1 | %
2 | % Given input AR filter coefficients, this function calculates
3 | % the corresponding Line spectral pair (LSP) parameters.
4 | %
5 | % Author : Madhukar Budagavi
6 | %
7 |
8 | 1;
9 |
10 | function w=atolsp(a)
11 |
12 | [m,n] = size(a);
13 | if m > n
14 | a = a';
15 | end
16 | m = length(a)-1;
17 | pz = [a,0] - [0 fliplr(a)];
18 | qz = [a,0] + [0 fliplr(a)];
19 | angpz = sort(angle(roots(pz)));
20 | angpz = angpz(find(angpz > 0));
21 | angqz = sort(angle(roots(qz)));
22 | angqz = angqz(find(angqz > 0 & angqz < pi));
23 | w = zeros(1,m);
24 | j = 1:(m/2);
25 | w(2*j) = angpz';
26 | w(2*j-1) = angqz';
27 | endfunction
28 |
29 | %
30 | % Given input Line spectral pair (LSP) parameters of an AR filter,
31 | % this function calculates the corresponding AR filter parameters
32 | %
33 | % Author : Madhukar Budagavi
34 | %
35 |
36 | function a=lsptoa(w)
37 |
38 | [m,n] = size(w);
39 | if m > n
40 | w = w';
41 | end
42 | m = length(w);
43 | pz = 1;
44 | qz = 1;
45 | for j = 1:(m/2),
46 | pz = conv(pz,[1 -2*cos(w(2*j)) 1]);
47 | qz = conv(qz,[1 -2*cos(w(2*j-1)) 1]);
48 | end
49 | pz = conv([1 -1],pz);
50 | qz = conv([1 1],qz);
51 | a = (pz+qz)/2;
52 | a = a(1:(m+1));
53 |
54 | endfunction
55 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/lspwarp.m:
--------------------------------------------------------------------------------
1 | % lspwarp.m
2 | % David Rowe Sep 2012
3 | %
4 | % Experimenting with non-linear LSP frequency axis for LSP quantisation
5 | % Plots a scaled mel axis.
6 |
7 | 1;
8 |
9 | function mel = freq2mel(f)
10 | mel = 70*log10(1 + f/700);
11 | endfunction
12 |
13 | function freq = mel2freq(m)
14 | freq = 700*(10 ^ (m/70) - 1);
15 | endfunction
16 |
17 | x = []; y = [];
18 |
19 | for freq = 100:25:4000
20 | mel = freq2mel(freq);
21 | x = [x freq];
22 | y = [y mel];
23 | end
24 |
25 | plot(x,y)
26 | grid
27 |
28 | mel_start = floor(freq2mel(100));
29 | mel_end = floor(freq2mel(4000));
30 |
31 | x = []; y = [];
32 | for mel=mel_start:mel_end
33 | freq = mel2freq(mel);
34 | x = [x freq];
35 | y = [y mel];
36 | end
37 |
38 | hold on;
39 | plot(x,y, '+')
40 | hold off;
41 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/make_hilb.m:
--------------------------------------------------------------------------------
1 | % make_hilb.m
2 | % David Rowe May 2015
3 | %
4 | % creates Hilber Transformer FIR coeffs
5 |
6 | graphics_toolkit ("gnuplot");
7 |
8 | ht_n = 100;
9 | imp = [1 zeros(1,ht_n-1)];
10 | ht_coeff = fftshift(hilbert(imp)) .* hanning(ht_n)';
11 |
12 | figure(1)
13 | subplot(211)
14 | plot(real(ht_coeff))
15 | subplot(212)
16 | plot(imag(ht_coeff))
17 |
18 | figure(2)
19 | plot(20*log10(abs(fft(ht_coeff))))
20 |
21 | % test it
22 |
23 | n=1:8000;
24 | w = 2*pi/4;
25 | x = cos(n*w);
26 | figure(3)
27 | y = filter(ht_coeff,1,x);
28 | figure(3)
29 | subplot(211)
30 | plot(y(800:8000))
31 | subplot(212)
32 | plot(20*log10(abs(fft(y(800:8000)))))
33 |
34 | % save coeffs to a C header file
35 |
36 | f=fopen("../src/ht_coeff.h","wt");
37 | fprintf(f,"/* Hilbert Transform FIR filter coeffs */\n");
38 | fprintf(f,"/* Generated by make_hilb Octave script */\n");
39 |
40 | fprintf(f,"\n#define HT_N %d\n\n", ht_n);
41 |
42 | fprintf(f,"COMP ht_coeff[]={\n");
43 | for r=1:ht_n
44 | if r < ht_n
45 | fprintf(f, " {%f,%f},\n", real(ht_coeff(r)), imag(ht_coeff(r)));
46 | else
47 | fprintf(f, " {%f,%f}\n};", real(ht_coeff(r)), imag(ht_coeff(r)));
48 | end
49 | end
50 |
51 | fclose(f);
52 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/make_ssbfilt.m:
--------------------------------------------------------------------------------
1 | % make_ssbfilt.m
2 | % David Rowe May 2015
3 | %
4 | % creates SSB filter FIR coeffs
5 |
6 | graphics_toolkit ("gnuplot");
7 |
8 | ssbfilt_n = 100;
9 | Fs = 8000;
10 |
11 | ssbfilt_coeff = fir2(ssbfilt_n,[0 400 600 2200 2600 4000]/(Fs/2),[0.001 0.001 1 1 0.001 0.001]);
12 |
13 | figure(1)
14 | clf;
15 | h = freqz(ssbfilt_coeff,1,Fs/2);
16 | plot(20*log10(abs(h)))
17 | grid minor
18 |
19 | % save coeffs to a C header file
20 |
21 | f=fopen("../src/ssbfilt_coeff.h","wt");
22 | fprintf(f,"/* 600 - 2600 Hz FIR filter coeffs */\n");
23 | fprintf(f,"/* Generated by make_ssbfilt Octave script */\n");
24 |
25 | fprintf(f,"\n#define SSBFILT_N %d\n\n", ssbfilt_n);
26 |
27 | fprintf(f,"float ssbfilt_coeff[]={\n");
28 | for r=1:ssbfilt_n
29 | if r < ssbfilt_n
30 | fprintf(f, " %f,\n", ssbfilt_coeff(r));
31 | else
32 | fprintf(f, " %f\n};", ssbfilt_coeff(r));
33 | end
34 | end
35 |
36 | fclose(f);
37 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/melstats.m:
--------------------------------------------------------------------------------
1 | % melstats.m
2 | % David Rowe April 2015
3 | %
4 | % plots some stats of mel/lsp quantisers
5 |
6 | function melstats(filename)
7 |
8 | mel = load(filename);
9 | [m n] = size(mel);
10 | nbins = 10;
11 |
12 | % histograms of each value
13 |
14 | figure(1)
15 | clf
16 | subplot(211)
17 | [h x] = hist(mel(:,1),nbins);
18 | plot(x,h,"1");
19 | hold on
20 |
21 | for i=2:n
22 | [h x] = hist(mel(:,i),nbins);
23 | colour = sprintf("%d",i);
24 | plot(x,h,colour);
25 | end
26 | hold off
27 |
28 | % histograms differences
29 |
30 | subplot(212)
31 | [h x] = hist(mel(:,1),nbins);
32 | plot(x,h,"1");
33 | hold on
34 |
35 | for i=2:n
36 | [h x] = hist(mel(:,i)-mel(:,i-1),nbins);
37 | colour = sprintf("%d",i);
38 | plot(x,h, colour);
39 | end
40 | hold off
41 |
42 | figure(2)
43 | plot(mel(:,1),mel(:,2),'r+')
44 | hold on;
45 | plot(mel(:,3),mel(:,4),'g+')
46 | plot(mel(:,5),mel(:,6),'b+')
47 | hold off;
48 |
49 | endfunction
50 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/ofdm_demod_c.m:
--------------------------------------------------------------------------------
1 | % ofdm_demod_c.m
2 | % David Rowe April 2018
3 | %
4 | % Plots data from The C OFDM demodulator ofdm_demod, in similar format to
5 | % plots from Octave OFDM demodulator ofdm_rx.m
6 | %
7 | % Useful for of line analysis of a demod run
8 |
9 | function ofdm_demod_c(filename)
10 | ofdm_lib;
11 | more off;
12 |
13 | % init modem
14 |
15 | Ts = 0.018; Tcp = 0.002; Rs = 1/Ts; bps = 2; Nc = 17; Ns = 8;
16 | states = ofdm_init(bps, Rs, Tcp, Ns, Nc);
17 | ofdm_load_const;
18 | states.verbose = 0;
19 |
20 | load(filename);
21 |
22 | figure(1); clf;
23 | plot(rx_np_log_c,'+');
24 | mx = 2*max(abs(rx_np_log_c));
25 | axis([-mx mx -mx mx]);
26 | title('Scatter');
27 |
28 | figure(2); clf;
29 | plot(phase_est_pilot_log_c(:,2:Nc),'g+', 'markersize', 5);
30 | title('Phase Est');
31 | axis([1 length(phase_est_pilot_log_c) -pi pi]);
32 |
33 | figure(3); clf;
34 | stem(timing_est_log_c)
35 | title('Timing Est');
36 |
37 | figure(4); clf;
38 | plot(foff_hz_log_c)
39 | mx = max(abs(foff_hz_log_c))+1;
40 | axis([1 max(length(foff_hz_log_c),2) -mx mx]);
41 | title('Fine Freq');
42 | ylabel('Hz')
43 |
44 | figure(4); clf;
45 | plot(snr_est_log_c);
46 | ylabel('SNR (dB)')
47 | title('SNR Estimates')
48 | endfunction
49 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/ofdm_load_const.m:
--------------------------------------------------------------------------------
1 | % make like C #define for ofdm modem
2 |
3 | Fs = states.Fs;
4 | bps = states.bps;
5 | Rs = states.Rs;
6 | Tcp = states.Tcp;
7 | Ns = states.Ns;
8 | Nc = states.Nc;
9 | M = states.M;
10 | Ncp = states.Ncp;
11 | bps = states.bps;
12 | Nbitsperframe = states.Nbitsperframe;
13 | Nrowsperframe = states.Nrowsperframe;
14 | Nsamperframe = states.Nsamperframe;
15 | timing_mx_thresh = 0.35;
16 | Nuwbits = states.Nuwbits;
17 | Ntxtbits = states.Ntxtbits;
18 | tx_uw = states.tx_uw;
19 | uw_ind = states.uw_ind;
20 | uw_ind_sym = states.uw_ind_sym;
21 |
22 | W = states.W;
23 | w = states.w;
24 |
25 | timing_est = states.timing_est;
26 | sample_point = states.sample_point;
27 | ftwindow_width = states.ftwindow_width;
28 |
29 | Nrxbuf = states.Nrxbuf;
30 | rxbuf = states.rxbuf;
31 |
32 | pilots = states.pilots;
33 | rate_fs_pilot_samples = states.rate_fs_pilot_samples;
34 |
35 | foff_est_gain = states.foff_est_gain;
36 | foff_est_hz = states.foff_est_hz;
37 |
38 | timing_en = states.timing_en;
39 | foff_est_en = states.foff_est_en;
40 | phase_est_en = states.phase_est_en;
41 |
42 | rate = states.rate;
43 | ldpc_en = states.ldpc_en;
44 | if ldpc_en
45 | code_param = states.code_param;
46 | max_iterations = states.ldpc_max_iterations;
47 | demod_type = states.ldpc_demod_type;
48 | decoder_type = states.ldpc_decoder_type;
49 | end
50 |
51 | verbose = states.verbose;
52 |
53 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/open_quant_slope.m:
--------------------------------------------------------------------------------
1 | function b = open_quant_slope(b)
2 | b(2) = quantise([-1 -0.5 0.5 1], b(2));
3 | b(1) = quantise([0.5 1.0], b(1));
4 | end
5 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/phase.m:
--------------------------------------------------------------------------------
1 | % phase.m
2 | % David Rowe August 2009
3 | % experiments with phase for sinusoidal codecs
4 |
5 | function phase(samname, F0, png)
6 | Wo=2*pi*F0/8000;
7 | P=2*pi/Wo;
8 | L = floor(pi/Wo);
9 | Nsam = 16000;
10 | N = 80;
11 | F = Nsam/N;
12 | A = 10000/L;
13 | phi = zeros(1,L);
14 | s = zeros(1,Nsam);
15 |
16 | for m=floor(L/2):L
17 | phi_off(m) = -m*Wo*8;
18 | end
19 |
20 | for f=1:F
21 | phi(1) = phi(1) + Wo*N;
22 | phi(1) = mod(phi(1),2*pi);
23 |
24 | for m=1:L
25 | phi(m) = m*phi(1);
26 | end
27 |
28 | x = zeros(1,N);
29 | for m=1:L
30 | x = x + A*cos(m*Wo*(0:(N-1)) + phi(m));
31 | endfor
32 | s((f-1)*N+1:f*N) = x;
33 | endfor
34 |
35 | figure(1);
36 | clf;
37 | plot(s(1:250));
38 |
39 | fs=fopen(samname,"wb");
40 | fwrite(fs,s,"short");
41 | fclose(fs);
42 |
43 | if (nargin == 3)
44 | % small image to fit blog
45 |
46 | __gnuplot_set__ terminal png size 450,300
47 | ss = sprintf("__gnuplot_set__ output \"%s.png\"", samname);
48 | eval(ss)
49 | replot;
50 |
51 | % for some reason I need this to stop large plot getting wiped
52 | __gnuplot_set__ output "/dev/null"
53 | endif
54 |
55 | endfunction
56 |
57 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/phase2.m:
--------------------------------------------------------------------------------
1 | % phase2.m
2 | % David Rowe Sep 2009
3 | % experiments with phase for sinusoidal codecs, looking at phase
4 | % of excitation with real Am samples from hts1
5 |
6 | function phase2(samname, png)
7 | N = 16000;
8 |
9 | f=43;
10 | model = load("../src/hts1a_phase_model.txt");
11 | phase = load("../src/hts1a_phase_phase.txt");
12 | Wo = model(f,1);
13 | P=2*pi/Wo;
14 | L = model(f,2);
15 | A = model(f,3:(L+2));
16 | phi = phase(f,1:L);
17 | phi = zeros(1,L);
18 | phi(3) = -pi/2;
19 | phi(4) = -pi/4;
20 | phi(5) = pi/2;
21 |
22 | s = zeros(1,N);
23 |
24 | for m=3:5
25 | s_m = A(m)*cos(m*Wo*(0:(N-1)) + phi(m));
26 | s = s + s_m;
27 | endfor
28 |
29 | figure(1);
30 | clf;
31 | plot(s(1:250));
32 |
33 | figure(2);
34 | clf;
35 | subplot(211)
36 | plot((1:L)*Wo*4000/pi, 20*log10(A),'+');
37 | subplot(212)
38 | plot((1:L)*Wo*4000/pi, phi,'+');
39 |
40 | fs=fopen(samname,"wb");
41 | fwrite(fs,s,"short");
42 | fclose(fs);
43 |
44 | if (nargin == 2)
45 | % small image to fit blog
46 |
47 | __gnuplot_set__ terminal png size 450,300
48 | ss = sprintf("__gnuplot_set__ output \"%s.png\"", samname);
49 | eval(ss)
50 | replot;
51 |
52 | % for some reason I need this to stop large plot getting wiped
53 | __gnuplot_set__ output "/dev/null"
54 | endif
55 |
56 | endfunction
57 |
58 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/phasesecord.m:
--------------------------------------------------------------------------------
1 | % phasesecord.m
2 | % David Rowe Aug 2012
3 | % Used to experiment with aproximations of phase of 2nd order systems
4 |
5 | function phasesecord(w,beta)
6 |
7 | a = [1 -2*cos(w)*beta beta*beta];
8 | b = 1;
9 |
10 | [h w1] = freqz(b,a);
11 |
12 | figure(1)
13 | subplot(211)
14 | plot(abs(h))
15 | subplot(212)
16 | plot(angle(h))
17 |
18 | % for beta close to 1, we approximate 3 dB points as 1-beta above
19 | % and below the resonance freq. Note this fails if w=0 as there is a
20 | % double pole. Lets sample the freq response at the 3dB points and
21 | % w:
22 |
23 | ws = [w-(1-beta) w w+(1-beta)];
24 | [h w1] = freqz(b,a,ws);
25 |
26 | % gain as a fraction of max, should be 3dB. Within 1.3 dB or for w > pi/8,
27 | % gets innacurate near w=0 due to 2nd pole
28 |
29 | printf("mag measured...:"); printf("% 4.3f ", abs(h)/max(abs(h)));
30 |
31 | % measured angle, 45 deg from angle at w
32 |
33 | printf("\nangle measured.: "); printf("% 5.3f ", angle(h));
34 |
35 | % Our estimate of angle, (pi+w) is phase at resonance, at lower 3dB
36 | % phase is pi/4 ahead, at upper 3B pi/4 behind. -pi/2 is contribution of
37 | % other pole at at -w to phase
38 |
39 | ph_lower = (pi+w) + pi/4 - pi/2;
40 | ph_res =(pi+w) - pi/2;
41 | ph_upper = (pi+w) - pi/4 - pi/2;
42 | ph_ests = [ph_lower ph_res ph_upper];
43 | ph_ests = ph_ests - 2*pi*(floor(ph_ests/(2*pi)) + 0.5);
44 | printf("\nangle estimated:"); printf("% 5.3f ", ph_ests);
45 | printf("\n");
46 | endfunction
47 |
48 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/pitch_test.m:
--------------------------------------------------------------------------------
1 | % pitch_test.m
2 | % David Rowe Sep 2009
3 | % Constructs a sequence to test the pitch estimator
4 |
5 | function pitch_test(samname)
6 | M=320;
7 | F=200;
8 |
9 | fs=fopen(samname,"wb");
10 |
11 | f0 = 100;
12 | for f=1:200
13 | Wo=2*pi*f0/8000;
14 | P=2*pi/Wo;
15 | L = floor(pi/Wo);
16 | A = 10000/L;
17 | phi = zeros(1,L);
18 | s = zeros(1,M);
19 |
20 | for m=1:L
21 | s = s + A*cos(m*Wo*(0:(M-1)) + phi(m));
22 | endfor
23 |
24 | figure(1);
25 | clf;
26 | plot(s);
27 |
28 | fwrite(fs,s,"short");
29 |
30 | f0 = f0 + 5;
31 | if (f0 > 400)
32 | f0 = 100;
33 | endif
34 | endfor
35 |
36 | fclose(fs);
37 |
38 | endfunction
39 |
40 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/pl.m:
--------------------------------------------------------------------------------
1 | % Copyright David Rowe 2009
2 | % This program is distributed under the terms of the GNU General Public License
3 | % Version 2
4 | %
5 | % Plots a raw speech sample file, you can optionally specify the start and end
6 | % samples and create a large and small PNGs
7 |
8 | function pl(samname1, start_sam, end_sam, pngname)
9 |
10 | fs=fopen(samname1,"rb");
11 | s=fread(fs,Inf,"short");
12 |
13 | st = 1;
14 | en = length(s);
15 | if (nargin >= 2)
16 | st = start_sam;
17 | endif
18 | if (nargin >= 3)
19 | en = end_sam;
20 | endif
21 |
22 | figure(1);
23 | clf;
24 | plot(s(st:en));
25 | axis([1 en-st 1.1*min(s) 1.1*max(s)]);
26 |
27 | if (nargin == 4)
28 |
29 | % small image
30 |
31 | __gnuplot_set__ terminal png size 420,300
32 | ss = sprintf("__gnuplot_set__ output \"%s.png\"", pngname);
33 | eval(ss)
34 | replot;
35 |
36 | % larger image
37 |
38 | __gnuplot_set__ terminal png size 800,600
39 | ss = sprintf("__gnuplot_set__ output \"%s_large.png\"", pngname);
40 | eval(ss)
41 | replot;
42 |
43 | endif
44 |
45 | endfunction
46 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/pl2.m:
--------------------------------------------------------------------------------
1 | % Copyright David Rowe 2009
2 | % This program is distributed under the terms of the GNU General Public License
3 | % Version 2
4 |
5 | function pl2(samname1, samname2, start_sam, end_sam, offset)
6 |
7 | fs1=fopen(samname1,"rb");
8 | s1=fread(fs1,Inf,"short");
9 | fs2=fopen(samname2,"rb");
10 | s2=fread(fs2,Inf,"short");
11 |
12 | st1 = st2 = 1;
13 | en1 = en2 = length(s1);
14 | if (nargin >= 3)
15 | st1 = st2 = start_sam;
16 | endif
17 | if (nargin >= 4)
18 | en1 = en2 = end_sam;
19 | endif
20 |
21 | if (nargin == 5)
22 | st2 += offset
23 | en2 += offset
24 | endif
25 |
26 | figure(1);
27 | clf;
28 | subplot(211);
29 | l1 = strcat("r;",samname1,";");
30 | plot(s1(st1:en1), l1);
31 | axis([1 en1-st1 min(s1(st1:en1)) max(s1(st1:en1))]);
32 | subplot(212);
33 | l2 = strcat("r;",samname2,";");
34 | plot(s2(st2:en2),l2);
35 | axis([1 en2-st2 min(s1(st2:en2)) max(s1(st2:en2))]);
36 |
37 | figure(2)
38 | plot(s1(st1:en1)-s2(st2:en2));
39 |
40 | f=fopen("diff.raw","wb");
41 | d = s1(st1:en1)-s2(st2:en2);
42 | fwrite(f,d,"short");
43 |
44 | endfunction
45 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/plinterp.m:
--------------------------------------------------------------------------------
1 | load ../unittest/tinterp_prev.txt;
2 | load ../unittest/tinterp_interp.txt;
3 | load ../unittest/tinterp_next.txt;
4 |
5 | clf;
6 | plot(tinterp_prev(:,1), 20.0*log10(tinterp_prev(:,2)),";prev;")
7 | hold on;
8 | plot(tinterp_interp(:,1), 20.0*log10(tinterp_interp(:,2)),'g+-;interp;')
9 | plot(tinterp_next(:,1), 20.0*log10(tinterp_next(:,2)),'ro-;next;')
10 | hold off;
11 | axis([0 pi 0 80])
12 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/pllsp.m:
--------------------------------------------------------------------------------
1 | % Copyright David Rowe 2010
2 | % This program is distributed under the terms of the GNU General Public License
3 | % Version 2
4 | %
5 | % Plots a bunch of information related to LSP quantisation:
6 | % - speech file
7 | % - LSPs before and after quantisation
8 | % - SNR for each frame
9 | %
10 | % Note: there is a 160 sample (two frame delay) from the when a sample
11 | % enters the input buffer until it is at the centre of the analysis window
12 |
13 | function pllsp(rawfile,
14 | dumpfile_prefix_lpc_only,
15 | dumpfile_prefix_lsp,
16 | start_f, end_f)
17 |
18 | fs=fopen(rawfile,"rb");
19 | s=fread(fs,Inf,"short");
20 |
21 | lpc_snr_name = strcat(dumpfile_prefix_lpc_only,"_lpc_snr.txt");
22 | lpc10_snr = load(lpc_snr_name);
23 | lpc_snr_name = strcat(dumpfile_prefix_lsp,"_lpc_snr.txt");
24 | lsp_snr = load(lpc_snr_name);
25 |
26 | lsp_name = strcat(dumpfile_prefix_lsp,"_lsp.txt");
27 | lsps = load(lsp_name);
28 | [m,n]=size(lsps);
29 | lsp = lsps(1:2:m,:);
30 | lsp_ = lsps(2:2:m,:);
31 |
32 | figure(1);
33 | clf;
34 | subplot(211);
35 | sp = s((start_f-2)*80:(end_f-2)*80);
36 | plot(sp);
37 |
38 | subplot(212);
39 | plot(lpc10_snr((start_f+1):end_f)-lsp_snr((start_f+1):end_f));
40 |
41 | figure(2);
42 | plot((4000/pi)*lsp((start_f+1):end_f,:));
43 | hold on;
44 | plot((4000/pi)*lsp_((start_f+1):end_f,:),'+-');
45 | hold off;
46 | endfunction
47 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/pllspdt.m:
--------------------------------------------------------------------------------
1 | % pllspdt.m
2 | % Copyright David Rowe 2010
3 | % This program is distributed under the terms of the GNU General Public License
4 | % Version 2
5 | %
6 | % Test script to plot differences in LSps between frames
7 |
8 | function pllspdt(rawfile,dumpfile_prefix_lsp,lspn, start_f, end_f)
9 |
10 | fs=fopen(rawfile,"rb");
11 | s=fread(fs,Inf,"short");
12 |
13 | lsp_name = strcat(dumpfile_prefix_lsp,"_lsp.txt");
14 | lsps = load(lsp_name);
15 | [m,n]=size(lsps);
16 | lsp = lsps(1:2:m,:);
17 | lsp_ = lsps(2:2:m,:);
18 | lspdt = lsp(2:m/2,:) - lsp(1:m/2-1,:);
19 |
20 | figure(1);
21 | clf;
22 | sp = s((start_f-2)*80:(end_f-2)*80);
23 | plot(sp);
24 |
25 | figure(2);
26 | plot((4000/pi)*lspdt((start_f+1):end_f,lspn));
27 | endfunction
28 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/plot_specgram.m:
--------------------------------------------------------------------------------
1 | % plot_specgram.m
2 | % David Rowe May 2017
3 | %
4 | % As the name suggests.....
5 |
6 | function S = plot_specgram(x, Fs = 8000)
7 |
8 | step = fix(20*Fs/1000); # one spectral slice every 5 ms
9 | window = fix(160*Fs/1000); # 40 ms data window
10 | fftn = 2^nextpow2(window); # next highest power of 2
11 | [S, f, t] = specgram(x, fftn, Fs, window, window-step);
12 | S = abs(S(2:fftn*4000/Fs,:)); # magnitude in range 0= 3)
17 | st = start_fr;
18 | endif
19 | if (nargin >= 4)
20 | en = end_fr;
21 | endif
22 |
23 | figure(1);
24 | clf;
25 | l1 = strcat("r;",pitch1_name,";")
26 | l1
27 | st
28 | en
29 | plot(pitch1(st:en), l1);
30 | axis([1 en-st 20 160]);
31 | l2 = strcat("g;",pitch2_name,";");
32 | hold on;
33 | plot(pitch2(st:en),l2);
34 | hold off;
35 | endfunction
36 |
37 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/plsub.m:
--------------------------------------------------------------------------------
1 | % Copyright David Rowe 2010
2 | % This program is distributed under the terms of the GNU General Public License
3 | % Version 2
4 | % plots the difference of two files
5 |
6 | function plsub(samname1, samname2, start_sam, end_sam, pngname)
7 |
8 | fs1=fopen(samname1,"rb");
9 | s1=fread(fs1,Inf,"short");
10 | fs2=fopen(samname2,"rb");
11 | s2=fread(fs2,Inf,"short");
12 |
13 | st = 1;
14 | en = length(s1);
15 | if (nargin >= 3)
16 | st = start_sam;
17 | endif
18 | if (nargin >= 4)
19 | en = end_sam;
20 | endif
21 |
22 | figure(1);
23 | clf;
24 | l1 = strcat("r;",samname1,";");
25 | plot(s1(st:en) - s2(st:en), l1);
26 | %axis([1 en-st min(s1(st:en)) max(s1(st:en))]);
27 |
28 | if (nargin == 5)
29 | pngname = sprintf("%s.png",pngname);
30 | print(pngname, '-dpng', "-S500,500")
31 | pngname = sprintf("%s_large.png",pngname);
32 | print(pngname, '-dpng', "-S800,600")
33 | endif
34 |
35 | endfunction
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/png.m:
--------------------------------------------------------------------------------
1 | % Copyright David Rowe 2009
2 | % This program is distributed under the terms of the GNU General Public License
3 | % Version 2
4 | %
5 | % Replot current plot as a png, generates small and large versions
6 |
7 | function png(pngname)
8 | % small image
9 |
10 | __gnuplot_set__ terminal png size 420,300
11 | ss = sprintf("__gnuplot_set__ output \"%s.png\"", pngname);
12 | eval(ss)
13 | replot;
14 |
15 | % larger image
16 |
17 | __gnuplot_set__ terminal png size 800,600
18 | ss = sprintf("__gnuplot_set__ output \"%s_large.png\"", pngname);
19 | eval(ss)
20 | replot;
21 |
22 | % for some reason I need this to stop large plot getting wiped
23 | __gnuplot_set__ output "/dev/null"
24 |
25 | endfunction
26 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/postfilter.m:
--------------------------------------------------------------------------------
1 | % Copyright David Rowe 2009
2 | % This program is distributed under the terms of the GNU General Public License
3 | % Version 2
4 | %
5 | % Plot postfilter doing its thing
6 |
7 | function postfilter(samname)
8 | p = load(samname);
9 | figure(1);
10 | plot(p(:,1),";energy;");
11 | hold on;
12 | plot(p(:,2),";bg_est;");
13 | hold off;
14 | grid;
15 | pngname=sprintf("%s_postfilter_1", samname);
16 | png(pngname);
17 |
18 | figure(2);
19 | plot(p(:,3),";% unvoiced;");
20 | grid;
21 | pngname=sprintf("%s_postfilter_2", samname);
22 | png(pngname);
23 | endfunction
24 |
25 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/pulse.m:
--------------------------------------------------------------------------------
1 | % pulse.m
2 | % David Rowe August 2009
3 | %
4 | % Experiments with human pulse perception for sinusoidal codecs
5 |
6 | function pulse(samname)
7 |
8 | A = 1000;
9 | K = 16000;
10 | N = 80;
11 | frames = K/N;
12 | s = zeros(1,K);
13 |
14 | for f=1:frames
15 | % lets try placing np random pulses in every frame
16 |
17 | P = 20 + (160-20)*rand(1,1);
18 | Wo = 2*pi/P;
19 | L = floor(pi/Wo);
20 | sf = zeros(1,N);
21 | for m=1:L/2:L
22 | pos = floor(rand(1,1)*N)+1;
23 | %pos = 50;
24 | for l=m:m+L/2-1
25 | sf = sf + A*cos(l*Wo*((f-1)*N+1:f*N) - pos*l*Wo);
26 | endfor
27 | endfor
28 | s((f-1)*N+1:f*N) = sf;
29 | endfor
30 |
31 | plot(s(1:250));
32 |
33 | fs=fopen(samname,"wb");
34 | fwrite(fs,s,"short");
35 | fclose(fs);
36 | endfunction
37 |
38 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/sample_clock_offset.m:
--------------------------------------------------------------------------------
1 | % sample_clock_offset.m
2 | %
3 | % David Rowe June 2017
4 | %
5 | % To simulate a sample clock offset we resample by a small amount
6 | % using linear interpolation
7 |
8 | function rx = sample_clock_offset(tx, sample_clock_offset_ppm)
9 | tin=1;
10 | tout=1;
11 | rx = zeros(1,length(tx));
12 | while tin < length(tx)
13 | t1 = floor(tin);
14 | t2 = ceil(tin);
15 | f = tin - t1;
16 | rx(tout) = (1-f)*tx(t1) + f*tx(t2);
17 | tout += 1;
18 | tin += 1+sample_clock_offset_ppm/1E6;
19 | end
20 | end
21 |
22 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/save_array_c_header.m:
--------------------------------------------------------------------------------
1 | % save_array_c_header.m
2 | %
3 | % David Rowe Sep 2015
4 |
5 | function save_array_c_header(array, array_name, filename)
6 | f=fopen(filename,"wt");
7 | fprintf(f,"/* Generated by save_array_c_header.m Octave function */\n\n");
8 | fprintf(f,"const int %s[]={\n", array_name);
9 | for m=1:length(array)-1
10 | fprintf(f," %f,\n",array(m));
11 | endfor
12 | fprintf(f," %f\n};\n",array(length(array)));
13 | fclose(f);
14 | endfunction
15 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/save_raw.m:
--------------------------------------------------------------------------------
1 | % save_raw.m
2 | % David Rowe 9 Feb 2015
3 |
4 | function s = save_raw(fn,s)
5 | fs=fopen(fn,"wb");
6 | fwrite(fs,s,"short");
7 | endfunction
8 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/test_cohpsk_ch.m:
--------------------------------------------------------------------------------
1 | % test_cohpsk_ch.m
2 | % David Rowe May 2015
3 | %
4 | % Plot outputs from test_coh_psk_ch.c
5 |
6 | Nc=7; Nd=2;
7 |
8 | load ../build_linux/src/test_cohpsk_ch_out.txt
9 |
10 | figure(3)
11 | clf;
12 |
13 | % plot combined signals to show diversity gains
14 |
15 | combined = rx_symb_log_c(:,1:Nc);
16 | for d=2:Nd
17 | combined += rx_symb_log_c(:, (d-1)*Nc+1:d*Nc);
18 | end
19 | plot(combined*exp(j*pi/4)/sqrt(Nd),'+')
20 | title('Scatter');
21 | axis([-2 2 -2 2])
22 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/tget_spec.m:
--------------------------------------------------------------------------------
1 | % tget-spec.m
2 | %
3 | % Used in conjunction with src/fdmdv_demod to test the
4 | % fdmdv_get_rx_spectrum() function.
5 | %
6 | % codec2-dev/src$ ./fdmdv_demod fdmdv_mod.raw tmp.c2 dump.txt
7 | % octave:3> tget_spec("../src/dump.txt")
8 | %
9 | % Copyright David Rowe 2012
10 | % This program is distributed under the terms of the GNU General Public License
11 | % Version 2
12 | %
13 |
14 | function tfft_log(dumpfilename)
15 |
16 | load(dumpfilename);
17 |
18 | [rows cols] = size(rx_spec_log_c);
19 | Fs = 8000; low_freq = 0; high_freq = 2500;
20 | res = (Fs/2)/cols;
21 | st_bin = low_freq/res + 1;
22 | en_bin = high_freq/res;
23 | xaxis = (st_bin:en_bin)*res;
24 |
25 | f_start = 2; f_end = 100;
26 | beta = 0.1;
27 |
28 | av = zeros(f_end, en_bin-st_bin+1);
29 | for r=f_start:f_end
30 | x = (1-beta)*av(r-1,:) + beta*rx_spec_log_c(r,st_bin:en_bin);
31 | av(r,:) = x;
32 | end
33 |
34 | % spectrogram (waterfall)
35 |
36 | figure(1)
37 | clf;
38 | imagesc(av,[-40 0]);
39 |
40 | % animated spectrum display
41 |
42 | figure(2)
43 | clf;
44 | for r=f_start:f_end
45 | plot(xaxis, av(r,:))
46 | axis([ low_freq high_freq -40 0])
47 | sleep(0.1)
48 | end
49 | endfunction
50 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/tlinreg.m:
--------------------------------------------------------------------------------
1 | % tlinreg
2 | % David Rowe April 2015
3 | %
4 | % Unit test for linear regression
5 |
6 | x = [1 2 7 8];
7 | y = [ -0.70702 + 0.70708i 0.77314 - 0.63442i -0.98083 + 0.19511i 0.99508 - 0.09799i] .* [1 -1 1 -1];
8 | [m b] = linreg(x,y,4);
9 |
10 | x = [1 2 3 4 5 6 7 8];
11 | yFit = m * x + b;
12 | figure(1)
13 | plot(yFit,'r*')
14 | axis([-1.5 1.5 -1.5 1.5])
15 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/tpapr.m:
--------------------------------------------------------------------------------
1 | % tpapr.m
2 | % David Rowe
3 | % 18 May 2015
4 |
5 | graphics_toolkit ("gnuplot");
6 | rand('state',1);
7 |
8 | Fs = 8000;
9 | Rs = 50;
10 | Nc = 8;
11 | Fc = 1500;
12 | Fsep = ((1:Nc).^1.2)*75;
13 | %Fsep = (1:Nc)*75 + 5 - 20*rand(1,Nc)
14 | n = 80000;
15 | t = 1:n;
16 | tx = zeros(1,n);
17 | phi = ones(1,Nc);
18 |
19 | figure(1)
20 | clf
21 |
22 | for m=1:Nc
23 | s = cos(phi(m)+t*2*pi*(Rs/2 + Fc + Fsep(m))/Fs);
24 | tx += s;
25 | subplot(Nc,1,m);
26 | plot(s)
27 | end
28 |
29 | figure(2)
30 | plot(tx)
31 |
32 | tx = tx(length(tx)*0.5:length(tx));
33 | papr = max(tx.*conj(tx)) / mean(tx.*conj(tx));
34 | papr_dB = 10*log10(papr);
35 | printf("PAPR: %4.2f dB\n", papr_dB);
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/twomixer.m:
--------------------------------------------------------------------------------
1 | % twomixer.m
2 | % David Rowe Feb 2015
3 | %
4 | % test program for combining signals from two mixers
5 |
6 | fc=1024;
7 | Fs=8192;
8 | [b a] = cheby2(6,40,[200 3000]/(Fs/2));
9 |
10 | w1 = 2*pi*(fc/2)/(Fs/2);
11 | w2 = 2*pi*(3*fc/2)/(Fs/2);
12 | w3 = 2*pi*(5*fc/2)/(Fs/2);
13 | wc = 2*pi*fc/(Fs/2);
14 |
15 | t = 0:(Fs-1);
16 | s1 = cos(w1.*t);
17 | s2 = cos(w2.*t);
18 | s3 = cos(w3.*t);
19 | s = s1 + s2 + s3;
20 |
21 | lo1 = cos(wc*t);
22 | lo2 = cos(2*wc*t);
23 | out1 = filter(b,a,s .* lo1);
24 | out2 = filter(b,a,s .* lo2);
25 |
26 | S = fft(s);
27 |
28 | figure(1)
29 | subplot(211)
30 | plot(abs(S));
31 | subplot(212)
32 | plot(angle(S))
33 |
34 | figure(2)
35 | subplot(211)
36 | plot(abs(fft(out1)))
37 | subplot(212)
38 | plot(abs(fft(out2)))
39 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/twotone.m:
--------------------------------------------------------------------------------
1 | % twotone.m
2 | % David Rowe Aug 2012
3 | % Used to experiment with combining phase of two tones
4 |
5 | function cbphase
6 |
7 | Wo = 100.0*pi/4000;
8 | L = floor(pi/Wo);
9 | phi = zeros(1,L);
10 |
11 | % two harmonics
12 |
13 | a = 20; b = 21;
14 |
15 | % set up phases to whatever
16 |
17 | phi(a) = -pi;
18 | phi(b) = -pi/2;
19 |
20 | % synthesis the two-tone signal
21 |
22 | N = 16000;
23 | Nplot = 250;
24 | s = zeros(1,N);
25 |
26 | for m=a:b
27 | s_m = cos(m*Wo*(0:(N-1)) + phi(m));
28 | s = s + s_m;
29 | endfor
30 |
31 | % now our theory says that this signal should be the same perceptually
32 |
33 | phi_(a) = (phi(a) - phi(b))/2;
34 | phi_(b) = (phi(b) - phi(a))/2;
35 |
36 | s_ = zeros(1,N);
37 | for m=a:b
38 | s_m = cos(m*Wo*(0:(N-1)) + phi_(m));
39 | s_ = s_ + s_m;
40 | endfor
41 |
42 | % plot them and see if envelope has the same phase, but "carriers"
43 | % have different phase
44 |
45 | figure(1);
46 | clf;
47 | subplot(211);
48 | plot(s(1:Nplot));
49 | subplot(212);
50 | plot(s_(1:Nplot),'r');
51 | endfunction
52 |
53 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/tximage.m:
--------------------------------------------------------------------------------
1 | % tximage.m
2 | % David Rpowe Sep 2015
3 |
4 | % Say we have two signals from a mixer, at f_lo +/- f_if
5 | % We attenuate one by 20dB with a BPF
6 | % We then pass through a non linear amp
7 | % Note non linearities are tricky to simulate as sign() gives
8 | % us a lot of HF harmonics that aliased back down.
9 | %
10 | % However, it does appear that non-linear PA(sign) only supresses image
11 | % by another 6dB. So mixing up does have it's problems compared
12 | % to direct generation. A softer limiter (sqrt) seems to do a better job.
13 |
14 | fs = 1E4;
15 | f_rf = 146;
16 | f_if = 10.7;
17 | f_lo = f_rf - f_if;
18 |
19 | f_rf1 = f_if + f_lo;
20 | f_rf2 = f_if - f_lo;
21 |
22 | a_rf1 = 1;
23 | a_rf2 = 0.1;
24 |
25 | t = 1:fs;
26 |
27 | sig_rf = a_rf1*cos(2*pi*t*f_rf1/fs) + a_rf2*cos(2*pi*t*f_rf2/fs);
28 | sig_rf_clip = sign(sig_rf).* sig_rf .^ 1/2;
29 | b = fir1(100, f_rf/fs);
30 | sig_rf_clip_filter = filter(b,1,sig_rf_clip);
31 |
32 | figure(1);
33 | subplot(211)
34 | plot(sig_rf(1:1000))
35 | subplot(212)
36 | plot(sig_rf_clip_filter(1:1000))
37 | figure(2)
38 | plot(20*log10(abs(fft(sig_rf_clip_filter))))
39 | axis([1 1000 0 80])
40 | grid
41 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/undersample.m:
--------------------------------------------------------------------------------
1 | % undersample.m
2 | % David Rowe 5 Nov 2012
3 | % Testing algorithms for plotting undersampled data for fdmdv2 waveform displays
4 |
5 | fs=fopen("../raw/hts1a.raw","rb");
6 | s = fread(fs,Inf,"short");
7 |
8 | Fs1=8000;
9 | Fs2=200;
10 |
11 | M=Fs1/Fs2;
12 |
13 | samples=length(s)/M;
14 | s1=zeros(1,2*samples);
15 | for b=1:samples
16 | st = (b-1)*M + 1;
17 | en = b*M;
18 | s1(2*b-1) = max(s(st:en));
19 | s1(2*b) = min(s(st:en));
20 | end
21 |
22 | subplot(211)
23 | plot(s)
24 | subplot(212)
25 | plot(s1);
26 |
27 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/vq_pager.m:
--------------------------------------------------------------------------------
1 | % vq_pager.m
2 | %
3 | % Interactive Octave script to inspect vectors, e.g. for newamp1.m vector quantisation
4 | %
5 | % Usage:
6 | %
7 | % octave:14> vq_pager(vq)
8 |
9 | function vq_pager(vq)
10 | grid_sz = 4;
11 |
12 | [vq_rows vq_cols] = size(vq);
13 |
14 | r = 1;
15 |
16 | % Keyboard loop
17 |
18 | k = ' ';
19 | do
20 | figure(1); clf;
21 | n_plot = min(grid_sz*grid_sz,vq_rows-r+1)
22 | printf("r: %d n_plot: %d\n", r, n_plot);
23 | for i = 1:n_plot;
24 | subplot(grid_sz,grid_sz,i);
25 | plot(vq(r+i-1,:));
26 | axis([1 vq_cols -20 20]);
27 | end
28 |
29 | % interactive menu
30 |
31 | printf("\rr: %d menu: n-next b-back q-quit", r);
32 | fflush(stdout);
33 | k = kbhit();
34 |
35 | if k == 'n'
36 | r = r + grid_sz*grid_sz;
37 | r = min(r, vq_rows);
38 | endif
39 | if k == 'b'
40 | r = r - grid_sz*grid_sz;
41 | r = max(r,1);
42 | endif
43 | until (k == 'q')
44 | printf("\n");
45 |
46 | endfunction
47 |
48 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/vq_search_gain.m:
--------------------------------------------------------------------------------
1 | %----------------------------------------------------------------------
2 | % abs() search with a linear gain term
3 |
4 | function [idx contrib errors test_ g mg sl] = vq_search_gain(vq, data)
5 |
6 | [nVec nCols] = size(vq);
7 | nRows = rows(data);
8 |
9 | error = zeros(1,nVec);
10 | g = zeros(nRows, nVec);
11 | diff = zeros(nVec, nCols);
12 | errors = zeros(1, nRows);
13 | idx = zeros(1, nRows);
14 | contrib = zeros(nRows, nCols);
15 | test_ = zeros(nVec, nCols);
16 | weights = ones(1,nCols);
17 | %weights(nCols-10+1:nCols) = 0.25;
18 |
19 | for f=1:nRows
20 | target = data(f,:);
21 | for i=1:nVec
22 | % work out gain for best match
23 |
24 | g(f, i) = (sum(target) - sum(vq(i,:)))/nCols;
25 | diff(i,:) = target - vq(i,:) - g(f, i);
26 | diff(i,:) .* weights;
27 |
28 | % abs in dB is MSE in linear
29 |
30 | error(i) = mean(abs(diff(i,:)));
31 |
32 | %printf("f: %d i: %d g: %f error: %f\n", f, i, g(f, i), error(i));
33 | end
34 | [mn min_ind] = min(error);
35 |
36 | idx(f) = min_ind;
37 |
38 | errors(f) = mn;
39 | contrib(f,:) = test_(f,:) = vq(min_ind,:) + g(f,min_ind);
40 | end
41 | mg = 1; sl = 0;
42 | endfunction
43 |
44 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/vq_search_mse.m:
--------------------------------------------------------------------------------
1 | % standard mean squared error search
2 |
3 | function [idx contrib errors test_ g mg sl] = vq_search_mse(vq, data)
4 | [nVec nCols] = size(vq);
5 | nRows = rows(data);
6 |
7 | error = zeros(1,nVec);
8 | errors = zeros(1, nRows);
9 | idx = zeros(1, nRows);
10 | contrib = zeros(nRows, nCols);
11 | test_ = zeros(nVec, nCols);
12 |
13 | for f=1:nRows
14 | target = data(f,:);
15 | for i=1:nVec
16 | diff = target - vq(i,:);
17 | error(i) = diff * diff';
18 | end
19 | [mn min_ind] = min(error);
20 | errors(f) = mn; idx(f) = min_ind; contrib(f,:) = vq(min_ind,:);
21 | test_(f,:) = vq(min_ind,:);
22 | end
23 |
24 | g = 0; mg = 1; sl = 0; % dummys for this function
25 | endfunction
26 |
27 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/vq_search_sg.m:
--------------------------------------------------------------------------------
1 | %----------------------------------------------------------------------
2 | % abs() search with a linear and slope term
3 |
4 | function [idx contrib errors b_log2] = vq_search_sg(vq, data)
5 | [nVec nCols] = size(vq);
6 | nRows = rows(data);
7 |
8 | idx = errors = zeros(1, nRows);
9 | error = zeros(1, nVec);
10 | contrib = zeros(nRows, nCols);
11 |
12 | b_log = zeros(nVec, 2);
13 | b_log2 = [];
14 |
15 | k = 1:nCols;
16 |
17 | for f=1:nRows
18 | t = data(f,:);
19 |
20 | for i=1:nVec
21 | v = vq(i,:);
22 | A = [k*k' sum(k); sum(k) nCols];
23 | c = [(t*k'-v*k') (sum(t)-sum(v))]';
24 | b = inv(A)*c;
25 | b(1) = quantise([-1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0], b(1));
26 | b_log(i,:) = b;
27 | diff = t - (v + b(1)*k + b(2));
28 | error(i) = diff*diff';
29 | %printf(" i: %d error %f\n", i, error(i));
30 | end
31 |
32 | [mn min_ind] = min(error);
33 | errors(f) = mn;
34 | idx(f) = min_ind(1);
35 | b = b_log(min_ind,:);
36 | v = vq(min_ind,:);
37 | printf("f: %d idx: %d b(1): %f b(2): %f\n", f, idx(f), b(1), b(2));
38 | contrib(f,:) = v + b(1)*k + b(2);
39 | b_log2 = [b_log2; b];
40 | end
41 |
42 | endfunction
43 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/octave/xormixer.m:
--------------------------------------------------------------------------------
1 | % xormixer.m
2 | % David Rowe Sep 2015
3 | %
4 | % Testing xor gate as a mixer for constant amplitude
5 | % modulation schemes
6 |
7 | n = 1024;
8 | carrier = modulation = zeros(1,n);
9 |
10 | Tc = 4; % carrier period
11 | for i=1:Tc:n
12 | carrier(i:i+Tc/2-1) = 1;
13 | end
14 |
15 | Tm = 32; % modulation signal period
16 | for i=1:Tm:n
17 | modulation(i:(i+Tm/2-1)) = 1;
18 | end
19 |
20 | %carrier = carrier .* hanning(n)';
21 | %modulation = modulation .* hanning(n)';
22 | mixer = xor(carrier,modulation) .* hanning(n)';
23 |
24 | figure(1);
25 | clf
26 | subplot(311)
27 | plot(abs(fft(carrier)))
28 | axis([1 n 0 n/2]);
29 |
30 | subplot(312)
31 | plot(abs(fft(modulation)))
32 | axis([1 n 0 n/2]);
33 |
34 | subplot(313)
35 | plot(abs(fft(mixer)))
36 | axis([1 n 0 n/2]);
37 |
38 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/b0067.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/b0067.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/cq_ref.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/cq_ref.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/cross.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/cross.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/cross_melp2400.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/cross_melp2400.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/f2400.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/f2400.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/forig.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/forig.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/forig_ambe2000.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/forig_ambe2000.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/forig_g729a.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/forig_g729a.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/forig_gsm13k.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/forig_gsm13k.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/forig_speex_8k.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/forig_speex_8k.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/g3plx.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/g3plx.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts1.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts1.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts1a.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts1a.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts1a_ambe2000.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts1a_ambe2000.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts1a_g729a.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts1a_g729a.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts1a_gsm13k.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts1a_gsm13k.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts1a_melp.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts1a_melp.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts1a_speex_8k.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts1a_speex_8k.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts2.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts2.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts2a.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts2a.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts2a_ambe2000.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts2a_ambe2000.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts2a_g729a.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts2a_g729a.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts2a_gsm13k.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts2a_gsm13k.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts2a_melp.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts2a_melp.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/hts2a_speex_8k.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/hts2a_speex_8k.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/k6hx.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/k6hx.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/kristoff.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/kristoff.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/m2400.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/m2400.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/mmt1.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/mmt1.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/mmt1_ambe2000.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/mmt1_ambe2000.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/mmt1_g729a.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/mmt1_g729a.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/mmt1_gsm13k.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/mmt1_gsm13k.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/mmt1_speex_8k.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/mmt1_speex_8k.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/morig.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/morig.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/morig_ambe2000.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/morig_ambe2000.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/morig_g729a.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/morig_g729a.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/morig_gsm13k.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/morig_gsm13k.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/morig_speex_8k.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/morig_speex_8k.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/sine1k_2Hz_spread.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/sine1k_2Hz_spread.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/sine1k_2ms_delay_2Hz_spread.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/sine1k_2ms_delay_2Hz_spread.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/speech_orig_16k.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/speech_orig_16k.wav
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/ve9qrp.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/ve9qrp.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/ve9qrp_10s.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/ve9qrp_10s.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/raw/vk5qi.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/codec2/raw/vk5qi.raw
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/script/playraw.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Plays a raw file
3 | # usage:
4 | # playraw file.raw
5 | # playraw file.raw -d /dev/dsp1 (e.g. for USB headphones)
6 | play -r 8000 -s -2 $1 $2 $3
7 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/script/raw2wav.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Converts 16 bit signed short 8 kHz raw (headerless) files to wave
3 | sox -r 8000 -s -2 $1 $2
4 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/script/separate_all.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | sox $1 hts1_$1.wav trim 0 3
3 | sox $1 hts2_$1.wav trim 3 3
4 | sox $1 morig_$1.wav trim 6 2
5 | sox $1 forig_$1.wav trim 8 2
6 | sox $1 ve9qrp_$1.wav trim 10 9.5
7 | sox $1 cq_ref_$1.wav trim 20 9
8 | sox $1 kristoff_$1.wav trim 29.5 4
9 | sox $1 vk5qi_$1.wav trim 33.5 13.5
10 | sox $1 vk5dgr_$1.wav trim 47 10
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/script/wav2raw.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Converts wave files to raw (headerless) files
3 | sox $1 -t raw $2
4 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/ampexp.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: ampexp.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: & August 2012
6 |
7 | Functions for experimenting with amplitude quantisation.
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2012 David Rowe
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not,see .
26 | */
27 |
28 | #ifndef __AMPEXP__
29 | #define __AMPEXP__
30 |
31 | #include "defines.h"
32 |
33 | struct AEXP;
34 |
35 | struct AEXP *amp_experiment_create();
36 | void amp_experiment_destroy(struct AEXP *aexp);
37 | void amp_experiment(struct AEXP *aexp, MODEL *model, char *arg);
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/c2file.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: c2file.h
4 | AUTHOR......: Kevin Otte
5 | DATE CREATED: 2017-08-01
6 |
7 | Header structures for Codec2 file storage
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | const char c2_file_magic[3] = {0xc0, 0xde, 0xc2};
12 |
13 | struct c2_header {
14 | char magic[3];
15 | char version_major;
16 | char version_minor;
17 | char mode;
18 | char flags;
19 | };
20 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/dlsp1.txt:
--------------------------------------------------------------------------------
1 | 1 32
2 | 25
3 | 50
4 | 75
5 | 100
6 | 125
7 | 150
8 | 175
9 | 200
10 | 225
11 | 250
12 | 275
13 | 300
14 | 325
15 | 350
16 | 375
17 | 400
18 | 425
19 | 450
20 | 475
21 | 500
22 | 525
23 | 550
24 | 575
25 | 600
26 | 625
27 | 650
28 | 675
29 | 700
30 | 725
31 | 750
32 | 775
33 | 800
34 |
35 |
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/dlsp10.txt:
--------------------------------------------------------------------------------
1 | 1 32
2 | 25
3 | 50
4 | 75
5 | 100
6 | 125
7 | 150
8 | 175
9 | 200
10 | 225
11 | 250
12 | 275
13 | 300
14 | 325
15 | 350
16 | 375
17 | 400
18 | 425
19 | 450
20 | 475
21 | 500
22 | 525
23 | 550
24 | 575
25 | 600
26 | 625
27 | 650
28 | 675
29 | 700
30 | 725
31 | 750
32 | 775
33 | 800
34 |
35 |
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/dlsp2.txt:
--------------------------------------------------------------------------------
1 | 1 32
2 | 25
3 | 50
4 | 75
5 | 100
6 | 125
7 | 150
8 | 175
9 | 200
10 | 225
11 | 250
12 | 275
13 | 300
14 | 325
15 | 350
16 | 375
17 | 400
18 | 425
19 | 450
20 | 475
21 | 500
22 | 525
23 | 550
24 | 575
25 | 600
26 | 625
27 | 650
28 | 675
29 | 700
30 | 725
31 | 750
32 | 775
33 | 800
34 |
35 |
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/dlsp3.txt:
--------------------------------------------------------------------------------
1 | 1 32
2 | 25
3 | 50
4 | 75
5 | 100
6 | 125
7 | 150
8 | 175
9 | 200
10 | 225
11 | 250
12 | 275
13 | 300
14 | 325
15 | 350
16 | 375
17 | 400
18 | 425
19 | 450
20 | 475
21 | 500
22 | 525
23 | 550
24 | 575
25 | 600
26 | 625
27 | 650
28 | 675
29 | 700
30 | 725
31 | 750
32 | 775
33 | 800
34 |
35 |
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/dlsp4.txt:
--------------------------------------------------------------------------------
1 | 1 32
2 | 25
3 | 50
4 | 75
5 | 100
6 | 125
7 | 150
8 | 175
9 | 200
10 | 250
11 | 300
12 | 350
13 | 400
14 | 450
15 | 500
16 | 550
17 | 600
18 | 650
19 | 700
20 | 750
21 | 800
22 | 850
23 | 900
24 | 950
25 | 1000
26 | 1050
27 | 1100
28 | 1150
29 | 1200
30 | 1250
31 | 1300
32 | 1350
33 | 1400
34 |
35 |
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/dlsp5.txt:
--------------------------------------------------------------------------------
1 | 1 32
2 | 25
3 | 50
4 | 75
5 | 100
6 | 125
7 | 150
8 | 175
9 | 200
10 | 250
11 | 300
12 | 350
13 | 400
14 | 450
15 | 500
16 | 550
17 | 600
18 | 650
19 | 700
20 | 750
21 | 800
22 | 850
23 | 900
24 | 950
25 | 1000
26 | 1050
27 | 1100
28 | 1150
29 | 1200
30 | 1250
31 | 1300
32 | 1350
33 | 1400
34 |
35 |
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/dlsp6.txt:
--------------------------------------------------------------------------------
1 | 1 32
2 | 25
3 | 50
4 | 75
5 | 100
6 | 125
7 | 150
8 | 175
9 | 200
10 | 250
11 | 300
12 | 350
13 | 400
14 | 450
15 | 500
16 | 550
17 | 600
18 | 650
19 | 700
20 | 750
21 | 800
22 | 850
23 | 900
24 | 950
25 | 1000
26 | 1050
27 | 1100
28 | 1150
29 | 1200
30 | 1250
31 | 1300
32 | 1350
33 | 1400
34 |
35 |
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/dlsp7.txt:
--------------------------------------------------------------------------------
1 | 1 32
2 | 25
3 | 50
4 | 75
5 | 100
6 | 125
7 | 150
8 | 175
9 | 200
10 | 225
11 | 250
12 | 275
13 | 300
14 | 325
15 | 350
16 | 375
17 | 400
18 | 425
19 | 450
20 | 475
21 | 500
22 | 525
23 | 550
24 | 575
25 | 600
26 | 625
27 | 650
28 | 675
29 | 700
30 | 725
31 | 750
32 | 775
33 | 800
34 |
35 |
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/dlsp8.txt:
--------------------------------------------------------------------------------
1 | 1 32
2 | 25
3 | 50
4 | 75
5 | 100
6 | 125
7 | 150
8 | 175
9 | 200
10 | 225
11 | 250
12 | 275
13 | 300
14 | 325
15 | 350
16 | 375
17 | 400
18 | 425
19 | 450
20 | 475
21 | 500
22 | 525
23 | 550
24 | 575
25 | 600
26 | 625
27 | 650
28 | 675
29 | 700
30 | 725
31 | 750
32 | 775
33 | 800
34 |
35 |
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/dlsp9.txt:
--------------------------------------------------------------------------------
1 | 1 32
2 | 25
3 | 50
4 | 75
5 | 100
6 | 125
7 | 150
8 | 175
9 | 200
10 | 225
11 | 250
12 | 275
13 | 300
14 | 325
15 | 350
16 | 375
17 | 400
18 | 425
19 | 450
20 | 475
21 | 500
22 | 525
23 | 550
24 | 575
25 | 600
26 | 625
27 | 650
28 | 675
29 | 700
30 | 725
31 | 750
32 | 775
33 | 800
34 |
35 |
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lsp1.txt:
--------------------------------------------------------------------------------
1 | 1 16
2 | 225
3 | 250
4 | 275
5 | 300
6 | 325
7 | 350
8 | 375
9 | 400
10 | 425
11 | 450
12 | 475
13 | 500
14 | 525
15 | 550
16 | 575
17 | 600
18 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lsp10.txt:
--------------------------------------------------------------------------------
1 | 1 4
2 | 2900
3 | 3100
4 | 3300
5 | 3500
6 |
7 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lsp2.txt:
--------------------------------------------------------------------------------
1 | 1 16
2 | 325
3 | 350
4 | 375
5 | 400
6 | 425
7 | 450
8 | 475
9 | 500
10 | 525
11 | 550
12 | 575
13 | 600
14 | 625
15 | 650
16 | 675
17 | 700
18 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lsp3.txt:
--------------------------------------------------------------------------------
1 | 1 16
2 | 500
3 | 550
4 | 600
5 | 650
6 | 700
7 | 750
8 | 800
9 | 850
10 | 900
11 | 950
12 | 1000
13 | 1050
14 | 1100
15 | 1150
16 | 1200
17 | 1250
18 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lsp4.txt:
--------------------------------------------------------------------------------
1 | 1 16
2 | 700
3 | 800
4 | 900
5 | 1000
6 | 1100
7 | 1200
8 | 1300
9 | 1400
10 | 1500
11 | 1600
12 | 1700
13 | 1800
14 | 1900
15 | 2000
16 | 2100
17 | 2200
18 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lsp5.txt:
--------------------------------------------------------------------------------
1 | 1 16
2 | 950
3 | 1050
4 | 1150
5 | 1250
6 | 1350
7 | 1450
8 | 1550
9 | 1650
10 | 1750
11 | 1850
12 | 1950
13 | 2050
14 | 2150
15 | 2250
16 | 2350
17 | 2450
18 |
19 |
20 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lsp6.txt:
--------------------------------------------------------------------------------
1 | 1 16
2 | 1100
3 | 1200
4 | 1300
5 | 1400
6 | 1500
7 | 1600
8 | 1700
9 | 1800
10 | 1900
11 | 2000
12 | 2100
13 | 2200
14 | 2300
15 | 2400
16 | 2500
17 | 2600
18 |
19 |
20 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lsp7.txt:
--------------------------------------------------------------------------------
1 | 1 16
2 | 1500
3 | 1600
4 | 1700
5 | 1800
6 | 1900
7 | 2000
8 | 2100
9 | 2200
10 | 2300
11 | 2400
12 | 2500
13 | 2600
14 | 2700
15 | 2800
16 | 2900
17 | 3000
18 |
19 |
20 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lsp8.txt:
--------------------------------------------------------------------------------
1 | 1 8
2 | 2300
3 | 2400
4 | 2500
5 | 2600
6 | 2700
7 | 2800
8 | 2900
9 | 3000
10 |
11 |
12 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lsp9.txt:
--------------------------------------------------------------------------------
1 | 1 8
2 | 2500
3 | 2600
4 | 2700
5 | 2800
6 | 2900
7 | 3000
8 | 3100
9 | 3200
10 |
11 |
12 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspdt1.txt:
--------------------------------------------------------------------------------
1 | 1 8
2 | -75
3 | -50
4 | -25
5 | 0
6 | 25
7 | 50
8 | 75
9 | 100
10 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspdt10.txt:
--------------------------------------------------------------------------------
1 | 1 2
2 | -50
3 | 50
4 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspdt2.txt:
--------------------------------------------------------------------------------
1 | 1 8
2 | -75
3 | -50
4 | -25
5 | 0
6 | 25
7 | 50
8 | 75
9 | 100
10 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspdt3.txt:
--------------------------------------------------------------------------------
1 | 1 4
2 | -50
3 | 0
4 | 50
5 | 100
6 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspdt4.txt:
--------------------------------------------------------------------------------
1 | 1 4
2 | -50
3 | 0
4 | 50
5 | 100
6 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspdt5.txt:
--------------------------------------------------------------------------------
1 | 1 4
2 | -50
3 | 0
4 | 50
5 | 100
6 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspdt6.txt:
--------------------------------------------------------------------------------
1 | 1 4
2 | -50
3 | 0
4 | 50
5 | 100
6 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspdt7.txt:
--------------------------------------------------------------------------------
1 | 1 2
2 | -50
3 | 50
4 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspdt8.txt:
--------------------------------------------------------------------------------
1 | 1 2
2 | -50
3 | 50
4 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspdt9.txt:
--------------------------------------------------------------------------------
1 | 1 2
2 | -50
3 | 50
4 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspres_bw1.txt:
--------------------------------------------------------------------------------
1 | 1 4
2 | 35
3 | 80
4 | 140
5 | 250
6 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspres_bw2.txt:
--------------------------------------------------------------------------------
1 | 1 8
2 | 50
3 | 100
4 | 200
5 | 400
6 | 500
7 | 600
8 | 800
9 | 1000
10 |
11 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspres_centre1.txt:
--------------------------------------------------------------------------------
1 | 1 8
2 | 300
3 | 350
4 | 400
5 | 450
6 | 500
7 | 550
8 | 600
9 | 650
10 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/lspres_centre2.txt:
--------------------------------------------------------------------------------
1 | 1 8
2 | 500
3 | 600
4 | 750
5 | 900
6 | 1100
7 | 1300
8 | 1500
9 | 1700
10 |
11 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/mel1.txt:
--------------------------------------------------------------------------------
1 | 1 8
2 | 550
3 | 600
4 | 650
5 | 700
6 | 750
7 | 800
8 | 850
9 | 900
10 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/mel2.txt:
--------------------------------------------------------------------------------
1 | 1 4
2 | 50
3 | 100
4 | 200
5 | 300
6 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/mel3.txt:
--------------------------------------------------------------------------------
1 | 1 16
2 | 800
3 | 850
4 | 900
5 | 950
6 | 1000
7 | 1050
8 | 1100
9 | 1150
10 | 1200
11 | 1250
12 | 1300
13 | 1350
14 | 1400
15 | 1450
16 | 1500
17 | 1650
18 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/mel4.txt:
--------------------------------------------------------------------------------
1 | 1 8
2 | 25
3 | 50
4 | 75
5 | 100
6 | 125
7 | 150
8 | 175
9 | 250
10 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/mel5.txt:
--------------------------------------------------------------------------------
1 | 1 8
2 | 1350
3 | 1400
4 | 1450
5 | 1500
6 | 1550
7 | 1600
8 | 1650
9 | 1700
10 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/mel6.txt:
--------------------------------------------------------------------------------
1 | 1 4
2 | 25
3 | 50
4 | 100
5 | 150
6 |
7 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebook/newamp1_energy_q.txt:
--------------------------------------------------------------------------------
1 | 1 16
2 | 10.000000
3 | 12.500000
4 | 15.000000
5 | 17.500000
6 | 20.000000
7 | 22.500000
8 | 25.000000
9 | 27.500000
10 | 30.000000
11 | 32.500000
12 | 35.000000
13 | 37.500000
14 | 40.000000
15 | 42.500000
16 | 45.000000
17 | 47.500000
18 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/codebooknewamp1_energy.c:
--------------------------------------------------------------------------------
1 | /* THIS IS A GENERATED FILE. Edit generate_codebook.c and its input */
2 |
3 | /*
4 | * This intermediary file and the files that used to create it are under
5 | * The LGPL. See the file COPYING.
6 | */
7 |
8 | #include "defines.h"
9 |
10 | /* /home/david/codec2-dev/src/codebook/newamp1_energy_q.txt */
11 | static const float codes0[] = {
12 | 10,
13 | 12.5,
14 | 15,
15 | 17.5,
16 | 20,
17 | 22.5,
18 | 25,
19 | 27.5,
20 | 30,
21 | 32.5,
22 | 35,
23 | 37.5,
24 | 40,
25 | 42.5,
26 | 45,
27 | 47.5
28 | };
29 |
30 | const struct lsp_codebook newamp1_energy_cb[] = {
31 | /* /home/david/codec2-dev/src/codebook/newamp1_energy_q.txt */
32 | {
33 | 1,
34 | 4,
35 | 16,
36 | codes0
37 | },
38 | { 0, 0, 0, 0 }
39 | };
40 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/cohpsk_defs.h:
--------------------------------------------------------------------------------
1 | /* Generated by write_pilot_file() Octave function */
2 |
3 | #define NSYMROW 4 /* number of data symbols per carrier (number of rows) */
4 | #define NS 4 /* number of data symbols between pilots */
5 | #define NPILOTSFRAME 2 /* number of pilot symbols per carrier */
6 | #define PILOTS_NC 7 /* number of carriers */
7 |
8 | #define NSYMROWPILOT 6 /* number of rows after pilots inserted */
9 |
10 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/comp.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: comp.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 24/08/09
6 |
7 | Complex number definition.
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2009 David Rowe
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | #ifndef __COMP__
29 | #define __COMP__
30 |
31 | /* Complex number */
32 |
33 | typedef struct {
34 | float real;
35 | float imag;
36 | } COMP;
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/fq20.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # fq20.shsh
3 | # David Rowe 27 July 2010
4 | #
5 | # Decode a file with fully quantised codec at 20ms frame rate
6 |
7 | ../src/sinedec ../raw/$1.raw $1.mdl -o $1_phase0_lsp_20_EWo2.raw --phase 0 --lpc 10 --lsp --postfilter --dec
8 |
9 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/golay23.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: golay23.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 3 March 2013
6 |
7 | Header file for Golay FEC.
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2013 David Rowe
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | #ifndef __GOLAY23__
29 | #define __GOLAY23__
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | void golay23_init(void);
36 | int golay23_encode(int data);
37 | int golay23_decode(int received_codeword);
38 | int golay23_count_errors(int recd_codeword, int corrected_codeword);
39 |
40 | #ifdef __cplusplus
41 | }
42 | #endif
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/horus_l2.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: horus_l2.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: Dec 2015
6 |
7 | \*---------------------------------------------------------------------------*/
8 |
9 | #ifndef __HORUS_L2__
10 | #define __HORUS_L2__
11 |
12 | int horus_l2_get_num_tx_data_bytes(int num_payload_data_bytes);
13 |
14 | /* call this first */
15 |
16 | void horus_l2_init(void);
17 |
18 | /* returns number of output bytes in output_tx_data */
19 |
20 | int horus_l2_encode_tx_packet(unsigned char *output_tx_data,
21 | unsigned char *input_payload_data,
22 | int num_payload_data_bytes);
23 |
24 | void horus_l2_decode_rx_packet(unsigned char *output_payload_data,
25 | unsigned char *input_rx_data,
26 | int num_payload_data_bytes);
27 |
28 | unsigned short horus_l2_gen_crc16(unsigned char* data_p, unsigned char length);
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/kiss_fftr.h:
--------------------------------------------------------------------------------
1 | #ifndef KISS_FTR_H
2 | #define KISS_FTR_H
3 |
4 | #include "kiss_fft.h"
5 | #ifdef __cplusplus
6 | extern "C" {
7 | #endif
8 |
9 |
10 | /*
11 |
12 | Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
13 |
14 |
15 |
16 | */
17 |
18 | typedef struct kiss_fftr_state *kiss_fftr_cfg;
19 |
20 |
21 | kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
22 | /*
23 | nfft must be even
24 |
25 | If you don't care to allocate space, use mem = lenmem = NULL
26 | */
27 |
28 |
29 | void kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata);
30 | /*
31 | input timedata has nfft scalar points
32 | output freqdata has nfft/2+1 complex points
33 | */
34 |
35 | void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata);
36 | /*
37 | input freqdata has nfft/2+1 complex points
38 | output timedata has nfft scalar points
39 | */
40 |
41 | #define kiss_fftr_free free
42 |
43 | #ifdef __cplusplus
44 | }
45 | #endif
46 | #endif
47 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/linreg.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: linreg.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: April 2015
6 |
7 | Linear regression C module based
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2015 David Rowe
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | #ifndef __LINREG__
29 | #define __LINREG__
30 |
31 | #include "comp.h"
32 |
33 | void linreg(COMP *m, COMP *b, float x[], COMP y[], int n);
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/listensim.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # listensim.sh
3 | # David Rowe 10 Sep 2009
4 | #
5 | # Listen to files processed with sim.sh
6 |
7 | ../script/menu.sh $1_uq.raw $1_lpc10.raw $1_lpcpf.raw $1_phase0.raw $1_phase0_lpcpf.raw $2 $3 $4 $5
8 |
9 |
10 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/lsp.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: lsp.c
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 24/2/93
6 |
7 |
8 | This file contains functions for LPC to LSP conversion and LSP to
9 | LPC conversion. Note that the LSP coefficients are not in radians
10 | format but in the x domain of the unit circle.
11 |
12 | \*---------------------------------------------------------------------------*/
13 |
14 | /*
15 | Copyright (C) 2009 David Rowe
16 |
17 | All rights reserved.
18 |
19 | This program is free software; you can redistribute it and/or modify
20 | it under the terms of the GNU Lesser General Public License version 2.1, as
21 | published by the Free Software Foundation. This program is
22 | distributed in the hope that it will be useful, but WITHOUT ANY
23 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
24 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
25 | License for more details.
26 |
27 | You should have received a copy of the GNU Lesser General Public License
28 | along with this program; if not, see .
29 | */
30 |
31 | #ifndef __LSP__
32 | #define __LSP__
33 |
34 | int lpc_to_lsp (float *a, int lpcrdr, float *freq, int nb, float delta);
35 | void lsp_to_lpc(float *freq, float *ak, int lpcrdr);
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/nlp.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: nlp.c
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 23/3/93
6 |
7 | Non Linear Pitch (NLP) estimation functions.
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2009 David Rowe
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | #ifndef __NLP__
29 | #define __NLP__
30 |
31 | #include "comp.h"
32 |
33 | void *nlp_create(C2CONST *c2const);
34 | void nlp_destroy(void *nlp_state);
35 | float nlp(void *nlp_state, float Sn[], int n,
36 | float *pitch_samples, COMP Sw[], COMP W[], float *prev_f0);
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/octave.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: octave.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: April 28 2012
6 |
7 | Functions to save C arrays in Octave matrix format. the output text
8 | file can be directly read into octave using "load filename".
9 |
10 | \*---------------------------------------------------------------------------*/
11 |
12 |
13 | /*
14 | Copyright (C) 2012 David Rowe
15 |
16 | All rights reserved.
17 |
18 | This program is free software; you can redistribute it and/or modify
19 | it under the terms of the GNU Lesser General Public License version 2.1, as
20 | published by the Free Software Foundation. This program is
21 | distributed in the hope that it will be useful, but WITHOUT ANY
22 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
23 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
24 | License for more details.
25 |
26 | You should have received a copy of the GNU Lesser General Public License
27 | along with this program; if not, see .
28 | */
29 |
30 | #ifndef __OCTAVE__
31 | #define __OCTAVE__
32 |
33 | #include "comp.h"
34 |
35 | void octave_save_int(FILE *f, char name[], int data[], int rows, int cols);
36 | void octave_save_float(FILE *f, char name[], float data[], int rows, int cols, int col_len);
37 | void octave_save_complex(FILE *f, char name[], COMP data[], int rows, int cols, int col_len);
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/os.h:
--------------------------------------------------------------------------------
1 | /* Generate using fir1(47,1/2) in Octave */
2 |
3 | static const float fdmdv_os_filter[]= {
4 | -0.0008215855034550382,
5 | -0.0007833023901802921,
6 | 0.001075563790768233,
7 | 0.001199092367787555,
8 | -0.001765309502928316,
9 | -0.002055372115328064,
10 | 0.002986877604154257,
11 | 0.003462567920638414,
12 | -0.004856570111126334,
13 | -0.005563143845031497,
14 | 0.007533613299748122,
15 | 0.008563932468880897,
16 | -0.01126857129039911,
17 | -0.01280782411693687,
18 | 0.01651443896361847,
19 | 0.01894875110322284,
20 | -0.02421604439474981,
21 | -0.02845107338464062,
22 | 0.03672973563400258,
23 | 0.04542046150312214,
24 | -0.06189165826716491,
25 | -0.08721876380763803,
26 | 0.1496157094199961,
27 | 0.4497962274137046,
28 | 0.4497962274137046,
29 | 0.1496157094199961,
30 | -0.08721876380763803,
31 | -0.0618916582671649,
32 | 0.04542046150312216,
33 | 0.03672973563400257,
34 | -0.02845107338464062,
35 | -0.02421604439474984,
36 | 0.01894875110322284,
37 | 0.01651443896361848,
38 | -0.01280782411693687,
39 | -0.0112685712903991,
40 | 0.008563932468880899,
41 | 0.007533613299748123,
42 | -0.005563143845031501,
43 | -0.004856570111126346,
44 | 0.003462567920638419,
45 | 0.002986877604154259,
46 | -0.002055372115328063,
47 | -0.001765309502928318,
48 | 0.001199092367787557,
49 | 0.001075563790768233,
50 | -0.0007833023901802925,
51 | -0.0008215855034550383
52 | };
53 |
54 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/phase.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: phase.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 1/2/09
6 |
7 | Functions for modelling phase.
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2009 David Rowe
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | #ifndef __PHASE__
29 | #define __PHASE__
30 |
31 | #include "codec2_fft.h"
32 | #include "comp.h"
33 |
34 | void sample_phase(MODEL *model, COMP filter_phase[], COMP A[]);
35 | void phase_synth_zero_order(int n_samp, MODEL *model, float *ex_phase, COMP filter_phase[]);
36 |
37 | void mag_to_phase(float phase[], float Gdbfk[], int Nfft, codec2_fft_cfg fwd_cfg, codec2_fft_cfg inv_cfg);
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/phaseexp.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: phaseexp.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: June 2012
6 |
7 | Experimental functions for quantising, modelling and synthesising phase.
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2012 David Rowe
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | #ifndef __PHASEEXP__
29 | #define __PHASEEXP__
30 |
31 | #include "kiss_fft.h"
32 |
33 | struct PEXP;
34 |
35 | struct PEXP * phase_experiment_create();
36 | void phase_experiment_destroy(struct PEXP *pexp);
37 | void phase_experiment(struct PEXP *pexp, MODEL *model, char *arg);
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/pilot_coeff.h:
--------------------------------------------------------------------------------
1 | /* Generated by pilot_coeff_file() Octave function */
2 |
3 | // const removed since this provides gain
4 | // on the STM32F4 platform
5 |
6 | #ifdef CORTEX_M4
7 | /* const */ float pilot_coeff[]={
8 | #else
9 | const float pilot_coeff[]={
10 | #endif
11 | 0.00223001,
12 | 0.00301037,
13 | 0.00471258,
14 | 0.0075934,
15 | 0.0118145,
16 | 0.0174153,
17 | 0.0242969,
18 | 0.0322204,
19 | 0.0408199,
20 | 0.0496286,
21 | 0.0581172,
22 | 0.0657392,
23 | 0.0719806,
24 | 0.0764066,
25 | 0.0787022,
26 | 0.0787022,
27 | 0.0764066,
28 | 0.0719806,
29 | 0.0657392,
30 | 0.0581172,
31 | 0.0496286,
32 | 0.0408199,
33 | 0.0322204,
34 | 0.0242969,
35 | 0.0174153,
36 | 0.0118145,
37 | 0.0075934,
38 | 0.00471258,
39 | 0.00301037,
40 | 0.00223001
41 | };
42 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/pilots_coh.h:
--------------------------------------------------------------------------------
1 | /* Generated by write_pilot_file() Octave function */
2 |
3 | float pilots_coh[][PILOTS_NC]={
4 | { 1.000000, -1.000000, 1.000000, -1.000000, 1.000000, -1.000000, -1.000000},
5 | { -1.000000, 1.000000, 1.000000, -1.000000, 1.000000, 1.000000, 1.000000}
6 | };
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/postfilter.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: postfilter.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 13/09/09
6 |
7 | Postfilter header file.
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2009 David Rowe
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | #ifndef __POSTFILTER__
29 | #define __POSTFILTER__
30 |
31 | void postfilter(MODEL *model, float *bg_est);
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/rxdec_coeff.h:
--------------------------------------------------------------------------------
1 | /* Generated by rxdec_file() Octave function */
2 |
3 | const float rxdec_coeff[]={
4 | -0.00125472,
5 | -0.00204605,
6 | -0.0019897,
7 | 0.000163906,
8 | 0.00490937,
9 | 0.00986375,
10 | 0.0096718,
11 | -0.000480351,
12 | -0.019311,
13 | -0.0361822,
14 | -0.0341251,
15 | 0.000827866,
16 | 0.0690577,
17 | 0.152812,
18 | 0.222115,
19 | 0.249004,
20 | 0.222115,
21 | 0.152812,
22 | 0.0690577,
23 | 0.000827866,
24 | -0.0341251,
25 | -0.0361822,
26 | -0.019311,
27 | -0.000480351,
28 | 0.0096718,
29 | 0.00986375,
30 | 0.00490937,
31 | 0.000163906,
32 | -0.0019897,
33 | -0.00204605,
34 | -0.00125472
35 | };
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/src/sim.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # sim.sh
3 | # David Rowe 10 Sep 2009
4 |
5 | # Process a source file using the codec 2 simulation. An output
6 | # speech file is generated for each major processing step, from the
7 | # unquantised siusoidal model to fully quantised. This way we can
8 | # listen to the effect of each processing step. Use listensim.sh to
9 | # test the output files.
10 |
11 | ../src/c2sim ../raw/$1.raw -o $1_uq.raw
12 | ../src/c2sim ../raw/$1.raw --phase0 -o $1_phase0.raw --postfilter
13 | ../src/c2sim ../raw/$1.raw --lpc 10 -o $1_lpc10.raw --postfilter
14 | ../src/c2sim ../raw/$1.raw --phase0 --lpc 10 -o $1_phase0_lpc10.raw --postfilter
15 | ../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --dec -o $1_phase0_lpc10_dec.raw --postfilter
16 | ../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp --dec -o $1_phase0_lsp_dec.raw --postfilter
17 |
18 | #../src/c2sim ../raw/$1.raw --lpc 10 --lsp -o $1_lsp.raw
19 | #../src/c2sim ../raw/$1.raw --phase0 --lpc 10 -o $1_phase0_lpc10.raw --postfilter
20 | #../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp -o $1_phase0_lsp.raw --postfilter
21 | #../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp -o $1_phase0_lsp_dec.raw --postfilter --dec
22 |
23 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/cmake/arm_toolchain.cmake:
--------------------------------------------------------------------------------
1 | #INCLUDE(CMakeForceCompiler)
2 |
3 | SET(CMAKE_SYSTEM_NAME GNU)
4 | SET(CMAKE_SYSTEM_VERSION 1)
5 | SET(CMAKE_CROSSCOMPILING TRUE)
6 |
7 | # specify the cross compiler
8 | set(CMAKE_C_COMPILER arm-none-eabi-gcc)
9 | set(CMAKE_CXX_COMPILER arm-none-eabi-cpp)
10 |
11 | #SET(COMMON_FLAGS "-mcpu=cortex-m3 -mthumb -mthumb-interwork -msoft-float -ffunction-sections -fdata-sections -g -fno-common -fmessage-length=0")
12 | #SET(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=gnu++0x")
13 | #SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu99")
14 | #set(CMAKE_EXE_LINKER_FLAGS "-Wl,-gc-sections ")
15 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/inc/debugblinky.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: debugblinky.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 12 August 2014
6 |
7 | Configures Port E GPIO pins used for debug blinkies, and control lines
8 | for SM2000 +12V switching.
9 |
10 | \*---------------------------------------------------------------------------*/
11 |
12 | /*
13 | Copyright (C) 2014 David Rowe
14 |
15 | All rights reserved.
16 |
17 | This program is free software; you can redistribute it and/or modify
18 | it under the terms of the GNU Lesser General Public License version 2.1, as
19 | published by the Free Software Foundation. This program is
20 | distributed in the hope that it will be useful, but WITHOUT ANY
21 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
23 | License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public License
26 | along with this program; if not, see .
27 | */
28 |
29 | #ifndef __DEBUGBLINKY__
30 | #define __DEBUGBLINKY__
31 |
32 | void init_debug_blinky(void);
33 | void txrx_12V(int state);
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/inc/iir_duc.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: iir_duc.h
4 | AUTHOR......: Brady O'Brien
5 | DATE CREATED: 6 Mar 2015
6 |
7 | Interapolator/Filter for IF upconversion
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2015 Brady O'Brien
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | #ifndef __IIR_DUC_H
29 | #define __IIR_DUC_H
30 | #include "comp.h"
31 |
32 | void iir_upconv(float modin[],unsigned short dac_out[]);
33 | void iir_upconv_fixp(int modin[], unsigned short dac_out[]);
34 | void upconv_48c_80r(COMP comp_8[],int real_80[],int count);
35 | void upconv_8c_80r(COMP comp_8[],float real_80[],int count);
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/inc/iir_tuner.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: iir_tuner.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 20 Feb 2015
6 |
7 | Header file for IIR tuner function.
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2015 David Rowe
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | #ifndef __IIR_TUNER__
29 | #define __IIR_TUNER__
30 |
31 | #define IIR_TUNER_DEC_50_10_FILT_MEM 100
32 |
33 | void iir_tuner(float dec_50[], unsigned short adc_buf[]);
34 | void iir_tuner_dec_50_to_10(float dec_10[], float dec_50[], int n);
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/inc/sounds.h:
--------------------------------------------------------------------------------
1 | #ifndef _SOUNDS_H
2 | #define _SOUNDS_H
3 | /*!
4 | * Sound effect library.
5 | *
6 | * This provides some sound effects for the SM1000 UI.
7 | *
8 | * Author Stuart Longland
9 | * Copyright (C) 2015 FreeDV project.
10 | *
11 | * This program is free software; you can redistribute it and/or modify it
12 | * under the terms of the GNU Lesser General Public License version 2.1,
13 | * as published by the Free Software Foundation. This program is
14 | * distributed in the hope that it will be useful, but WITHOUT ANY
15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 | * for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public
20 | * License along with this program; if not, see
21 | * .
22 | */
23 |
24 | #include "sfx.h"
25 |
26 | /*! Start-up tune / selected tune */
27 | extern const struct sfx_note_t sound_startup[];
28 |
29 | /*! Returned tune */
30 | extern const struct sfx_note_t sound_returned[];
31 |
32 | /*! Click sound */
33 | extern const struct sfx_note_t sound_click[];
34 |
35 | /*! Death march tune */
36 | extern const struct sfx_note_t sound_death_march[];
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/inc/stm32f4_adc.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: stm32f4_adc.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 30 May 2014
6 |
7 | Two channel FIFO buffered ADC driver module for STM32F4.
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2014 David Rowe
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | #ifndef __STM32F4_ADC__
29 | #define __STM32F4_ADC__
30 |
31 | #define ADC_BUF_SZ 320
32 |
33 | /* divisors for various sample rates */
34 |
35 | #define ADC_FS_8KHZ 10500
36 | #define ADC_FS_16KHZ 5250
37 | #define ADC_FS_48KHZ 1750
38 | #define ADC_FS_96KHZ 875
39 |
40 | void adc_open(int fs_divisor, int fifo_sz);
41 | int adc1_read(short buf[], int n); /* ADC1 Pin PA1 */
42 | int adc2_read(short buf[], int n); /* ADC2 Pin PA2 */
43 | int adc1_samps();
44 | int adc2_samps();
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/inc/stm32f4_dac.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: stm32f4_dac.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 1 June 2013
6 |
7 | Two channel FIFO buffered DAC driver module for STM32F4.
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2013 David Rowe
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | #ifndef __STM32F4_DAC__
29 | #define __STM32F4_DAC__
30 |
31 | #define DAC_BUF_SZ 320
32 |
33 | /* divisors for various sample rates */
34 |
35 | #define DAC_FS_8KHZ 10500
36 | #define DAC_FS_16KHZ 5250
37 | #define DAC_FS_48KHZ 1750
38 | #define DAC_FS_96KHZ 875
39 |
40 | void dac_open(int fs_divisor, int fifo_sz);
41 | int dac1_write(short buf[], int n); /* DAC1 pin PA4 */
42 | int dac1_free();
43 | int dac2_write(short buf[], int n); /* DAC2 pin PA5 */
44 | int dac2_free();
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/inc/stm32f4_dacduc.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: stm32f4_dac.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 1 June 2013
6 |
7 | Two channel FIFO buffered DAC driver module for STM32F4. DAC1 is fixed at
8 | Fs=2Mhz
9 |
10 | \*---------------------------------------------------------------------------*/
11 |
12 | /*
13 | Copyright (C) 2013 David Rowe
14 |
15 | All rights reserved.
16 |
17 | This program is free software; you can redistribute it and/or modify
18 | it under the terms of the GNU Lesser General Public License version 2.1, as
19 | published by the Free Software Foundation. This program is
20 | distributed in the hope that it will be useful, but WITHOUT ANY
21 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
23 | License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public License
26 | along with this program; if not, see .
27 | */
28 |
29 | #ifndef __STM32F4_DAC__
30 | #define __STM32F4_DAC__
31 |
32 | #define DUC_N 160
33 | #define DUC_M 25
34 | #define DUC_48N 96 //This is 3/5th DUC_N
35 | #define DAC_DUC_BUF_SZ DUC_M*DUC_N
36 | #define DAC_BUF_SZ 2048
37 |
38 | void fast_dac_open(int dac1_fifo_size,int dac2_fifo_size);
39 | int dac1_write(short buf[], int n); /* DAC1 pin PA4 */
40 | int dac2_write(short buf[], int n); /* DAC2 pin PA5 */
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/inc/stm32f4_usb_vcp.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: stm32f4_usb_vcp.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 4 Sep 2014
6 |
7 | USB Virtual COM Port (VCP) module.
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | #ifndef __STM32F4_USB_VCP__
12 | #define __STM32F4_USB_VCP__
13 |
14 | #include
15 |
16 | void usb_vcp_init(void);
17 |
18 | int VCP_get_char(uint8_t *buf);
19 | int VCP_get_string(uint8_t *buf);
20 | void VCP_put_char(uint8_t buf);
21 | void VCP_send_str(uint8_t* buf);
22 | void VCP_send_buffer(uint8_t* buf, int len);
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/src/dac_ut_fast.c:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: dac_ut_fast.c
4 | AUTHOR......: David Rowe
5 | DATE CREATED: Sep 2015
6 |
7 | Plays a Fs/4 sine wave sampled out of PA5 on a Discovery board, used for
8 | testing high speed DAC operation, e.g. for IF/RF generation.
9 |
10 | \*---------------------------------------------------------------------------*/
11 |
12 | /*
13 | Copyright (C) 2015 David Rowe
14 |
15 | All rights reserved.
16 |
17 | This program is free software; you can redistribute it and/or modify
18 | it under the terms of the GNU Lesser General Public License version 2.1, as
19 | published by the Free Software Foundation. This program is
20 | distributed in the hope that it will be useful, but WITHOUT ANY
21 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
23 | License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public License
26 | along with this program; if not, see .
27 | */
28 |
29 | #include
30 | #include "stm32f4_dac.h"
31 |
32 |
33 | int main(void) {
34 | dac_open(4*DAC_BUF_SZ);
35 | while (1);
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/src/init.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Dummy function to avoid compiler error
3 | */
4 | void _init() {
5 |
6 | }
7 | void _fini() {
8 |
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/src/mco_ut.c:
--------------------------------------------------------------------------------
1 | /*
2 | mco_ut.c
3 |
4 | Slightly modified version of :
5 | http://stm32f4-discovery.net/2014/10/library-40-output-clocks-stm32f4/
6 |
7 | Outputs the HSI oscillator on MCO1, pin PA8, which is SCL3 on the SM2000, can
8 | be probed around R124. Used to track down a USB boot loader bug, suspect the
9 | HSI on this particular STM32F407 is out so the boot loader is failing on USB
10 | discovery/enumeration and forcing a reset.
11 | */
12 |
13 | /* Include core modules */
14 | #include "stm32f4xx.h"
15 | /* Include my libraries here */
16 | #include "defines.h"
17 | #include "tm_stm32f4_mco_output.h"
18 |
19 | int main(void) {
20 | /* Initialize system */
21 | SystemInit();
22 |
23 | /* Initialize MCO1 output, pin PA8 */
24 | TM_MCOOUTPUT_InitMCO1();
25 |
26 | /* Initialize MCO2 output, pin PC9 */
27 | TM_MCOOUTPUT_InitMCO2();
28 |
29 | /* Set MCO1 output = HSI with prescaler 2 = 16MHz / 2 = 8MHz*/
30 | TM_MCOOUTPUT_SetOutput1(TM_MCOOUTPUT1_Source_HSI, TM_MCOOUTPUT_Prescaler_2);
31 |
32 | /* Set MCO2 output = SYSCLK / 4 */
33 | TM_MCOOUTPUT_SetOutput2(TM_MCOOUTPUT2_Source_SYSCLK, TM_MCOOUTPUT_Prescaler_4);
34 |
35 | while (1) {
36 |
37 | }
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/src/sm1000_leds_switches_ut.c:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: sm1000_leds_switches_ut.c
4 | AUTHOR......: David Rowe
5 | DATE CREATED: August 5 2014
6 |
7 | Unit Test program for the SM1000 switches and LEDs driver.
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2014 David Rowe
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | #include
29 | #include "sm1000_leds_switches.h"
30 |
31 | int main(void) {
32 | sm1000_leds_switches_init();
33 |
34 | while(1) {
35 | led_pwr(switch_select());
36 | led_ptt(switch_ptt());
37 | led_rt(switch_back());
38 | led_err(!switch_back());
39 | }
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/stm32/stlink/elfsym.h:
--------------------------------------------------------------------------------
1 | /*
2 | elfsym.h
3 |
4 | Read symbol adresses from a .elf file.
5 | */
6 |
7 | #ifndef __ELFSYM__
8 | #define __ELFSYM__
9 |
10 | int elfsym_open(char file[]);
11 | void elfsym_close(int fd);
12 | unsigned int elfsym_get_symbol_address(int fd, char symbol_name[]);
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/unittest/README:
--------------------------------------------------------------------------------
1 | README
2 | for codec2/unittest
3 | Created David Rowe 31 July 2012
4 |
5 | Training (experimental) sparse phase VQs:
6 |
7 | 1/ In ../src/phase.c phase_experiment() enable:
8 |
9 | print_sparse_pred_error()
10 |
11 | and 'make' c2sim (in src)
12 |
13 | 2/ Run over a training database:
14 |
15 | $ ./c2sim /xhome1/codec2/samples/train.spc --phaseexp > train_phtrain.txt
16 |
17 | a) check stats in Octave:
18 | octave> load ../src/train_phtrain.txt
19 | octave> std(nonzeros(train_phtrain(:,1:20)))
20 | octave> hist(nonzeros(train_phtrain(:,1:20)),20)
21 | 3/ Extract and convert to floats vector you wish to train for example
22 | first 20 (out of MAX_AMP == 80):
23 |
24 | $ ./extract ../src/train_phtrain.txt train_phtrain.flt 1 20
25 |
26 | 4/ Convert to rectangular:
27 |
28 | $ ./polar2rect train_phtrain.flt train_phtrainr.flt
29 |
30 | 5/ Run this program:
31 |
32 | $ ./vqtrainph train_phtrainr.flt 20 1024 vq.txt
33 |
34 | Ouput is vq.txt
35 |
36 | Tests
37 | -----
38 |
39 | + build up insmallest possible stesp
40 | + impl errors v alg errors
41 | + use actual phase data as codebook
42 | + test vq with rand phases first or known data
43 |
44 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/unittest/c2validate.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: c2validate.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 10 April 2013
6 |
7 | Encodes and decodes an array of speech samples using Codec 2 and compares
8 | it to a previously stored output to validate Codec operation.
9 |
10 | \*---------------------------------------------------------------------------*/
11 |
12 | /*
13 | Copyright (C) 2013 David Rowe
14 |
15 | All rights reserved.
16 |
17 | This program is free software; you can redistribute it and/or modify
18 | it under the terms of the GNU Lesser General Public License version 2.1, as
19 | published by the Free Software Foundation. This program is
20 | distributed in the hope that it will be useful, but WITHOUT ANY
21 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
23 | License for more details.
24 |
25 | You should have received a copy of the GNU Lesser General Public License
26 | along with this program; if not, see .
27 | */
28 |
29 | #ifndef __C2VALIDATE__
30 |
31 | int c2validate(int mode, short input_samples[], short output_samples[], char outfile[], int nsamples);
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/unittest/create_interleaver.c:
--------------------------------------------------------------------------------
1 | /*
2 | create_interleaver.c
3 | David Rowe
4 | May 27 2012
5 |
6 | Creates an interleaver for Codec 2.
7 | */
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | int main(int argc, char * argv[]) {
14 | int m,i, src_bit, dest_bit;
15 | FILE *f;
16 | int *interleaver;
17 |
18 | if (argc != 3) {
19 | printf("usage: %s InterleaverBits InterleaverFile\n", argv[0]);
20 | exit(1);
21 | }
22 |
23 | m = atoi(argv[1]);
24 | f = fopen(argv[2],"wt");
25 | assert(f != NULL);
26 |
27 |
28 | interleaver = (int*)malloc(m*sizeof(int));
29 | assert(interleaver != NULL);
30 | for(i=0; i
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include "lpc.h"
16 |
17 | #define N 80
18 |
19 | int main(int argc, char *argv[]) {
20 | FILE *fin, *fout;
21 | short buf[N];
22 | float Sn[N], Sn_de[N];
23 | float de_mem = 0.0;
24 | int i;
25 |
26 | if (argc != 3) {
27 | printf("usage: de InputRawSpeechFile OutputRawSpeechFile\n");
28 | printf("e.g de input.raw output.raw");
29 | exit(1);
30 | }
31 |
32 | if (strcmp(argv[1], "-") == 0) fin = stdin;
33 | else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
34 | fprintf(stderr, "Error opening input speech file: %s: %s.\n",
35 | argv[1], strerror(errno));
36 | exit(1);
37 | }
38 |
39 | if (strcmp(argv[2], "-") == 0) fout = stdout;
40 | else if ( (fout = fopen(argv[2],"wb")) == NULL ) {
41 | fprintf(stderr, "Error opening output speech file: %s: %s.\n",
42 | argv[2], strerror(errno));
43 | exit(1);
44 | }
45 |
46 | while(fread(buf, sizeof(short), N, fin) == N) {
47 | for(i=0; i
10 | #include
11 | #include
12 | #include
13 |
14 | #define TWO_PI 6.283185307
15 | #define FS 8000.0
16 | #define AMP 10000.0
17 |
18 | int main(int argc, char *argv[]) {
19 | FILE *f;
20 | int i,n;
21 | float freq, length;
22 | short *buf;
23 |
24 | if (argc != 4) {
25 | printf("usage: %s outputFile frequencyHz lengthSecs\n", argv[0]);
26 | exit(1);
27 | }
28 |
29 | f = fopen(argv[1] ,"wb");
30 | freq = atof(argv[2]);
31 | length = atof(argv[3]);
32 | n = length*FS;
33 | buf = (short*)malloc(sizeof(short)*n);
34 | assert(buf != NULL);
35 |
36 | for(i=0; i
10 | #include
11 | #include
12 | #include
13 |
14 | typedef struct {
15 | float real;
16 | float imag;
17 | } COMP;
18 |
19 | int main(int argc, char *argv[]) {
20 | FILE *fpolar;
21 | FILE *frect;
22 | float polar;
23 | COMP rect;
24 |
25 | if (argc != 3) {
26 | printf("usage: %s polarFile rectFile\n", argv[0]);
27 | exit(0);
28 | }
29 |
30 | fpolar = fopen(argv[1], "rb");
31 | assert(fpolar != NULL);
32 | frect = fopen(argv[2], "wb");
33 | assert(frect != NULL);
34 |
35 | while (fread(&polar, sizeof(float), 1, fpolar) != 0) {
36 | if (polar == 0.0) {
37 | /* this values indicates the VQ training should ignore
38 | this vector element. It's not a valid phase as it
39 | doesn't have mangitude of 1.0 */
40 | rect.real = 0.0;
41 | rect.imag = 0.0;
42 | }
43 | else {
44 | rect.real = cos(polar);
45 | rect.imag = sin(polar);
46 | }
47 | fwrite(&rect, sizeof(COMP), 1, frect);
48 | }
49 |
50 | fclose(fpolar);
51 | fclose(frect);
52 |
53 | return 0;
54 | }
55 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/unittest/pre.c:
--------------------------------------------------------------------------------
1 | /*
2 | pre.c
3 | David Rowe
4 | Sep 26 2012
5 |
6 | Takes audio from a file, pre-emphasises, and sends to output file.
7 | */
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include "lpc.h"
16 |
17 | #define N 80
18 |
19 | int main(int argc, char*argv[]) {
20 | FILE *fin, *fout;
21 | short buf[N];
22 | float Sn[N], Sn_pre[N];
23 | float pre_mem = 0.0;
24 | int i;
25 |
26 | if (argc != 3) {
27 | printf("usage: pre InputRawSpeechFile OutputRawSpeechFile\n");
28 | printf("e.g pre input.raw output.raw");
29 | exit(1);
30 | }
31 |
32 | if (strcmp(argv[1], "-") == 0) fin = stdin;
33 | else if ( (fin = fopen(argv[1],"rb")) == NULL ) {
34 | fprintf(stderr, "Error opening input speech file: %s: %s.\n",
35 | argv[1], strerror(errno));
36 | exit(1);
37 | }
38 |
39 | if (strcmp(argv[2], "-") == 0) fout = stdout;
40 | else if ( (fout = fopen(argv[2],"wb")) == NULL ) {
41 | fprintf(stderr, "Error opening output speech file: %s: %s.\n",
42 | argv[2], strerror(errno));
43 | exit(1);
44 | }
45 |
46 | while(fread(buf, sizeof(short), N, fin) == N) {
47 | for(i=0; i
11 | #include
12 | #include
13 | #include
14 |
15 | int main(int argc, char *argv[]) {
16 | FILE *fraw, *fheader;
17 | int i, samples, ret;
18 | short sam;
19 |
20 | if (argc != 5) {
21 | printf("usage: %s inputRawFile outputHeaderFile arrayName samples\n", argv[0]);
22 | exit(1);
23 | }
24 |
25 | fraw = fopen(argv[1] ,"rb");
26 | assert(fraw != NULL);
27 | fheader = fopen(argv[2],"wt");
28 | assert(fheader != NULL);
29 | samples = atoi(argv[4]);
30 |
31 | fprintf(fheader, "short %s[] = {\n", argv[3]);
32 | for(i=0; i.
26 | */
27 |
28 | #ifndef __SD__
29 | #define __SD__
30 |
31 | float spectral_dist(float ak1[], float ak2[], int p, int n);
32 |
33 | #endif /* __SD__ */
34 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/unittest/t_helpers.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | #include "t_helpers.h"
7 |
8 | void test(char * tfn)
9 | {
10 | fn = tfn;
11 | printf("========================================\n");
12 | printf("test function: %s\n", fn);
13 | printf("========================================\n");
14 | }
15 |
16 | void test_failed()
17 | {
18 | printf("Failed to calculate %s.\n", fn);
19 | exit(1);
20 | }
21 |
22 | void test_failed_s(char * expected, char * res)
23 | {
24 |
25 | printf("Failed to calculate %s.\n", fn);
26 |
27 | printf("expected: %s\ngot: %s\n", expected, res);
28 | exit(1);
29 | }
30 |
31 | void test_failed_f(float expected, float res)
32 | {
33 |
34 | printf("Failed to calculate %s.\n", fn);
35 | printf("expected: %f\ngot: %f\n", expected, res);
36 | exit(1);
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/unittest/t_helpers.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: t_helpers.c
4 | AUTHOR......: Phil Ayres
5 | DATE CREATED: July 2017
6 |
7 | * Simple helper functions for unit tests
8 | *
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright David Rowe 2017
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 |
27 | */
28 |
29 | #ifndef T_HELPERS_H
30 | #define T_HELPERS_H
31 |
32 | void test(char * tfn);
33 | void test_failed();
34 | void test_failed_s(char * expected, char * res);
35 | void test_failed_f(float expected, float res);
36 |
37 | char *fn;
38 |
39 |
40 | #endif /* T_HELPERS_H */
41 |
42 |
--------------------------------------------------------------------------------
/libcodec2-android/src/codec2/unittest/tprede.c:
--------------------------------------------------------------------------------
1 | /*
2 | tpre_de.c
3 | David Rowe
4 | Sep 24 2012
5 |
6 | Unit test to generate the combined impulse response of pre & de-emphasis filters.
7 |
8 | pl("../unittest/out48.raw",1,3000)
9 | pl("../unittest/out8.raw",1,3000)
10 |
11 | Listening to it also shows up anything nasty:
12 |
13 | $ play -s -2 -r 48000 out48.raw
14 | $ play -s -2 -r 8000 out8.raw
15 |
16 | */
17 |
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include "lpc.h"
23 |
24 | #define N 10
25 | #define F 10
26 |
27 | int main() {
28 | FILE *fprede;
29 | float Sn[N], Sn_pre[N], Sn_de[N];
30 | float pre_mem = 0.0, de_mem = 0.0;
31 | int i, f;
32 |
33 | fprede = fopen("prede.txt", "wt");
34 | assert(fprede != NULL);
35 |
36 | for(i=0; i
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/libcodec2-android/src/main/cpp/codec2/codec2/version.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: version.h
4 | AUTHOR......: Tomas Härdin
5 | DATE CREATED: 03 November 2017
6 |
7 | Codec 2 VERSION #defines
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2017 Tomas Härdin
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | //this functions both as an include guard and your typical HAVE macro
29 | #ifndef CODEC2_HAVE_VERSION
30 | #define CODEC2_HAVE_VERSION
31 |
32 | #define CODEC2_VERSION_MAJOR 0
33 | #define CODEC2_VERSION_MINOR 8
34 | /* #undef CODEC2_VERSION_PATCH */
35 | #define CODEC2_VERSION "0.8"
36 |
37 | #endif //CODEC2_HAVE_VERSION
38 |
--------------------------------------------------------------------------------
/libcodec2-android/src/main/cpp/codec2/comp.h:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------*\
2 |
3 | FILE........: comp.h
4 | AUTHOR......: David Rowe
5 | DATE CREATED: 24/08/09
6 |
7 | Complex number definition.
8 |
9 | \*---------------------------------------------------------------------------*/
10 |
11 | /*
12 | Copyright (C) 2009 David Rowe
13 |
14 | All rights reserved.
15 |
16 | This program is free software; you can redistribute it and/or modify
17 | it under the terms of the GNU Lesser General Public License version 2.1, as
18 | published by the Free Software Foundation. This program is
19 | distributed in the hope that it will be useful, but WITHOUT ANY
20 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22 | License for more details.
23 |
24 | You should have received a copy of the GNU Lesser General Public License
25 | along with this program; if not, see .
26 | */
27 |
28 | #ifndef __COMP__
29 | #define __COMP__
30 |
31 | /* Complex number */
32 |
33 | typedef struct {
34 | float real;
35 | float imag;
36 | } COMP;
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UstadMobile/Codec2-Android/be98848a6536432ba56ee89ae2044443553ed2c8/libcodec2-android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Codec2
3 |
4 |
--------------------------------------------------------------------------------
/libcodec2-android/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/libcodec2-android/src/test/java/com/ustadmobile/codec2/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.ustadmobile.codec2;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertEquals;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':libcodec2-android', ':appcodec2demo'
2 |
--------------------------------------------------------------------------------