symusic.Soundfont

class Soundfont(name: str, url: str, hash_: str)[source]

Bases: object

Descriptor 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.

__init__(name: str, url: str, hash_: str) None

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

name

Local filename used when saving the SoundFont.

url

Public URL from which the SoundFont can be downloaded.

hash_

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 in hash_.

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:

bool

path(download: bool = True) Path[source]

Return the local path to the SoundFont file.

Parameters:

download (bool, default True) – When True, automatically download the file if it is missing or fails integrity verification.

Returns:

Absolute path where the SoundFont is stored.

Return type:

pathlib.Path

hash_: str

SHA-384 digest of the file used to verify integrity after download.

name: str

Local filename used when saving the SoundFont.

url: str

Public URL from which the SoundFont can be downloaded.