voicesauce / opensauce-python

Voice analysis software (Python port of VoiceSauce)
Apache License 2.0
55 stars 16 forks source link

Unit test for snack F0 function...that fails. #9

Closed bitdancer closed 8 years ago

bitdancer commented 8 years ago

I've learned a bunch getting this far, especially I'm more comfortable with the VoiceSauce source now. I believe I have translated the way VoiceSauce uses snack to compute the sF0 column in the output data correctly, but the data values do no match up. As you will see if you run the unit test, the values are at least in the same ballpark (within 0.6, usually closer) at first, but then things go off the rails. I would expect the numbers to match with greater than 0.6 precision, given we have the same input file and the same program executing the calculation, but perhaps I am naive :).

Can you see anything I've done wrong, or incorrect assumptions I'm not aware of? Can you run the test and see what results you get? The first few from my run look like this:

(0, 247.31, (766.0, 247.262)) (1, 247.152, (767.0, 247.148)) (2, 246.636, (768.0, 246.649)) (3, 246.561, (769.0, 246.566)) (4, 246.277, (770.0, 246.299)) (5, 246.059, (771.0, 246.042)) (6, 246.422, (772.0, 246.432)) (7, 246.165, (773.0, 246.307)) (8, 245.713, (774.0, 245.741)) (9, 245.891, (775.0, 245.792)) (10, 246.717, (776.0, 246.595)) (11, 246.596, (777.0, 246.66)) (12, 246.321, (778.0, 246.312)) (13, 246.392, (779.0, 246.307)) (14, 246.57, (780.0, 246.387))

and it fails for me at sample 134:

AssertionError: 103.148 not less than 0.6 : row 134

bitdancer commented 8 years ago

OK, so I'll set this issue aside for the moment and move on. I've marked the test as a failure and added a test of what we do get to make sure I don't break anything going forward.

I'll be building newer changes off this changeset...I'll merge this if there is no objection.

krismyu commented 8 years ago

I tried to run the unit test on snack f0, but I don't think I'm doing it correctly. Based on the instructions in HACKING.md, I ran

python -m unittest test

but then I got the following error message (see end of message). I'm probably missing something really obvious---can you let me know what might be going wrong? One line that looks suspicious to me in the error message is an error looking for a very strange file path:

'/var/folders/3h/qkl7zrt96bb6mznj2g0k8c2w0000gp/T/tmp86ZSKl/defaults/sounds/cant_c5_19a.f0'
can't find package snack
    while executing
"package require snack"
    (file "tclforsnackpitch.tcl" line 5)
Traceback (most recent call last):
  File "opensauce/process.py", line 59, in <module>
    process(indir, outdir, settings, params)
  File "opensauce/process.py", line 34, in process
    soundfile.measurements[param] = measurements[param](soundfile) # it is what it is...
  File "/Users/amoebe/Documents/research/voice-sauce/open-sauce/opensauce-python/opensauce/measure.py", line 16, in f0_snack
    f0 = snack_ks.get_snack_f0(soundfile)
  File "/Users/amoebe/Documents/research/voice-sauce/open-sauce/opensauce-python/opensauce/snack_ks.py", line 49, in get_snack_f0
    with open(f0file, "r") as f:
IOError: [Errno 2] No such file or directory: '/var/folders/3h/qkl7zrt96bb6mznj2g0k8c2w0000gp/T/tmp86ZSKl/defaults/sounds/cant_c5_19a.f0'
F.No handlers could be found for logger "opensauce.snack"
xE
======================================================================
ERROR: test_raw (test_snack.TestSnack)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/amoebe/Documents/research/voice-sauce/open-sauce/opensauce-python/test/test_snack.py", line 69, in test_raw
    F0, V = snack_pitch(fn, frame_length=f_len, window_length=w_len)
TypeError: 'NoneType' object is not iterable

======================================================================
FAIL: test_default_setup (test_cli.TestCLI)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/amoebe/Documents/research/voice-sauce/open-sauce/opensauce-python/test/test_cli.py", line 27, in test_default_setup
    self.assertEqual(rc, 0)
AssertionError: 1 != 0

----------------------------------------------------------------------
Ran 4 tests in 0.475s

FAILED (failures=1, errors=1, expected failures=1)