lichen-community-systems / Flocking

Flocking - Creative audio synthesis for the Web
GNU General Public License v2.0
695 stars 60 forks source link

Audio file encoding tests are poorly factored and fail when running at >44.1 KHz #187

Closed colinbdclark closed 6 years ago

colinbdclark commented 8 years ago

Flocking includes a round-trip encoding/decoding unit test to verify that our WAVE file encoder is compatible and does not introduce significant noise. However, its comparison algorithm is naive, and causes failures in any case where the audio file doesn't match the current sample rate (due to small numeric differences caused by resampling the file to the current rate and imprecision in the int > float conversion process).

The tests should be improved in the following ways:

  1. Audio buffers should be compared within the "native" numeric representation of the audio file. So, in the case of int16 files, both buffers should be converted to int16 arrays prior to comparison
  2. The test case should be expanded to test all typical sampling rates we support—44.1, 48, 88.2, and 96 KHz.
colinbdclark commented 6 years ago

This issue was fixed in February with the merge of the longstanding unit-testing-improvements branch at 1aec8fb540b246c03dabfaeb35ff2e8daf7b32c0.