voicesauce / opensauce-python

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

Computing Snack formants via Tkinter produces non-deterministic results #26

Open terriyu opened 7 years ago

terriyu commented 7 years ago

When the snack formant command is run, it appears to produce non-deterministic results, despite having the same input sound file and parameter values. This is especially apparent if we call the formant command through Python's Tkinter library and calculate formants for multiple sound files in the same Tcl shell. Changing the order in which the sound files are processed, changes the results slightly. This suggests that the formant command uses a random seed (unfortunately, we can't confirm if it's actually a random seed issue, since the snack formant documentation doesn't mention anything about a random seed.) If we run the formant command for a single sound file via a Tcl script, then we get consistent results, presumably because the same random seed is used each time.

For now, it's best to avoid calling Snack through the Python Tkinter library since the Tkinter-based implementation evaluates Snack commands line by line through the Tcl interpreter, which can lead to non-deterministic results depending on the order in which sound files are processed.