├── documentation ├── source │ ├── MATAA_manual.ky │ ├── MATAA_manual.pg │ ├── MATAA_manual.tp │ ├── MATAA_manual.vr │ ├── octave-core │ ├── MATAA_manual.log │ ├── figures │ │ ├── Jack.pdf │ │ ├── Jack.png │ │ ├── Acr45613530.tmp │ │ ├── measurement_setup.pdf │ │ ├── measurement_setup.png │ │ ├── ref_signal_paths.pdf │ │ ├── ref_signal_paths.png │ │ ├── measurement_impedance.pdf │ │ ├── measurement_impedance.png │ │ ├── measurement_setup_old.pdf │ │ ├── mac_os_x_audio_settings.pdf │ │ ├── mac_os_x_audio_settings.png │ │ ├── measurement_impedance_R.pdf │ │ ├── measurement_impedance_R.png │ │ ├── measurement_impedance_noisy.pdf │ │ ├── measurement_impedance_noisy.png │ │ ├── measurement_setup_impedance.pdf │ │ └── measurement_setup_impedance.png │ ├── MATAA_manual_MatOctPrimer.texi │ ├── MATAA_manual_installation.texi │ ├── MATAA_manual_reference.texi │ ├── MATAA_manual_math.texi │ ├── make_documentation.sh │ ├── MATAA_manual_calibration.texi │ ├── MATAA_manual_working.texi │ ├── MATAA_manual.cps │ └── make_tools_help_list.m ├── MATAA_manual.pdf ├── MATAA_aX_original.pdf └── MATAA_aX_readable.pdf ├── TestTone ├── MAC │ ├── TestTonePA19 │ └── TestDevicesPA19 ├── LINUX_PPC │ ├── TestTonePA19 │ └── TestDevicesPA19 ├── PCWIN │ ├── TestTonePA19.exe │ ├── portaudio_x86.dll │ ├── portaudio_x86.lib │ └── TestDevicesPA19.exe ├── LINUX_X86-32 │ ├── TestTonePA19 │ └── TestDevicesPA19 ├── LINUX_X86-64 │ ├── TestTonePA19 │ └── TestDevicesPA19 ├── LINUX_ARM_GNUEABIHF │ ├── TestTonePA19 │ └── TestDevicesPA19 ├── stuff │ ├── XCode │ │ ├── TestTone │ │ │ └── libportaudio.a │ │ └── TestDevices │ │ │ └── libportaudio.a │ └── PC_Win │ │ ├── TestTone_and_TestDevices_from_Shu_Sang.zip │ │ └── TestTonePA19.exe_multichannelFromMortenLaursen.zip └── source │ └── CMakeLists.txt ├── calibration ├── extras │ ├── MB_ACOUSTIC_CHAIN_FLATMIC.txt │ ├── RTX6001_ELECTRONIC-DIRECT_CHAIN_1V-OUT-SE_1V-IN.txt │ ├── RTX6001_ELECTRONIC-DIRECT_CHAIN_10V-OUT-SE_10V-IN.txt │ ├── RTX6001_ELECTRONIC-DIRECT_CHAIN_1V-OUT-BAL_1V-IN.txt │ ├── RTX6001_ELECTRONIC-DIRECT_CHAIN_10V-OUT-BAL_10V-IN.txt │ ├── RTX6001_ELECTRONIC-DIRECT_CHAIN_10V-OUT-SE_3.16V-IN.txt │ ├── RTX6001_ELECTRONIC-DIRECT_CHAIN_1V-OUT-BAL_3.16V-IN.txt │ ├── RTX6001_ELECTRONIC-DIRECT_CHAIN_1V-OUT-SE_3.16V-IN.txt │ ├── RTX6001_ELECTRONIC-DIRECT_CHAIN_10V-OUT-BAL_3.16V-IN.txt │ ├── MB_RTX_AUTOSCALING_LEFT.txt │ ├── MB_RTX_AUTOSCALING_RIGHT.txt │ ├── RTX6001_INPUT_100mV.txt │ ├── RTX6001_OUTPUT_10V_SE.txt │ ├── RTX6001_OUTPUT_1V_SE.txt │ ├── RTX6001_OUTPUT_10V_BALANCED.txt │ ├── RTX6001_OUTPUT_1V_BALANCED.txt │ ├── RTX6001_OUTPUT_100mV_SE.txt │ ├── RTX6001_OUTPUT_100mV_BALANCED.txt │ ├── RTX6001_INPUT_1V.txt │ ├── RTX6001_INPUT_10V.txt │ ├── RTX6001_INPUT_100V.txt │ ├── RTX6001_INPUT_3.16V.txt │ ├── RTX6001_INPUT_31.6V.txt │ └── RTX6001_INPUT_316mV.txt ├── MB_ACOUSTIC_CHAIN_REF.txt ├── MB_ELECTRONIC_CHAIN_SEout.txt ├── MB_ELECTRONIC_CHAIN_BALout.txt ├── LOOPBACK_SENSOR.txt ├── GENERIC_ADC.txt ├── GENERIC_DAC.txt ├── GENERIC_CHAIN_ACOUSTIC.txt ├── GENERIC_CHAIN_DIRECT.txt ├── FLAT_SOUNDCARD.txt ├── MB_ACOUSTIC_CHAIN_DUT.txt ├── FLAT_MICROPHONE.txt ├── BEHRINGER_UMC202HD_HEADPHONEOUT_DAC.txt ├── RTX6001_INPUT_AUTOSCALING_LEFT.txt ├── RTX6001_INPUT_AUTOSCALING_RIGHT.txt ├── GENERIC_EXAMPLE_MICROPHONE.txt ├── BEHRINGER_UMC202HD_LINEOUT_DAC.txt ├── RTX6001_OUTPUT_AUTOSCALING_SE_LEFT.txt ├── RTX6001_OUTPUT_AUTOSCALING_BALANCED_LEFT.txt ├── RTX6001_OUTPUT_AUTOSCALING_SE_RIGHT.txt ├── RTX6001_OUTPUT_AUTOSCALING_BALANCED_RIGHT.txt ├── BEHRINGER_UMC202HD_LINEIN_ADC.txt ├── BEHRINGER_UMC202HD_MICIN_ADC.txt ├── BEYERDYNAMIC_MM1_14308_MICROPHONE_CSLABS.txt ├── RTX6001_MATAA_integration_notes.txt ├── ISEMCON_EMX7150_2391606-270916_MICROPHONE.txt ├── EARTHWORKS_M23_2298J_MICROPHONE.txt ├── RTX6001_USB_STATUS ├── RTX6001_AUTOSCALINGFUNCTION_DAC_SE.m ├── RTX6001_AUTOSCALINGFUNCTION_DAC_BALANCED.m ├── BEYERDYNAMIC_MM1_14308_MICROPHONE_BEYERFACTORY.txt ├── BEHRINGER_ECM8000_D1303397118_MICROPHONE.txt └── RTX6001_AUTOSCALINGFUNCTION_ADC.m ├── linux_pulseaudio └── README.txt ├── README.txt ├── mataa_tools ├── mataa_tempfile.m ├── mataa_t_to_f.m ├── mataa_realFT.m ├── mataa_realIFT.m ├── mataa_plot_two_logX.m ├── mataa_IR_to_SR.m ├── mataa_phase_remove_delay.m ├── mataa_IR_remove_echo.m ├── mataa_signal_analytic.m ├── mataa_f_to_t.m ├── mataa_signal_crop.m ├── mataa_signal_autocorr.m ├── mataa_IR_to_ETC.m ├── mataa_plot_IR.m ├── mataa_plot_SR.m ├── mataa_plot_save.m ├── mataa_audio_playrec_list_devices.m ├── mataa_signal_pad_Zeros.m ├── mataa_signal_removeHF.m ├── mataa_octave_version.m ├── mataa_plot_ETC_lin.m ├── mataa_convolve.m ├── mataa_plot_ETC_dB.m ├── mataa_plot_impedance.m ├── mataa_plot_one.m ├── mataa_hilbert.m ├── mataa_t_to_f0.m ├── mataa_file_default_name.m ├── mataa_minimum_phase.m ├── mataa_deConvolve.m ├── mataa_import_AIFF.m ├── mataa_plot_defaults.m ├── mataa_plot_time_signal.m ├── mataa_select_signal_window_time.m ├── mataa_cal_autoscale.m ├── mataa_speaker_TSP_addmass.m ├── mataa_realIFT0.m ├── mataa_audio_guess_latency.m ├── mataa_interp.m ├── mataa_realFT0.m ├── mataa_import_FRD.m ├── mataa_plot_two.m ├── mataa_signal_save.m ├── mataa_gnuplot.m ├── mataa_running_mean.m ├── mataa_plot_HD.m ├── mataa_menu.m ├── mataa_export_TMD.m ├── mataa_phase_remove_trend.m ├── mataa_IR_to_CSD.m ├── mataa_import_TMD.m ├── mataa_FR_smooth.m ├── mataa_impedance_speaker_model_WRIGHT.m ├── mataa_smooth_log.m ├── mataa_signal_clipcheck.m ├── mataa_signal_spectrogram.m ├── mataa_plot_FR.m ├── mataa_computer.m └── mataa_impedance_speaker_model_LR2.m └── mataa_scripts ├── mataa_demo_loudspeaker.m └── mataa_impedance_measure.m /documentation/source/MATAA_manual.ky: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /documentation/source/MATAA_manual.pg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /documentation/source/MATAA_manual.tp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /documentation/source/MATAA_manual.vr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /TestTone/MAC/TestTonePA19: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/MAC/TestTonePA19 -------------------------------------------------------------------------------- /TestTone/MAC/TestDevicesPA19: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/MAC/TestDevicesPA19 -------------------------------------------------------------------------------- /documentation/MATAA_manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/MATAA_manual.pdf -------------------------------------------------------------------------------- /TestTone/LINUX_PPC/TestTonePA19: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/LINUX_PPC/TestTonePA19 -------------------------------------------------------------------------------- /TestTone/PCWIN/TestTonePA19.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/PCWIN/TestTonePA19.exe -------------------------------------------------------------------------------- /TestTone/PCWIN/portaudio_x86.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/PCWIN/portaudio_x86.dll -------------------------------------------------------------------------------- /TestTone/PCWIN/portaudio_x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/PCWIN/portaudio_x86.lib -------------------------------------------------------------------------------- /documentation/source/octave-core: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/octave-core -------------------------------------------------------------------------------- /TestTone/LINUX_PPC/TestDevicesPA19: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/LINUX_PPC/TestDevicesPA19 -------------------------------------------------------------------------------- /TestTone/LINUX_X86-32/TestTonePA19: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/LINUX_X86-32/TestTonePA19 -------------------------------------------------------------------------------- /TestTone/LINUX_X86-64/TestTonePA19: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/LINUX_X86-64/TestTonePA19 -------------------------------------------------------------------------------- /TestTone/PCWIN/TestDevicesPA19.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/PCWIN/TestDevicesPA19.exe -------------------------------------------------------------------------------- /documentation/MATAA_aX_original.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/MATAA_aX_original.pdf -------------------------------------------------------------------------------- /documentation/MATAA_aX_readable.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/MATAA_aX_readable.pdf -------------------------------------------------------------------------------- /TestTone/LINUX_X86-32/TestDevicesPA19: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/LINUX_X86-32/TestDevicesPA19 -------------------------------------------------------------------------------- /TestTone/LINUX_X86-64/TestDevicesPA19: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/LINUX_X86-64/TestDevicesPA19 -------------------------------------------------------------------------------- /documentation/source/MATAA_manual.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/MATAA_manual.log -------------------------------------------------------------------------------- /documentation/source/figures/Jack.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/Jack.pdf -------------------------------------------------------------------------------- /documentation/source/figures/Jack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/Jack.png -------------------------------------------------------------------------------- /TestTone/LINUX_ARM_GNUEABIHF/TestTonePA19: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/LINUX_ARM_GNUEABIHF/TestTonePA19 -------------------------------------------------------------------------------- /TestTone/LINUX_ARM_GNUEABIHF/TestDevicesPA19: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/LINUX_ARM_GNUEABIHF/TestDevicesPA19 -------------------------------------------------------------------------------- /TestTone/stuff/XCode/TestTone/libportaudio.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/stuff/XCode/TestTone/libportaudio.a -------------------------------------------------------------------------------- /documentation/source/figures/Acr45613530.tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/Acr45613530.tmp -------------------------------------------------------------------------------- /TestTone/stuff/XCode/TestDevices/libportaudio.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/stuff/XCode/TestDevices/libportaudio.a -------------------------------------------------------------------------------- /documentation/source/figures/measurement_setup.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/measurement_setup.pdf -------------------------------------------------------------------------------- /documentation/source/figures/measurement_setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/measurement_setup.png -------------------------------------------------------------------------------- /documentation/source/figures/ref_signal_paths.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/ref_signal_paths.pdf -------------------------------------------------------------------------------- /documentation/source/figures/ref_signal_paths.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/ref_signal_paths.png -------------------------------------------------------------------------------- /documentation/source/MATAA_manual_MatOctPrimer.texi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/MATAA_manual_MatOctPrimer.texi -------------------------------------------------------------------------------- /documentation/source/MATAA_manual_installation.texi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/MATAA_manual_installation.texi -------------------------------------------------------------------------------- /documentation/source/figures/measurement_impedance.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/measurement_impedance.pdf -------------------------------------------------------------------------------- /documentation/source/figures/measurement_impedance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/measurement_impedance.png -------------------------------------------------------------------------------- /documentation/source/figures/measurement_setup_old.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/measurement_setup_old.pdf -------------------------------------------------------------------------------- /documentation/source/figures/mac_os_x_audio_settings.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/mac_os_x_audio_settings.pdf -------------------------------------------------------------------------------- /documentation/source/figures/mac_os_x_audio_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/mac_os_x_audio_settings.png -------------------------------------------------------------------------------- /documentation/source/figures/measurement_impedance_R.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/measurement_impedance_R.pdf -------------------------------------------------------------------------------- /documentation/source/figures/measurement_impedance_R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/measurement_impedance_R.png -------------------------------------------------------------------------------- /documentation/source/figures/measurement_impedance_noisy.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/measurement_impedance_noisy.pdf -------------------------------------------------------------------------------- /documentation/source/figures/measurement_impedance_noisy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/measurement_impedance_noisy.png -------------------------------------------------------------------------------- /documentation/source/figures/measurement_setup_impedance.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/measurement_setup_impedance.pdf -------------------------------------------------------------------------------- /documentation/source/figures/measurement_setup_impedance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/documentation/source/figures/measurement_setup_impedance.png -------------------------------------------------------------------------------- /TestTone/stuff/PC_Win/TestTone_and_TestDevices_from_Shu_Sang.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/stuff/PC_Win/TestTone_and_TestDevices_from_Shu_Sang.zip -------------------------------------------------------------------------------- /calibration/extras/MB_ACOUSTIC_CHAIN_FLATMIC.txt: -------------------------------------------------------------------------------- 1 | type = chain % complete chain of DAC, SENSOR, and ADC FILE = RTX6001_OUTPUT_1V_BNC.txt FILE = FLAT_MICROPHONE.txt FILE = RTX6001_INPUT_100mV.txt -------------------------------------------------------------------------------- /TestTone/stuff/PC_Win/TestTonePA19.exe_multichannelFromMortenLaursen.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Strategy/mataa/master/TestTone/stuff/PC_Win/TestTonePA19.exe_multichannelFromMortenLaursen.zip -------------------------------------------------------------------------------- /calibration/MB_ACOUSTIC_CHAIN_REF.txt: -------------------------------------------------------------------------------- 1 | type = chain % complete chain of DAC, SENSOR, and ADC FILE = RTX6001_OUTPUT_AUTOSCALING_SE_RIGHT.txt FILE = LOOPBACK_SENSOR.txt FILE = RTX6001_INPUT_AUTOSCALING_RIGHT.txt -------------------------------------------------------------------------------- /calibration/MB_ELECTRONIC_CHAIN_SEout.txt: -------------------------------------------------------------------------------- 1 | type = chain % complete chain of DAC, SENSOR, and ADC FILE = RTX6001_OUTPUT_AUTOSCALING_SE_LEFT.txt FILE = LOOPBACK_SENSOR.txt FILE = RTX6001_INPUT_AUTOSCALING_LEFT.txt -------------------------------------------------------------------------------- /calibration/MB_ELECTRONIC_CHAIN_BALout.txt: -------------------------------------------------------------------------------- 1 | type = chain % complete chain of DAC, SENSOR, and ADC FILE = RTX6001_OUTPUT_AUTOSCALING_BALANCED_LEFT.txt FILE = LOOPBACK_SENSOR.txt FILE = RTX6001_INPUT_AUTOSCALING_LEFT.txt -------------------------------------------------------------------------------- /documentation/source/MATAA_manual_reference.texi: -------------------------------------------------------------------------------- 1 | @node MATAA Tools Reference 2 | @chapter MATAA Tools Reference 3 | 4 | THIS CHAPTER IS UNDER CONSTRUCTION 5 | 6 | @cindex Tools 7 | @cindex MATAA tools 8 | 9 | (List and description of the various MATAA tools.) -------------------------------------------------------------------------------- /calibration/LOOPBACK_SENSOR.txt: -------------------------------------------------------------------------------- 1 | % "Sensor" configuration for a loopback connection (DAC-output directly connected to ADC-input) % General information: name = DIRECT WIRE type = SENSOR sensitivity = 1 V/V % one-to-one transfer from DUT (or DAC-output) to ADC-input: 1 V at input gives 1 V at output -------------------------------------------------------------------------------- /calibration/extras/RTX6001_ELECTRONIC-DIRECT_CHAIN_1V-OUT-SE_1V-IN.txt: -------------------------------------------------------------------------------- 1 | type = chain % complete chain of DAC, SENSOR, and ADC % 1 V-RMS-sine output, single ended: FILE = RTX6001_OUTPUT_1V_SE.txt % no sensor (direct connection): FILE = LOOPBACK_SENSOR.txt % 1 V-RMS-sine input: FILE = RTX6001_INPUT_1V.txt -------------------------------------------------------------------------------- /calibration/extras/RTX6001_ELECTRONIC-DIRECT_CHAIN_10V-OUT-SE_10V-IN.txt: -------------------------------------------------------------------------------- 1 | type = chain % complete chain of DAC, SENSOR, and ADC % 10 V-RMS-sine output, single ended: FILE = RTX6001_OUTPUT_10V_SE.txt % no sensor (direct connection): FILE = LOOPBACK_SENSOR.txt % 10 V-RMS-sine input: FILE = RTX6001_INPUT_10V.txt -------------------------------------------------------------------------------- /calibration/extras/RTX6001_ELECTRONIC-DIRECT_CHAIN_1V-OUT-BAL_1V-IN.txt: -------------------------------------------------------------------------------- 1 | type = chain % complete chain of DAC, SENSOR, and ADC % 1 V-RMS-sine output, balanced: FILE = RTX6001_OUTPUT_1V_BALANCED.txt % no sensor (direct connection): FILE = LOOPBACK_SENSOR.txt % 1 V-RMS-sine input: FILE = RTX6001_INPUT_1V.txt -------------------------------------------------------------------------------- /calibration/extras/RTX6001_ELECTRONIC-DIRECT_CHAIN_10V-OUT-BAL_10V-IN.txt: -------------------------------------------------------------------------------- 1 | type = chain % complete chain of DAC, SENSOR, and ADC % 10 V-RMS-sine output, balanced: FILE = RTX6001_OUTPUT_10V_BALANCED.txt % no sensor (direct connection): FILE = LOOPBACK_SENSOR.txt % 10 V-RMS-sine input: FILE = RTX6001_INPUT_10V.txt -------------------------------------------------------------------------------- /calibration/extras/RTX6001_ELECTRONIC-DIRECT_CHAIN_10V-OUT-SE_3.16V-IN.txt: -------------------------------------------------------------------------------- 1 | type = chain % complete chain of DAC, SENSOR, and ADC % 10 V-RMS-sine output, single ended: FILE = RTX6001_OUTPUT_10V_SE.txt % no sensor (direct connection): FILE = LOOPBACK_SENSOR.txt % 3.16 V-RMS-sine input: FILE = RTX6001_INPUT_3.16V.txt -------------------------------------------------------------------------------- /calibration/extras/RTX6001_ELECTRONIC-DIRECT_CHAIN_1V-OUT-BAL_3.16V-IN.txt: -------------------------------------------------------------------------------- 1 | type = chain % complete chain of DAC, SENSOR, and ADC % 1 V-RMS-sine output, balanced: FILE = RTX6001_OUTPUT_1V_BALANCED.txt % no sensor (direct connection): FILE = LOOPBACK_SENSOR.txt % 3.16 V-RMS-sine input: FILE = RTX6001_INPUT_3.16V.txt -------------------------------------------------------------------------------- /calibration/extras/RTX6001_ELECTRONIC-DIRECT_CHAIN_1V-OUT-SE_3.16V-IN.txt: -------------------------------------------------------------------------------- 1 | type = chain % complete chain of DAC, SENSOR, and ADC % 1 V-RMS-sine output, single ended: FILE = RTX6001_OUTPUT_1V_SE.txt % no sensor (direct connection): FILE = LOOPBACK_SENSOR.txt % 3.16 V-RMS-sine input: FILE = RTX6001_INPUT_3.16V.txt -------------------------------------------------------------------------------- /calibration/extras/RTX6001_ELECTRONIC-DIRECT_CHAIN_10V-OUT-BAL_3.16V-IN.txt: -------------------------------------------------------------------------------- 1 | type = chain % complete chain of DAC, SENSOR, and ADC % 10 V-RMS-sine output, balanced: FILE = RTX6001_OUTPUT_10V_BALANCED.txt % no sensor (direct connection): FILE = LOOPBACK_SENSOR.txt % 3.16 V-RMS-sine input: FILE = RTX6001_INPUT_3.16V.txt -------------------------------------------------------------------------------- /calibration/extras/MB_RTX_AUTOSCALING_LEFT.txt: -------------------------------------------------------------------------------- 1 | % MB's default for electronic measurements using the RTX6001 audio analyser (autoscaling, left channel) type = chain % complete chain of DAC, SENSOR, and ADC FILE = RTX6001_OUTPUT_AUTOSCALING_BALANCED_LEFT.txt FILE = LOOPBACK_SENSOR.txt FILE = RTX6001_INPUT_AUTOSCALING_LEFT.txt -------------------------------------------------------------------------------- /calibration/extras/MB_RTX_AUTOSCALING_RIGHT.txt: -------------------------------------------------------------------------------- 1 | % MB's default for electronic measurements using the RTX6001 audio analyser (autoscaling, right channel) type = chain % complete chain of DAC, SENSOR, and ADC FILE = RTX6001_OUTPUT_AUTOSCALING_BALANCED_RIGHT.txt FILE = LOOPBACK_SENSOR.txt FILE = RTX6001_INPUT_AUTOSCALING_RIGHT.txt -------------------------------------------------------------------------------- /calibration/GENERIC_ADC.txt: -------------------------------------------------------------------------------- 1 | % Generic example for calibratioon data file (ADC / analog digital conversion) % General information: name = GENERIC ADC type = ADC sensitivity = 0.7 1/V % 1V input at ADC input produces 70% digital level at ADC output % The ADC is assumed to have sufficiently flat frequency response, so no transfer function data is included here. -------------------------------------------------------------------------------- /calibration/GENERIC_DAC.txt: -------------------------------------------------------------------------------- 1 | % Generic example for calibratioon data file (DAC / digital-to-analog conversion) % General information: name = GENERIC DAC type = DAC sensitivity = 2.5 V % 100% signal level at DAC input produces 2.5 V at DAC output % The DAC is assumed to have sufficiently flat frequency response, so no transfer function data is included here. -------------------------------------------------------------------------------- /documentation/source/MATAA_manual_math.texi: -------------------------------------------------------------------------------- 1 | @node The Mathematics behind MATAA 2 | @chapter The Mathematics behind MATAA 3 | 4 | THIS CHAPTER IS UNDER CONSTRUCTION 5 | 6 | (Explain some signal theory things like impulse response, step response, frequency response, fourier transform, etc. Refer to standard texts.) 7 | @math{(a + b)(a + b) = a^2 + 2ab + b^2} -------------------------------------------------------------------------------- /calibration/GENERIC_CHAIN_ACOUSTIC.txt: -------------------------------------------------------------------------------- 1 | % Generic example for calibration data file (complete chain of DAC, SENSOR/MICROPHONE, ADC) type = chain % complete chain of DAC, SENSOR, and ADC FILE = GENERIC_DAC.txt % DAC calibration data FILE = BEHRINGER_ECM8000_D1303397118_MICROPHONE.txt % MICROPHONE/SENSOR calibration data FILE = GENERIC_ADC.txt % ADC calibration data -------------------------------------------------------------------------------- /calibration/GENERIC_CHAIN_DIRECT.txt: -------------------------------------------------------------------------------- 1 | % Generic calibration data for direct electronic connection of DUT ot ADC input % (this is also useful for REF channel with loopback cable from DAC-output to ADC-input) type = chain FILE = GENERIC_DAC.txt % DAC calibration data FILE = LOOPBACK_SENSOR.txt % 'SENSOR' calibration data FILE = GENERIC_ADC.txt % ADC calibration data -------------------------------------------------------------------------------- /calibration/FLAT_SOUNDCARD.txt: -------------------------------------------------------------------------------- 1 | % Calibration data for generic soundcard (DAC and ADC) with flat response (useful for measurements which don't require absolute calibration or frequnency dependent gain calibration). type = chain FILE = GENERIC_DAC.txt % DAC calibration data FILE = LOOPBACK_SENSOR.txt % 'SENSOR' calibration data FILE = GENERIC_ADC.txt % ADC calibration data -------------------------------------------------------------------------------- /calibration/MB_ACOUSTIC_CHAIN_DUT.txt: -------------------------------------------------------------------------------- 1 | type = chain % complete chain of DAC, SENSOR, and ADC FILE = RTX6001_OUTPUT_AUTOSCALING_SE_LEFT.txt % FILE = ISEMCON_EMX7150_2391606-270916_MICROPHONE.txt % FILE = BEYERDYNAMIC_MM1_14308_MICROPHONE_CSLABS.txt % FILE = BEHRINGER_ECM8000_D1303397118_MICROPHONE.txt FILE = EARTHWORKS_M23_2298J_MICROPHONE.txt FILE = RTX6001_INPUT_AUTOSCALING_LEFT.txt % FILE = RTX6001_INPUT_316mV.txt -------------------------------------------------------------------------------- /calibration/FLAT_MICROPHONE.txt: -------------------------------------------------------------------------------- 1 | % Generic calibration data for a virtual microphone with perflecly flat frequency response between 1 and 40’000 Hz % General information: name = VIRTUAL FLAT MIC type = Microphone sensitivity = 15.0 mV/Pa % Transfer function % free field, 1m distance to sound source, 0 deg. (axial) incidence % column-1: frequency (Hz) % column-2: gain (dB) relative to absolute sensitivity value given above 1 0 40000 0 -------------------------------------------------------------------------------- /linux_pulseaudio/README.txt: -------------------------------------------------------------------------------- 1 | Using MATAA on Linux with Pulseaudio installed 2 | 3 | Pulseaudio is a "sound software layer" that sits on top of the ALSA sound layer. Pulseaudio may sometimes interfere with MATAA / PlayRec, which needs direct ALSA access to the audio hardware. If you need to disable Pulseaudio for use with MATAA / PlayRec, run Octave using "pasuspender": 4 | 5 | >> pasuspender octave 6 | 7 | This will disable Pulseaudio while Octave is running, so PlayRec will be happy. 8 | -------------------------------------------------------------------------------- /documentation/source/make_documentation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo `dirname $0` 3 | cd `dirname $0` 4 | #/Applications/Octave.app/Contents/Resources/bin/octave --silent < ./make_tools_help_list.m 5 | octave --silent < ./make_tools_help_list.m 6 | #makeinfo --html --no-split MATAA_manual.texi 7 | #rm ../MATAA_manual.html 8 | #mv MATAA_manual.html .. 9 | #open ../MATAA_manual.html 10 | texi2pdf MATAA_manual.texi 11 | rm ../MATAA_manual.pdf 12 | mv MATAA_manual.pdf .. 13 | open ../MATAA_manual.pdf 14 | -------------------------------------------------------------------------------- /calibration/extras/RTX6001_INPUT_100mV.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (ADC, input at “100mV” setting) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | % General information: name = RTX6001 100-mV INPUT 5 | type = ADC sensitivity = 7.0711 1/V % 0.1414 Volt at input gives 100% full scale at ADC output 6 | % Frequency response is very flat, so no transfer function data is included here. -------------------------------------------------------------------------------- /calibration/BEHRINGER_UMC202HD_HEADPHONEOUT_DAC.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for BEHRINGER UMC202HD (DAC, phones output) 2 | % 3 | % Headphones output at max volume setting, without any additinal amp or buffer 4 | % Software mixer volume set to 100% (Mac OS X 10.10) 5 | % Measured using an DVM connected to the headphones out, with 50 Hz sine signal 6 | % General information: name = BEHRINGER UMC202HD HEADPHONE-OUT type = DAC sensitivity = 3.23 V % Frequency response was flat down to 5 Hz, so no transfer function data is included here. Analysis was difficult for lower frequencies -------------------------------------------------------------------------------- /calibration/RTX6001_INPUT_AUTOSCALING_LEFT.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (ADC, input range detected automatically via USB) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer to RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | 5 | % General information: 6 | name = RTX6001 AUTOSCALING INPUT (LEFT CHANNEL) 7 | type = ADC 8 | sensitivity_autoscalefunction = RTX6001_AUTOSCALINGFUNCTION_ADC('LEFT') 9 | 10 | % Frequency response is very flat, so no transfer function data is included here. 11 | -------------------------------------------------------------------------------- /calibration/RTX6001_INPUT_AUTOSCALING_RIGHT.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (ADC, input range detected automatically via USB) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer to RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | 5 | % General information: 6 | name = RTX6001 AUTOSCALING INPUT (RIGHT CHANNEL) 7 | type = ADC 8 | sensitivity_autoscalefunction = RTX6001_AUTOSCALINGFUNCTION_ADC('RIGHT') 9 | 10 | % Frequency response is very flat, so no transfer function data is included here. 11 | -------------------------------------------------------------------------------- /calibration/GENERIC_EXAMPLE_MICROPHONE.txt: -------------------------------------------------------------------------------- 1 | % Generic example for calibration data file (microphone) % General information: name = GENERIC MICROPHONE % name / descriptor of hardware type = MICROPHONE % type of hardware ('DAC', 'ADC', 'MICROPHONE', or 'SENSOR') sensitivity = 0.35 mV/Pc % sensitivity of device, including unit (ratio of output/input signals) % Transfer function: % column-1: frequency (Hz) % column-2: gain (dB) relative to absolute sensitivity value given above 15 0 60 0 2000 0 5000 1.1 8000 1.5 10000 1.3 18000 0 20000 -1 22000 -2 30000 -10 -------------------------------------------------------------------------------- /calibration/extras/RTX6001_OUTPUT_10V_SE.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (DAC, single ended output at “10V” setting via BNC or XLR-to-RCA adapter) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer to RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | % 5 | 6 | % General information: 7 | name = RTX6001 10-V SINGLE ENDED OUTPUT 8 | type = DAC 9 | sensitivity = 7.0711 V % 100% full scale input to DAC gives 7.0711 V at BNC output 10 | 11 | % Frequency response is very flat, so no transfer function data is included here. 12 | -------------------------------------------------------------------------------- /calibration/extras/RTX6001_OUTPUT_1V_SE.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (DAC, single ended output at “1V” setting via BNC or XLR-to-RCA adapter) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer to RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | % 5 | 6 | % General information: 7 | name = RTX6001 1-V SINGLE ENDED OUTPUT 8 | type = DAC 9 | sensitivity = 0.70711 V % 100% full scale input to DAC gives 0.70711 V at BNC output 10 | 11 | % Frequency response is very flat, so no transfer function data is included here. 12 | -------------------------------------------------------------------------------- /calibration/extras/RTX6001_OUTPUT_10V_BALANCED.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (DAC, XLR/balanced output at “10V” setting) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer to RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | % 5 | 6 | % General information: 7 | name = RTX6001 10-V BALANCED OUTPUT 8 | type = DAC 9 | sensitivity = 14.142 V % 100% full scale input to DAC gives 14.142 V at XLR output (measured from POS to NEG pins) 10 | 11 | % Frequency response is very flat, so no transfer function data is included here. 12 | -------------------------------------------------------------------------------- /calibration/extras/RTX6001_OUTPUT_1V_BALANCED.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (DAC, XLR/balanced output at “1V” setting) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer to RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | % 5 | 6 | % General information: 7 | name = RTX6001 1-V BALANCED OUTPUT 8 | type = DAC 9 | sensitivity = 1.4142 V % 100% full scale input to DAC gives 1.4142 V at XLR output (measured from POS to NEG pins) 10 | 11 | % Frequency response is very flat, so no transfer function data is included here. 12 | -------------------------------------------------------------------------------- /calibration/extras/RTX6001_OUTPUT_100mV_SE.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (DAC, single ended output at “0.1V” setting via BNC or XLR-to-RCA adapter) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer to RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | % 5 | 6 | % General information: 7 | name = RTX6001 0.1-V SINGLE ENDED OUTPUT 8 | type = DAC 9 | sensitivity = 0.070711 V % 100% full scale input to DAC gives 0.070711 V at BNC output 10 | 11 | % Frequency response is very flat, so no transfer function data is included here. 12 | -------------------------------------------------------------------------------- /calibration/extras/RTX6001_OUTPUT_100mV_BALANCED.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (DAC, XLR/balanced output at “100 mV” setting) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer to RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | % 5 | 6 | % General information: 7 | name = RTX6001 100-mV BALANCED OUTPUT 8 | type = DAC 9 | sensitivity = 0.14142 V % 100% full scale input to DAC gives 0.14142 V at XLR output (measured from POS to NEG pins) 10 | 11 | % Frequency response is very flat, so no transfer function data is included here. 12 | -------------------------------------------------------------------------------- /TestTone/source/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 2.8.12) 3 | 4 | project(TestTone) 5 | 6 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 7 | # define a default build type 8 | if (NOT CMAKE_BUILD_TYPE) 9 | message(STATUS "No build type selected, default to Release") 10 | set(CMAKE_BUILD_TYPE "Release") 11 | endif() 12 | 13 | add_executable(TestTonePA19 TestTonePA19.c) 14 | target_link_libraries(TestTonePA19 -L/usr/lib/x86_64-linux-gnu portaudio m rt asound pthread ) 15 | 16 | add_executable(TestDevicesPA19 TestDevicesPA19.c) 17 | target_link_libraries(TestDevicesPA19 -L/usr/lib/x86_64-linux-gnu portaudio rt asound pthread ) 18 | -------------------------------------------------------------------------------- /calibration/BEHRINGER_UMC202HD_LINEOUT_DAC.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for BEHRINGER UMC202HD (DAC, line output) 2 | % 3 | % Line level output, without any extra amp or buffer 4 | % “Output” level control set to maximum, “Direct Monitor” turned off 5 | % Software mixer volume set to 100% (Mac OS X 10.10) 6 | % Measured using an oscilloscope and DVM connected to the line-level outputs 7 | % Sensitivity was found to be independent of sampling rate % General information: name = BEHRINGER UMC202HD LINE-OUT type = DAC sensitivity = 1.407 V % Frequency response was flat down to 5 Hz, so no transfer function data is included here. Analysis was difficult for lower frequencies -------------------------------------------------------------------------------- /calibration/extras/RTX6001_INPUT_1V.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (ADC, input at “1V” setting) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | % General information: 5 | name = RTX6001 1-V INPUT 6 | type = ADC 7 | sensitivity = 0.70711 1/V % 70.711%-FS digital output corresponds to 1 Volt at ADC input (voltage measured between POS and NEG pins). NOTE: clipping may occur before reaching 100% ADC output depending on signal symmetry between POS and NEG pins. 8 | 9 | % Frequency response is very flat, so no transfer function data is included here. 10 | -------------------------------------------------------------------------------- /calibration/extras/RTX6001_INPUT_10V.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (ADC, input at “10V” setting) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | % General information: 5 | name = RTX6001 10-V INPUT 6 | type = ADC 7 | sensitivity = 0.070711 1/V % 7.0711%-FS digital output corresponds to 1 Volt at ADC input (voltage measured between POS and NEG pins). NOTE: clipping may occur before reaching 100% ADC output depending on signal symmetry between POS and NEG pins. 8 | 9 | % Frequency response is very flat, so no transfer function data is included here. 10 | -------------------------------------------------------------------------------- /calibration/extras/RTX6001_INPUT_100V.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (ADC, input at “100V” setting) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | % General information: 5 | name = RTX6001 100-V INPUT 6 | type = ADC 7 | sensitivity = 0.0070711 1/V % 0.70711%-FS digital output corresponds to 1 Volt at ADC input (voltage measured between POS and NEG pins). NOTE: clipping may occur before reaching 100% ADC output depending on signal symmetry between POS and NEG pins. 8 | 9 | % Frequency response is very flat, so no transfer function data is included here. 10 | -------------------------------------------------------------------------------- /calibration/extras/RTX6001_INPUT_3.16V.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (ADC, input at “3.16V” setting) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | % General information: 5 | name = RTX6001 3.16-V INPUT 6 | type = ADC 7 | sensitivity = 0.22377 1/V % 22.377%-FS digital output corresponds to 1 Volt at ADC input (voltage measured between POS and NEG pins). NOTE: clipping may occur before reaching 100% ADC output depending on signal symmetry between POS and NEG pins. 8 | 9 | % Frequency response is very flat, so no transfer function data is included here. 10 | -------------------------------------------------------------------------------- /calibration/extras/RTX6001_INPUT_31.6V.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (ADC, input at “31.6V” setting) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | % General information: 5 | name = RTX6001 31.6-V INPUT 6 | type = ADC 7 | sensitivity = 0.022377 1/V % 2.2377%-FS digital output corresponds to 1 Volt at ADC input (voltage measured between POS and NEG pins). NOTE: clipping may occur before reaching 100% ADC output depending on signal symmetry between POS and NEG pins. 8 | 9 | % Frequency response is very flat, so no transfer function data is included here. 10 | -------------------------------------------------------------------------------- /calibration/extras/RTX6001_INPUT_316mV.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (ADC, input at “316mV” setting) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | % General information: 5 | name = RTX6001 316-mV INPUT 6 | type = ADC 7 | sensitivity = 2.2377 1/V % 22.377%-FS digital output corresponds to 0.1 Volt at ADC input (voltage measured between POS and NEG pins). NOTE: clipping may occur before reaching 100% ADC output depending on signal symmetry between POS and NEG pins. 8 | 9 | % Frequency response is very flat, so no transfer function data is included here. 10 | -------------------------------------------------------------------------------- /calibration/RTX6001_OUTPUT_AUTOSCALING_SE_LEFT.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (DAC, BNC/single-ended output range detected automatically via USB) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer to RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | 5 | % Frequency response is very flat, so no transfer function data is included here. 6 | 7 | % General information: 8 | name = RTX6001 AUTOSCALING SINGLE-ENDED OUTPUT (LEFT CHANNEL) 9 | type = DAC 10 | sensitivity_autoscalefunction = RTX6001_AUTOSCALINGFUNCTION_DAC_SE('LEFT') 11 | 12 | % Frequency response is very flat, so no transfer function data is included here. 13 | -------------------------------------------------------------------------------- /calibration/RTX6001_OUTPUT_AUTOSCALING_BALANCED_LEFT.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (DAC, XLR/balanced output range detected automatically via USB) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer to RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | 5 | % Frequency response is very flat, so no transfer function data is included here. 6 | 7 | % General information: 8 | name = RTX6001 AUTOSCALING BALANCED OUTPUT (LEFT CHANNEL) 9 | type = DAC 10 | sensitivity_autoscalefunction = RTX6001_AUTOSCALINGFUNCTION_DAC_BALANCED('LEFT') 11 | 12 | % Frequency response is very flat, so no transfer function data is included here. 13 | -------------------------------------------------------------------------------- /calibration/RTX6001_OUTPUT_AUTOSCALING_SE_RIGHT.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (DAC, BNC/single-ended output range detected automatically via USB) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer to RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | 5 | % Frequency response is very flat, so no transfer function data is included here. 6 | 7 | % General information: 8 | name = RTX6001 AUTOSCALING SINGLE-ENDED OUTPUT (RIGHT CHANNEL) 9 | type = DAC 10 | sensitivity_autoscalefunction = RTX6001_AUTOSCALINGFUNCTION_DAC_SE('RIGHT') 11 | 12 | % Frequency response is very flat, so no transfer function data is included here. 13 | -------------------------------------------------------------------------------- /calibration/RTX6001_OUTPUT_AUTOSCALING_BALANCED_RIGHT.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for RTX6001 audio analyser (DAC, XLR/balanced output range detected automatically via USB) 2 | % 3 | % NOTE: the voltage labels on the RTX6001 front panel refer to RMS values of a sine signal. Multiply the front panel labels by sqrt(2) to obtain the peak voltage. 4 | 5 | % Frequency response is very flat, so no transfer function data is included here. 6 | 7 | % General information: 8 | name = RTX6001 AUTOSCALING BALANCED OUTPUT (RIGHT CHANNEL) 9 | type = DAC 10 | sensitivity_autoscalefunction = RTX6001_AUTOSCALINGFUNCTION_DAC_BALANCED('RIGHT') 11 | 12 | % Frequency response is very flat, so no transfer function data is included here. 13 | -------------------------------------------------------------------------------- /calibration/BEHRINGER_UMC202HD_LINEIN_ADC.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for BEHRINGER UMC202HD (ADC, LINE input) 2 | % 3 | % Line level output, without any extra amp or buffer 4 | % Input gain control set to different levels (see sensitivity values below) 5 | % PAD off (PAD = ON reduces input gain by 19 dB) 6 | % Software mixer volume set to 100% (Mac OS X 10.10) 7 | % Measured using an oscilloscope and DVM connected to the line-level input 8 | % General information: name = BEHRINGER UMC202HD LINE-IN type = ADC %% sensitivity = 28.6 1/V % input gain at maximum setting 9 | sensitivity = 0.536 1/V % input gain at 50% setting 10 | %% sensitivity = 0.0627 1/V % input gain at minimum setting % Frequency response was flat down to 5 Hz, so no transfer function data is included here. Analysis was difficult for lower frequencies -------------------------------------------------------------------------------- /calibration/BEHRINGER_UMC202HD_MICIN_ADC.txt: -------------------------------------------------------------------------------- 1 | % Calibration file for BEHRINGER UMC202HD (ADC, INST/microphone input) 2 | % 3 | % INST/microphone level input, without any extra amp or buffer 4 | % Input gain control set to different levels (see sensitivity values below) 5 | % PAD off (PAD = ON reduces input gain by 19 dB) 6 | % Software mixer volume set to 100% (Mac OS X 10.10) 7 | % Measured using an oscilloscope and DVM connected to the line-level input 8 | % General information: name = BEHRINGER UMC202HD MIC-IN type = ADC %% sensitivity = XX 1/V % input gain at maximum setting (can’t test because test signal causes overload to analog input even at lowest level possible) 9 | sensitivity = 7.9 1/V % input gain at 50% setting 10 | %% sensitivity = 0.904 1/V % input gain at minimum setting % Frequency response was flat down to 5 Hz, so no transfer function data is included here. Analysis was difficult for lower frequencies -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | MATAA (Mat's Audio Analyzer) 2 | 3 | MATAA is an extremely flexible and versatile audio analysis system. Similarly to many other computer-based audio analysis systems, MATAA applies a test signal to the device under test and simultaneously records the response signal for subsequent analysis. MATAA uses a computer soundcard to play and record test signals to and from a device under test. 4 | 5 | MATAA runs on all sorts of computer platforms because it uses GNU Octave or Matlab (these are powerful number crunching programs which provide a huge toolbox of routines for data analysis and processing). For this reason, MATAA is extremely flexible and easily extendible with custom test signals, data analysis methods, plotting procedures, and scrips to automate measurements. 6 | 7 | Further instructions on how to install and use MATAA are available in the manual provided with MATAA. 8 | 9 | MATAA is distributed as free software under the GNU General Public License (see LICENSE.txt). 10 | 11 | Copyright (C) 2006-2016 Matthias S. Brennwald. 12 | Contact: info@audioroot.net 13 | -------------------------------------------------------------------------------- /mataa_tools/mataa_tempfile.m: -------------------------------------------------------------------------------- 1 | function filepath = mataa_tempfile; 2 | 3 | % function filepath = mataa_tempfile; 4 | % 5 | % DESCRIPTION: 6 | % returns a path to a tempfile to be used with MATAA 7 | % 8 | % INPUT: 9 | % (none) 10 | % 11 | % OUTPUT: 12 | % filepath: string containing the path to the tempfile (including the file name). 13 | % 14 | % DISCLAIMER: 15 | % This file is part of MATAA. 16 | % 17 | % MATAA is free software; you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation; either version 2 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % MATAA is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with MATAA; if not, write to the Free Software 29 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 30 | % 31 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 32 | % Contact: info@audioroot.net 33 | % Further information: http://www.audioroot.net/MATAA 34 | 35 | filepath = tempname; 36 | -------------------------------------------------------------------------------- /mataa_tools/mataa_t_to_f.m: -------------------------------------------------------------------------------- 1 | function f = mataa_t_to_f (t); 2 | 3 | % function f = mataa_t_to_f (t); 4 | % 5 | % DESCRIPTION: 6 | % Same as mataa_t_to_f0, but the component corresponding to f=0 is removed from the output. 7 | % 8 | % INPUT: 9 | % (see mataa_t_to_f0). 10 | % 11 | % OUTPUT: 12 | % (see mataa_to_f0). 13 | % 14 | % DISCLAIMER: 15 | % This file is part of MATAA. 16 | % 17 | % MATAA is free software; you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation; either version 2 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % MATAA is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with MATAA; if not, write to the Free Software 29 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 30 | % 31 | % Copyright (C) 2007, 2008 Matthias S. Brennwald. 32 | % Contact: info@audioroot.net 33 | % Further information: http://www.audioroot.net/MATAA 34 | 35 | f = mataa_t_to_f0(t); 36 | f = f(2:end); % remove f=0 37 | -------------------------------------------------------------------------------- /calibration/BEYERDYNAMIC_MM1_14308_MICROPHONE_CSLABS.txt: -------------------------------------------------------------------------------- 1 | % Calibration data for Beyerdynamic MM1 microphone (serial number 14308) 2 | % Data source: Measurement by Cross Spectrum Labs / Herb Singleton, 3 Aug. 2015 (email from hsingleton@csacoustics.com to matthias@brennwald.org, 7.8.2015) 3 | 4 | % General information: 5 | name = Beyerdynamic MM1 (SN 14308) 6 | type = Microphone 7 | % original sensitivity: 8 | % sensitivity = 16 mV/Pa 9 | 10 | % sensitivity from PeakTech calibrator (4.12.2018): 11 | sensitivity = 6.76 mV/Pa 12 | 13 | % Transfer function 14 | % free field, 1m distance to sound source, 0 deg. (axial) incidence 15 | % column-1: frequency (Hz) 16 | % column-2: gain (dB) relative to absolute sensitivity value given above 17 | 5 -1.85 18 | 6.3 -1.7 19 | 8 -1.36 20 | 10 -0.99 21 | 12.5 -0.62 22 | 16 -0.29 23 | 20 0.17 24 | 25 0.43 25 | 31.5 0.54 26 | 40 0.58 27 | 50 0.59 28 | 63 0.53 29 | 80 0.43 30 | 100 0.3 31 | 125 0.3 32 | 160 0.33 33 | 200 0.34 34 | 250 0.26 35 | 315 0.12 36 | 400 -0.01 37 | 500 0.02 38 | 630 -0.06 39 | 800 -0.04 40 | 1000 0 41 | 1250 -0.04 42 | 1600 -0.08 43 | 2000 -0.2 44 | 2500 -0.07 45 | 3150 0.12 46 | 4000 0.17 47 | 5000 0.12 48 | 6300 0.64 49 | 8000 0.57 50 | 10000 0.73 51 | 12500 0.77 52 | 16000 0.5 53 | 20000 0.4 54 | 25000 0.23 55 | -------------------------------------------------------------------------------- /mataa_tools/mataa_realFT.m: -------------------------------------------------------------------------------- 1 | function [S,f] = mataa_realFT (s,t); 2 | 3 | % function [S,f] = mataa_realFT (s,t); 4 | % 5 | % DESCRIPTION: 6 | % Identical to mataa_realFT0, but without the component corresponding to f=0. 7 | % 8 | % INPUT: 9 | % (see mataa_realFT0) 10 | % 11 | % OUTPUT: 12 | % (see mataa_realFT0) 13 | % 14 | % DISCLAIMER: 15 | % This file is part of MATAA. 16 | % 17 | % MATAA is free software; you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation; either version 2 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % MATAA is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with MATAA; if not, write to the Free Software 29 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 30 | % 31 | % Copyright (C) 2006,2007, 2008 Matthias S. Brennwald. 32 | % Contact: info@audioroot.net 33 | % Further information: http://www.audioroot.net/MATAA 34 | 35 | [S,f] = mataa_realFT0(s,t); 36 | 37 | % remove component corresponding to f=0: 38 | S = S(2:end); 39 | f = f(2:end); 40 | -------------------------------------------------------------------------------- /calibration/RTX6001_MATAA_integration_notes.txt: -------------------------------------------------------------------------------- 1 | *** Autoscaling using the RTX6001 audio analyser with MATAA *** 2 | 3 | Steps to make RTX6001 autoscaling work with MATAA: 4 | 5 | 1. Linux only: Make a UDEV rule to allow non-root access to the RTX6001 via USB: 6 | - file: /etc/udev/rules.d/90-RTX6001-hidraw-permissions.rules 7 | - file content: ATTRS{idVendor}=="0d9a" , ATTRS{idProduct}=="00df" , MODE="0666" 8 | - restart UDEV (or reboot computer): service udev restart 9 | 10 | 2. Make sure you have Python 3.x available on your computer, and the python-hidapi packages is installed. 11 | 12 | - Ubuntu and similar Linux distros: 13 | sudo apt install python3-hid 14 | 15 | - Mac OS X with MacPorts: 16 | sudo port install python36 py36-pip 17 | sudo port select --set python3 python36 18 | sudo port select --set pip pip36 19 | sudo -H pip install hidapi 20 | 21 | 3. Make sure the RTX6001_USB_STATUS file in the .../mataa/calibration folder is marked as executable. 22 | 23 | 4. Switch on the the RTX6001 and connect it to the computer. Run the RTX6001_USB_STATUS program to see if it works. 24 | 25 | 5. Make sure the .../mataa/calibration folder in in your Octave / Matlab search path 26 | 27 | 6. Configure your calibration file to suit your setup. You may use the MB_RTX_AUTOSCALING_LEFT.txt cal file as a template. 28 | 29 | 7. Use the mataa_cal_autoscale function with your cal file (or just use the MB_RTX_AUTOSCALING_LEFT.txt file to test things). 30 | -------------------------------------------------------------------------------- /mataa_tools/mataa_realIFT.m: -------------------------------------------------------------------------------- 1 | function [s,t] = mataa_realIFT (S,f); 2 | 3 | % function [s,t] = mataa_realIFT (S,f); 4 | % 5 | % DESCRIPTION: 6 | % Same as mataa_realIFT0, but without f=0. 7 | % 8 | % INPUT: 9 | % S: complex fourier spectrum of the signal ('positive' half, see also DESCRIPTION). 10 | % f: frequency values (vector) 11 | % 12 | % OUTPUT: 13 | % s: signal samples (real-valued samples) 14 | % t: time values of the signal 15 | % 16 | % DISCLAIMER: 17 | % This file is part of MATAA. 18 | % 19 | % MATAA is free software; you can redistribute it and/or modify 20 | % it under the terms of the GNU General Public License as published by 21 | % the Free Software Foundation; either version 2 of the License, or 22 | % (at your option) any later version. 23 | % 24 | % MATAA is distributed in the hope that it will be useful, 25 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | % GNU General Public License for more details. 28 | % 29 | % You should have received a copy of the GNU General Public License 30 | % along with MATAA; if not, write to the Free Software 31 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 32 | % 33 | % Copyright (C) 2008 Matthias S. Brennwald. 34 | % Contact: info@audioroot.net 35 | % Further information: http://www.audioroot.net/MATAA 36 | 37 | if f(1) ~= 0 38 | f = [0 ; f]; 39 | S = [0 ; S]; 40 | end 41 | 42 | [s,t] = mataa_realIFT0 (S,f); 43 | -------------------------------------------------------------------------------- /mataa_tools/mataa_plot_two_logX.m: -------------------------------------------------------------------------------- 1 | function h = mataa_plot_two_logX (x,y1,y2,figNum,plottit,xtit,y1tit,y2tit); 2 | 3 | % function h = mataa_plot_two_log (x,y1,y2,figNum,plottit,xtit,y1tit,y2tit); 4 | % 5 | % DESCRIPTION: 6 | % Same as mataa_plot_two, but with logarithmic x axes. 7 | % 8 | % INPUT: 9 | % (see mataa_plot_two) 10 | % 11 | % OUTPUT: 12 | % (see mataa_plot_two) 13 | % 14 | % DISCLAIMER: 15 | % This file is part of MATAA. 16 | % 17 | % MATAA is free software; you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation; either version 2 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % MATAA is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with MATAA; if not, write to the Free Software 29 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 30 | % 31 | % Copyright (C) 2007, 2008 Matthias S. Brennwald. 32 | % Contact: info@audioroot.net 33 | % Further information: http://www.audioroot.net/MATAA 34 | 35 | h = mataa_plot_two (x,y1,y2,figNum,plottit,xtit,y1tit,y2tit); 36 | 37 | set (h(1),'xscale','log'); 38 | if ~isnan (h(2)) 39 | set (h(2),'xscale','log'); 40 | end 41 | -------------------------------------------------------------------------------- /mataa_tools/mataa_IR_to_SR.m: -------------------------------------------------------------------------------- 1 | function [s,t] = mataa_IR_to_SR (h,t); 2 | 3 | % function [s,t] = mataa_IR_to_SR (h,t); 4 | % 5 | % DESCRIPTION: 6 | % calculates the step response of a system with impulse response h(t) 7 | % 8 | % INPUT: 9 | % h: impulse response 10 | % t: time coordinates of samples in h (vector, in seconds) or sampling rate of h (scalar, in Hz) 11 | % 12 | % OUTPUT: 13 | % s: step response 14 | % t: time (seconds) 15 | % 16 | % DISCLAIMER: 17 | % This file is part of MATAA. 18 | % 19 | % MATAA is free software; you can redistribute it and/or modify 20 | % it under the terms of the GNU General Public License as published by 21 | % the Free Software Foundation; either version 2 of the License, or 22 | % (at your option) any later version. 23 | % 24 | % MATAA is distributed in the hope that it will be useful, 25 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | % GNU General Public License for more details. 28 | % 29 | % You should have received a copy of the GNU General Public License 30 | % along with MATAA; if not, write to the Free Software 31 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 32 | % 33 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 34 | % Contact: info@audioroot.net 35 | % Further information: http://www.audioroot.net/MATAA 36 | 37 | if isscalar(t) 38 | t = [0:1/t:(length(h)-1)/t]; 39 | end 40 | 41 | 42 | dt = (max(t)-min(t))/(length(t)-1); 43 | 44 | s = cumsum(h)*dt; 45 | s=s-s(1); % offset = first sample of s 46 | -------------------------------------------------------------------------------- /mataa_tools/mataa_phase_remove_delay.m: -------------------------------------------------------------------------------- 1 | function phase = mataa_phase_remove_delay (phase,f,delay); 2 | 3 | % function [phase,f] = mataa_phase_remove_delay (phase,f,delay); 4 | % 5 | % DESCRIPTION: 6 | % This function removes excess phase due to time delay. 7 | % 8 | % INPUT: 9 | % phase: phase, including excess phase due to time delay (unwrapped, in degrees) 10 | % f: frequency coordinates of phase (in Hz) 11 | % delay: time delay to be removed from the phase (in seconds) 12 | % 13 | % OUTPUT: 14 | % phase: phase with excess phase corresponding to delay removed (unwrapped, in degrees) 15 | % 16 | % DISCLAIMER: 17 | % This file is part of MATAA. 18 | % 19 | % MATAA is free software; you can redistribute it and/or modify 20 | % it under the terms of the GNU General Public License as published by 21 | % the Free Software Foundation; either version 2 of the License, or 22 | % (at your option) any later version. 23 | % 24 | % MATAA is distributed in the hope that it will be useful, 25 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | % GNU General Public License for more details. 28 | % 29 | % You should have received a copy of the GNU General Public License 30 | % along with MATAA; if not, write to the Free Software 31 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 32 | % 33 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 34 | % Contact: info@audioroot.net 35 | % Further information: http://www.audioroot.net/MATAA 36 | 37 | exPhase = -2*pi*f*delay; % see D'Appolito, J.: Testing Loudspeakers, page 111 38 | phase = phase - exPhase; 39 | -------------------------------------------------------------------------------- /mataa_tools/mataa_IR_remove_echo.m: -------------------------------------------------------------------------------- 1 | function [h,t] = mataa_IR_remove_echo (h,t,t_echo_start,t_echo_end); 2 | 3 | % function [h,t] = mataa_IR_remove_echo (h,t,t_echo_start,t_echo_end); 4 | % 5 | % DESCRIPTION: 6 | % This function removes echos from an impulse response. The echos are replaced by data calculated by linear interpolation. 7 | % 8 | % INPUT: 9 | % h: values impulse response (vector) 10 | % t: time values of samples in h (vector) 11 | % t_echo_start: start time of echo 12 | % t_echo_end: end time of echo 13 | % 14 | % OUTPUT: 15 | % h: values impulse response with echo removed 16 | % t: time values of samples in h 17 | % 18 | % DISCLAIMER: 19 | % This file is part of MATAA. 20 | % 21 | % MATAA is free software; you can redistribute it and/or modify 22 | % it under the terms of the GNU General Public License as published by 23 | % the Free Software Foundation; either version 2 of the License, or 24 | % (at your option) any later version. 25 | % 26 | % MATAA is distributed in the hope that it will be useful, 27 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | % GNU General Public License for more details. 30 | % 31 | % You should have received a copy of the GNU General Public License 32 | % along with MATAA; if not, write to the Free Software 33 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 34 | % 35 | % Copyright (C) 2008 Matthias S. Brennwald. 36 | % Contact: info@audioroot.net 37 | % Further information: http://www.audioroot.net/MATAA 38 | 39 | ii = find (t < t_echo_start | t > t_echo_end); 40 | 41 | 42 | h = interp1 (t(ii),h(ii),t); 43 | -------------------------------------------------------------------------------- /mataa_tools/mataa_signal_analytic.m: -------------------------------------------------------------------------------- 1 | function a = mataa_signal_analytic (s); 2 | 3 | % function a = mataa_signal_analytic (s); 4 | % 5 | % DESCRIPTION: 6 | % Calculate analytic signal a of signal s. 7 | % 8 | % INPUT: 9 | % s: vector containing the samples values of the signal. 10 | % 11 | % OUTPUT: 12 | % a: vector containing the analytic signal of s. 13 | % 14 | % EXAMPLE: 15 | % calculate the amplitude envelope of the impulse response of a loudspeaker 16 | % > [h,t] = mataa_IR_demo; % load demo impulse response 17 | % > a = mataa_signal_analytic(h); % calculate analytic response 18 | % > a = abs(a); % abs(a) is the amplitude envelope of impulse response 19 | % > plot(t,a); 20 | % 21 | % DISCLAIMER: 22 | % This file is part of MATAA. 23 | % 24 | % MATAA is free software; you can redistribute it and/or modify 25 | % it under the terms of the GNU General Public License as published by 26 | % the Free Software Foundation; either version 2 of the License, or 27 | % (at your option) any later version. 28 | % 29 | % MATAA is distributed in the hope that it will be useful, 30 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 31 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 32 | % GNU General Public License for more details. 33 | % 34 | % You should have received a copy of the GNU General Public License 35 | % along with MATAA; if not, write to the Free Software 36 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 37 | % 38 | % Copyright (C) 2007 Matthias S. Brennwald. 39 | % Contact: info@audioroot.net 40 | % Further information: http://www.audioroot.net/MATAA 41 | 42 | a = s + i*mataa_hilbert(s); 43 | -------------------------------------------------------------------------------- /calibration/ISEMCON_EMX7150_2391606-270916_MICROPHONE.txt: -------------------------------------------------------------------------------- 1 | % Calibration data for Isemcon EMx7150 microphone (serial number 2391606-270916), free field 2 | % Data source: ISEMCON calibration data delivered with microphone 3 | % 4 | % General information: 5 | name = Isemcon EMX7150 (SN 2391606-270916) 6 | type = Microphone 7 | % original sensitivity value: 8 | % sensitivity = 7.43 mV/Pa 9 | 10 | % sensitivity from PeakTech calibrator (4.12.2018): 11 | sensitivity = 6.52 mV/Pa 12 | 13 | 14 | % Transfer function 15 | % free field, 1m distance to sound source, 0 deg. (axial) incidence 16 | % column-1: frequency (Hz) 17 | % column-2: gain (dB) relative to absolute sensitivity value given above% 18 | 10 -1.23 19 | 11.2 -0.85 20 | 12.5 -0.7 21 | 14 -0.61 22 | 16 -0.42 23 | 18 -0.3 24 | 20 -0.21 25 | 22.4 -0.14 26 | 25 -0.08 27 | 28 -0.02 28 | 31.5 0.02 29 | 35.5 0.05 30 | 40 0.08 31 | 45 0.11 32 | 50 0.11 33 | 56 0.13 34 | 63 0.14 35 | 71 0.14 36 | 80 0.15 37 | 90 0.15 38 | 100 0.15 39 | 112 0.15 40 | 125 0.15 41 | 140 0.14 42 | 160 0.14 43 | 180 0.14 44 | 200 0.13 45 | 224 0.13 46 | 250 0.12 47 | 280 0.11 48 | 315 0.1 49 | 355 0.1 50 | 400 0.09 51 | 450 0.07 52 | 500 0.06 53 | 560 0.06 54 | 630 0.05 55 | 710 0.03 56 | 800 0.02 57 | 900 0.01 58 | 1000 0.0 59 | 1120 -0.01 60 | 1250 -0.05 61 | 1400 -0.05 62 | 1600 -0.1 63 | 1800 -0.14 64 | 2000 -0.17 65 | 2240 -0.21 66 | 2500 -0.28 67 | 2800 -0.41 68 | 3150 -0.53 69 | 3550 -0.52 70 | 4000 -0.53 71 | 4500 -0.74 72 | 5000 -0.81 73 | 5600 -0.69 74 | 6300 -0.66 75 | 7100 -0.5 76 | 8000 -0.36 77 | 9000 -0.29 78 | 10000 -0.16 79 | 11200 -0.05 80 | 12500 0.1 81 | 14000 0.15 82 | 16000 -0.06 83 | 18000 -0.51 84 | 20000 -0.9 85 | -------------------------------------------------------------------------------- /mataa_tools/mataa_f_to_t.m: -------------------------------------------------------------------------------- 1 | function t = mataa_f_to_t (f); 2 | 3 | % function t = mataa_f_to_t (f); 4 | % 5 | % DESCRIPTION: 6 | % returns the time bins of the inverse fourier spectrum sampled at frequencies f (f is assumed to be evenly spaced!) 7 | % 8 | % INPUT: 9 | % f: frequency-value vector (in Hz). Values must be sorted and evenly spaced. 10 | % 11 | % OUTPUT: 12 | % t: time values (vector, in seconds) 13 | % 14 | % DISCLAIMER: 15 | % This file is part of MATAA. 16 | % 17 | % MATAA is free software; you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation; either version 2 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % MATAA is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with MATAA; if not, write to the Free Software 29 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 30 | % 31 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 32 | % Contact: info@audioroot.net 33 | % Further information: http://www.audioroot.net/MATAA 34 | 35 | if any (f<0) 36 | error ('mataa_f_to_t: f must not contain negative values.') 37 | end 38 | 39 | f = sort (f); % make sure f is sorted 40 | 41 | l=length(f) 42 | 43 | if f(1) ~= 0 44 | T = 1/f(1); 45 | else 46 | T = 1/f(2); 47 | end 48 | 49 | if mod(l,2) 50 | dt = T/(2*l+1); 51 | else 52 | dt = 1/(2*f(end)); 53 | end 54 | 55 | t = [0:dt:T-dt]'; 56 | -------------------------------------------------------------------------------- /mataa_tools/mataa_signal_crop.m: -------------------------------------------------------------------------------- 1 | function [s,t] = mataa_signal_crop (s,t,t_start,t_end); 2 | 3 | % function [s,t] = mataa_signal_crop (s,t,t_start,t_end); 4 | % 5 | % DESCRIPTION: 6 | % This function crops out the part of the signal s(t) in the range t = t_start...t_end 7 | % 8 | % INPUT: 9 | % s: signal samples 10 | % t: time coordinates of impulse response samples (vector, in seconds), or, alternatively, the sampling frequency of s(t) (scalar, in Hz) 11 | % 12 | % OUPTUT: 13 | % s: signal samples of cropped signal 14 | % t: time coordinates of cropped signal (in seconds) 15 | % 16 | % DISCLAIMER: 17 | % This file is part of MATAA. 18 | % 19 | % MATAA is free software; you can redistribute it and/or modify 20 | % it under the terms of the GNU General Public License as published by 21 | % the Free Software Foundation; either version 2 of the License, or 22 | % (at your option) any later version. 23 | % 24 | % MATAA is distributed in the hope that it will be useful, 25 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | % GNU General Public License for more details. 28 | % 29 | % You should have received a copy of the GNU General Public License 30 | % along with MATAA; if not, write to the Free Software 31 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 32 | % 33 | % Copyright (C) 2006, 2007 Matthias S. Brennwald. 34 | % Contact: info@audioroot.net 35 | % Further information: http://www.audioroot.net/MATAA 36 | 37 | if isscalar(t) % t is the sampling frequency 38 | t = [0 : 1/t : (length(s)-1)/t]; 39 | end 40 | 41 | % crop the signal: 42 | i=find((t>=t_start) & (t<=t_end)); 43 | t=t(i); t = t-min(t); 44 | s=s(i); 45 | 46 | -------------------------------------------------------------------------------- /mataa_tools/mataa_signal_autocorr.m: -------------------------------------------------------------------------------- 1 | function [c,T] = mataa_signal_autocorr (s,t); 2 | 3 | % function [c,T] = mataa_signal_autocorr (s,t); 4 | % 5 | % DESCRIPTION: 6 | % Autocorrelation c(T) of signal s(t), for positive delays (T>=0). 7 | % 8 | % INPUT: 9 | % s: vector containing the samples values of the signal. 10 | % t: time values of the signal samples (vector, in seconds, with evenly spaced values) or sample rate (scalar, in Hz). 11 | % 12 | % OUTPUT: 13 | % c: vector containing the autocorrelation of s. 14 | % T: time lag (vector). 15 | % 16 | % DISCLAIMER: 17 | % This file is part of MATAA. 18 | % 19 | % MATAA is free software; you can redistribute it and/or modify 20 | % it under the terms of the GNU General Public License as published by 21 | % the Free Software Foundation; either version 2 of the License, or 22 | % (at your option) any later version. 23 | % 24 | % MATAA is distributed in the hope that it will be useful, 25 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | % GNU General Public License for more details. 28 | % 29 | % You should have received a copy of the GNU General Public License 30 | % along with MATAA; if not, write to the Free Software 31 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 32 | % 33 | % Copyright (C) 2007, 2008 Matthias S. Brennwald. 34 | % Contact: info@audioroot.net 35 | % Further information: http://www.audioroot.net/MATAA 36 | 37 | if isscalar(t) % sample rate given instead of time values 38 | t = [0:1/t:(length(s)-1)/t]; 39 | end 40 | 41 | if exist('OCTAVE_VERSION','builtin') 42 | c = autocov(s); 43 | c = c/c(1); 44 | else 45 | c = xcorr(s,'coeff'); 46 | c = c(length(s):end); 47 | end 48 | 49 | T = t-t(1); 50 | -------------------------------------------------------------------------------- /mataa_tools/mataa_IR_to_ETC.m: -------------------------------------------------------------------------------- 1 | function [etc,t] = mataa_IR_to_ETC (h,t); 2 | 3 | % function [etc,t] = mataa_IR_to_ETC (h,t); 4 | % 5 | % DESCRIPTION: 6 | % This function calculates the energy-time-curve (ETC) from the impulse response h(t). 7 | % The ETC is the envelope (magnitude) of the analytic signal of h (see D'Appolito, J.: Testing Loudspeakers, p. 125) 8 | % 9 | % INPUT: 10 | % h: impulse response (in volts) 11 | % t: time coordinates of samples in h (vector, in seconds) or sampling rate of h (scalar, in Hz) 12 | % 13 | % OUTPUT: 14 | % etc: energy-time curve 15 | % t: time coordinates of etc (in seconds) 16 | % 17 | % EXAMPLE: 18 | % > [h,t] = mataa_IR_demo; 19 | % > [etc,t] = mataa_IR_to_ETC(h,t); 20 | % > mataa_plot_ETC_lin(etc,t) 21 | % DISCLAIMER: 22 | % This file is part of MATAA. 23 | % 24 | % MATAA is free software; you can redistribute it and/or modify 25 | % it under the terms of the GNU General Public License as published by 26 | % the Free Software Foundation; either version 2 of the License, or 27 | % (at your option) any later version. 28 | % 29 | % MATAA is distributed in the hope that it will be useful, 30 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 31 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 32 | % GNU General Public License for more details. 33 | % 34 | % You should have received a copy of the GNU General Public License 35 | % along with MATAA; if not, write to the Free Software 36 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 37 | % 38 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 39 | % Contact: info@audioroot.net 40 | % Further information: http://www.audioroot.net/MATAA 41 | 42 | if isscalar(t) 43 | t = [0:1/t:(length(h)-1)/t]; 44 | end 45 | 46 | etc = abs( h + i*mataa_hilbert(h)); 47 | -------------------------------------------------------------------------------- /mataa_tools/mataa_plot_IR.m: -------------------------------------------------------------------------------- 1 | function mataa_plot_IR (h,t,annote); 2 | 3 | % function mataa_plot_IR (h,t,annote); 4 | % 5 | % DESCRIPTION: 6 | % This function plots the impulse response h(t). 7 | % 8 | % INPUT: 9 | % h: impulse response samples 10 | % t: time coordinates of impulse response samples (vector, in seconds), or, alternatively, the sampling frequency of h(t) (scalar, in Hz) 11 | % annote (optional): text note to be added to the plot title. 12 | % 13 | % EXAMPLE: 14 | % > [h,t] = mataa_IR_demo; 15 | % > mataa_plot_IR(h,t,'demo impulse response'); 16 | % 17 | % DISCLAIMER: 18 | % This file is part of MATAA. 19 | % 20 | % MATAA is free software; you can redistribute it and/or modify 21 | % it under the terms of the GNU General Public License as published by 22 | % the Free Software Foundation; either version 2 of the License, or 23 | % (at your option) any later version. 24 | % 25 | % MATAA is distributed in the hope that it will be useful, 26 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | % GNU General Public License for more details. 29 | % 30 | % You should have received a copy of the GNU General Public License 31 | % along with MATAA; if not, write to the Free Software 32 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 33 | % 34 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 35 | % Contact: info@audioroot.net 36 | % Further information: http://www.audioroot.net/MATAA 37 | 38 | if ~exist('annote','var') 39 | annote = ''; 40 | end 41 | 42 | if length (annote) > 0 43 | annote = sprintf (' (%s)',annote); 44 | end 45 | 46 | annote = sprintf ('MATAA: Impulse response%s',annote); 47 | 48 | mataa_plot_time_signal (h,t,annote,'Impulse response',mataa_settings ('plotWindow_IR')); 49 | -------------------------------------------------------------------------------- /mataa_tools/mataa_plot_SR.m: -------------------------------------------------------------------------------- 1 | function mataa_plot_SR (h,t,annote); 2 | 3 | % function mataa_plot_SR (h,t,annote); 4 | % 5 | % DESCRIPTION: 6 | % This function plots the step response h(t). 7 | % 8 | % INPUT: 9 | % h: step response samples 10 | % t: time coordinates of response response samples (vector), or, alternatively, the sampling frequency of h(t) (scalar) 11 | % annote (optional): text note to be added to the plot title. 12 | % 13 | % EXAMPLE: 14 | % > [h,t] = mataa_IR_demo; 15 | % > [h,t] = mataa_IR_to_SR(h,t); 16 | % > mataa_plot_SR(h,t,'demo step response'); 17 | % 18 | % DISCLAIMER: 19 | % This file is part of MATAA. 20 | % 21 | % MATAA is free software; you can redistribute it and/or modify 22 | % it under the terms of the GNU General Public License as published by 23 | % the Free Software Foundation; either version 2 of the License, or 24 | % (at your option) any later version. 25 | % 26 | % MATAA is distributed in the hope that it will be useful, 27 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | % GNU General Public License for more details. 30 | % 31 | % You should have received a copy of the GNU General Public License 32 | % along with MATAA; if not, write to the Free Software 33 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 34 | % 35 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 36 | % Contact: info@audioroot.net 37 | % Further information: http://www.audioroot.net/MATAA 38 | 39 | if ~exist('annote','var') 40 | annote = ''; 41 | end 42 | 43 | if length (annote) > 0 44 | annote = sprintf (' (%s)',annote); 45 | end 46 | 47 | annote = sprintf ('MATAA: Step response%s',annote); 48 | 49 | mataa_plot_time_signal (h,t,annote,'Step response',mataa_settings ('plotWindow_SR')); 50 | -------------------------------------------------------------------------------- /mataa_tools/mataa_plot_save.m: -------------------------------------------------------------------------------- 1 | function mataa_plot_save (fileName); 2 | 3 | % function mataa_plot_save (fileName); 4 | % 5 | % DESCRIPTION: 6 | % Saves the last plot to an EPS (encapsulated post script) file. 7 | % 'fileName' is the name (and path) of the file. If it does not include a path, the file is saved to the current directory (type 'pwd' to see the current directory). 8 | % 9 | % DISCLAIMER: 10 | % This file is part of MATAA. 11 | % 12 | % MATAA is free software; you can redistribute it and/or modify 13 | % it under the terms of the GNU General Public License as published by 14 | % the Free Software Foundation; either version 2 of the License, or 15 | % (at your option) any later version. 16 | % 17 | % MATAA is distributed in the hope that it will be useful, 18 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | % GNU General Public License for more details. 21 | % 22 | % You should have received a copy of the GNU General Public License 23 | % along with MATAA; if not, write to the Free Software 24 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 25 | % 26 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 27 | % Contact: info@audioroot.net 28 | % Further information: http://www.audioroot.net/MATAA 29 | 30 | if length(fileName) < 4 31 | fileName = [ fileName '.eps' ]; 32 | elseif ~strcmp(fileName(end-3:end),'.eps') 33 | fileName = [fileName '.eps']; 34 | end 35 | 36 | if exist('print','file') 37 | or = orient; 38 | orient('landscape'); 39 | print('-dpsc',fileName); 40 | orient(or); 41 | else 42 | error('mataa_plot_save: print function is missing. If you are using Octave, you may need to upgrade to a more current version of Octave (3.0 or loater is recommended).') 43 | end 44 | -------------------------------------------------------------------------------- /mataa_tools/mataa_audio_playrec_list_devices.m: -------------------------------------------------------------------------------- 1 | function [dev_names, dev_IDs] = mataa_audio_playrec_list_devices (); 2 | 3 | % function [dev_names, dev_IDs] = mataa_audio_playrec_list_devices (); 4 | % 5 | % DESCRIPTION: 6 | % Return IDs and names of all audio devices that are available with PlayRec 7 | % 8 | % INPUT: 9 | % (none) 10 | % 11 | % OUTPUT: 12 | % dev_names: names / labels of the audio devices (cell string) 13 | % dev_IDs: PlayRec IDs of the audio devices (vector) 14 | % 15 | % DISCLAIMER: 16 | % This file is part of MATAA. 17 | % 18 | % MATAA is free software; you can redistribute it and/or modify 19 | % it under the terms of the GNU General Public License as published by 20 | % the Free Software Foundation; either version 2 of the License, or 21 | % (at your option) any later version. 22 | % 23 | % MATAA is distributed in the hope that it will be useful, 24 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | % GNU General Public License for more details. 27 | % 28 | % You should have received a copy of the GNU General Public License 29 | % along with MATAA; if not, write to the Free Software 30 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 31 | % 32 | % Copyright (C) 2020 Matthias S. Brennwald. 33 | % Contact: info@audioroot.net 34 | % Further information: http://www.audioroot.net/MATAA 35 | 36 | dev_names = {}; 37 | dev_IDs = []; 38 | 39 | if ~exist('playrec') 40 | warning ('mataa_audio_playrec_list_devices: PlayRec is not available. Please see the MATAA manual for instructions on how to install PlayRec.') 41 | else 42 | d = playrec('getDevices'); 43 | for k = 1:length(d) 44 | dev_names{end+1} = undo_string_escapes (d(k).name); 45 | dev_IDs = [ dev_IDs ; d(k).deviceID ]; 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /mataa_tools/mataa_signal_pad_Zeros.m: -------------------------------------------------------------------------------- 1 | function [s,t] = mataa_signal_pad_Zeros (s0,t0,T); 2 | 3 | % function [s,t] = mataa_signal_pad_Zeros (s0,t0,T); 4 | % 5 | % DESCRIPTION: 6 | % This function pads a signal s0(t0) with zeroes, i.e. replaces signal s0(t0) with s(t), where... 7 | % ...s(t=t0) = s0(t0) 8 | % ...s(t>max(t0) and t T 34 | warning('Signal is longer than desired length after zero padding. No zero padding applied.') 35 | s = s0; 36 | t = t0; 37 | else 38 | dt = t0(2)-t0(1); 39 | 40 | % make sure we've got column vectors: 41 | t0 = reshape(t0,length(t0),1); 42 | s0 = reshape(s0,length(s0),1); 43 | 44 | % make sure T is multiple of dt: 45 | T = round(T/dt)*dt; 46 | 47 | % pad the signal 48 | T = [t0(end)+dt:dt:T]'; 49 | t = [ t0 ; T ]; 50 | s = [ s0 ; repmat(0,length(T),1) ]; 51 | end 52 | -------------------------------------------------------------------------------- /mataa_tools/mataa_signal_removeHF.m: -------------------------------------------------------------------------------- 1 | function [s,t] = mataa_signal_removeHF (s,t,fc); 2 | 3 | % function [s,t] = mataa_signal_removeHF (s,t,fc); 4 | % 5 | % DESCRIPTION: 6 | % Removes signal components with frequencies higher than fc from s(t) by repeated convolution of s with a Hann window. 7 | % 8 | % INPUT: 9 | % s: signal samples 10 | % t: time (vector, in seconds) or sampling frequency (scalar, in Hz) 11 | % fc: cut-off frequency (in Hz) 12 | % 13 | % OUTPUT: 14 | % s: filtered signal samples 15 | % t: time 16 | % 17 | % DISCLAIMER: 18 | % This file is part of MATAA. 19 | % 20 | % MATAA is free software; you can redistribute it and/or modify 21 | % it under the terms of the GNU General Public License as published by 22 | % the Free Software Foundation; either version 2 of the License, or 23 | % (at your option) any later version. 24 | % 25 | % MATAA is distributed in the hope that it will be useful, 26 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | % GNU General Public License for more details. 29 | % 30 | % You should have received a copy of the GNU General Public License 31 | % along with MATAA; if not, write to the Free Software 32 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 33 | % 34 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 35 | % Contact: info@audioroot.net 36 | % Further information: http://www.audioroot.net/MATAA 37 | 38 | if isscalar(t) 39 | fs = t; 40 | t = [0:1/fs:(length(s)-1)/fs]; 41 | else 42 | fs = 1 / (t(2)-t(1)); % sampling frequency 43 | end 44 | 45 | w = 1/fc; % window width 46 | 47 | n = round(w*fs); 48 | 49 | if ~mod(n,2) 50 | n = n+1; 51 | end 52 | 53 | % repeat to get better HF removal 54 | s = mataa_running_mean(s,n,'hann'); 55 | s = mataa_running_mean(s,n,'hann'); 56 | -------------------------------------------------------------------------------- /mataa_tools/mataa_octave_version.m: -------------------------------------------------------------------------------- 1 | function [version,subversion,subsubversion] = mataa_octave_version 2 | 3 | % function [version,subversion,subsubversion] = mataa_octave_version 4 | % 5 | % DESCRIPTION: 6 | % Returns the Octave version. If called with Matlab, the output values are set to NaN. 7 | % 8 | % INPUT: 9 | % (none) 10 | % 11 | % OUTPUT: 12 | % version: main version 13 | % subversion: subversion 14 | % subsubversion: subsubversion 15 | % 16 | % EXAMPLE: 17 | % With Octave 2.1.73, the output is: 18 | % version = 2 19 | % subversion = 1 20 | % subsubversion = 73 21 | % 22 | % DISCLAIMER: 23 | % This file is part of MATAA. 24 | % 25 | % MATAA is free software; you can redistribute it and/or modify 26 | % it under the terms of the GNU General Public License as published by 27 | % the Free Software Foundation; either version 2 of the License, or 28 | % (at your option) any later version. 29 | % 30 | % MATAA is distributed in the hope that it will be useful, 31 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 32 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 33 | % GNU General Public License for more details. 34 | % 35 | % You should have received a copy of the GNU General Public License 36 | % along with MATAA; if not, write to the Free Software 37 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 38 | % 39 | % Copyright (C) 2007, 2008 Matthias S. Brennwald. 40 | % Contact: info@audioroot.net 41 | % Further information: http://www.audioroot.net/MATAA 42 | 43 | if exist('OCTAVE_VERSION','builtin') 44 | v = OCTAVE_VERSION; 45 | p = findstr('.',v); 46 | version = str2num(v(1:p(1)-1)); 47 | subversion = str2num(v(p(1)+1:p(2)-1)); 48 | subsubversion = str2num(v(p(2)+1:end)); 49 | else 50 | version = NaN; 51 | subversion = NaN; 52 | subsubversion = NaN; 53 | end 54 | 55 | -------------------------------------------------------------------------------- /mataa_tools/mataa_plot_ETC_lin.m: -------------------------------------------------------------------------------- 1 | function mataa_plot_ETC_lin (etc,t,annote); 2 | 3 | % function mataa_plot_ETC_lin (etc,t,annote); 4 | % 5 | % DESCRIPTION: 6 | % Plots the energy-time-curve (ETC) etc(t), using a linear y-axis scale. 7 | % 8 | % INPUT: 9 | % etc: values of the energy-time curve (vector) 10 | % t: time values (vector) 11 | % annote (optional): annotation to the plot title (string) 12 | % 13 | % OUTPUT: 14 | % (none) 15 | % 16 | % EXAMPLE: 17 | % > t = [0:100]/1000; h = sin(200*t).*exp(-70*t); 18 | % > etc = mataa_IR_to_ETC(h,t); 19 | % > mataa_plot_ETC(t,etc, 'damped sine'); 20 | % 21 | % DISCLAIMER: 22 | % This file is part of MATAA. 23 | % 24 | % MATAA is free software; you can redistribute it and/or modify 25 | % it under the terms of the GNU General Public License as published by 26 | % the Free Software Foundation; either version 2 of the License, or 27 | % (at your option) any later version. 28 | % 29 | % MATAA is distributed in the hope that it will be useful, 30 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 31 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 32 | % GNU General Public License for more details. 33 | % 34 | % You should have received a copy of the GNU General Public License 35 | % along with MATAA; if not, write to the Free Software 36 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 37 | % 38 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 39 | % Contact: info@audioroot.net 40 | % Further information: http://www.audioroot.net/MATAA 41 | 42 | if ~exist('annote','var') 43 | annote = ''; 44 | end 45 | 46 | if length (annote) > 0 47 | annote = sprintf (' (%s)',annote); 48 | end 49 | 50 | annote = sprintf ('MATAA: energy-time curve%s',annote); 51 | 52 | h = mataa_plot_one (t,etc,mataa_settings ('plotWindow_ETC'),annote,'Time (s)','ETC (linear)'); 53 | -------------------------------------------------------------------------------- /mataa_tools/mataa_convolve.m: -------------------------------------------------------------------------------- 1 | function z = mataa_convolve(x,y); 2 | 3 | % function z = mataa_convolve(x,y); 4 | % 5 | % DESCRIPTION: 6 | % This function convolves two data series x and y. The convolution is done using the fourier-transform method. x and y should have the same length (pad zeroes, if necessary). The result of the convolution (z) will also be of the same length as x and y. 7 | % 8 | % see also http://rkb.home.cern.ch/rkb/AN16pp/node38.html 9 | % 10 | % EXAMPLE: 11 | % T = 1; fs = 44100; f0 = 10; 12 | % t = [1/fs:1/fs:T]; 13 | % x = sin(2*pi*f0*t); 14 | % y = zeros (size(x)); 15 | % y(1000) = -1.5; 16 | % z = mataa_convolve (x,y); 17 | % plot (t,x,'r',t,y,'k',t,z,'b') 18 | % 19 | % DISCLAIMER: 20 | % This file is part of MATAA. 21 | % 22 | % MATAA is free software; you can redistribute it and/or modify 23 | % it under the terms of the GNU General Public License as published by 24 | % the Free Software Foundation; either version 2 of the License, or 25 | % (at your option) any later version. 26 | % 27 | % MATAA is distributed in the hope that it will be useful, 28 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | % GNU General Public License for more details. 31 | % 32 | % You should have received a copy of the GNU General Public License 33 | % along with MATAA; if not, write to the Free Software 34 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 35 | % 36 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 37 | % Contact: info@audioroot.net 38 | % Further information: http://www.audioroot.net/MATAA 39 | 40 | if length(x) ~= length(y) 41 | error ('mataa_convolve: arguments x and y must be same length!') 42 | end 43 | 44 | X = mataa_realFT0 (x,[1:length(x)]); 45 | Y = mataa_realFT0 (y,[1:length(y)]); 46 | Z = X .* Y; 47 | z = mataa_realIFT0 (Z,[0:length(Z)-1]); -------------------------------------------------------------------------------- /mataa_tools/mataa_plot_ETC_dB.m: -------------------------------------------------------------------------------- 1 | function mataa_plot_ETC_dB (etc,t,annote,dB_range); 2 | 3 | % function mataa_plot_ETC_log (etc,t,annote,dB_range); 4 | % 5 | % DESCRIPTION: 6 | % Same as mataa_plot_ETC, but uses a dB scale for the vertical axis. 7 | % The 'dB_range' parameter (optional) can be given to specify the dB range to be plotted. If not specified, a default value of 60 dB is used 8 | % 9 | % DISCLAIMER: 10 | % This file is part of MATAA. 11 | % 12 | % MATAA is free software; you can redistribute it and/or modify 13 | % it under the terms of the GNU General Public License as published by 14 | % the Free Software Foundation; either version 2 of the License, or 15 | % (at your option) any later version. 16 | % 17 | % MATAA is distributed in the hope that it will be useful, 18 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | % GNU General Public License for more details. 21 | % 22 | % You should have received a copy of the GNU General Public License 23 | % along with MATAA; if not, write to the Free Software 24 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 25 | % 26 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 27 | % Contact: info@audioroot.net 28 | % Further information: http://www.audioroot.net/MATAA 29 | 30 | if ~exist('annote','var') 31 | annote = ''; 32 | end 33 | 34 | if length (annote) > 0 35 | annote = sprintf (' (%s)',annote); 36 | end 37 | 38 | annote = sprintf ('MATAA: energy-time curve%s',annote); 39 | etc = 20*log(etc); 40 | 41 | h = mataa_plot_one (t,etc,mataa_settings ('plotWindow_ETC'),annote,'Time (s)','ETC (dB)'); 42 | 43 | if ~exist('dB_range','var') 44 | dB_range=60; 45 | end 46 | 47 | r = axis (h); r(3) = max(etc)-dB_range; 48 | figure (get(h,'parent')); % make sure the right figure window is in front 49 | axis (r); 50 | -------------------------------------------------------------------------------- /mataa_tools/mataa_plot_impedance.m: -------------------------------------------------------------------------------- 1 | function mataa_plot_impedance (mag,phase,f,annote); 2 | 3 | % function mataa_plot_impedance (mag,phase,f,annote); 4 | % 5 | % DESCRIPTION: 6 | % Plots impedance (magnitude and phase) versus frequency. 7 | % 8 | % INPUT: 9 | % mag: impedance magnitude (Ohm) 10 | % phase: impedance phase (degrees) 11 | % f: frequency (Hz) 12 | % annote (optional): text note to be added to the plot title. 13 | % 14 | % OUTPUT: 15 | % (none) 16 | % 17 | % DISCLAIMER: 18 | % This file is part of MATAA. 19 | % 20 | % MATAA is free software; you can redistribute it and/or modify 21 | % it under the terms of the GNU General Public License as published by 22 | % the Free Software Foundation; either version 2 of the License, or 23 | % (at your option) any later version. 24 | % 25 | % MATAA is distributed in the hope that it will be useful, 26 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | % GNU General Public License for more details. 29 | % 30 | % You should have received a copy of the GNU General Public License 31 | % along with MATAA; if not, write to the Free Software 32 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 33 | % 34 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 35 | % Contact: info@audioroot.net 36 | % Further information: http://www.audioroot.net/MATAA 37 | 38 | if ~exist ('annote','var') 39 | annote = ''; 40 | end 41 | 42 | if length (annote) > 0 43 | annote = sprintf (' (%s)',annote); 44 | end 45 | 46 | annote = sprintf ('MATAA: impedance%s',annote); 47 | 48 | h = mataa_plot_two_logX (f,mag,mod (phase+180,360)-180,mataa_settings ('plotWindow_impedance'),annote,'Frequency (Hz)','Magnitude (Ohm)','Phase (deg.)'); 49 | 50 | if ~isnan(h(2)) 51 | r = axis(h(2)); r([3,4]) = [-180 180]; axis(r); 52 | set (h(2),'ytick',[-180:90:180]); 53 | end 54 | -------------------------------------------------------------------------------- /calibration/EARTHWORKS_M23_2298J_MICROPHONE.txt: -------------------------------------------------------------------------------- 1 | % Microphone calibration data for Earthworks M23 (SN 2298J) 2 | % Earthworks calibration data, Dec-2018 3 | % Original data from Tod Davis (19.12.2018) 4 | 5 | 6 | name = Earthworks M23 (SN 2298J) 7 | type = Microphone 8 | 9 | % gain at 1000 Hz as specified in Earthworks certificate: 10 | sensitivity = 31.9 mV/Pa 11 | 12 | % Gain relative to sensitivity at 1 kHz: 13 | % (column-1: frequency (Hz), column-2: gain (dB) 14 | 5.000 -2.97751395663981 15 | 10.000 0.032786 16 | 765.4139 0.032786 17 | 818.201 0.055624 18 | 870.9882 0.053576 19 | 950.1689 0.026837 20 | 1002.956 0.0 21 | 1082.137 -0.035618 22 | 1161.318 -0.040622 23 | 1240.498 -0.018824 24 | 1319.679 0.018123 25 | 1425.253 0.053682 26 | 1530.828 0.051086 27 | 1636.402 0.02182 28 | 1768.37 -0.011218 29 | 1873.944 -0.023861 30 | 2032.306 -0.03339 31 | 2164.274 -0.049936 32 | 2322.635 -0.07385 33 | 2480.997 -0.068201 34 | 2665.752 -0.016605 35 | 2850.507 0.020513 36 | 3061.655 0.055203 37 | 3272.804 0.096838 38 | 3510.346 0.108303 39 | 3774.282 0.097571 40 | 4038.218 0.086954 41 | 4328.547 0.043282 42 | 4645.27 0.034635 43 | 4961.993 -0.000506 44 | 5331.503 -0.046779 45 | 5701.014 -0.055982 46 | 6123.311 -0.040099 47 | 6572.002 -0.068972 48 | 7020.693 -0.174224 49 | 7548.564 -0.267559 50 | 8076.436 -0.190292 51 | 8657.095 -0.156606 52 | 9290.541 -0.201133 53 | 9950.38 -0.204841 54 | 10663.01 -0.02328 55 | 11428.42 0.175896 56 | 12246.62 0.122744 57 | 13117.61 0.432521 58 | 14067.78 0.503897 59 | 15070.73 0.488959 60 | 16152.87 0.546669 61 | 17314.19 0.370477 62 | 18554.69 0.437195 63 | 19900.76 0.373098 64 | 21326.01 0.277834 65 | 22856.84 0.39938 66 | 24493.24 0.478922 67 | 26261.61 0.603972 68 | 28135.56 0.724677 69 | 30167.86 0.631272 70 | 32332.14 0.390862 71 | 34628.38 -0.051036 72 | 37135.77 -0.6586277 73 | 39801.52 -1.6420493 74 | 42652.03 -2.4432752 75 | 45713.68 -3.189894 76 | 48986.49 -3.624407 77 | -------------------------------------------------------------------------------- /mataa_tools/mataa_plot_one.m: -------------------------------------------------------------------------------- 1 | function h = mataa_plot_one (x,y,figNum,plottit,xtit,ytit); 2 | 3 | % function h = mataa_plot_one (x,y,figNum,plottit,xtit,ytit); 4 | % 5 | % DESCRIPTION: 6 | % Plots y vs. x. 7 | % 8 | % INPUT: 9 | % x: x values 10 | % y: y values to be plotted vs. x. 11 | % figNum: number (handle) of the figure window to be used for the plot. Use figNum = [] if the default window is to be used (e.g. the current plot window) 12 | % plottit: plot title. 13 | % xtit: x-axis label 14 | % ytit: y-axis label 15 | % 16 | % OUTPUT: 17 | % h: handle to the axes of the plot. 18 | % 19 | % DISCLAIMER: 20 | % This file is part of MATAA. 21 | % 22 | % MATAA is free software; you can redistribute it and/or modify 23 | % it under the terms of the GNU General Public License as published by 24 | % the Free Software Foundation; either version 2 of the License, or 25 | % (at your option) any later version. 26 | % 27 | % MATAA is distributed in the hope that it will be useful, 28 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | % GNU General Public License for more details. 31 | % 32 | % You should have received a copy of the GNU General Public License 33 | % along with MATAA; if not, write to the Free Software 34 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 35 | % 36 | % Copyright (C) 2007, 2008 Matthias S. Brennwald. 37 | % Contact: info@audioroot.net 38 | % Further information: http://www.audioroot.net/MATAA 39 | 40 | h = NaN; 41 | 42 | x = x(:); 43 | y = y(:); 44 | 45 | if size (x) ~= size (y) 46 | error ('mataa_plot_one: size of x and y data does not agree.') 47 | end 48 | 49 | color = mataa_settings ('plotColor'); 50 | if ~isempty(figNum) 51 | figure (figNum); 52 | end 53 | mataa_plot_defaults; 54 | 55 | plot (x,y,color) 56 | title (plottit); 57 | ylabel (ytit); 58 | xlabel (xtit); 59 | 60 | h = gca; 61 | -------------------------------------------------------------------------------- /mataa_tools/mataa_hilbert.m: -------------------------------------------------------------------------------- 1 | function y = mataa_hilbert (x) 2 | 3 | % function y = mataa_hilbert (x) 4 | % 5 | % DESCRIPTION: 6 | % Calculates the Hilbert transform of x. 7 | % 8 | % This code was modelled after the Hilbert transform function 'hilbert.m' available from Octave-Forge 9 | % 10 | % INPUT: 11 | % x: input signal (column vector). If x contains complex values, only the real part of these values will be used. 12 | % 13 | % OUTPUT: 14 | % y: hilbert transform of x 15 | % 16 | % DISCLAIMER: 17 | % This file is part of MATAA. 18 | % 19 | % MATAA is free software; you can redistribute it and/or modify 20 | % it under the terms of the GNU General Public License as published by 21 | % the Free Software Foundation; either version 2 of the License, or 22 | % (at your option) any later version. 23 | % 24 | % MATAA is distributed in the hope that it will be useful, 25 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | % GNU General Public License for more details. 28 | % 29 | % You should have received a copy of the GNU General Public License 30 | % along with MATAA; if not, write to the Free Software 31 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 32 | % 33 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 34 | % Contact: info@audioroot.net 35 | % Further information: http://www.audioroot.net/MATAA 36 | 37 | if any(imag(x)) 38 | warning('mataa_hilbert: complex components of input will be ignored!') 39 | end 40 | 41 | x = real(x); % discard any complex components from input 42 | 43 | transpose = size(x,1)==1; 44 | if transpose 45 | x = x'; 46 | end 47 | r = length(x); 48 | n=2^nextpow2(r); 49 | if r < n 50 | x = [ x ; zeros(n-r, 1) ]; 51 | end 52 | y = fft(x); 53 | 54 | y = ifft([y(1,:) ; 2*y(2:n/2,:) ; y(n/2+1,:) ; zeros(n/2-1,1)]); 55 | if r < n 56 | y(r+1:n,:) = []; 57 | end 58 | 59 | y = imag(y); 60 | 61 | if transpose 62 | y = y'; 63 | end 64 | -------------------------------------------------------------------------------- /mataa_tools/mataa_t_to_f0.m: -------------------------------------------------------------------------------- 1 | function f = mataa_t_to_f0 (t); 2 | 3 | % function f = mataa_t_to_f0 (t); 4 | % 5 | % DESCRIPTION: 6 | % This function returns the frequency bins of the fourier spectrum of a signal sampled at times t (vector). t must be be sorted and evenly spaced for this. 7 | % 8 | % INPUT: 9 | % t: time values (vector, in seconds) of the signal 10 | % 11 | % OUTPUT: 12 | % f: vector of the fourier-frequency bins (in Hz) 13 | % 14 | % DISCLAIMER: 15 | % This file is part of MATAA. 16 | % 17 | % MATAA is free software; you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation; either version 2 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % MATAA is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with MATAA; if not, write to the Free Software 29 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 30 | % 31 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 32 | % Contact: info@audioroot.net 33 | % Further information: http://www.audioroot.net/MATAA 34 | 35 | t = sort(t); % t should be sorted anyway, but it does not hurt to make sure it is. 36 | u = diff(t); 37 | dt = mean(u); 38 | 39 | if (std(u)/dt > 200) % if the relative variability in the time values exceeds 2%: 40 | error('mataa_t_to_f0: t must be even spaced!') 41 | end 42 | 43 | N = length(t); % number of samples in signal 44 | T = N*dt; % duration of the signal 45 | 46 | % determine N (number of positive frequencies, including f=0): 47 | if mod(N,2) 48 | N = (N-1)/2+1; 49 | else 50 | N = N/2+1; 51 | end 52 | 53 | % frequency vector: 54 | f = [0:N-1]/T; 55 | 56 | if size(t,1) > size(t,2) % t is a column vector 57 | f = f'; 58 | end 59 | -------------------------------------------------------------------------------- /mataa_tools/mataa_file_default_name.m: -------------------------------------------------------------------------------- 1 | function name = mataa_file_default_name (ask); 2 | 3 | % function name = mataa_file_default_name; 4 | % 5 | % DESCRIPTION: 6 | % This function returns a file name that can be used to save MATAA data. If 'ask' is nonzero, the user is asked to enter a file name. If no answer is given or if 'ask' is zero, a default file name made up of the current date and time of day is returned. 7 | % 8 | % INPUT: 9 | % ask: flag to specify if the user should be asked for a file name. If 'ask' is not specified, ask=0 is assumed. 10 | % 11 | % OUTPUT: 12 | % name: file name 13 | % 14 | % DISCLAIMER: 15 | % This file is part of MATAA. 16 | % 17 | % MATAA is free software; you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation; either version 2 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % MATAA is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with MATAA; if not, write to the Free Software 29 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 30 | % 31 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 32 | % Contact: info@audioroot.net 33 | % Further information: http://www.audioroot.net/MATAA 34 | 35 | if ~exist('ask','var') 36 | ask = 0; 37 | end 38 | 39 | c = clock; 40 | c = [ 'mataafile_' num2str(c(1)) '_' num2str(c(2)) '_' num2str(c(3)) '_' num2str(c(4)) '_' num2str(c(5)) '_' num2str(round(c(6))) '.mat' ]; 41 | cd(mataa_path('data')); 42 | name = []; 43 | if ask 44 | name = input(sprintf('Enter name of file to save data (default is ''%s'', path is %s): ',c,pwd),'s'); 45 | end 46 | 47 | if isempty(name) 48 | name = c; 49 | end 50 | 51 | if ~strcmp(name(end-3:end),'.mat') 52 | name = [name '.mat']; 53 | end 54 | -------------------------------------------------------------------------------- /mataa_tools/mataa_minimum_phase.m: -------------------------------------------------------------------------------- 1 | function min_phase = mataa_minimum_phase (mag,f); 2 | 3 | % function min_phase = mataa_minimum_phase (mag,f); 4 | % 5 | % DESCRIPTION: 6 | % Calculates minimum phase from magnitude frequency response using the Hilbert transform (see http://en.wikipedia.org/wiki/Minimum_phase#Relationship_of_magnitude_response_to_phase_response). 7 | % 8 | % 9 | % INPUT: 10 | % mag: magnitude of frequency response (in dB) 11 | % f: frequency coordinates of mag (in Hz) 12 | % 13 | % OUTPUT: 14 | % min_phase: minimum phase at frequnecies f (unwrapped, in degrees) 15 | % 16 | % DISCLAIMER: 17 | % This file is part of MATAA. 18 | % 19 | % MATAA is free software; you can redistribute it and/or modify 20 | % it under the terms of the GNU General Public License as published by 21 | % the Free Software Foundation; either version 2 of the License, or 22 | % (at your option) any later version. 23 | % 24 | % MATAA is distributed in the hope that it will be useful, 25 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | % GNU General Public License for more details. 28 | % 29 | % You should have received a copy of the GNU General Public License 30 | % along with MATAA; if not, write to the Free Software 31 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 32 | % 33 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 34 | % Contact: info@audioroot.net 35 | % Further information: http://www.audioroot.net/MATAA 36 | 37 | %%%% % calculate minimum phase using the Hilbert transform: 38 | %%%% % see: http://www.fourelectronics.com/Hilbert-transform-to-calculate-Magnitude-from-Phase-10052397.html 39 | %%%% % and: http://www.dsprelated.com/showmessage/29416/1.php 40 | %%%% % this should use the NATURAL log, and 'abs(p)' rather than '10*abs(p)'! 41 | 42 | % convert mag from dB to natural units: 43 | mag = mag/20; 44 | mag = 10.^mag; 45 | 46 | u = log(mag); 47 | % normalize mag to avoid dependency of min_phase on the scaling of mag 48 | u = u-mean(u); 49 | 50 | 51 | min_phase = -mataa_hilbert(u)/pi*180; 52 | -------------------------------------------------------------------------------- /mataa_tools/mataa_deConvolve.m: -------------------------------------------------------------------------------- 1 | function [y] = mataa_deConvolve(z,x); 2 | 3 | % function [y] = mataa_deConvolve(z,x); 4 | % 5 | % DESCRIPTION: 6 | % This function deconvolves z from x. In other words: if z = x*y ('z is the convolution of x and y'), then this function calculates y from z and x. The deconvolution is done using the fourier-transform method. z and x should have the same length (pad zeroes, if necessary). 7 | % 8 | % see also http://rkb.home.cern.ch/rkb/AN16pp/node38.html 9 | % 10 | % Example (calculate impulse response of a loudspeaker or other DUT): 11 | % x: the input signal sent to the speaker (known), length(x) = Lx 12 | % y: the impulse response of the speaker (not known), length(y) = Ly 13 | % z: the measured response of the speaker to signal x (known), length(z) = Lz 14 | % then: z = x*y 15 | % note: Lz = Lx + Ly -1 16 | % 17 | % then: Z = XY (where the uppercase letters denote the complex fourier transforms of x, y, and z) 18 | % or: fft(z) = fft(x) fft(y), where x and y are padded with zeros to length Lz 19 | % hence fft(y) = fft(z) / fft(x), or y = ifft( fft(z) / fft(x) ) 20 | % 21 | % DISCLAIMER: 22 | % This file is part of MATAA. 23 | % 24 | % MATAA is free software; you can redistribute it and/or modify 25 | % it under the terms of the GNU General Public License as published by 26 | % the Free Software Foundation; either version 2 of the License, or 27 | % (at your option) any later version. 28 | % 29 | % MATAA is distributed in the hope that it will be useful, 30 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 31 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 32 | % GNU General Public License for more details. 33 | % 34 | % You should have received a copy of the GNU General Public License 35 | % along with MATAA; if not, write to the Free Software 36 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 37 | % 38 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 39 | % Contact: info@audioroot.net 40 | % Further information: http://www.audioroot.net/MATAA 41 | 42 | x=x(:); z= z(:); 43 | 44 | y=ifft(fft(z)./fft(x)); 45 | 46 | % get rid of the complex 'noise': 47 | y=real(y); 48 | -------------------------------------------------------------------------------- /mataa_tools/mataa_import_AIFF.m: -------------------------------------------------------------------------------- 1 | function [t,s] = mataa_import_AIFF (file); 2 | 3 | % function [t,s] = mataa_import_AIFF (file) 4 | % 5 | % DESCRIPTION: 6 | % Import time-domain data from an AIFF file. This function requires the sndfile-convert utiliy, which is part of libsndfile ( http://www.mega-nerd.com/libsndfile ). 7 | % 8 | % INPUT: 9 | % file: string containing the name of the file containing the data to be imported. The string may contain a complete path. If no path is given, the file is assumed to be located in the current working directory. 10 | % 11 | % OUTPUT: 12 | % t: time values (s) 13 | % s: signal samples 14 | % 15 | % DISCLAIMER: 16 | % This file is part of MATAA. 17 | % 18 | % MATAA is free software; you can redistribute it and/or modify 19 | % it under the terms of the GNU General Public License as published by 20 | % the Free Software Foundation; either version 2 of the License, or 21 | % (at your option) any later version. 22 | % 23 | % MATAA is distributed in the hope that it will be useful, 24 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | % GNU General Public License for more details. 27 | % 28 | % You should have received a copy of the GNU General Public License 29 | % along with MATAA; if not, write to the Free Software 30 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 31 | % 32 | % Copyright (C) 2008 Matthias S. Brennwald. 33 | % Contact: info@audioroot.net 34 | % Further information: http://www.audioroot.net/MATAA 35 | 36 | if nargin == 0 37 | file = ''; 38 | end 39 | 40 | if length (file) == 0 41 | error ('mataa_export_TMD: the file name must not be empty.'); 42 | end 43 | 44 | t = []; 45 | s = []; 46 | comments = cellstr (''); 47 | nc = 0; 48 | 49 | % convert the AIFF file to a MAT file: 50 | outfile = sprintf ('%s.mat',tmpnam); 51 | cmd = sprintf ('sndfile-convert %s %s',file,outfile); 52 | [status, output] = system (cmd); 53 | 54 | X = load (outfile); % load the mat file 55 | 56 | delete (outfile); % clean up 57 | 58 | s = X.wavedata; s = s(:); 59 | t = linspace (0,(length(s)-1)/X.samplerate,length(s)); t = t(:); -------------------------------------------------------------------------------- /mataa_tools/mataa_plot_defaults.m: -------------------------------------------------------------------------------- 1 | function mataa_plot_defaults 2 | 3 | % function mataa_plot_defaults 4 | % 5 | % DESCRIPTION: 6 | % In earlier version of MATAA, this function sets default gnuplot state for MATAA plots in Octave. With the current version of MATAA, this function has no effect. 7 | % 8 | % DISCLAIMER: 9 | % This file is part of MATAA. 10 | % 11 | % MATAA is free software; you can redistribute it and/or modify 12 | % it under the terms of the GNU General Public License as published by 13 | % the Free Software Foundation; either version 2 of the License, or 14 | % (at your option) any later version. 15 | % 16 | % MATAA is distributed in the hope that it will be useful, 17 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | % GNU General Public License for more details. 20 | % 21 | % You should have received a copy of the GNU General Public License 22 | % along with MATAA; if not, write to the Free Software 23 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24 | % 25 | % Copyright (C) 2006 Matthias S. Brennwald. 26 | % Contact: info@audioroot.net 27 | % Further information: http://www.audioroot.net/MATAA 28 | % 29 | % HISTORY: 30 | % 26. December 2007 (Matthias Brennwald): commented out all commands so they have no effect anymore. Leave setting of plotting options to the user. 31 | % first version: 7. November 2006, Matthias Brennwald 32 | 33 | %%%% if exist('OCTAVE_VERSION') 34 | %%%% % do Octave specific stuff here 35 | %%%% else 36 | %%%% % do Matlab specific stuff here 37 | %%%% %%% fh = gcf; 38 | %%%% %%% p = get(fh,'Position'); 39 | %%%% %%% if p([3,4]) == [560 420]; 40 | %%%% %%% % make plots somewhat smaller than default 41 | %%%% %%% p([3,4]) = [450 280]; 42 | %%%% %%% set(fh,'Position',p); 43 | %%%% %%% end 44 | %%%% %%% set(fh,'PaperPositionMode','auto'); % use same plot size for saving files as for plotting on screen 45 | %%%% end 46 | 47 | %%%% if mataa_settings('plotHoldState') 48 | %%%% hold on 49 | %%%% end 50 | %%%% 51 | %%%% % otherwise leave the plot state as it is (the user may have typed 'hold on' or something 52 | -------------------------------------------------------------------------------- /mataa_tools/mataa_plot_time_signal.m: -------------------------------------------------------------------------------- 1 | function mataa_plot_time_signal (s,t,plottit,ytit,plotWindow); 2 | 3 | % function mataa_plot_time_signal (s,t,plottit,xtit,ytit,plotWindow); 4 | % 5 | % DESCRIPTION: 6 | % This function plots the signal s(t). 7 | % 8 | % INPUT: 9 | % s: signal samples 10 | % t: time values (vector, in seconds), or, alternatively, the sampling frequency of the signal (scalar, in Hz) 11 | % plottit: plot title. 12 | % xtit, ytit: labels for the x-axis and y-axis 13 | % plotWindow: number (handle) of the figure window to be used for the plot. Use plotWindow = [] if the default window is to be used (e.g. the current plot window) 14 | % 15 | % DISCLAIMER: 16 | % This file is part of MATAA. 17 | % 18 | % MATAA is free software; you can redistribute it and/or modify 19 | % it under the terms of the GNU General Public License as published by 20 | % the Free Software Foundation; either version 2 of the License, or 21 | % (at your option) any later version. 22 | % 23 | % MATAA is distributed in the hope that it will be useful, 24 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | % GNU General Public License for more details. 27 | % 28 | % You should have received a copy of the GNU General Public License 29 | % along with MATAA; if not, write to the Free Software 30 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 31 | % 32 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 33 | % Contact: info@audioroot.net 34 | % Further information: http://www.audioroot.net/MATAA 35 | 36 | if ~isempty(plotWindow) 37 | figure (plotWindow); 38 | end 39 | 40 | if isscalar(t) % t is the sampling frequency 41 | t = [0 : 1/t : (length(s)-1)/t]; 42 | end 43 | 44 | scale = 0; 45 | while scale > ceil(log10(max(t))) 46 | scale = scale-3; 47 | end 48 | 49 | switch scale 50 | case 0 51 | unit = 's'; 52 | case -3 53 | unit = 'ms'; 54 | case -6 55 | unit = 'us'; 56 | case -9 57 | unit = 'ns'; 58 | otherwise 59 | unit = sprintf('10^{%i} s',scale); 60 | end 61 | mataa_plot_one (t/10^scale,s,plotWindow,plottit,sprintf ('Time (%s)',unit),ytit); 62 | -------------------------------------------------------------------------------- /mataa_tools/mataa_select_signal_window_time.m: -------------------------------------------------------------------------------- 1 | function [t_start,t_end] = mataa_select_signal_window_time; 2 | 3 | % function [t_start,t_end] = mataa_select_signal_window_time; 4 | % 5 | % DESCRIPTION: 6 | % Interactively select start and end times of a signal. 7 | % 8 | % INPUT: 9 | % (none) 10 | % 11 | % OUTPUT: 12 | % t_start: start of selected signal range 13 | % t_end: end of selected signal range 14 | % 15 | % DISCLAIMER: 16 | % This file is part of MATAA. 17 | % 18 | % MATAA is free software; you can redistribute it and/or modify 19 | % it under the terms of the GNU General Public License as published by 20 | % the Free Software Foundation; either version 2 of the License, or 21 | % (at your option) any later version. 22 | % 23 | % MATAA is distributed in the hope that it will be useful, 24 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | % GNU General Public License for more details. 27 | % 28 | % You should have received a copy of the GNU General Public License 29 | % along with MATAA; if not, write to the Free Software 30 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 31 | % 32 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 33 | % Contact: info@audioroot.net 34 | % Further information: http://www.audioroot.net/MATAA 35 | 36 | % input('Make shure that the window showing the signal-plot is active, and the zoom is set accordingly (press ENTER to confirm)...') 37 | 38 | r = axis; 39 | 40 | disp('Click on start of signal (press ENTER to confirm)...'); 41 | fflush (stdout); 42 | [x,y] = ginput; 43 | t_start=x(end); % use last value before ENTER was pressed; 44 | disp(sprintf(' t_start = %g\n', t_start)); fflush (stdout); 45 | 46 | line([t_start t_start],[-1 1],'Color',0.5*[1 1 1]); axis (r); 47 | 48 | disp('Click on end of signal (press ENTER to confirm)...'); fflush (stdout); 49 | [x,y] = ginput; 50 | t_end=x(end); % use last value befor ENTER was pressed; 51 | disp(sprintf(' t_end = %g\n', t_end)); fflush (stdout); 52 | 53 | disp(sprintf(' T = t_end - t_start = %g\n', t_end-t_start)); fflush (stdout); 54 | disp(sprintf(' f_min = 1/T = %g\n', 1/(t_end-t_start))); fflush (stdout); 55 | 56 | line([t_end t_end],[-1 1],'Color',0.5*[1 1 1]); axis (r); 57 | -------------------------------------------------------------------------------- /calibration/RTX6001_USB_STATUS: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import hid 4 | from time import sleep 5 | 6 | # find and open the RTX6001 HID device: 7 | hidraw = hid.device(0x0D9A, 0x00DF) 8 | hidraw.open(0x0D9A, 0x00DF) 9 | 10 | # Read status -- NOTE: RTX changed firmware after releasing the Software Interface Documentation. The code below repeats the query a few times, which seems to be necessary to get the correct status readings from the changed firmware. 11 | 12 | k = 0; 13 | while k < 2: 14 | # send status query: 15 | hidraw.write([0x01 , 0x00 , 0x80 , 0x80 , 0x80 , 0x80]) # status querey 16 | 17 | # read response bytes: 18 | # NOTE: automatic detection of overflow or overvoltage may introduce additional data bytes that were not requested from staus query! 19 | # Make sure the response has the right size and re-read if necessary. 20 | u1 = u2 = [] 21 | while not( len(u1) == 6 ): 22 | u1 = hidraw.read(6) 23 | # print ('** Length of answer-1 = ' + str(len(u1))) 24 | while not( len(u2) == 2 ): 25 | u2 = hidraw.read(6) 26 | # print ('** Length of answer-2 = ' + str(len(u2))) 27 | 28 | if k < 2: 29 | sleep(0.1) 30 | 31 | k = k+1 32 | 33 | # close the HID device: 34 | hidraw.close() 35 | 36 | # determine overflow and overvoltage conditions: 37 | OVERFLOW_left = OVERFLOW_right = OVERVOLTAGE_left = OVERVOLTAGE_right = 'no' 38 | if u2[1] & 0b0001: 39 | OVERFLOW_left = 'yes' 40 | if u2[1] & 0b0010: 41 | OVERFLOW_right = 'yes' 42 | if u2[1] & 0b0100: 43 | OVERVOLTAGE_left = 'yes' 44 | if u2[1] & 0b1000: 45 | OVERVOLTAGE_right = 'yes' 46 | 47 | # determine AC/DC coupling: 48 | ACDC_left = ACDC_right = 'AC' 49 | if u1[1] & 0b0010: 50 | ACDC_left = 'DC' 51 | if u1[1] & 0b1000: 52 | ACDC_right = 'DC' 53 | 54 | # determine attenuator levels and print switch settings: 55 | levels = { 236: '-20 dBV' , 246: '-10 dBV' , 0: '0 dBV' , 10: '+10 dBV' , 20: '+20 dBV' , 30: '+30 dBV' , 40: '+40 dBV'} 56 | print ( 'Output_left=' + levels[u1[2]] + '\tOutput_right=' + levels[u1[3]] + '\tInput_left=' + levels[u1[4]] + '(' + ACDC_left + ')' + '\tInput_right=' + levels[u1[5]] + '(' + ACDC_right + ')') 57 | 58 | # print overflow and overvoltage information: 59 | print ( 'Overflow_left=' + OVERFLOW_left + '\tOverflow_right=' + OVERFLOW_right + '\tOvervoltage_left=' + OVERVOLTAGE_left + '\tOvervoltage_right=' + OVERVOLTAGE_right ) 60 | -------------------------------------------------------------------------------- /mataa_tools/mataa_cal_autoscale.m: -------------------------------------------------------------------------------- 1 | function cal = mataa_cal_autoscale (c); 2 | 3 | % function cal = mataa_cal_autoscale (c); 4 | % 5 | % DESCRIPTION: 6 | % Execute the "autoscaling" function(s) for the ADC and DAC device(s) described by the calibration struct c, and return the ADC and DAC sensitivites in cal struct in the same format as with fixed/non-autoscaling calibration structs. 7 | % 8 | % DISCLAIMER: 9 | % This file is part of MATAA. 10 | % 11 | % MATAA is free software; you can redistribute it and/or modify 12 | % it under the terms of the GNU General Public License as published by 13 | % the Free Software Foundation; either version 2 of the License, or 14 | % (at your option) any later version. 15 | % 16 | % MATAA is distributed in the hope that it will be useful, 17 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | % GNU General Public License for more details. 20 | % 21 | % You should have received a copy of the GNU General Public License 22 | % along with MATAA; if not, write to the Free Software 23 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24 | % 25 | % Copyright (C) 2018 Matthias S. Brennwald. 26 | % Contact: info@audioroot.net 27 | % Further information: http://www.audioroot.net/MATAA 28 | 29 | if ischar(c) % name of calibration file instead of cal struct 30 | c = mataa_load_calibration (c); 31 | end 32 | 33 | if length(c) > 1 % array of multiple cal structs 34 | for i = 1:length(c) 35 | cal{i} = mataa_cal_autoscale (c{i}); 36 | end 37 | else 38 | 39 | cal_adc = []; 40 | cal_dac = []; 41 | 42 | if isfield (c,'ADC') 43 | if isfield (c.ADC,'sensitivity_autoscalefunction') 44 | eval ( sprintf( "u = %s;",c.ADC.sensitivity_autoscalefunction ) ); 45 | cal_adc = u; 46 | end 47 | end 48 | 49 | if isfield (c,'DAC') 50 | if isfield (c.ADC,'sensitivity_autoscalefunction') 51 | eval ( sprintf( "u = %s;",c.DAC.sensitivity_autoscalefunction ) ); 52 | cal_dac = u; 53 | end 54 | end 55 | 56 | cal = c; % copy all fields (including SENSORs etc.) 57 | 58 | if not(isempty(cal_adc)) 59 | % overwrite with autoscaling result: 60 | cal.ADC = cal_adc.ADC; 61 | end 62 | 63 | if not(isempty(cal_dac)) 64 | % overwrite with autoscaling result: 65 | cal.DAC = cal_dac.DAC; 66 | end 67 | 68 | end 69 | -------------------------------------------------------------------------------- /mataa_tools/mataa_speaker_TSP_addmass.m: -------------------------------------------------------------------------------- 1 | function [Vas,Cms,Mms,Sd] = mataa_speaker_TSP_addmass (fs,fsM,M,D); 2 | 3 | % function [Vas,Cms,Mms,Sd] = mataa_speaker_TSP_addmass (fs,fsM,M,D); 4 | % 5 | % DESCRIPTION: 6 | % Determine Thiele-Small parameters Vas, Cms and Mms using the "added mass method". This works by comparing the resonance frequency of the unmodified driver (fs) with the resonance frequency (fsM) obtained after adding a mass (M) to cone. Make sure the mass M is firmly attached to the cone! 7 | % 8 | % INPUT: 9 | % fs: driver resonance frequency (Hz) 10 | % fsM: resonance frequency with added mass (Hz) 11 | % M: added mass (g) 12 | % D: cone diameter including part of the surround, typically 1/3 to 1/2 the width of the surround (cm) 13 | % 14 | % OUTPUT: 15 | % Vas: driver compliance equivalent volume (litres) 16 | % Cms: Compliance of the driver's suspension (mm/N) 17 | % Mms: Mass of the diaphragm/coil, including acoustic load (g) 18 | % Sd: Projected area of the driver diaphragm (cm²) 19 | % 20 | % EXAMPLE (measured driver resonance at fs = 46.1 Hz, fsM = 21.9 Hz with added mass M = 166 g, cone diameter with 1/2 surround on both sides D = 25.0 cm): 21 | % > [Vas,Cms,Mms,Sd] = mataa_speaker_TSP_addmass (46.1,21.9,166,25.0); 22 | % 23 | % DISCLAIMER: 24 | % This file is part of MATAA. 25 | % 26 | % MATAA is free software; you can redistribute it and/or modify 27 | % it under the terms of the GNU General Public License as published by 28 | % the Free Software Foundation; either version 2 of the License, or 29 | % (at your option) any later version. 30 | % 31 | % MATAA is distributed in the hope that it will be useful, 32 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 33 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 34 | % GNU General Public License for more details. 35 | % 36 | % You should have received a copy of the GNU General Public License 37 | % along with MATAA; if not, write to the Free Software 38 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 39 | % 40 | % Copyright (C) Matthias S. Brennwald. 41 | % Contact: info@audioroot.net 42 | % Further information: http://www.audioroot.net/MATAA 43 | 44 | rho = 1.184; % density of air (kg/m³) 45 | c = 345; % speed of sound (m/s) 46 | 47 | Mms = M / ( (fs/fsM)^2 - 1 ); % in grams 48 | Cms = 1 / (2*pi*fs)^2 / (Mms/1000) * 1000; % in s²/g = mm/N 49 | Sd = pi * (D/2)^2; % in cm² 50 | Vas = rho * c^2 * (Sd/10000)^2 * (Cms/1000) * 1000; % in L 51 | -------------------------------------------------------------------------------- /mataa_tools/mataa_realIFT0.m: -------------------------------------------------------------------------------- 1 | function [s,t] = mataa_realIFT0 (S,f); 2 | 3 | % function [s,t] = mataa_realIFT0 (S,f); 4 | % 5 | % DESCRIPTION: 6 | % Calculates the inverse Fourier transform of a spectrum S(f) of a signal with real-valued samples. Only the 'positive' half of the spectrum is used, i.e. only positive frequencies (including f=0) must be given as input. See also mataa_realFT0. 7 | % 8 | % INPUT: 9 | % S: complex fourier spectrum of the signal ('positive' half, see also DESCRIPTION). 10 | % f: frequency values (vector) 11 | % 12 | % OUTPUT: 13 | % s: signal samples (real-valued samples) 14 | % t: time values of the signal 15 | % 16 | % DISCLAIMER: 17 | % This file is part of MATAA. 18 | % 19 | % MATAA is free software; you can redistribute it and/or modify 20 | % it under the terms of the GNU General Public License as published by 21 | % the Free Software Foundation; either version 2 of the License, or 22 | % (at your option) any later version. 23 | % 24 | % MATAA is distributed in the hope that it will be useful, 25 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | % GNU General Public License for more details. 28 | % 29 | % You should have received a copy of the GNU General Public License 30 | % along with MATAA; if not, write to the Free Software 31 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 32 | % 33 | % Copyright (C) 2008 Matthias S. Brennwald. 34 | % Contact: info@audioroot.net 35 | % Further information: http://www.audioroot.net/MATAA 36 | 37 | if ~any (size (S) == 1) 38 | error ('mataa_realFT0: the input signal s must be of dimension 1xN or Nx1 !') 39 | end 40 | 41 | S = S(:); f = f(:); % make sure these are column vectors 42 | 43 | if f(1) ~= 0 44 | f = [0 ; f]; 45 | S = [0 ; S]; 46 | warning ('mataa_realIFT0: first frequency value was not zero; padded sample for f=0.'); 47 | end 48 | 49 | N = length(f); % number of positive frequency values, including f=0 50 | f0 = min (f (find(f~=0))); 51 | 52 | % construct full complex spectrum with negative frequencies 53 | 54 | if imag (S(end)) == 0 % S can be expressed by a signal with an even number of samples 55 | S = [ S ; flipud(conj(S(2:end-1))) ]; 56 | L = 2 * (N-1); 57 | 58 | else % an additional sample is needed, giving a signal with an odd number of samples 59 | S = [ S ; flipud(conj(S(2:end))) ]; 60 | L = 2 * (N-1) + 1; 61 | 62 | end 63 | 64 | s = ifft (S); s = real(s); 65 | t = ([0 : (L-1)] / f0 / L)'; 66 | -------------------------------------------------------------------------------- /mataa_tools/mataa_audio_guess_latency.m: -------------------------------------------------------------------------------- 1 | function latency = mataa_audio_guess_latency (fs,maxLatency); 2 | 3 | % function latency = mataa_audio_guess_latency (fs,maxLatency); 4 | % 5 | % DESCRIPTION: 6 | % This function measures the latency of the audio hardware at sampling frequency fs, including the connected DUT. 7 | % 8 | % The latency is defined as follows: 9 | % t1: the time needed by the audio output device to process the signal 10 | % t2: the time needed by the signal to travel from the audio output to the audio input of the computer (this will be determined by the analytical setup. In case of loudspeaker analysis, t2 will be deteremined mainly by the distance between microphone and loudspeaker). 11 | % t3: the time needed by the audio input device to process the signal 12 | % 13 | % Then: latency = t1 + t2 + t3 14 | % 15 | % INPUT: 16 | % fs: sampling frequency to be used for audio I/O (in seconds) 17 | % maxLatency (optional): the expected maximum of the latency (in seconds). If not specified, the user will be asked to supply a value. 18 | % 19 | % OUTPUT: 20 | % latency: the latency of the system, as defined above (in seconds) 21 | % 22 | % DISCLAIMER: 23 | % This file is part of MATAA. 24 | % 25 | % MATAA is free software; you can redistribute it and/or modify 26 | % it under the terms of the GNU General Public License as published by 27 | % the Free Software Foundation; either version 2 of the License, or 28 | % (at your option) any later version. 29 | % 30 | % MATAA is distributed in the hope that it will be useful, 31 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 32 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 33 | % GNU General Public License for more details. 34 | % 35 | % You should have received a copy of the GNU General Public License 36 | % along with MATAA; if not, write to the Free Software 37 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 38 | % 39 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 40 | % Contact: info@audioroot.net 41 | % Further information: http://www.audioroot.net/MATAA 42 | 43 | if ~exist('maxLatency','var') 44 | maxLatency = input('Enter maximum expected latency (in ms):'); 45 | maxLatency=maxLatency/1000; 46 | end 47 | 48 | t=[1/fs:1/fs:2*maxLatency]'; 49 | out=repmat(0,size(t)); 50 | k=round(length(out)/2); 51 | out(k)=1; 52 | 53 | in = mataa_measure_signal_response(out,fs,0); 54 | 55 | in = in(:,mataa_settings ('channel_DUT')); % only used data in DUT channel 56 | 57 | latency = mataa_guess_IR_start (in,t,0)-t(k); 58 | -------------------------------------------------------------------------------- /documentation/source/MATAA_manual_calibration.texi: -------------------------------------------------------------------------------- 1 | @node Data Calibration 2 | @chapter Data Calibration 3 | 4 | MATAA allows calibrating the test data in terms of real physical units. To achieve this, many MATAA tools which send or record test signals to/from a DUT allow specifying (i) the physical units of the test data and (ii) a file that describes the measurement chain in terms of the sensitivities and transfer functions of the various hardware blocks in the measurement chain. 5 | 6 | @noindent 7 | The measurement chain is reflected by the DAC, the SENSOR, and the ADC: 8 | 9 | @itemize @bullet 10 | @item 11 | The digital-to-analog converter (DAC) outputs a test signal to the device under test (DUT). If an amplifier or buffer is used in between the DAC and the DUT, MATAA considers this amplifier/buffer as part of the DAC for the purposes for calibration. 12 | 13 | @item 14 | The SENSOR is used to probe the DUT output signal. This could be a microphone, vibration sensor, or simply a plain wire ``sensing'' an electronic signal. 15 | 16 | @item 17 | The analog-to-digital converter (ADC) records the output signal from the SENSOR. If an amplifier or buffer is used in between the SENSOR and the ADC (e.g., a microphone amplifier), MATAA considers this amplifier/buffer as part of the ADC for the purposes for calibration. 18 | 19 | @end itemize 20 | 21 | @noindent 22 | MATAA calibrates the test data by evaluating the test signals at the input and the output of the DUT: 23 | 24 | @findex mataa_signal_calibrate_DUTin 25 | @itemize @bullet 26 | @item 27 | Calibration of the test signal applied to the DUT input works by considering the gain and transfer function of the DAC. This is implemented in the the function mataa_signal_calibrate_DUTin. 28 | 29 | @item 30 | Calibration of the test signal output by the DUT works by considering the gains and transfer functions of the sensor and the ADC. This is implemented in the function mataa_signal_calibrate_DUTout. 31 | @end itemize 32 | 33 | 34 | @node Calibration files 35 | @section Calibration files 36 | This section is under constuction. For the time being, it is recommended to study the examples in the mataa/calibration/ directory to learn how the calibration files work. Note that there are two types of calibration files. On the one hand, there are files that describe the individual hardware blocks (DAC, SENSOR, or ADC types). On the other hand, there are ``CHAIN'' type files, which describe a complete measurement chain. These CHAIN files contain the links to the correspondings DAC, SENSOR and ADC files. 37 | 38 | 39 | -------------------------------------------------------------------------------- /documentation/source/MATAA_manual_working.texi: -------------------------------------------------------------------------------- 1 | @node Working with MATAA 2 | @chapter Working with MATAA 3 | 4 | This manual assumes you know what kind of measurements you are after, and why. This manual is not an introduction to acoustic measurement principles. Please refer to other sources to find background information on techniques and methods for measurements in electroacoustic systems. Some documents that I can recommend: 5 | 6 | @enumerate 7 | @item J. d'Appolito: Testing Loudspeakers, Audio Amateur Press, Peterborough, New Hampshire, USA, 1987. 8 | @item J. d'Appolito: Testing Loudspeakers: Which Measurements Matter (Parts 1 and 2), audioXpress (9,10), 2008. 9 | @item L. Olson: A MLSSA Gallery, 2006, @uref{http://www.nutshellhifi.com/MLS} (last checked 5 May 2007) 10 | @item M.S. Brennwald: MATAA: A Free Computer-Based Audio Analysis System, audioXpress (7), 2007. Copies of this article are distributed together with MATAA, and are available online, too. The original article is at @uref{http://www.audioxpress.com/magsdirx/ax/addenda/media/brennwald2806.pdf} (last checked 12 Aug 2007), and a version that is somewhat easier to read is at @uref{http://www.audioroot.net/analysis/MATAA_aX_original.pdf} (last checked 12. Aug 2007). 11 | @end enumerate 12 | 13 | The workflow with MATAA can be separated into two parts. First, you need to figure out how to setup the connections between the DUT and the soundcard (see @ref{Hardware Setup}). Second, you will type commands into MATLAB/Octave telling MATAA to carry out the tests, process the data, or plot the results. This second step requires you to know how to work with MATLAB/Octave (see @ref{Getting started with MATLAB or Octave}). You will also need to know the names of the MATAA commands and how they work. 14 | 15 | Information on the MATAA commands is available in the @ref{MATAA tools reference}. You may also use the online help system on MATLAB/Octave by typing @command{help } into the MATLAB/Octave command prompt. For instance, if you need to know how to use the signal generator command @command{mataa_signal_generator}, type @command{help mataa_signal_generator}. This help system is not limited to the MATAA commands, but works for all MATLAB/Octave commands (for example, if you want to find out how to save data from within Matab/Octave to disk, type @command{help save}). 16 | 17 | For a few worked examples on how to use MATAA in real-world applications, please refer to the MATAA article published in audioXpress (``MATAA: A Free Computer-Based Audio Analysis System'', included with the MATAA package). 18 | 19 | -------------------------------------------------------------------------------- /mataa_tools/mataa_interp.m: -------------------------------------------------------------------------------- 1 | function y = mataa_interp (xi,yi,x); 2 | 3 | % function y = mataa_interp (xi,yi,x); 4 | % 5 | % DESCRIPTION: 6 | % Linear interpolation of y(x) from yi(xi) 7 | % if x is outside the range of xi, mataa_interp returns a linear extrapolation of the yi 8 | % 9 | % Linear interpolation is of course available in Matlab and Octave-Forge as interp1. However, it's not available in plain-vanilla Octave, which is a shame, I think (this was fixed a while ago, so mataa_interp is obsolete and may be removed in the future). I therefore provided this function for MATAA so that I don't have to worry about interp1 missing in Octave while still being able to easily write code that is compatible with both Matlab and Octave. 10 | % 11 | % FIXME: THIS CODE IS AS INEFFICIENT AS IT GETS! 12 | % 13 | % DISCLAIMER: 14 | % This file is part of MATAA. 15 | % 16 | % MATAA is free software; you can redistribute it and/or modify 17 | % it under the terms of the GNU General Public License as published by 18 | % the Free Software Foundation; either version 2 of the License, or 19 | % (at your option) any later version. 20 | % 21 | % MATAA is distributed in the hope that it will be useful, 22 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 | % GNU General Public License for more details. 25 | % 26 | % You should have received a copy of the GNU General Public License 27 | % along with MATAA; if not, write to the Free Software 28 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 29 | % 30 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 31 | % Contact: info@audioroot.net 32 | % Further information: http://www.audioroot.net/MATAA 33 | 34 | if exist('interp1','file') 35 | y = interp1(xi,yi,x,'linear','extrap'); 36 | else 37 | X = x; 38 | Y = repmat(NaN,size(X)); 39 | 40 | for k=1:length(X) 41 | x = X(k); 42 | n=find(x==xi); 43 | 44 | if ~isempty(n) 45 | y=yi(n); 46 | else 47 | nLow = max(find(xi < x)); 48 | nHigh = min(find(xi > x)); 49 | 50 | if isempty(nLow) 51 | y = yi(1) + (yi(2)-yi(1))/(xi(2)-xi(1)) * (x-xi(1)); 52 | elseif isempty(nHigh) 53 | y = yi(end) + (yi(end)-yi(end-1))/(xi(end)-xi(end-1)) * (x-xi(end)); 54 | else 55 | a = (x-xi(nLow)) / (xi(nHigh)-xi(nLow)); 56 | y = a*yi(nHigh) + (1-a)*yi(nLow); 57 | end 58 | end 59 | Y(k)=y; 60 | end 61 | 62 | y=Y; 63 | end 64 | -------------------------------------------------------------------------------- /mataa_scripts/mataa_demo_loudspeaker.m: -------------------------------------------------------------------------------- 1 | % This script runs various tests to check the set up of MATAA 2 | % 3 | % This file is part of MATAA. 4 | % 5 | % MATAA is free software; you can redistribute it and/or modify 6 | % it under the terms of the GNU General Public License as published by 7 | % the Free Software Foundation; either version 2 of the License, or 8 | % (at your option) any later version. 9 | % 10 | % MATAA is distributed in the hope that it will be useful, 11 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | % GNU General Public License for more details. 14 | % 15 | % You should have received a copy of the GNU General Public License 16 | % along with MATAA; if not, write to the Free Software 17 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | % 19 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 20 | % Contact: info@audioroot.net 21 | % Further information: http://www.audioroot.net/MATAA.html 22 | 23 | if exist('OCTAVE_VERSION','builtin') 24 | more('off'), 25 | end 26 | 27 | disp('****** MATAA demo: loudspeaker analysis ******') 28 | input('Hit ENTER key to start.'); 29 | 30 | disp('First, load impulse-response data from disk, apply a half-Hann window, and plot it...') 31 | 32 | [h,t] = mataa_IR_demo; 33 | 34 | [t_start,t_rise] = mataa_guess_IR_start(h,t); 35 | 36 | max_window_length = t(end)-t(1); 37 | [h,t] = mataa_signal_crop(h,t,t_start,t_start+max_window_length); 38 | h = mataa_signal_window(h,'hann_half'); 39 | mataa_plot_IR(h,t,'half-Hann window'); 40 | input('...done. Hit ENTER to continue.'); 41 | 42 | disp('Calculate the step response, and plot it...'); 43 | s = mataa_IR_to_SR(h,t); 44 | mataa_plot_SR(s,t,'half-Hann window'); 45 | input('...done. Hit ENTER to continue.'); 46 | 47 | disp('Calculate and plot the frequency response (magnitude & phase, smoothed to 1/48 octave)...'); 48 | [spl,phase,f] = mataa_IR_to_FR(h,t,1/48); 49 | % phase = mataa_phase_remove_trend(phase,f,300,3000); 50 | phase = mataa_phase_remove_trend(phase,f); 51 | mataa_plot_FR(spl,phase,f,'half-Hann window',2000); 52 | input('...done. Hit ENTER to continue.'); 53 | 54 | disp('Calculate and plot the cumulative spectral decay (CSD, smoothed to 1/48 octave). This may take a while...'); 55 | T = linspace(0,0.005,40); 56 | [spl,f,d] = mataa_IR_to_CSD(h,t,T,1/48); 57 | mataa_plot_CSD(spl,f,d,50); 58 | if exist('OCTAVE_VERSION','builtin') 59 | disp('...done (plot may take a while to appear).') 60 | else 61 | disp('...done.') 62 | end 63 | disp('****** MATAA demo completed ******') 64 | -------------------------------------------------------------------------------- /mataa_tools/mataa_realFT0.m: -------------------------------------------------------------------------------- 1 | function [S,f] = mataa_realFT0 (s,t); 2 | 3 | % function [S,f] = mataa_realFT0 (s,t); 4 | % 5 | % DESCRIPTION: 6 | % Calculates the complex fourier-spectrum S of a real signal s for frequencies f >= 0. Only the half spectrum corresponding to positive frequencies is returned, because for a real signal S(-f)=S*(f). This implies that the RMS level of S is only half the RMS level of the full (symmetric) Fourier spectrum. 7 | % s can be of any length (no padding to length of 2n or even length necessary). In order to avoid frequency leakage, mataa_realFT does NOT pad s to even length. Each column of s represents one audio channel. 8 | % 9 | % INPUT: 10 | % s: signal samples (vector containing the real-valued samples) 11 | % t: time values of the signal samples (vector, with evenly spaced values) or sample rate (scalar) 12 | % 13 | % OUTPUT: 14 | % S: complex fourier spectrum of s ('positive' half, see also DESCRIPTION). 15 | % f: frequency values (vector) 16 | % 17 | % DISCLAIMER: 18 | % This file is part of MATAA. 19 | % 20 | % MATAA is free software; you can redistribute it and/or modify 21 | % it under the terms of the GNU General Public License as published by 22 | % the Free Software Foundation; either version 2 of the License, or 23 | % (at your option) any later version. 24 | % 25 | % MATAA is distributed in the hope that it will be useful, 26 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | % GNU General Public License for more details. 29 | % 30 | % You should have received a copy of the GNU General Public License 31 | % along with MATAA; if not, write to the Free Software 32 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 33 | % 34 | % Copyright (C) 2006,2007, 2008 Matthias S. Brennwald. 35 | % Contact: info@audioroot.net 36 | % Further information: http://www.audioroot.net/MATAA 37 | 38 | if ~any (size (s) == 1) 39 | error ('mataa_realFT0: the input signal s must be of dimension 1xN or Nx1 !') 40 | end 41 | 42 | if isscalar(t) % sample rate given instead of time values 43 | t = [0:1/t:(length(s)-1)/t]; 44 | end 45 | 46 | s=s(:); t=t(:); 47 | 48 | L = length(t); 49 | 50 | % calculate fourier transform(s) 51 | S = fft(s); % matlab checks for real or complex input signals, so we don not need to do it on our own to save CPU-time 52 | 53 | % determine N (number of positive frequencies, including f=0): 54 | if mod(L,2) % L is odd 55 | N = (L-1)/2+1; 56 | else % L is even 57 | N = L/2+1; 58 | end 59 | 60 | % Discard negative half of spectrum: 61 | S = S(1:N); 62 | 63 | % construct frequency vecor: 64 | f = mataa_t_to_f0(t); 65 | -------------------------------------------------------------------------------- /mataa_tools/mataa_import_FRD.m: -------------------------------------------------------------------------------- 1 | function [f,mag,phase,comments] = mataa_import_FRD (file); 2 | 3 | % function [f,mag,phase,comments] = mataa_import_FRD (file); 4 | % 5 | % DESCRIPTION: 6 | % Import frequency-domain data from a FRD file. 7 | % (see also mataa_export_FRD). 8 | % 9 | % INPUT: 10 | % file: string containing the name of the file containing the data to be imported. The string may contain a complete path. If no path is given, the file is assumed to be located in the current working directory. 11 | % 12 | % OUTPUT: 13 | % f: frequency values (Hz) 14 | % mag: magnitude values 15 | % phase: phase 16 | % comments: cell string containing the comments in the data file (if any) 17 | % 18 | % DISCLAIMER: 19 | % This file is part of MATAA. 20 | % 21 | % MATAA is free software; you can redistribute it and/or modify 22 | % it under the terms of the GNU General Public License as published by 23 | % the Free Software Foundation; either version 2 of the License, or 24 | % (at your option) any later version. 25 | % 26 | % MATAA is distributed in the hope that it will be useful, 27 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | % GNU General Public License for more details. 30 | % 31 | % You should have received a copy of the GNU General Public License 32 | % along with MATAA; if not, write to the Free Software 33 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 34 | % 35 | % Copyright (C) 2008 Matthias S. Brennwald. 36 | % Contact: info@audioroot.net 37 | % Further information: http://www.audioroot.net/MATAA 38 | % 39 | % HISTORY: 40 | % 9. January 2008 (Matthias Brennwald): first version 41 | 42 | if nargin == 0 43 | file = ''; 44 | end 45 | 46 | if length (file) == 0 47 | error ('mataa_export_FRD: the file name must not be empty.'); 48 | end 49 | 50 | f = []; 51 | mag = []; 52 | phase = []; 53 | comments = cellstr (''); 54 | nc = 0; 55 | 56 | [fid,msg] = fopen (file,'rt'); 57 | 58 | if fid == -1 59 | error (sprintf ('mataa_import_TMD: %s (file: %s).',msg,file)) 60 | end 61 | 62 | % read the header 63 | try_header = 1; 64 | while try_header 65 | pos = ftell (fid); % current file positions 66 | l0 = fgetl (fid); 67 | l = fliplr(deblank(fliplr(l0))); 68 | if strcmp (l(1),'*') 69 | nc = nc+1; 70 | comments{nc} = fliplr(deblank(fliplr(l)))(2:end); 71 | else 72 | try_header = 0; 73 | fseek (fid, pos, SEEK_SET); % go back to the beginning of the first data line 74 | end 75 | end 76 | 77 | x = fscanf(fid, '%f%f', Inf); 78 | fclose (fid); 79 | 80 | x = reshape (x,3,length(x)/3)'; 81 | f = x(:,1); 82 | mag = x(:,2); 83 | phase = x(:,3); 84 | -------------------------------------------------------------------------------- /mataa_tools/mataa_plot_two.m: -------------------------------------------------------------------------------- 1 | function h = mataa_plot_two (x,y1,y2,figNum,plottit,xtit,y1tit,y2tit); 2 | 3 | % function h = mataa_plot_two (x,y1,y2,figNum,plottit,xtit,y1tit,y2tit); 4 | % 5 | % DESCRIPTION: 6 | % Plots y1 and y2 vs. x. 7 | % 8 | % INPUT: 9 | % x: x values 10 | % y1, y2: y values to be plotted vs. x. y2 may be empty (y2 = []), which will result in a single plot of y1 vs x. 11 | % figNum: number (handle) of the figure window to be used for the plot. Use figNum = [] if the default window is to be used (e.g. the current plot window) 12 | % plottit: plot title. 13 | % xtit: x-axis label 14 | % y1tit, y2tit: y-axis label of the y1 and y2 data 15 | % 16 | % OUTPUT: 17 | % h: a 2-vector containig the handles to the axes of the two plots. If the second plot is omitted h(2) will be set to NaN, 18 | % 19 | % DISCLAIMER: 20 | % This file is part of MATAA. 21 | % 22 | % MATAA is free software; you can redistribute it and/or modify 23 | % it under the terms of the GNU General Public License as published by 24 | % the Free Software Foundation; either version 2 of the License, or 25 | % (at your option) any later version. 26 | % 27 | % MATAA is distributed in the hope that it will be useful, 28 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | % GNU General Public License for more details. 31 | % 32 | % You should have received a copy of the GNU General Public License 33 | % along with MATAA; if not, write to the Free Software 34 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 35 | % 36 | % Copyright (C) 2007, 2008 Matthias S. Brennwald. 37 | % Contact: info@audioroot.net 38 | % Further information: http://www.audioroot.net/MATAA 39 | 40 | h = repmat (NaN,2,1); 41 | 42 | x = x(:); 43 | y1 = y1(:); 44 | y2 = y2(:); 45 | 46 | if size (x) ~= size (y1) 47 | error ('mataa_plot_two: size of x and y1 data does not agree.') 48 | end 49 | 50 | if size (x) ~= size (y2) 51 | error ('mataa_plot_two: size of x and y2 data does not agree.') 52 | end 53 | 54 | color = mataa_settings ('plotColor'); 55 | if ~isempty(figNum) 56 | figure (figNum); 57 | end 58 | mataa_plot_defaults; 59 | 60 | if length (y2) > 0 61 | subplot(2,1,1); 62 | % no xlabel on upper subplot 63 | else 64 | subplot(1,1,1) % make sure there's only one (sub)plot, e.g. if there was as previous figure with more than one subplots 65 | xlabel (xtit); 66 | end 67 | 68 | plot (x,y1,color) 69 | title (plottit); 70 | ylabel (y1tit); 71 | 72 | h(1) = gca; 73 | 74 | if length (y2) > 0 75 | subplot (2,1,2) 76 | plot (x,y2,color); 77 | ylabel (y2tit); 78 | xlabel (xtit); 79 | h(2) = gca; 80 | end 81 | -------------------------------------------------------------------------------- /mataa_tools/mataa_signal_save.m: -------------------------------------------------------------------------------- 1 | function mataa_signal_save (s,fs,file,description); 2 | 3 | % function mataa_signal_save (s,fs,file,description); 4 | % 5 | % DESCRIPTION: 6 | % Saves the signal s(t) to an binary file (Matlab 6 format). 7 | % 8 | % INPUT: 9 | % ... 10 | % 11 | % OUTPUT: 12 | % ... 13 | % 14 | % DISCLAIMER: 15 | % This file is part of MATAA. 16 | % 17 | % MATAA is free software; you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation; either version 2 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % MATAA is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with MATAA; if not, write to the Free Software 29 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 30 | % 31 | % Copyright (C) 2008 Matthias S. Brennwald. 32 | % Contact: info@audioroot.net 33 | % Further information: http://www.audioroot.net/MATAA 34 | 35 | if ~any (size (s) == 1) 36 | error ('mataa_signal_save: only signals containing one data channel are supported at the moment.') 37 | end 38 | 39 | if ~any (size (fs) == 1) 40 | error ('mataa_signal_save: only signals containing one data channel are supported at the moment.') 41 | end 42 | 43 | if ~isscalar(fs) % fs contains the time values 44 | fs = 1 / mean (diff (fs)); 45 | end 46 | 47 | s = s(:); 48 | 49 | if ~exist ('file','var') 50 | p = input (sprintf('Enter path to file (leave empty to use default %s): ',pwd),'s'); 51 | if isempty (p) 52 | p = pwd; 53 | end 54 | if ~strcmp (p(end),filesep) 55 | p = sprintf ('%s%s',p,filesep); 56 | end 57 | if ~exist (p,'dir') 58 | error (sprintf ('mataa_save_signal: the directory ''%s'' does not exist.',p)) 59 | end 60 | 61 | f = ''; 62 | while isempty (f) 63 | f = input ('Enter file name: ','s'); 64 | if isempty (f) 65 | disp ('The file name must not be empty!') 66 | end 67 | end 68 | 69 | if length (f) < 4 70 | f = sprintf ('%s.mat',f); 71 | elseif ~strcmp (f(end-3:end),'.mat') 72 | f = sprintf ('%s.mat',f); 73 | end 74 | 75 | file = sprintf ('%s%s',p,f); 76 | 77 | clear f p 78 | end 79 | 80 | if ~exist ('description','var') 81 | description = input ('Enter a (short) description of the signal: ','s'); 82 | end 83 | 84 | save ('-v6',file,'fs','s','description'); 85 | -------------------------------------------------------------------------------- /documentation/source/MATAA_manual.cps: -------------------------------------------------------------------------------- 1 | \initial {A} 2 | \entry{Allocation of soundcard channels}{10} 3 | \entry{ALSA}{7} 4 | \entry{Anti-aliasing filter}{6} 5 | \initial {C} 6 | \entry{Calibration file (microphone)}{4} 7 | \entry{Channel allocation}{10} 8 | \entry{Column vector}{79} 9 | \entry{Copyright}{2} 10 | \initial {D} 11 | \entry{Default path (MATAA)}{4} 12 | \entry{Default path (MATLAB/Octave)}{3} 13 | \entry{Default path (test signal files)}{4} 14 | \entry{Delay, interchannel (soundcard)}{13} 15 | \entry{Documentaion, MATAA}{4} 16 | \entry{Download, MATAA}{3} 17 | \entry{DUT channel}{10} 18 | \initial {F} 19 | \entry{FDL, GNU Free Documentation License}{85} 20 | \entry{Filter, anti-aliasing}{6} 21 | \initial {G} 22 | \entry{GNU General Public License}{81} 23 | \entry{GPL, GNU General Public License}{81} 24 | \initial {H} 25 | \entry{Hardware setup, sound}{5} 26 | \initial {I} 27 | \entry{Installing MATAA}{3} 28 | \entry{Installing MATLAB}{3} 29 | \entry{Installing Octave}{3} 30 | \entry{Interchannel delay}{13} 31 | \initial {L} 32 | \entry{Linux}{7, 9} 33 | \initial {M} 34 | \entry{Manual, MATAA}{4} 35 | \entry{MATAA default paths}{4} 36 | \entry{MATAA documentation}{4} 37 | \entry{MATAA scripts}{4} 38 | \entry{MATAA settings/preferences}{4} 39 | \entry{MATAA tools}{4} 40 | \entry{MATAA, installation}{3} 41 | \entry{MATAA, obtaining/download}{3} 42 | \entry{MATLAB}{78} 43 | \entry{MATLAB default path}{3} 44 | \entry{MATLAB, installation}{3} 45 | \entry{MATLAB, startup file}{4} 46 | \entry{Matrix}{79} 47 | \entry{Measurement setup}{5} 48 | \entry{Microphone calibration file}{4} 49 | \initial {O} 50 | \entry{Octave}{78} 51 | \entry{Octave default path}{3} 52 | \entry{Octave, installation}{3} 53 | \entry{Octave, startup file}{4} 54 | \initial {P} 55 | \entry{Path, default (MATAA)}{4} 56 | \entry{Path, default (MATLAB/Octave)}{3} 57 | \entry{Path, test signal}{5} 58 | \entry{PlayRec}{7} 59 | \entry{PortAudio}{9} 60 | \entry{Preferences, MATAA}{4} 61 | \entry{Pulseaudio}{7} 62 | \initial {R} 63 | \entry{REF channel}{10} 64 | \entry{Row vector}{79} 65 | \initial {S} 66 | \entry{Scalar}{79} 67 | \entry{Scripts, MATAA}{4} 68 | \entry{Settings, MATAA}{4} 69 | \entry{Setup, measurement}{5} 70 | \entry{Setup, sound hardware}{5} 71 | \entry{Signal path}{5} 72 | \entry{Sound hardware setup}{5} 73 | \entry{Soundcard}{7} 74 | \entry{Soundcard channel allocation}{10} 75 | \entry{Soundcard interchannel delay}{13} 76 | \entry{Startup file, MATLAB/Octave}{4} 77 | \initial {T} 78 | \entry{Terms and Conditions}{2} 79 | \entry{Test signal files, default path}{4} 80 | \entry{Test signal path}{5} 81 | \entry{TestDevices}{4, 7, 9} 82 | \entry{TestTone}{4, 7, 9} 83 | \entry{Tools}{4} 84 | \initial {V} 85 | \entry{Vector}{79} 86 | \entry{Vector (row, column)}{79} 87 | -------------------------------------------------------------------------------- /calibration/RTX6001_AUTOSCALINGFUNCTION_DAC_SE.m: -------------------------------------------------------------------------------- 1 | function c = RTX6001_AUTOSCALINGFUNCTION_DAC_SE(channel); 2 | 3 | % function c = RTX6001_AUTOSCALINGFUNCTION_DAC_SE(channel); 4 | % 5 | % DESCRIPTION: 6 | % Determine current sensitivity settings for DAC (SINGLE-ENDED BNC output) and return as cal struct. 7 | % 8 | % INPUT: 9 | % channel: channel string ('left' or 'right') 10 | % 11 | % OUTPUT: 12 | % c: cal struct corresponding to the left or right channel 13 | % 14 | % DISCLAIMER: 15 | % This file is part of MATAA. 16 | % 17 | % MATAA is free software; you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation; either version 2 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % MATAA is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with MATAA; if not, write to the Free Software 29 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 30 | % 31 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 32 | % Contact: info@audioroot.net 33 | % Further information: http://www.audioroot.net/MATAA 34 | 35 | [s,x] = system( [ mataa_path('calibration') 'RTX6001_USB_STATUS' ] ); 36 | if s 37 | error ('RTX6001_AUTOSCALINGFUNCTION_DAC_SE: error running the RTX-USB utility.') 38 | end 39 | 40 | x = strsplit(x,'\n'){1}; % first line 41 | x = strsplit (x,'\t'); % separate fields 42 | 43 | % FORMAT: 44 | % x = { 45 | % [1,1] = Output_left=0 dBV 46 | % [1,2] = Output_right=+20 dBV 47 | % [1,3] = Input_left=-20 dBV(AC) 48 | % [1,4] = Input_right=-20 dBV(DC) 49 | %} 50 | 51 | ch = toupper(channel); 52 | switch ch 53 | case 'LEFT' 54 | k = 1; 55 | case 'RIGHT' 56 | k = 2; 57 | otherwise 58 | error (sprintf('RTX6001_AUTOSCALINGFUNCTION_DAC_SE: cannot parse channel identifier (%s).',channel)) 59 | end 60 | 61 | 62 | c.DAC.sensitivity_unit = 'V'; 63 | u = strsplit (x{k},'='){2}(1:end); 64 | switch u 65 | case '-20 dBV' 66 | c.DAC.name = 'RTX6001 100-mV SINGLE-ENDED OUTPUT'; 67 | c.DAC.sensitivity = 0.1*sqrt(2)/2; 68 | case '0 dBV' 69 | c.DAC.name = 'RTX6001 1-V SINGLE-ENDED OUTPUT'; 70 | c.DAC.sensitivity = sqrt(2)/2; 71 | case '+20 dBV' 72 | c.DAC.name = 'RTX6001 10-V SINGLE-ENDED OUTPUT'; 73 | c.DAC.sensitivity = 10*sqrt(2)/2; 74 | otherwise 75 | error (sprintf('RTX6001_AUTOSCALINGFUNCTION_DAC_SE: cannot parse DAC sensitivity string (%s).',u)) 76 | end 77 | c.DAC.name = [ c.DAC.name ' (' ch ')' ]; 78 | 79 | 80 | -------------------------------------------------------------------------------- /mataa_tools/mataa_gnuplot.m: -------------------------------------------------------------------------------- 1 | function mataa_gnuplot (cmd); 2 | 3 | % function mataa_gnuplot (cmd); 4 | % 5 | % DESCRIPTION: 6 | % This function executes the gnuplot command 'cmd' by calling __gnuplot_raw__(cmd). This only makes sense with Octave if gnuplot is used as the plotting engine. IMPORTANT: THIS FUNCTION SHOULD NOT BE USED ANYMORE, BECAUSE THE GNUPLOT INTERFACE TO OCTAVE HAS CHANGED CONSIDERABLY IN OCTAVE 2.9.X. IT WILL PROPABLY BE CHANGED FURTHER, BREAKING THIS FUNCTION. 7 | % 8 | % INPUT: 9 | % cmd: string containing the gnuplot command. 10 | % 11 | % DISCLAIMER: 12 | % This file is part of MATAA. 13 | % 14 | % MATAA is free software; you can redistribute it and/or modify 15 | % it under the terms of the GNU General Public License as published by 16 | % the Free Software Foundation; either version 2 of the License, or 17 | % (at your option) any later version. 18 | % 19 | % MATAA is distributed in the hope that it will be useful, 20 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | % GNU General Public License for more details. 23 | % 24 | % You should have received a copy of the GNU General Public License 25 | % along with MATAA; if not, write to the Free Software 26 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 27 | % 28 | % Copyright (C) 2007, 2008 Matthias S. Brennwald. 29 | % Contact: info@audioroot.net 30 | % Further information: http://www.audioroot.net/MATAA 31 | 32 | warning('mataa_gnuplot: THE FUNCTION mataa_gnuplot SHOULD NOT BE USED ANYMORE, BECAUSE THE GNUPLOT INTERFACE TO OCTAVE HAS CHANGED CONSIDERABLY IN OCTAVE 2.9.X. IT WILL PROPABLY BE CHANGED FURTHER, BREAKING THIS FUNCTION.') 33 | 34 | if ~exist('OCTAVE_VERSION','builtin') 35 | warning('mataa_gnuplot: talking to Gnuplot from within MATAA only makes sense with GNU Octave.') 36 | else 37 | try 38 | v = OCTAVE_VERSION; 39 | 40 | i = findstr('.',v); v = v(1:i(2)-1); 41 | 42 | cmd = undo_string_escapes(cmd); 43 | 44 | switch v 45 | case '2.1' % v = 2.1.x, use single quotes: 46 | eval(sprintf('__gnuplot_raw__( ''%s ; \\n '')',cmd)); % the eval is needed to make Matlab read the file without complaining. 47 | case '2.9' % v = 2.9.x, use double quotes: 48 | eval(sprintf('__gnuplot_raw__( "%s ; \\n ")',cmd)); % the eval is needed to make Matlab read the file without complaining. 49 | otherwise 50 | warning('mataa_gnuplot: don''t know how to handle gnuplot commands with your version of GNU Octave.') 51 | end 52 | catch 53 | warning(sprintf('mataa_gnuplot: %s', lasterr)) 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /mataa_tools/mataa_running_mean.m: -------------------------------------------------------------------------------- 1 | function y = mataa_running_mean (x,n,w); 2 | 3 | % function y = mataa_running_mean (x,n,w); 4 | % 5 | % DESCRIPTION: 6 | % Returns a running mean of a data series x. 7 | % 8 | % INPUT: 9 | % x: vector conaining the original data series 10 | % n: width of the smoothing window (number of samples, should be an odd number, n > 0) 11 | % w (optional): name of window type to be used. Default is 'rectangular', for other window types see mataa_signal_window 12 | % 13 | % OUTPUT: 14 | % y: running mean of y, length(ym) = length(y) 15 | % 16 | % EXAMPLE: 17 | % > N=1000; f0=500; fs=96000; t=[0:N-1]/fs; s = sin(2*pi*f0*t); % prepare a 500-Hz sine 18 | % > x = s+randn(size(s))/10; % create a noisy version of s 19 | % > y = mataa_running_mean(x,41,'hamm'); % remove the noise using a 41 samples wide Hamming window 20 | % > plot(t,x,'k',t,s,'g',t,y,'r') % plot the different versions of s 21 | % 22 | % DISCLAIMER: 23 | % This file is part of MATAA. 24 | % 25 | % MATAA is free software; you can redistribute it and/or modify 26 | % it under the terms of the GNU General Public License as published by 27 | % the Free Software Foundation; either version 2 of the License, or 28 | % (at your option) any later version. 29 | % 30 | % MATAA is distributed in the hope that it will be useful, 31 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 32 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 33 | % GNU General Public License for more details. 34 | % 35 | % You should have received a copy of the GNU General Public License 36 | % along with MATAA; if not, write to the Free Software 37 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 38 | % 39 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 40 | % Contact: info@audioroot.net 41 | % Further information: http://www.audioroot.net/MATAA 42 | 43 | if ~exist('w','var') 44 | w = 'rectangular'; 45 | end 46 | 47 | if mod(n,2)==0 48 | error('Length of averaging window is even.'); 49 | end 50 | 51 | % make sure x is a column vector 52 | 53 | [rows, cols] = size(x); 54 | 55 | if ~any([rows,cols] == 1) 56 | error('mataa_running_mean: need vector as input'); 57 | end 58 | 59 | transpose = (rows < cols); 60 | 61 | if transpose 62 | x = x'; 63 | end 64 | 65 | % setup the window 66 | w = mataa_signal_window(repmat(1,n,1),w); % NOTE: n should be odd 67 | w = w/sum(w); % normalize w 68 | 69 | % pad x to minimize end effects: 70 | x = [ repmat(x(1),n,1) ; x ; repmat(x(end),n,1) ]; 71 | 72 | % convolve x and w: 73 | y=conv(x,w); 74 | 75 | % remove padded 'ends' 76 | y = y(n+(n-1)/2:end-(n+(n+1)/2)); 77 | 78 | y = reshape(y,rows,cols); % make sure y is of the same format as the input vector 79 | -------------------------------------------------------------------------------- /calibration/RTX6001_AUTOSCALINGFUNCTION_DAC_BALANCED.m: -------------------------------------------------------------------------------- 1 | function c = RTX6001_AUTOSCALINGFUNCTION_DAC_BALANCED(channel); 2 | 3 | % function c = RTX6001_AUTOSCALINGFUNCTION_DAC_BALANCED(channel); 4 | % 5 | % DESCRIPTION: 6 | % Determine current sensitivity settings for DAC (BALANCED XLR output) and return as cal struct. 7 | % 8 | % INPUT: 9 | % channel: channel string ('left' or 'right') 10 | % 11 | % OUTPUT: 12 | % c: cal struct corresponding to the left or right channel 13 | % 14 | % DISCLAIMER: 15 | % This file is part of MATAA. 16 | % 17 | % MATAA is free software; you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation; either version 2 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % MATAA is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with MATAA; if not, write to the Free Software 29 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 30 | % 31 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 32 | % Contact: info@audioroot.net 33 | % Further information: http://www.audioroot.net/MATAA 34 | 35 | [s,x] = system( [ mataa_path('calibration') 'RTX6001_USB_STATUS' ] ); 36 | if s 37 | error ('RTX6001_AUTOSCALINGFUNCTION_DAC_BALANCED: error running the RTX-USB utility.') 38 | end 39 | 40 | x = strsplit(x,'\n'){1}; % first line 41 | x = strsplit (x,'\t'); % separate fields 42 | 43 | % FORMAT: 44 | % x = { 45 | % [1,1] = Output_left=0 dBV 46 | % [1,2] = Output_right=+20 dBV 47 | % [1,3] = Input_left=-20 dBV(AC) 48 | % [1,4] = Input_right=-20 dBV(DC) 49 | %} 50 | 51 | ch = toupper(channel); 52 | switch ch 53 | case 'LEFT' 54 | k = 1; 55 | case 'RIGHT' 56 | k = 2; 57 | otherwise 58 | error (sprintf('RTX6001_AUTOSCALINGFUNCTION_DAC_BALANCED: cannot parse channel identifier (%s).',channel)) 59 | end 60 | 61 | 62 | c.DAC.sensitivity_unit = 'V'; 63 | u = strsplit (x{k},'='){2}(1:end); 64 | switch u 65 | case '-20 dBV' 66 | c.DAC.name = 'RTX6001 100-mV BALANCED OUTPUT'; 67 | c.DAC.sensitivity = 0.1*sqrt(2); 68 | case '0 dBV' 69 | c.DAC.name = 'RTX6001 1-V BALANCED OUTPUT'; 70 | c.DAC.sensitivity = sqrt(2); 71 | case '+20 dBV' 72 | c.DAC.name = 'RTX6001 10-V BALANCED OUTPUT'; 73 | c.DAC.sensitivity = 10*sqrt(2); 74 | otherwise 75 | error (sprintf('RTX6001_AUTOSCALINGFUNCTION_DAC_BALANCED: cannot parse DAC sensitivity string (%s).',u)) 76 | end 77 | c.DAC.name = [ c.DAC.name ' (' ch ')' ]; 78 | 79 | 80 | -------------------------------------------------------------------------------- /calibration/BEYERDYNAMIC_MM1_14308_MICROPHONE_BEYERFACTORY.txt: -------------------------------------------------------------------------------- 1 | % Calibration data for Beyerdynamic MM1 microphone (serial number 14308) 2 | % Data source: Beyerdynamic factory data (email from kirchhoefer@beyerdynamic.de to matthias@brennwald.org, 18.6.2015) 3 | 4 | % General information: 5 | name = Beyerdynamic MM1 (SN 14308) 6 | type = Microphone 7 | % factory: 8 | % sensitivity = 14.5 mV/Pa 9 | 10 | % sensitivity from PeakTech calibrator (4.12.2018): 11 | sensitivity = 6.76 mV/Pa 12 | 13 | % Transfer function 14 | % free field, 1m distance to sound source, 0 deg. (axial) incidence 15 | % column-1: frequency (Hz) 16 | % column-2: gain (dB) relative to absolute sensitivity value given above 17 | 50 1.9 18 | 60 1.8 19 | 70 1.6 20 | 80 1.5 21 | 90 1.5 22 | 100 1.4 23 | 110 1.4 24 | 120 1.3 25 | 130 1.3 26 | 140 1.2 27 | 150 1.2 28 | 160 1.1 29 | 170 1.1 30 | 180 1.1 31 | 190 1 32 | 200 1 33 | 210 1 34 | 220 1 35 | 230 0.9 36 | 240 0.9 37 | 250 0.9 38 | 260 0.8 39 | 270 0.8 40 | 280 0.8 41 | 290 0.7 42 | 300 0.7 43 | 310 0.7 44 | 320 0.6 45 | 330 0.6 46 | 340 0.6 47 | 350 0.6 48 | 360 0.5 49 | 370 0.5 50 | 380 0.5 51 | 390 0.4 52 | 400 0.4 53 | 420 0.3 54 | 440 0.3 55 | 470 0.2 56 | 500 0.1 57 | 530 0.1 58 | 570 0.1 59 | 600 0.1 60 | 640 0.1 61 | 680 0.1 62 | 720 0.1 63 | 770 0.1 64 | 820 0.1 65 | 870 0 66 | 920 0 67 | 980 0 68 | 1050 0 69 | 1110 0.1 70 | 1180 0.1 71 | 1260 0.1 72 | 1340 0 73 | 1420 0 74 | 1510 0 75 | 1610 0 76 | 1710 0 77 | 1820 -0.1 78 | 1930 -0.1 79 | 2050 -0.3 80 | 2180 -0.3 81 | 2320 -0.3 82 | 2470 -0.2 83 | 2630 -0.3 84 | 2790 -0.2 85 | 2970 0 86 | 3160 0 87 | 3360 0.2 88 | 3570 0.2 89 | 3800 0.2 90 | 4040 -0.1 91 | 4290 -0.3 92 | 4570 -0.1 93 | 4860 0.3 94 | 5160 0.8 95 | 5490 1.3 96 | 5840 1.6 97 | 6210 1.3 98 | 6610 1.2 99 | 7030 1.4 100 | 7470 1.6 101 | 7950 1.7 102 | 8450 2 103 | 8990 2.5 104 | 9560 2.4 105 | 10160 2.4 106 | 10810 2.6 107 | 11490 2.7 108 | 12220 2.5 109 | 13000 2.5 110 | 13830 2.5 111 | 14700 2.3 112 | 15640 2.3 113 | 16630 2.1 114 | 17690 2 115 | 18810 1.8 116 | 19980 1.7 117 | -------------------------------------------------------------------------------- /mataa_tools/mataa_plot_HD.m: -------------------------------------------------------------------------------- 1 | function mataa_plot_HD (kn,annote); 2 | 3 | % function mataa_plot_HD (kn, annote); 4 | % 5 | % DESCRIPTION: 6 | % This function plots the harmonic distortion spectrum in kn. 7 | % 8 | % INPUT: 9 | % kn = [ k1 k2 k3 ... kn ] is the normalised distortion spectrum. 10 | % k1 corresponds to the fundamental frequency or first harmonic (k1 = 1, not plotted), k2 the component of second harmonic relative to the fundamental, k3 that of the third harmonic, etc. 11 | % annote (optional): optional annotation to be added to the plot title 12 | % 13 | % EXAMPLE: 14 | % > HD = mataa_measure_HD_noise ( 1000,1,44100,10,0.2 ); % measure harmonic distortion spectrum 15 | % > mataa_plot_HD(HD(1,:),'f0: 1kHz'); % plot the distortion spectrum 16 | % 17 | % DISCLAIMER: 18 | % This file is part of MATAA. 19 | % 20 | % MATAA is free software; you can redistribute it and/or modify 21 | % it under the terms of the GNU General Public License as published by 22 | % the Free Software Foundation; either version 2 of the License, or 23 | % (at your option) any later version. 24 | % 25 | % MATAA is distributed in the hope that it will be useful, 26 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | % GNU General Public License for more details. 29 | % 30 | % You should have received a copy of the GNU General Public License 31 | % along with MATAA; if not, write to the Free Software 32 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 33 | % 34 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 35 | % Contact: info@audioroot.net 36 | % Further information: http://www.audioroot.net/MATAA 37 | 38 | if ~exist('annote','var') 39 | annote = ''; 40 | end 41 | 42 | if length(annote) > 0 43 | annote = [' (' annote ')' ]; 44 | end 45 | 46 | figure(mataa_settings('plotWindow_HD')); 47 | mataa_plot_defaults; 48 | 49 | set (0,'defaultaxesposition', [0.05, 0.1, 0.9, 0.85]) 50 | 51 | holdstate=ishold; 52 | 53 | yp_min = 1E-10; 54 | 55 | for i=2:length(kn) 56 | yp = kn(i)*100; % convert to percent 57 | ydB = 20*log10(kn(i)); % convert to dB 58 | [ax, h1, h2] = plotyy ([i i],[yp_min yp], i,ydB ); hold on 59 | % plot([i i],[0 y],style1,i,y,style2); hold on 60 | 61 | set (h1,'linestyle','-','color','k','linewidth',3) 62 | set (h2,'linestyle','none','marker','.','markersize',30,'color','k') 63 | 64 | end 65 | 66 | set(ax,'position',[0.13 0.11 0.73 0.77]) 67 | set (ax,{'ycolor'},{'k';'k'}); 68 | set (ax(1),'yscale','log' ); 69 | set (ax(2),'xtick',[]); 70 | 71 | r1 = [ 1.5 length(kn)+0.5 0.0001 100 ]; axis(ax(1),r1); 72 | r2 = r1; r2(3:4) = 20*log10(r1(3:4)/100); axis(ax(2),r2); 73 | title(['MATAA: harmonic distortion spectrum' annote]); 74 | ylabel(ax(1),'k_n (%)'); 75 | ylabel(ax(2),'k_n (dB)'); 76 | xlabel('n'); 77 | 78 | if ~holdstate 79 | hold off 80 | end 81 | -------------------------------------------------------------------------------- /calibration/BEHRINGER_ECM8000_D1303397118_MICROPHONE.txt: -------------------------------------------------------------------------------- 1 | % Microphone calibration data for Behringer ECM8000 (SN D1303397118) 2 | % Data acquired on 19-Jul-2015 09:41:43 3 | % Number of replicate measurements: 5 (with REF/DUT exchange in between each replication, walked out of the room each time) 4 | % Microphone used as reference: Beyerdynamic MM1 (SN 14308) 5 | 6 | name = Behringer ECM8000 (SN D1303397118) 7 | type = Microphone 8 | % original value: 9 | % sensitivity = 12.5 mV/Pa 10 | 11 | % from PeakTech level calibrator 4.12.18: 12 | sensitivity = 11.84 mV/Pa 13 | 14 | % Gain relative to sensitivity at 1 kHz: 15 | % (column-1: frequency (Hz), column-2: gain (dB) 16 | 82.2387 0.970328 17 | 86.9073 1.226 18 | 91.841 1.27702 19 | 97.053 1.22803 20 | 102.561 1.17533 21 | 108.383 1.11316 22 | 114.534 1.04589 23 | 121.033 1.08533 24 | 127.905 1.08449 25 | 135.163 1.03609 26 | 142.834 1.05416 27 | 150.942 1.06283 28 | 159.508 1.05968 29 | 168.56 1.08539 30 | 178.129 1.08026 31 | 188.238 1.05437 32 | 198.92 1.03315 33 | 210.213 1.02031 34 | 222.143 1.00127 35 | 234.749 0.974502 36 | 248.076 0.945453 37 | 262.154 0.901121 38 | 277.031 0.861537 39 | 292.758 0.823172 40 | 309.372 0.763318 41 | 326.929 0.705151 42 | 345.488 0.67233 43 | 365.095 0.619112 44 | 385.814 0.577264 45 | 407.716 0.518027 46 | 430.854 0.440026 47 | 455.305 0.368991 48 | 481.152 0.294636 49 | 508.457 0.259774 50 | 537.312 0.236871 51 | 567.815 0.229463 52 | 600.039 0.229913 53 | 634.091 0.225275 54 | 670.088 0.202035 55 | 708.115 0.16912 56 | 748.3 0.162257 57 | 790.781 0.133095 58 | 835.658 0.099257 59 | 883.081 0.0681148 60 | 933.213 0.0141931 61 | 986.173 -0.002181 62 | 1042.14 -0.000323108 63 | 1101.3 -0.00368002 64 | 1163.8 -0.0521402 65 | 1229.84 -0.104902 66 | 1299.66 -0.146111 67 | 1373.42 -0.167962 68 | 1451.36 -0.169656 69 | 1533.75 -0.160247 70 | 1620.79 -0.161389 71 | 1712.77 -0.174174 72 | 1810 -0.201315 73 | 1912.72 -0.253058 74 | 2021.27 -0.301072 75 | 2136.01 -0.377932 76 | 2257.23 -0.393236 77 | 2385.33 -0.377535 78 | 2520.74 -0.434005 79 | 2663.79 -0.399933 80 | 2814.96 -0.367537 81 | 2974.77 -0.337991 82 | 3143.58 -0.253889 83 | 3321.98 -0.162983 84 | 3510.57 -0.117202 85 | 3709.79 -0.112476 86 | 3920.32 -0.154566 87 | 4142.88 -0.218196 88 | 4377.98 -0.202079 89 | 4626.43 -0.0521926 90 | 4889.07 0.257536 91 | 5166.53 0.669402 92 | 5459.73 0.96679 93 | 5769.67 1.08989 94 | 6097.1 1.11465 95 | 6443.11 1.08037 96 | 6808.88 1.15475 97 | 7195.28 1.3363 98 | 7603.61 1.54223 99 | 8035.27 1.74356 100 | 8491.26 1.85027 101 | 8973.14 1.929 102 | 9482.54 2.11512 103 | 10020.7 2.31903 104 | 10589.3 2.40035 105 | 11190.5 2.44197 106 | 11825.6 2.51165 107 | 12496.7 2.5577 108 | 13206.1 2.61657 109 | 13955.5 2.76506 110 | 14747.5 2.95387 111 | 15584.7 3.02924 112 | 16469.1 3.11593 113 | 17403.7 3.31947 114 | 18391.8 3.31168 115 | 19435.8 3.40149 116 | -------------------------------------------------------------------------------- /mataa_tools/mataa_menu.m: -------------------------------------------------------------------------------- 1 | function out = mataa_menu (title, varargin) 2 | 3 | % function out = mataa_menu (title, varargin) 4 | % 5 | % DESCRIPTION: 6 | % This function prints a menu and asks the user to choose a command from the menu. 7 | % 8 | % title: the tile of the menu (string) 9 | % varargin: a list of menu entries as described in the below example 10 | % out: the command chosen by the user 11 | % 12 | % EXAMPLE: 13 | % 14 | % To print a menu with the title 'Main menu' and the commands 'measure', 'plot', 'save' and 'exit': 15 | % choice = mataa_menu('Main menu','m','measure','p','plot','s','save','e','exit'); 16 | % 17 | % The result will look like this: 18 | % ----------- 19 | % Main menu: 20 | % [m] measure -- [p] plot -- [s] save -- [e] exit 21 | % 22 | % Choose a command: 23 | % ----------- 24 | % The user then chooses one of the four commands by entering 'm', 'p', 's' or 'e'. If he/she enteres something else, an error message will be shown, and the menu is displayed again. 25 | % 26 | % DISCLAIMER: 27 | % This file is part of MATAA. 28 | % 29 | % MATAA is free software; you can redistribute it and/or modify 30 | % it under the terms of the GNU General Public License as published by 31 | % the Free Software Foundation; either version 2 of the License, or 32 | % (at your option) any later version. 33 | % 34 | % MATAA is distributed in the hope that it will be useful, 35 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 36 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 37 | % GNU General Public License for more details. 38 | % 39 | % You should have received a copy of the GNU General Public License 40 | % along with MATAA; if not, write to the Free Software 41 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 42 | % 43 | % Copyright (C) 2007, 2008 Matthias S. Brennwald. 44 | % Contact: info@audioroot.net 45 | % Further information: http://www.audioroot.net/MATAA 46 | 47 | if exist('OCTAVE_VERSION','builtin') 48 | % Force pending output to appear before the menu. 49 | fflush (stdout); 50 | end 51 | 52 | N = nargin-1; 53 | if mod(N,2) 54 | error('mataa_menu: list of options is corrupted or incomplete') 55 | end 56 | N = N/2; 57 | 58 | done = false; 59 | 60 | while(~done) 61 | printf('\n') 62 | if (~isempty(title)) 63 | disp(strcat(title,':')); 64 | end 65 | for i = 1:N 66 | o = varargin{2*i-1}; 67 | t = varargin{2*i}; 68 | printf("[%s] %s",o,t); 69 | if i < N 70 | printf(" -- "); 71 | else 72 | printf("\n"); 73 | end 74 | end 75 | 76 | printf('\n') 77 | s = input ("Choose a command: ", "s"); 78 | 79 | for i = 1:N 80 | if strcmp(varargin{2*i-1},s); 81 | done = true; 82 | out = s; 83 | break 84 | end 85 | end 86 | if ~done 87 | printf('\n') 88 | disp('Invalid command! Try a again...'); 89 | end 90 | end 91 | -------------------------------------------------------------------------------- /mataa_tools/mataa_export_TMD.m: -------------------------------------------------------------------------------- 1 | function mataa_export_TMD (t,s,comment,file); 2 | 3 | % function mataa_export_TMD (t,s,comment,file); 4 | % 5 | % DESCRIPTION: 6 | % Export time-domain data to a TMD file (or, in other words: export the samples a signal s(t) to an ASCII file). A TMD file is essentially an ASCII file containing two columns of data: time and signal samples. The 'TMD format' is modelled after the FRD format for frequency-domain data (see mataa_export_FRD for more information). 7 | % 8 | % INPUT: 9 | % t: time values (seconds) 10 | % s: signal samples 11 | % comment: string containing a comment to be saved with the data, e.g. a description of the data. Use comment = '' if you do not want a comment in the data file. 12 | % 13 | % OUTPUT: 14 | % (none) 15 | % 16 | % DISCLAIMER: 17 | % This file is part of MATAA. 18 | % 19 | % MATAA is free software; you can redistribute it and/or modify 20 | % it under the terms of the GNU General Public License as published by 21 | % the Free Software Foundation; either version 2 of the License, or 22 | % (at your option) any later version. 23 | % 24 | % MATAA is distributed in the hope that it will be useful, 25 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | % GNU General Public License for more details. 28 | % 29 | % You should have received a copy of the GNU General Public License 30 | % along with MATAA; if not, write to the Free Software 31 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 32 | % 33 | % Copyright (C) 2008 Matthias S. Brennwald. 34 | % Contact: info@audioroot.net 35 | % Further information: http://www.audioroot.net/MATAA 36 | 37 | 38 | t = t(:); 39 | s = s(:); 40 | 41 | N = length (t); 42 | 43 | if length (s) ~= N 44 | error ('mataa_export_TMD: s must be of the same size as t.') 45 | end 46 | 47 | if length (file) == 0 48 | error ('mataa_export_TMD: the file name must not be empty.'); 49 | end 50 | 51 | if length (file) < 4 52 | file = sprintf ('%s.TMD',file); % append '.TMD' 53 | end 54 | 55 | if ~strcmp (upper (file(end-3:end)),'.TMD') 56 | file = sprintf ('%s.TMD',file); % append '.TMD' 57 | end 58 | 59 | if exist(file,'file') 60 | beep; 61 | overwrite = input(sprintf("File %s exists. Enter 'Y' or 'y' to overwrite, or anything else to cancel.",file),"s"); 62 | if ~strcmp(lower(overwrite),"y") 63 | disp ('File not saved, user cancelled.') 64 | return 65 | else 66 | disp (sprintf('Overwriting %s...',file)); 67 | end 68 | end 69 | 70 | [fid,msg] = fopen (file,'wt'); 71 | 72 | if fid == -1 73 | error (sprintf ('mataa_export_TMD: %s',msg)) 74 | end 75 | 76 | fprintf (fid,'* TMD data written by MATAA on %s\n',datestr (now)); 77 | 78 | if ~isempty (comment) 79 | fprintf (fid,'* %s\n',comment); 80 | end 81 | 82 | for i = 1:N-1 83 | fprintf (fid,'%g\t%g\n',t(i),s(i)) 84 | end 85 | fprintf (fid,'%g\t%g',t(N),s(N)) % print last line without line break 86 | 87 | fclose (fid); 88 | -------------------------------------------------------------------------------- /calibration/RTX6001_AUTOSCALINGFUNCTION_ADC.m: -------------------------------------------------------------------------------- 1 | function c = RTX6001_AUTOSCALINGFUNCTION_ADC(channel); 2 | 3 | % function c = RTX6001_AUTOSCALINGFUNCTION_ADC(channel); 4 | % 5 | % DESCRIPTION: 6 | % Determine current sensitivity settings for ADC and return as cal struct. 7 | % 8 | % INPUT: 9 | % channel: channel string ('left' or 'right') 10 | % 11 | % OUTPUT: 12 | % c: cal struct corresponding to the left or right channel 13 | % 14 | % DISCLAIMER: 15 | % This file is part of MATAA. 16 | % 17 | % MATAA is free software; you can redistribute it and/or modify 18 | % it under the terms of the GNU General Public License as published by 19 | % the Free Software Foundation; either version 2 of the License, or 20 | % (at your option) any later version. 21 | % 22 | % MATAA is distributed in the hope that it will be useful, 23 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | % GNU General Public License for more details. 26 | % 27 | % You should have received a copy of the GNU General Public License 28 | % along with MATAA; if not, write to the Free Software 29 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 30 | % 31 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 32 | % Contact: info@audioroot.net 33 | % Further information: http://www.audioroot.net/MATAA 34 | 35 | [s,x] = system( [ mataa_path('calibration') 'RTX6001_USB_STATUS' ] ); 36 | if s 37 | error ('RTX6001_AUTOSCALINGFUNCTION_ADC: error running the RTX-USB utility.') 38 | end 39 | 40 | x = strsplit(x,'\n'){1}; % first line 41 | x = strsplit (x,'\t'); % separate fields 42 | 43 | % FORMAT: 44 | % x = { 45 | % [1,1] = Output_left=0 dBV 46 | % [1,2] = Output_right=+20 dBV 47 | % [1,3] = Input_left=-20 dBV(AC) 48 | % [1,4] = Input_right=-20 dBV(DC) 49 | %} 50 | 51 | ch = toupper(channel); 52 | switch ch 53 | case 'LEFT' 54 | k = 1; 55 | case 'RIGHT' 56 | k = 2; 57 | otherwise 58 | error (sprintf('RTX6001_AUTOSCALINGFUNCTION_ADC: cannot parse channel identifier (%s).',channel)) 59 | end 60 | 61 | c.ADC.sensitivity_unit = '1/V'; 62 | 63 | u = strsplit (x{k+2},'='){2}(1:end-4); 64 | switch u 65 | case '-20 dBV' 66 | c.ADC.name = 'RTX6001 100-mV INPUT'; 67 | c.ADC.sensitivity = 10*sqrt(0.5); 68 | case '-10 dBV' 69 | c.ADC.name = 'RTX6001 316-mV INPUT'; 70 | c.ADC.sensitivity = sqrt(0.5)*sqrt(10); 71 | case '0 dBV' 72 | c.ADC.name = 'RTX6001 1-V INPUT'; 73 | c.ADC.sensitivity = sqrt(0.5); 74 | case '+10 dBV' 75 | c.ADC.name = 'RTX6001 3.16-V INPUT'; 76 | c.ADC.sensitivity = 0.1*sqrt(0.5)*sqrt(10); 77 | case '+20 dBV' 78 | c.ADC.name = 'RTX6001 10-V INPUT'; 79 | c.ADC.sensitivity = 0.1*sqrt(0.5); 80 | case '+30 dBV' 81 | c.ADC.name = 'RTX6001 31.6-V INPUT'; 82 | c.ADC.sensitivity = 0.01*sqrt(0.5)*sqrt(10); 83 | case '+40 dBV' 84 | c.ADC.name = 'RTX6001 100-V INPUT'; 85 | c.ADC.sensitivity = 0.01*sqrt(0.5); 86 | otherwise 87 | error (sprintf('RTX6001_AUTOSCALING_ADC: cannot parse ADC sensitivity string (%s).',u)) 88 | end 89 | c.ADC.name = [ c.ADC.name ' (' ch ')' ]; 90 | -------------------------------------------------------------------------------- /mataa_tools/mataa_phase_remove_trend.m: -------------------------------------------------------------------------------- 1 | function [phase,delay] = mataa_phase_remove_trend (phase,f,f1,f2); 2 | 3 | % function [phase,delay] = mataa_phase_remove_trend (phase,f,f1,f2); 4 | % 5 | % DESCRIPTION: 6 | % Remove linear trend in phase(f), e.g. excess phase due to time delay. 7 | % 8 | % INPUT: 9 | % phase: phase, including excess phase due to time delay (unwrapped, in degrees) 10 | % f: frequency coordinates of phase (in Hz) 11 | % f1, f2 (optional, in Hz): if both f1 and f2 are specified, the linear trend in phase(f1 f2 50 | ff = f2; f2 = f1; f1 = ff; clear ff; 51 | end 52 | i = find(f>=f1 & f<=f2); 53 | else 54 | error('mataa_phase_remove_trend: f2 not specified'); 55 | end 56 | else 57 | i = 1:length(f); 58 | end 59 | 60 | if isempty(i) 61 | error('mataa_phase_remove_trend: frequency range too small'); 62 | end 63 | 64 | % determine delay corresponding to phase trend (excess phase, see D'Appolito, J. (1998) Testing Loudspeakers, page 111) 65 | p = polyfit(f(i),phase(i),1); 66 | %%% delay = -p(1)/(2*pi); 67 | delay = -p(1)/360; 68 | 69 | % remove exess phase due to delay: 70 | phase = mataa_phase_remove_delay(phase,f,delay); 71 | -------------------------------------------------------------------------------- /mataa_tools/mataa_IR_to_CSD.m: -------------------------------------------------------------------------------- 1 | function [spl,f,d] = mataa_IR_to_CSD (h,t,T,smooth_interval); 2 | 3 | % function [spl,f,d] = mataa_IR_to_CSD (h,t,T,smooth_interval); 4 | % 5 | % DESCRIPTION: 6 | % This function calculates cumulative spectral decay (CSD) data (SPL-responses spl at frequencies f and delay times d). 7 | % 8 | % INPUT: 9 | % h: values impulse response (vector) 10 | % t: time values of samples in h (vector, in seconds) or sampling rate of h (scalar, in Hz) 11 | % T: desired delay times (should be evenly spaced) 12 | % smooth_interval (optional): if supplied, the SPL curves are smoothed using mataa_IR_to_FR_smooth 13 | % 14 | % OUTPUT: 15 | % spl: CSD data (dB) 16 | % f: frequency (Hz) 17 | % d: delay of CSD data (seconds) 18 | % 19 | % EXAMPLE: 20 | % [h,t] = mataa_IR_demo ('FE108'); 21 | % T = [0:1E-4:4E-3]; 22 | % [spl,f,t] = mataa_IR_to_CSD (h,t,T,1/24); 23 | % mataa_plot_CSDt (spl,f,t,50); 24 | % 25 | % DISCLAIMER: 26 | % This file is part of MATAA. 27 | % 28 | % MATAA is free software; you can redistribute it and/or modify 29 | % it under the terms of the GNU General Public License as published by 30 | % the Free Software Foundation; either version 2 of the License, or 31 | % (at your option) any later version. 32 | % 33 | % MATAA is distributed in the hope that it will be useful, 34 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 35 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 36 | % GNU General Public License for more details. 37 | % 38 | % You should have received a copy of the GNU General Public License 39 | % along with MATAA; if not, write to the Free Software 40 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 41 | % 42 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 43 | % Contact: info@audioroot.net 44 | % Further information: http://www.audioroot.net/MATAA 45 | 46 | if isscalar(t) 47 | t = [0:1/t:(length(h)-1)/t]; 48 | end 49 | 50 | % make sure we've got column vectors: 51 | h = h(:); 52 | t = t(:); 53 | T = T(:); 54 | 55 | fs=(length(t)-1)/(max(t)-min(t)); 56 | 57 | t = t-t(1); % shift impulse response to zero-based time 58 | 59 | spl=[]; f=[]; d=[]; 60 | dT=T(2)-T(1); 61 | 62 | for n=1:length(T) 63 | % construct a time window to (smoothly) cut off the beginning of the impulse response: 64 | window = repmat(NaN,length(h),1); 65 | window(tT(n)+dT/2) = 1; 67 | i = find(isnan(window)); 68 | window(i)=0.5+0.5*sin(pi*(t(i)-T(n))/dT); % smooth transition from 0 to 1 69 | h = window.*h; 70 | 71 | if T(n) <= max(t) 72 | if exist('smooth_interval','var') 73 | [splI,phase,fI] = mataa_IR_to_FR(h,t,smooth_interval,'FS'); 74 | else 75 | [splI,phase,fI] = mataa_IR_to_FR(h,t,[],'FS'); 76 | end 77 | 78 | clear phase; 79 | 80 | % throw away data with f < fMin THIS IS TOO RESTRICTIVE!!! 81 | % fMin = 1/(max(t)-(T(n))) 82 | % i = find( fI >= fMin ); 83 | % fI = fI(i); splI = splI(i); 84 | 85 | % make sure we've got column vectors: 86 | splI = splI(:); 87 | fI = fI(:); 88 | 89 | % add the data to the output: 90 | f = [ f ; fI ]; 91 | spl = [ spl ; splI ]; 92 | d = [ d ; repmat(T(n),size(fI)) ]; 93 | end 94 | % else 95 | % T(n) = NaN; 96 | % end 97 | end 98 | -------------------------------------------------------------------------------- /mataa_tools/mataa_import_TMD.m: -------------------------------------------------------------------------------- 1 | function [t,s,comments] = mataa_import_TMD (file,timefix); 2 | 3 | % function [t,s,comments] = mataa_import_TMD (file,timefix) 4 | % 5 | % DESCRIPTION: 6 | % Import time-domain data from a TMD file (see also mataa_export_TMD). 7 | % 8 | % INPUT: 9 | % file: string containing the name of the file containing the data to be imported. The string may contain a complete path. If no path is given, the file is assumed to be located in the current working directory. 10 | % timefix (optional): flag indicating if (and how) mataa_import_TMD should try to make time values evenly spaced. If timefix > 1: t = timefix * round (1/mean(diff(t))/timefix) 11 | % 12 | % OUTPUT: 13 | % t: time values (s) 14 | % s: signal samples 15 | % comments: cell string containing the comments in the data file (if any) 16 | % 17 | % DISCLAIMER: 18 | % This file is part of MATAA. 19 | % 20 | % MATAA is free software; you can redistribute it and/or modify 21 | % it under the terms of the GNU General Public License as published by 22 | % the Free Software Foundation; either version 2 of the License, or 23 | % (at your option) any later version. 24 | % 25 | % MATAA is distributed in the hope that it will be useful, 26 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | % GNU General Public License for more details. 29 | % 30 | % You should have received a copy of the GNU General Public License 31 | % along with MATAA; if not, write to the Free Software 32 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 33 | % 34 | % Copyright (C) 2008 Matthias S. Brennwald. 35 | % Contact: info@audioroot.net 36 | % Further information: http://www.audioroot.net/MATAA 37 | % 38 | % EXAMPLE: 39 | % 40 | % > [t,h,comments] = mataa_import_TMD ('scanspeaker_0deg_no_filter_tweeter.tmd',10); 41 | 42 | if nargin == 0 43 | file = ''; 44 | end 45 | 46 | if length (file) == 0 47 | error ('mataa_export_TMD: the file name must not be empty.'); 48 | end 49 | 50 | t = []; 51 | s = []; 52 | comments = cellstr (''); 53 | nc = 0; 54 | 55 | [fid,msg] = fopen (file,'rt'); 56 | 57 | if fid == -1 58 | error (sprintf ('mataa_import_TMD: %s (file: %s).',msg,file)) 59 | end 60 | 61 | %%% s = char (fread(fid,[2,Inf])); 62 | %%% s = strsplit(s(1:end),"\n"); 63 | 64 | % read the header 65 | try_header = 1; 66 | while try_header 67 | l0 = fgetl (fid); 68 | if l0 == -1 69 | return 70 | else 71 | l = fliplr(deblank(fliplr(l0))); 72 | if strcmp (l(1),'*') 73 | nc = nc+1; 74 | comments{nc} = fliplr(deblank(fliplr(l)))(2:end); 75 | else 76 | try_header = 0; 77 | fseek (fid,-length(l0)-1,"cof"); % go back to beginning of the line 78 | end 79 | end 80 | end 81 | 82 | x = fscanf(fid, '%f%f', Inf); 83 | fclose (fid); 84 | x = reshape (x,2,length(x)/2)'; 85 | t = x(:,1); 86 | s = x(:,2); 87 | 88 | if exist ('timefix','var') 89 | if timefix > 1 90 | fs = timefix * round (1/mean(diff(t))/timefix); 91 | t = t(1) + [ 0 : 1/fs : (length(s)-1)/fs ]'; 92 | end 93 | end 94 | 95 | if max(diff(t)) - min(diff(t)) > 2.5*eps 96 | warning ('mataa_import_TMD: time values are not evenly spaced. Be careful!') 97 | end -------------------------------------------------------------------------------- /mataa_tools/mataa_FR_smooth.m: -------------------------------------------------------------------------------- 1 | function [mag,phase,f] = mataa_FR_smooth (mag,phase,f,smooth_interval); 2 | 3 | % function [mag,phase,f] = mataa_FR_smooth (mag,phase,f,smooth_interval); 4 | % 5 | % DESCRIPTION: 6 | % Smooth frequency response in octave bands. 7 | % 8 | % INPUT: 9 | % mag: magnitude data 10 | % phase: phase data 11 | % f: frequency 12 | % smooth_interval: width of octave band used for smoothing 13 | % 14 | % OUTPUT: 15 | % mag: smoothed frequency response (magnitude) 16 | % phase: smoothed frequency response (phase) 17 | % f: frequency values of smoothed frequency response data 18 | % 19 | % EXAMPLE: 20 | % > [h,t] = mataa_IR_demo; 21 | % > [mag,phase,f] = mataa_IR_to_FR(h,t); % calculates magnitude(f) and phase(f) 22 | % > [magS,phaseS,fS] = mataa_FR_smooth(mag,phase,f,1/4); % smooth to 1/4 octave resolution 23 | % > semilogx ( f,mag , fS,magS ); % plot raw and smoothed data 24 | % 25 | % DISCLAIMER: 26 | % This file is part of MATAA. 27 | % 28 | % MATAA is free software; you can redistribute it and/or modify 29 | % it under the terms of the GNU General Public License as published by 30 | % the Free Software Foundation; either version 2 of the License, or 31 | % (at your option) any later version. 32 | % 33 | % MATAA is distributed in the hope that it will be useful, 34 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 35 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 36 | % GNU General Public License for more details. 37 | % 38 | % You should have received a copy of the GNU General Public License 39 | % along with MATAA; if not, write to the Free Software 40 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 41 | % 42 | % Copyright (C) 2015 Matthias S. Brennwald. 43 | % Contact: info@audioroot.net 44 | % Further information: http://www.audioroot.net/MATAA 45 | 46 | % fractional octave between last and second-last data point: 47 | Nf = log2 (f(end)/f(end-1)); 48 | 49 | % number of points corresponding to smooth_interval: 50 | Ns = round (smooth_interval / Nf); 51 | 52 | % smooth the log-f data: 53 | if Ns > 1 % otherwise no smoothing is required 54 | 55 | No = log2 (f(end)/f(1)); % number of octaves covered by full data set 56 | NL = round (No/Nf); % number of data points required for log-interpolation to capture the original data at full resolution 57 | 58 | % interpolate to log-distributed frequency values: 59 | f0 = f; 60 | f = logspace(log10(f0(1)),log10(f0(end)),NL); 61 | mag = interp1 (f0,mag,f,'extrap'); 62 | phase = interp1 (f0,phase,f,'extrap'); 63 | 64 | % construct sliding window W with effective width Ns: 65 | W = linspace (1/Ns,1,round(0.2*Ns)); 66 | W = [ W repmat(1,1,round(0.8*Ns)) fliplr(W) ]; 67 | W = W / sum(W); % normalize 68 | NW = length(W); 69 | % convolve mag and phase with W: 70 | % mag = conv ([ repmat(mag(1),1,NW) mag repmat(mag(end),1,NW) ],W,'same')(NW+1:end-NW); 71 | % phase = conv ([ repmat(phase(1),1,NW) phase repmat(phase(end),1,NW) ],W,'same')(NW+1:end-NW); 72 | M0 = mag; 73 | P0 = phase; 74 | mag = fftconv ([ repmat(mag(1),1,NW) mag repmat(mag(end),1,NW) ],W); 75 | phase = fftconv ([ repmat(phase(1),1,NW) phase repmat(phase(end),1,NW) ],W); 76 | a = round(1.5*NW); 77 | b = 3*NW-a; 78 | mag = mag(a:end-b); 79 | phase = phase(a:end-b); 80 | end -------------------------------------------------------------------------------- /mataa_tools/mataa_impedance_speaker_model_WRIGHT.m: -------------------------------------------------------------------------------- 1 | function [mag,phase] = mataa_impedance_speaker_model_WRIGHT (f,Rdc,f0,Qe,Qm,Kr,Xr,Ki,Xi) 2 | 3 | % function [mag,phase] = mataa_impedance_speaker_model_WRIGHT (f,Rdc,f0,Qe,Qm,Kr,Xr,Ki,Xi) 4 | % 5 | % DESCRIPTION: 6 | % Calculate speaker impedance (magnitude and phase) as a function of frequency f according to the "Wright model" (see "An Empirical Model for Loudspeaker Motor Impedance", J R Wright, AES Preprint, 2776 (S-2), 1989). This model essentially consists of a combination of three impedance elements connected in series (where w = 2*pi*f, w0 = 2*pi*f0): 7 | % (a) The DC resistance of the voice coil (Rdc) 8 | % (b) A parallel LCR circuit, reflecting the the low-frequency part of the impedance curve (resonance peak). 9 | % (c) an empirical term that describes the impedance rise above the resonance peak: Z = Kr w^Xr + i Ki w^Xi 10 | % 11 | % INPUT: 12 | % f: frequency values for which impedance will be calculatedq 13 | % Rdc: DC resistance of the voice coil (Ohm) 14 | % f0: resonance frequency of the speaker (Hz) 15 | % Qe: electrical quality factor of the speaker (at resonance) 16 | % Qm: mechanical quality factor of the speaker (at resonance) 17 | % Kr,Xr,Ki,Xi (optional): see above 18 | % 19 | % OUTPUT: 20 | % mag: magnitude of impedance (Ohm) 21 | % phase: phase of impedance (degrees) 22 | % 23 | % NOTES: 24 | % - The ratio Qm/Qe reflects the height of the impedance peak. If Zmax is the impedance maximum (at resonance) then Zmax/Rdc = Qm/Qe+1. 25 | % - Qe reflects the width of the impedance peak (large Qe corresponds to a narrow peak) 26 | % 27 | % EXAMPLE: 28 | % > f = logspace(1,4,1000); 29 | % > Rdc = 6.1; f0 = 45; Qe = 0.35; Qm = 5.0; 30 | % > Kr = 4.5E-3; Ki = 27E-3; Xr = 0.65; Xi = 0.68; 31 | % > [mag,phase] = mataa_impedance_speaker_model_WRIGHT (f,Rdc,f0,Qe,Qm,Kr,Xr,Ki,Xi); 32 | % 33 | % DISCLAIMER: 34 | % This file is part of MATAA. 35 | % 36 | % MATAA is free software; you can redistribute it and/or modify 37 | % it under the terms of the GNU General Public License as published by 38 | % the Free Software Foundation; either version 2 of the License, or 39 | % (at your option) any later version. 40 | % 41 | % MATAA is distributed in the hope that it will be useful, 42 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 43 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 44 | % GNU General Public License for more details. 45 | % 46 | % You should have received a copy of the GNU General Public License 47 | % along with MATAA; if not, write to the Free Software 48 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 49 | % 50 | % Copyright (C) 2008 Matthias S. Brennwald. 51 | % Contact: info@audioroot.net 52 | % Further information: http://www.audioroot.net/MATAA 53 | 54 | if any ([Rdc,f0,Qe,Qm] == 0) 55 | error ('mataa_impedance_speaker_model: Rdc, f0, Qe and Qm must not be zero!') 56 | end 57 | 58 | w0 = 2*pi*f0; 59 | w = 2*pi*f; 60 | 61 | % low-frequency impedance (resonance peak, LCR part): 62 | Res = Rdc*Qm/Qe; 63 | Ces = Qe/w0/Rdc; 64 | Les = 1/w0^2/Ces; 65 | 66 | ZCes = 1./(i*w*Ces); 67 | ZLes = i*w*Les; 68 | Zlow = 1 ./ ( 1/Res + 1./ZCes + 1./ZLes ); 69 | 70 | % high-frequency impedance: 71 | Zhigh = Kr * w.^Xr + i * Ki * w.^Xi; 72 | 73 | % total impedance: 74 | Z = Rdc + Zlow + Zhigh; 75 | mag = abs (Z); 76 | phase = angle (Z) / pi * 180; 77 | -------------------------------------------------------------------------------- /mataa_tools/mataa_smooth_log.m: -------------------------------------------------------------------------------- 1 | function [y,x] = mataa_smooth_log (yRaw,xRaw,step) 2 | 3 | % function [y,x] = mataa_smooth_log (yRaw,xRaw,step) 4 | % 5 | % THIS FUNCTION IS OBSOLETE. USE mataa_FR_smooth instead. 6 | % 7 | % DISCLAIMER: 8 | % This file is part of MATAA. 9 | % 10 | % MATAA is free software; you can redistribute it and/or modify 11 | % it under the terms of the GNU General Public License as published by 12 | % the Free Software Foundation; either version 2 of the License, or 13 | % (at your option) any later version. 14 | % 15 | % MATAA is distributed in the hope that it will be useful, 16 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | % GNU General Public License for more details. 19 | % 20 | % You should have received a copy of the GNU General Public License 21 | % along with MATAA; if not, write to the Free Software 22 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 23 | % 24 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 25 | % Contact: info@audioroot.net 26 | % Further information: http://www.audioroot.net/MATAA 27 | 28 | error ('mataa_smooth_log: this function is obsolete! Use mataa_FR_smooth instead.') 29 | 30 | %% % DESCRIPTION: 31 | %% % This function smoothes a data set (xRaw,yRaw) reflecting a function y(x), where the size of the averaging bins of x increases exponentially. y may be a multi-dimensional function of x. 32 | %% % 33 | %% % INPUT: 34 | %% % yRaw, xRaw: vectors containing raw data corresponding to function y(x). 35 | %% % step: smoothing width in octaves (e.g. step = 1/12 gives smoothed data with 1/12-octave resolution) 36 | %% % 37 | %% % OUTPUT: 38 | %% % y, x: vectors containing smoothed data. If y(x) is multi dimensional, y is a matrix. 39 | %% % 40 | %% % DISCLAIMER: 41 | %% % This file is part of MATAA. 42 | %% % 43 | %% % MATAA is free software; you can redistribute it and/or modify 44 | %% % it under the terms of the GNU General Public License as published by 45 | %% % the Free Software Foundation; either version 2 of the License, or 46 | %% % (at your option) any later version. 47 | %% % 48 | %% % MATAA is distributed in the hope that it will be useful, 49 | %% % but WITHOUT ANY WARRANTY; without even the implied warranty of 50 | %% % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 51 | %% % GNU General Public License for more details. 52 | %% % 53 | %% % You should have received a copy of the GNU General Public License 54 | %% % along with MATAA; if not, write to the Free Software 55 | %% % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 56 | %% % 57 | %% % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 58 | %% % Contact: info@audioroot.net 59 | %% % Further information: http://www.audioroot.net/MATAA 60 | %% 61 | %% xMin = min(xRaw); 62 | %% xMax = max(xRaw); 63 | %% 64 | %% step = 2^step; 65 | %% 66 | %% n = round(log(xMax/xMin)/log(step)); 67 | %% 68 | %% x = logspace(log10(xMin),log10(xMax),2*n+1); 69 | %% x = x(2:2:end-1); 70 | %% 71 | %% lenY = length(x); % length of series 72 | %% y = repmat(NaN,lenY,1); 73 | %% 74 | %% for k=1:n 75 | %% l = find(xRaw >= x(k)/sqrt(step) & xRaw <= x(k)*sqrt(step)); 76 | %% if ~isempty(l) 77 | %% y(k) = mean(yRaw(l)); 78 | %% end 79 | %% end 80 | %% 81 | %% i = ~isnan(y); 82 | %% x = x(find(i)); 83 | %% y = y(find(i)); 84 | -------------------------------------------------------------------------------- /mataa_tools/mataa_signal_clipcheck.m: -------------------------------------------------------------------------------- 1 | function n = mataa_signal_clipcheck (s,N); 2 | 3 | % function n = mataa_signal_clipcheck (s,N); 4 | % 5 | % DESCRIPTION: 6 | % Returns the number of samples with amplitude less than N percent% lower than the maximum amplitude of the signal (absolute values). 7 | % 8 | % INPUT: 9 | % s: vector of signal samples 10 | % N (optional): percentage of deviation from maximum amplitude. Default value is N = 1 (i.e. 1%). 11 | % 12 | % OUTPUT: 13 | % n: number of samples with amplitude less than 1% lower than the maximum amplitude of the signal (absolute values). 14 | % 15 | % EXAMPLES: 16 | % * White-noise signal (not clipped): 17 | % > wn = mataa_signal_generator('pink',1000,1); % a white-noise signal with 1000 samples (with sample ranges distributed in the range between -1...+1). 18 | % > n = mataa_signal_clipcheck(wn,0.1); % find number of samples with (absolute) amplitudes that are within 0.1% of the maximum (absolute) amplitude. This will result in a low value of n (i.e. n=1, 2, or 3, but higher values are unlikely). 19 | % 20 | % * Clipped white-noise signal: 21 | % > wn = 2.5*mataa_signal_generator('pink',1000,1); % a white-noise signal with 1000 samples (with sample ranges distributed in the range between -2.5...+2.5). 22 | % > wn(wn > 1) = 1; wn(wn < -1) = -1; % fake clipping, i.e. truncate the samples to the range (-1...+1). 23 | % > n = mataa_signal_clipcheck(wn,0.1); % find number of samples with (absolute) amplitudes that are within 0.1% of the maximum (absolute) amplitude. This will result in a much higher value of n than in the previous example (n ~ 200). 24 | % 25 | % * Square-wave signal: 26 | % > sq = mataa_signal_generator('square',10000,0.1,1000); % a square wave signal with 1000 samples (i.e. a signal with sample values of either +1 or -1). 27 | % > n = mataa_signal_clipcheck(sq,0.01); % find number of samples with (absolute) amplitudes that are within 0.01% of the maximum (absolute) amplitude. This results in n=1000, because the amplitude of all samples is equal to 1. 28 | % 29 | % DISCLAIMER: 30 | % This file is part of MATAA. 31 | % 32 | % MATAA is free software; you can redistribute it and/or modify 33 | % it under the terms of the GNU General Public License as published by 34 | % the Free Software Foundation; either version 2 of the License, or 35 | % (at your option) any later version. 36 | % 37 | % MATAA is distributed in the hope that it will be useful, 38 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 39 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 40 | % GNU General Public License for more details. 41 | % 42 | % You should have received a copy of the GNU General Public License 43 | % along with MATAA; if not, write to the Free Software 44 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 45 | % 46 | % Copyright (C) 2007, 2008 Matthias S. Brennwald. 47 | % Contact: info@audioroot.net 48 | % Further information: http://www.audioroot.net/MATAA 49 | 50 | x = size(s); 51 | if x(1) < x(2) 52 | s = s'; 53 | x = size(s); 54 | end 55 | 56 | s = abs(s); 57 | 58 | n_chan = x(2); 59 | n_samp = x(1); 60 | 61 | n = repmat(NaN,1,n_chan); 62 | 63 | for chan=1:n_chan 64 | if ~any(s(:,chan)) 65 | % signal is all zero 66 | n(chan) = 0; 67 | else 68 | m = max(s(:,chan)); 69 | i = find(abs(s(:,chan) - m)/m < 0.01); 70 | n(chan) = length(i); 71 | end 72 | end 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /mataa_tools/mataa_signal_spectrogram.m: -------------------------------------------------------------------------------- 1 | function [m,t,f] = mataa_signal_spectrogram (s,t,dt,smooth); 2 | 3 | % function [m,t,f] = mataa_signal_spectrogram (s,t,dt,smooth); 4 | % 5 | % DESCRIPTION: 6 | % Calculate spectrogram (aka sonogram) of the signal s(t). 7 | % 8 | % INPUT: 9 | % s: vector containing the samples values of the signal. 10 | % t: time values of samples in h (vector, in seconds) or sampling rate of h (scalar, in Hz) 11 | % dt: width time chunks used to calculate of spectrogram lines 12 | % smooth (optional): if specified, the data is smoothed in the frequency domain over the octave interval smooth_interval. 13 | % 14 | % OUTPUT: 15 | % m: magnitude values in dB (matrix) 16 | % t: time values 17 | % f: frequency values 18 | % 19 | % EXAMPLE: 20 | % fs = 44100; L = 3; 21 | % [s1,t] = mataa_signal_generator ("sweep_lin",fs,L,[1000 20000]); 22 | % s2 = mataa_signal_generator ("sweep_log",fs,L,[1000 20000]); 23 | % s3 = s1+s2; 24 | % [M1,T1,F1] = mataa_signal_spectrogram (s1,t,0.05); 25 | % [M2,T2,F2] = mataa_signal_spectrogram (s2,t,0.05); 26 | % [M3,T3,F3] = mataa_signal_spectrogram (s3,t,0.05); 27 | % subplot (3,1,1); surf (T1,F1/1000,M1); shading interp; view (0,90); ylabel ('Frequency (kHz)'); 28 | % subplot (3,1,2); surf (T2,F2/1000,M2); shading interp; view (0,90); ylabel ('Frequency (kHz)'); 29 | % subplot (3,1,3); surf (T3,F3/1000,M3); shading interp; view (0,90); xlabel ('Time (s)'); ylabel ('Frequency (kHz)'); 30 | % 31 | % DISCLAIMER: 32 | % This file is part of MATAA. 33 | % 34 | % MATAA is free software; you can redistribute it and/or modify 35 | % it under the terms of the GNU General Public License as published by 36 | % the Free Software Foundation; either version 2 of the License, or 37 | % (at your option) any later version. 38 | % 39 | % MATAA is distributed in the hope that it will be useful, 40 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 41 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 42 | % GNU General Public License for more details. 43 | % 44 | % You should have received a copy of the GNU General Public License 45 | % along with MATAA; if not, write to the Free Software 46 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 47 | % 48 | % Copyright (C) 2014 Matthias S. Brennwald. 49 | % Contact: info@audioroot.net 50 | % Further information: http://www.audioroot.net/MATAA 51 | 52 | if isscalar(t) 53 | fs = t; 54 | t = [0:1/fs:(length(s)-1)/fs]; 55 | else 56 | fs = (length(t)-1)/(max(t)-min(t)); 57 | t = t-t(1); % shift impulse response to zero-based time 58 | end 59 | 60 | % make sure we've got column vectors: 61 | s = s(:); 62 | t = t(:); 63 | 64 | T = t(end) + 1/fs; % total length of signal 65 | tt = [0:dt:T]; % time bins 66 | nt = ceil ( length (t) / (length(tt)-1) ) ; % number of samples per signal chunk 67 | 68 | nf = floor (nt/2); % number of frequency values in each spectrogram line 69 | 70 | m = []; 71 | for i = 1:length(tt)-1 72 | j = find ( t >= tt(i) & t < tt(i+1) ); 73 | x = s(j); x = x(:); 74 | x = detrend (x); 75 | x = mataa_signal_window (x,'hann'); 76 | if length(x) < nt % pad zeros 77 | x = [ x ; repmat(0,nt-length(x),1) ]; 78 | end 79 | x = x(1:nt); % in case there's one too many 80 | 81 | if exist ('smooth','var') 82 | [M,u,f] = mataa_IR_to_FR (x,fs,smooth); 83 | 84 | else 85 | [M,u,f] = mataa_IR_to_FR (x,fs); 86 | end 87 | m = [ m M ]; 88 | end 89 | 90 | t = ( tt(1:end-1) + tt(2:end) ) / 2; -------------------------------------------------------------------------------- /mataa_tools/mataa_plot_FR.m: -------------------------------------------------------------------------------- 1 | function mataa_plot_FR (mag,phase,f,annote,fNorm,phaseUnwrap); 2 | 3 | % function mataa_plot_FR (mag,phase,f,annote,fNorm,phaseUnwrap); 4 | % 5 | % DESCRIPTION: 6 | % Plots frequency response magnitude, and phase (optional) 7 | % 8 | % INPUT: 9 | % mag: magnitude of frequency response (in dB) 10 | % phase (optional): phase of frequency response (in degrees). If you don't want to plot phase, but other optional arguments below are required, use phase = []. 11 | % f: frequency coordinates of mag and phase (in Hz) 12 | % annote (optional): text note to be added to the plot title. If you don't want to add a note, but other optional arguments below are required, use annote = ''. 13 | % fNorm (optional): frequency to which the magnitude plot is normalised. If you don't want to normalise the plot, but other optional arguments below are required, use fNorm = []. 14 | % phaseUnwrap (optional): if phaseUnwrap is not zero, the phase is unwraped (so that discontinuities at +/- 180 deg. are avoided). Otherwise, phase is wrapped to +/- 180 deg. 15 | % 16 | % EXAMPLE(S): 17 | % > [h,t] = mataa_IR_demo; 18 | % > [mag,phase,f] = mataa_IR_to_FR(h,t,1/12); 19 | % > mataa_plot_FR(mag,[],f); % plain vanilla plot of magnitude vs. frequency (without phase) 20 | % > mataa_plot_FR(mag,[],f,'demo',1000); % plots magnitude with an annotation to the plot title and normalizes mag by mag(f=1000). 21 | % > mataa_plot_FR(mag,phase,f,'demo again',80,1); % plots magnitude and phase with an annotation to the plot title. Magnitude is normalised such that mag(f=80) = 0 dB, and phase is unwrapped. 22 | % 23 | % DISCLAIMER: 24 | % This file is part of MATAA. 25 | % 26 | % MATAA is free software; you can redistribute it and/or modify 27 | % it under the terms of the GNU General Public License as published by 28 | % the Free Software Foundation; either version 2 of the License, or 29 | % (at your option) any later version. 30 | % 31 | % MATAA is distributed in the hope that it will be useful, 32 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 33 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 34 | % GNU General Public License for more details. 35 | % 36 | % You should have received a copy of the GNU General Public License 37 | % along with MATAA; if not, write to the Free Software 38 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 39 | % 40 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 41 | % Contact: info@audioroot.net 42 | % Further information: http://www.audioroot.net/MATAA 43 | 44 | if ~exist ('annote','var') 45 | annote = ''; 46 | end 47 | 48 | if length (annote) > 0 49 | annote = sprintf (' (%s)',annote); 50 | end 51 | 52 | if ~exist('fNorm','var') 53 | fNorm = []; 54 | end 55 | 56 | if ~isempty(fNorm) 57 | mag = mag - mataa_interp (f,mag,fNorm); 58 | y1lab = sprintf('Magnitude (dB, rel. %i Hz)',fNorm); 59 | else 60 | y1lab = 'Magnitude (dB)'; 61 | end 62 | 63 | if ~exist('phaseUnwrap','var') 64 | phaseUnwrap = 0; 65 | end 66 | 67 | annote = sprintf ('MATAA: frequency response%s',annote); 68 | 69 | if phaseUnwrap 70 | phase = unwrap(phase/180*pi)/pi*180; 71 | else 72 | phase = mod (phase+180,360)-180; 73 | end 74 | 75 | h = mataa_plot_two_logX (f,mag,phase,mataa_settings ('plotWindow_FR'),annote,'Frequency (Hz)',y1lab,'Phase (deg.)'); 76 | 77 | if ~isnan(h(2)) 78 | if ~phaseUnwrap 79 | r = axis(h(2)); r([3,4]) = [-180 180]; axis(r); 80 | set (h(2),'ytick',[-180:90:180]); 81 | end 82 | end 83 | -------------------------------------------------------------------------------- /documentation/source/make_tools_help_list.m: -------------------------------------------------------------------------------- 1 | % this is an Octave m-file to make a texi (TeXinfo) file containing the help messages of the m-files in the MATAA tools folder. 2 | 3 | outfile = 'MATAA_manual_tools.texi'; 4 | out_fid = fopen(outfile,'wt'); 5 | fprintf(out_fid,'@node MATAA tools reference\n'); 6 | fprintf(out_fid,'@chapter MATAA tools reference\n\n'); 7 | fprintf(out_fid,'@paragraphindent 0\n\n'); 8 | fprintf(out_fid,'This section contains a list of the MATAA tools and their usage information as of %s.\n\n',date); 9 | path = mataa_path('tools'); 10 | t = mataa_tempfile; 11 | 12 | system(sprintf('ls %s*.m | sort -f > %s',path,t)); % this sorts without caring for capitalization 13 | % system(sprintf('ls %s*.m > %s',path,t)); % this sorts by capitalization first, then alphabetically 14 | fid_list = fopen(t,'rt'); 15 | frewind(fid_list); 16 | doReadList = 1; 17 | while doReadList 18 | tool = fgetl(fid_list); 19 | if tool == -1 20 | doReadList = 0; 21 | else 22 | if strcmp (tool(end-1:end),".m") 23 | i = findstr(filesep,tool); 24 | %disp('') % insert empty line 25 | %disp('******************') 26 | %disp('') % insert empty line 27 | funName = tool(i(end)+1:end-2); 28 | filePath = tool(i(end-1)+1:end); 29 | fprintf(out_fid,'@findex %s\n',funName); 30 | fprintf(out_fid,'@node %s\n',funName); 31 | fprintf(out_fid,'@section %s\n\n',funName); 32 | fprintf(out_fid,'file: ...%s@*\n\n',filePath); 33 | %disp(''); % insert empty line 34 | fid_tool = fopen(tool,'rt'); 35 | frewind(fid_tool); 36 | doReadTool = 1; 37 | header = 1; % there are a few header lines that don not start with a '%' sign 38 | while doReadTool 39 | lTool = fgetl(fid_tool); 40 | if lTool == -1 41 | doReadTool = 0; 42 | else 43 | if length(lTool) > 0 % otherwise the next line might fail 44 | if strcmp(lTool(1),'%') ~= 0 45 | header = 0; % we are not in the header anymore 46 | 47 | if findstr('DISCLAIMER',lTool) 48 | for i=1:20 % skip disclaimer, license and copyright info 49 | fgetl(fid_tool); 50 | end 51 | else 52 | line = lTool(3:end); 53 | if length(line) > 0 54 | line = sprintf('%s@*',line); % add line break 55 | end 56 | % fprintf(out_fid,'%s@*\n',line) % include the texi command @* for the line break 57 | fprintf(out_fid,'%s\n',line) % include the texi command @* for the line break 58 | % if ~strcmp(lTool(end),sprintf('\n')) 59 | % fprintf(out_fid,'\n'); 60 | % end 61 | end 62 | else 63 | if header == 0 64 | doReadTool = 0; 65 | end 66 | end 67 | end 68 | end 69 | end 70 | fclose(fid_tool); 71 | fprintf(out_fid,'\n') 72 | end 73 | end 74 | end 75 | 76 | fclose(fid_list); 77 | delete(t); 78 | 79 | fprintf(out_fid,'\n\n@paragraphindent 3'); % reset indent to default value 80 | fclose(out_fid); -------------------------------------------------------------------------------- /mataa_scripts/mataa_impedance_measure.m: -------------------------------------------------------------------------------- 1 | % Use this script for impedance measurements. 2 | % 3 | % This file is part of MATAA. 4 | % 5 | % MATAA is free software; you can redistribute it and/or modify 6 | % it under the terms of the GNU General Public License as published by 7 | % the Free Software Foundation; either version 2 of the License, or 8 | % (at your option) any later version. 9 | % 10 | % MATAA is distributed in the hope that it will be useful, 11 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | % GNU General Public License for more details. 14 | % 15 | % You should have received a copy of the GNU General Public License 16 | % along with MATAA; if not, write to the Free Software 17 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | % 19 | % 20 | % Copyright (C) 2018 Matthias S. Brennwald. 21 | % Contact: info@audioroot.net 22 | % Further information: http://www.audioroot.net/MATAA.html 23 | 24 | 25 | 26 | % sample rate: 27 | if ~exist('fs','var') 28 | fs = input ('Enter sampling rate (Hz, default = 44100): '); 29 | end 30 | if isempty(fs) 31 | fs = 44100; 32 | end 33 | disp (sprintf('Sampling rate fs = %g Hz',fs)) 34 | 35 | % sine sweep: 36 | if ~exist('fL','var') 37 | fL = input ('Sine sweep start frequency (Hz): ') 38 | end 39 | disp (sprintf('Sine sweep start frequency fL = %g Hz',fL)) 40 | 41 | if ~exist('fH','var') 42 | fH = input ('Sine sweep end frequency (Hz): ') 43 | end 44 | fH = min([fs/2,fH]); 45 | disp (sprintf('Sine sweep end frequency fH = %g Hz',fH)) 46 | 47 | if ~exist('U0rms','var') 48 | U0rms = input ('Sine sweep amplitude (V-RMS): ') 49 | end 50 | disp (sprintf('Sine sweep amplitude U0rms = %g V-RMS',U0rms)) 51 | 52 | % reference resistor: 53 | if ~exist('R0','var') 54 | R0 = input ('Enter reference resistor value (Ohm): ') 55 | end 56 | disp (sprintf('Reference resistor R0 = %g Ohm',R0)) 57 | 58 | % SPL smoothing / resolution: 59 | if ~exist('res','var') 60 | res = input ('Impedance curve smoothing (octave-fraction, leave empty for no smoothing): '); 61 | end 62 | if res <= 0 63 | res = []; 64 | end 65 | if isempty(res) 66 | disp ('No smoothing') 67 | else 68 | disp (sprintf('Impedance curve smoothing 1/res = 1/%i octave',res)) 69 | res = 1/res; 70 | end 71 | 72 | % Plot color: 73 | if ~exist('col','var') 74 | col = input ('Plot color (char: k, R, g, b, c, m, y): ','s'); 75 | end 76 | if isempty ('col') 77 | col = 'r'; 78 | end 79 | col = tolower(col); 80 | disp (sprintf('Plot color col = %s',col)) 81 | style = sprintf('%s-',col); 82 | 83 | % calibration file: 84 | calfile = 'MB_ELECTRONIC_CHAIN.txt'; 85 | disp (sprintf('Calibration file = %s',calfile)) 86 | 87 | % Ready? Input ok? 88 | input ('Ready to start? Press ENTER...') 89 | 90 | % impedance measurement: 91 | [Zmag,Zphase,f] = mataa_measure_impedance (fL,fH,R0,fs,res,calfile,U0rms*sqrt(2),'V'); 92 | 93 | % plot result: 94 | semilogx (f,Zmag,style) 95 | 96 | 97 | % always save to "LastMeasurement.mat": 98 | save ('-V7','LastMeasurementIMPEDANCE.mat','f','Zmag','Zphase','fL','fH','R0','fs','res','calfile','U0rms'); 99 | 100 | % Ask to save file: 101 | x = input ('Do you want to save raw data (impedance magnitude and phase) to a file (y/N)?','s'); 102 | if isempty(x) 103 | x = 'N'; 104 | end 105 | if upper(x) == 'Y' 106 | fn = uiputfile('*.mat','Choose file to save raw data...'); 107 | if ischar(fn) 108 | info = input ('Enter data description: ','s') 109 | save ('-V7',fn,'f','Zmag','Zphase','fL','fH','R0','fs','res','calfile','U0rms','info'); 110 | disp (sprintf('Saved impedance data to file %s.',fn)); 111 | else 112 | disp ('File not saved.') 113 | end 114 | end 115 | -------------------------------------------------------------------------------- /mataa_tools/mataa_computer.m: -------------------------------------------------------------------------------- 1 | function platform = mataa_computer; 2 | 3 | % function platform = mataa_computer; 4 | % 5 | % DESCRIPTION: 6 | % Returns the current computer platform. 7 | % 8 | % INPUT: 9 | % (none) 10 | % 11 | % OUTPUT 12 | % platform: string indicating the computer platform: 13 | % MAC: Mac OS X (Darwin) 14 | % PCWIN: MS Windows 15 | % LINUX_X86-32: Linux on x86 / 32 Bit platform 16 | % LINUX_X86-64: Linux on AMD / 64 Bit platform 17 | % UNKNOWN: unknown platform (unknown to MATAA) 18 | % 19 | % DISCLAIMER: 20 | % This file is part of MATAA. 21 | % 22 | % MATAA is free software; you can redistribute it and/or modify 23 | % it under the terms of the GNU General Public License as published by 24 | % the Free Software Foundation; either version 2 of the License, or 25 | % (at your option) any later version. 26 | % 27 | % MATAA is distributed in the hope that it will be useful, 28 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | % GNU General Public License for more details. 31 | % 32 | % You should have received a copy of the GNU General Public License 33 | % along with MATAA; if not, write to the Free Software 34 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 35 | % 36 | % Copyright (C) 2006, 2007, 2008 Matthias S. Brennwald. 37 | % Contact: info@audioroot.net 38 | % Further information: http://www.audioroot.net/MATAA 39 | 40 | platform = computer; 41 | 42 | if (exist('OCTAVE_VERSION','builtin')) % we're running Octave 43 | if (~isempty(findstr(platform,'apple')) && ~isempty(findstr(platform,'darwin'))) 44 | platform='MAC'; 45 | elseif ~isempty(findstr(platform,'linux')) % e.g. platform = 'x86_64-unknown-linux-gnu' 46 | if ~isempty(findstr(platform,'x86_64')) 47 | platform = 'LINUX_X86-64'; 48 | elseif ~isempty(findstr(platform,'i386')) 49 | platform = 'LINUX_X86-32'; 50 | elseif ~isempty(findstr(platform,'i486')) 51 | platform = 'LINUX_X86-32'; 52 | elseif ~isempty(findstr(platform,'i586')) 53 | platform = 'LINUX_X86-32'; 54 | elseif ~isempty(findstr(platform,'i686')) 55 | platform = 'LINUX_X86-32'; 56 | elseif ~isempty(findstr(platform,'powerpc')) 57 | platform = 'LINUX_PPC'; 58 | elseif ~isempty(findstr(platform,'gnueabihf')) 59 | platform = 'LINUX_ARM_GNUEABIHF'; 60 | else 61 | platform = 'LINUX_UNKNOWN'; 62 | end 63 | elseif ~isempty(findstr(platform,'-pc-')) % e.g. platform = 'i686-pc-cygwin' 64 | platform='PCWIN'; 65 | elseif ~isempty(findstr(platform,'-w64-')) % e.g. platform = 'i686-w64-mingw32' 66 | platform='PCWIN'; 67 | else % try again (it seems the above may fail, especially in some Windows / Octave combinations) 68 | if ismac 69 | platform = 'MAC'; 70 | elseif isunix 71 | platform = 'LINUX'; % just a blind assumption that UNIX = LINUX (which is wrong) 72 | elseif ispc 73 | platform = 'PCWIN'; 74 | else 75 | platform='UNKNOWN'; 76 | end 77 | 78 | end 79 | 80 | else % we're running matlab 81 | if strcmp(platform,'MACI') % Intel MAC 82 | platform = 'MAC' 83 | end 84 | 85 | if strcmp(platform,'MACI64') % 64-Bit Intel MAC 86 | platform = 'MAC' 87 | end 88 | 89 | if strcmp(platform,'PCWIN64') % 64-Bit Windows 90 | platform = 'PCWIN'; 91 | end 92 | 93 | if strcmp(platform,'GLNX86') % GNU-Linux / Intel 32 Bit 94 | platform = 'LINUX_X86-32' 95 | end 96 | 97 | if strcmp(platform,'GLNXA64') % GNU-Linux / AMD 64 Bit 98 | platform = 'LINUX_X86-64' 99 | end 100 | 101 | if ( ~strcmp(platform,'MAC') && ~strcmp(platform,'PCWIN') ) 102 | platform='UNKNOWN'; 103 | end 104 | 105 | end 106 | -------------------------------------------------------------------------------- /mataa_tools/mataa_impedance_speaker_model_LR2.m: -------------------------------------------------------------------------------- 1 | function [mag,phase] = mataa_impedance_speaker_model_LR2 (f,Rdc,f0,Qe,Qm,L1,L2,R2) 2 | 3 | % function [mag,phase] = mataa_impedance_speaker_model_LR2 (f,Rdc,f0,Qe,Qm,L1,L2,R2) 4 | % 5 | % DESCRIPTION: 6 | % Calculate speaker impedance (magnitude and phase) as a function of frequency f according to the "LR-2 model" (see also Figure 7.16 in J. d'Appolito, "Testing Loudspeakers", Audio Amateur Press). This model essentially consists of a combination of three impedance elements connected in series (where w = 2*pi*f, w0 = 2*pi*f0): 7 | % (a) The DC resistance of the voice coil (Rdc) 8 | % (b) A parallel LCR circuit, reflecting the the low-frequency part of the impedance curve (resonance peak). 9 | % (c) L1 in series with a parallel combination of R2 and L2. L1, L2, and R2 reflect the high-frequency part of the impedance curve. For L2 = 0 and R2 = Inf, this model reduces to the simpler concept where the voice-coil inductance Le is constant with frequency (and L1 = Le). 10 | % 11 | % INPUT: 12 | % f: frequency values for which impedance will be calculatedq 13 | % Rdc: DC resistance of the voice coil (Ohm) 14 | % f0: resonance frequency of the speaker (Hz) 15 | % Qe: electrical quality factor of the speaker (at resonance) 16 | % Qm: mechanical quality factor of the speaker (at resonance) 17 | % L1, L2, R2 (optional): see above (in H or Ohm, respectively) 18 | % 19 | % OUTPUT: 20 | % mag: magnitude of impedance (Ohm) 21 | % phase: phase of impedance (degrees) 22 | % 23 | % NOTES: 24 | % - The ratio Qm/Qe reflects the height of the impedance peak. If Zmax is the impedance maximum (at resonance) then Zmax/Rdc = Qm/Qe+1. 25 | % - Qe reflects the width of the impedance peak (large Qe corresponds to a narrow peak) 26 | % 27 | % EXAMPLE: 28 | % The following gives a good approximation of the data shown in Fig. 7.18 in J. d'Appolito, "Testing oudspeaker" on page 122: 29 | % f = logspace(1,4,100); 30 | % [mag,phase] = mataa_impedance_speaker_model (f,7.66,33.22,0.45,3.4,0.4e-3,1.1e-3,13); 31 | % semilogx (f,mag,f,phase) 32 | % DISCLAIMER: 33 | % This file is part of MATAA. 34 | % 35 | % MATAA is free software; you can redistribute it and/or modify 36 | % it under the terms of the GNU General Public License as published by 37 | % the Free Software Foundation; either version 2 of the License, or 38 | % (at your option) any later version. 39 | % 40 | % MATAA is distributed in the hope that it will be useful, 41 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 42 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 43 | % GNU General Public License for more details. 44 | % 45 | % You should have received a copy of the GNU General Public License 46 | % along with MATAA; if not, write to the Free Software 47 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 48 | % 49 | % Copyright (C) 2008 Matthias S. Brennwald. 50 | % Contact: info@audioroot.net 51 | % Further information: http://www.audioroot.net/MATAA 52 | 53 | if nargin < 8; 54 | R2 = Inf; 55 | end 56 | 57 | if nargin < 7; 58 | L2 = 0; 59 | end 60 | 61 | if nargin < 6; 62 | L1 = 0; 63 | end 64 | 65 | if nargin < 5; 66 | error ('mataa_impedance_speaker_model: not enough input arguments!') 67 | end 68 | 69 | if any ([Rdc,f0,Qe,Qm,R2] == 0) 70 | error ('mataa_impedance_speaker_model: Rdc, f0, Qe, Qm, and R2 must not be zero!') 71 | end 72 | 73 | w0 = 2*pi*f0; 74 | w = 2*pi*f; 75 | 76 | % low-frequency impedance (resonance peak, LCR part): 77 | Res = Rdc*Qm/Qe; 78 | Ces = Qe/w0/Rdc; 79 | Les = 1/w0^2/Ces; 80 | 81 | ZCes = 1./(i*w*Ces); 82 | ZLes = i*w*Les; 83 | Zlow = 1 ./ ( 1/Res + 1./ZCes + 1./ZLes ); 84 | 85 | % high-frequency impedance: 86 | Z1 = i*w*L1; 87 | Z2 = 1 ./ ( 1./(i*w*L2) + 1/R2 ); 88 | Zhigh = Z1 + Z2; 89 | 90 | % total impedance: 91 | Z = Rdc + Zlow + Zhigh; 92 | mag = abs (Z); 93 | phase = angle (Z) / pi * 180; 94 | --------------------------------------------------------------------------------