This package adds audio file support to b2btest. b2btest is a tool to automate tests that compare results to some previous ones, and this plugin, is helpful to compare audiofiles in a sensible way.
See b2btest README for a deeper discussion on why you should avoid back-to-back testing, although sometimes it is the lesser evil way to proceed.
This plugin handles audiofiles specially in several ways:
- Instead of doing a text or byte difference, it interprets the audio contents and compares them sample by sample.
- It considers two outputs to be different if:
- Metadata differs
- Sample-by-sample differs relative to the audio level
- In the case of differences, it generates a diff audio by substracting both waves sample by sample.
By means of python-wavefile
, it supports floating point samples, and multichannel waves.
Just use:
$ pip install b2btest_audio
This plugin requires the wavefile module, which in turn requires having libsndfile library installed in your system.
When you are testing back-to-back the output of a command line, you define a yaml file like this (name it b2bcases.yaml).
#!/usr/bin/env back2back
datapath: "b2bdata" # Point it to the directory containing your reference data
testcases:
Generate1KHzSine:
command: sox -n /tmp/sine.wav synth 1.0 sine 1000.0
outputs:
- /tmp/sine.wav
Ouputs with supported audio file extension will be recognize and this plugin diff will be used for them.
See [b2btest] documentation on how to use this file.
The package also provides a diffaudio
CLI tool to generate the audio difference
- Audio plugin separated from b2btest package
In earlier versions this plugin was distributed
as an optional plugin in b2btest
- Simplified dependency on lxml
diffaudio
as console scriptdiffxml
as console script- Fix: entry points for xml and audio plugins
- Just markdown README
- Updated README
- Avoid larg diffs by telling just the generated file with the failed results
- Fix unicode problems in certain python versions
- Using older lxml versions for python<3.5
- CLI: Fix: only the first output was actually checked
- Plugin based type sensitive diff
- Specific diff for XML
- XML and Audio diffing now are extras
- 'extensions' key in yaml testcases to associate custom file extensions to a diff plugin
- Unit test like usage for back-to-back test Python code instead of command line programs.
- New commandline tool
back2back
that takes a yaml file with the test cases definitions.
- First github version
- (There were previous unpublished versions)