#488 made corrscope check master audio for mono, then upmix it to stereo
to prevent ffmpeg/video players from playing it at reduced volume. It
used Python's wave module, which unfortunately does not support
floating-point WAV files. This has been reported upstream at
https://github.com/python/cpython/issues/60729, but unfortunately there
appears to be no interest in fixing it.
This commit switches to using my vendored wavfile library. This doesn't
support 24-bit integer samples, but we already reject those for
channels.
If necessary I could introduce a cut-down WAV-probing library that
*only* parses the "fmt " chunk and counts channels.
My code uses the __setstate__ method to load config objects from YAML
files. This method is also called by pickle.load. I deserialized data
from YAML by passing the map into new_from_state() (creating a temporary
object), then replacing __dict__ with the temporary object's.
In some Python and library configurations (eg. 3.13 on Linux), when the
temporary object is garbage-collected (and __del__() is called if
present), its __dict__ is blanked out. This also blanks out the __dict__
of the config object at a random time, causing random crashes trying to
access fields that should be present.
To fix this crash, replace the other object's __dict__ so blanking it
doesn't affect the returned object.
Fixes#506.
In PR #377 (save GlobalPrefs atomically), I created a new codepath by
passing a file into yaml.dump. Unfortunately I forgot to mark it as
UTF-8 (regressing #311). This breaks saving settings after opening a
config in a Unicode folder.
To prevent this from recurring, I restructured the code to always pass a
Path into yaml.dump(), and write the file atomically.
This helps linux distro packagers, as distro
packaging needs to include -all- dependencies.
Restricting appnope to only be required on darwin
means that downstream packagers no longer have to
patch out the dependency and calls to appnope.
This should have no effect on macOS, and should be
basically unnoticeable to anyone who isn't doing
distro packaging.
* Remember most recently selected filetype in Render dialog
Some users prefer to always render their files as .mkv or another
filetype. This commit changes corrscope's render dialog to remember the
most recently selected filetype, and default to it on next render.
* Don't move render filetype dropdown if user types a different extension
The render dialog has a selected filetype ("filter") dropdown to pick
what format to save to by default. This PR changes the code to remember
the selected filetype between renders.
Previously we changed the selected filetype if the user types an
extension belonging to a different type in the list, even if they didn't
pick an extension in the list. This can be confusing, so I removed the
code responsible (instead only remembering the most recently selected
list item).
Matplotlib stores a cache of installed fonts, and does not reload it
when the user installs a new font and tries to use it. We workaround
this by adding a menu item which clears the font cache
(causing Matplotlib to reload its font list). This is easier than
telling users to find and delete a folder on their system.
Also change Trigger tab accelerator so users can use Alt+T to access
Tools -> Reload Font List.
By default, when converting or playing mono audio tracks as stereo,
ffmpeg halves the power of the left/right audio channels. This is
undesirable since it makes mono tracks quieter than intended.
This commit makes corrscope detect mono master audio, and tell ffmpeg to
play audio at full volume in both channels. We cannot enable this for
stereo master audio, since it will discard the right input channel.
opus in mp4 is supported by modern versions of ffmpeg, as well as
YouTube upload. libopus is known to have good audio quality, while
FFmpeg's built-in AAC encoder is slow and low-quality (especially on
older ffmpeg versions)
Poetry sets the pinned NumPy version based on the minimum allowed Python
version. Previously we set the minimum Python version to 3.8 (the last
version with Windows 7 binaries), so Poetry pinned NumPy to the last
version to support 3.8, which lacks wheels for modern Python. As a
result you could not install corrscope on modern Python through Poetry.
This commit sets the minimum Python version to 3.10. This breaks Windows
7 support (unless you use a custom newer Python build or override the
minimum Python version), but fixes corrscope Poetry installation on
newer Python versions. (corrscope wheel installation does not pin the
numpy version, so is exempt.) This also enables testing corrscope on
NumPy 2.0, which has incompatible changes.