Twingo is a simple nidaqmx / pyAudio based, 2 channel speaker measurement application supporting continuous and finite test signals generation, acquisition and analysis.
The easiest way to install will be to use Anaconda python distribution and by creating a conda environment.
-
Clone the project from GitHub
-
In Anaconda prompt navigate to the cloned project folder and setup conda environment from the YAML file:
conda env create -f environment.yml
-
At this point you should be able to launch the application in the environment created:
conda activate twingo_conda_env
python twingo.py
NOTE: You will not be able to install pyAudio easily using pip because it can't handle the C binaries (whatever they are) that have to go with it. This is why you do not find the familiar requirements.txt file in this repo.
If you wish to set up the project in pyCharm additionally follow below steps:
- Create new project
- Select project folder location but do not click "Create" yet
- Instead, expand "Project Interpreter" selection
- Select "Existing Interpreter"
- Choose the newly created conda env (twingo_conda_env) from the drop-down
- click "Create" You can see that you were successful by noting that in terminal the start of each line reads (twingo_conda_env) i.e. environment is activated.
There are two types of hardware that twingo should support right out of the box.
-
Your NIDAQmx USB based National instruments data acquisition card
I could only test my private NI6211 M series DAQ so far but the code may well work (or require little adjustments) with any other NIDAQmx driver-based National Instruments card as long as its equipped with both analog input and output ports.
-
Your current system default sound device input and output
This is later added feature and still requires much improvement but it expands the usability of the tool to any input and output sound hardware currently set default in your system. This way its possible to use for instance:
- your sound card I/O,
- external audio interfaces
- Focusrite Scarlett series, e.g. 2i2 or 4i4,
- Steinberg UR series,
- NOTE: only first two I/O's will be functional and you may have to adjust pyaudio_read_offset_msec under model/config in order to synchronize the input and output.
- external Digital/Analog converters,
- bluetooth speakers.
It should work likewise on Linux and Mac, let me know!
NOTE: Your system sound drivers often have various DSP effects enabled by default that can cause strange results (most frequent offender are equalizers, echo cancellation which attempts to remove your test signal from the output since it correlates well with the input or noise cancellation that attempt to dampen white noise test) Usually though, its possible to find the sound driver config application in your system and disable these effects.
-
High resolution harmonic distortion analysis (see demo at the top of this readme)
-
Frequency response analysis with swept or white noise signal
-
Spectrogram for speaker / room ringing
-
Phase scope to test phase matching between speaker or microphone pairs, or setup stereo image width for instrument recordings.
This project is my first real OOP application after several years spent just on scientific scripting once in a while, therefore i expect that a lot of my code can be improved with your support and feedback. Thanks!
The ESS measurement method is still experimental and you should not trust the results too much.
- "Python For the Lab" book by Aquiles Carattino (without this book I'd have no clue how to structure my project)
- https://www.schlameel.com & schlameel/interleave.py
- Exponential Sine Sweep article from Will Fehlhaber
- Qt Dark Theme by Michael Herrmann
- Classical Recording - A Practical Guide in the Decca Tradition, C.Haigh et.al.