symusic.Soundfont¶
- class Soundfont(name: str, url: str, hash_: str)[source]¶
Bases:
objectDescriptor for a SoundFont artifact (.sf2/.sf3).
This lightweight record tracks where to fetch a curated font, how to verify it, and where it is stored locally. It exposes convenience helpers so downstream code can obtain a valid path without duplicating download or integrity logic.
Methods
__init__(name, url, hash_)download()Download the SoundFont file and verify its integrity.
exists()Check whether the local SoundFont file exists and matches the hash.
path([download])Return the local path to the SoundFont file.
Attributes
Local filename used when saving the SoundFont.
Public URL from which the SoundFont can be downloaded.
SHA-384 digest of the file used to verify integrity after download.
- download() None[source]¶
Download the SoundFont file and verify its integrity.
The payload is stored under the platform-specific
platformdirs.user_data_path('soundfont', 'symusic')directory. Verification uses the expected SHA-384 digest inhash_.
- exists() bool[source]¶
Check whether the local SoundFont file exists and matches the hash.
- Returns:
True if the file exists and its SHA-384 digest matches
hash_.- Return type: