Python 型定義
libsonare Python パッケージの結果型と設定型のリファレンスです。これらを返す関数は Python API の索引ページと、その姉妹ページを参照してください。
型定義
結果オブジェクトの多くは属性でアクセスできる frozen dataclass です。マッピング型は TypedDict として示します。生成されたブロックには、各フィールドが型と既定値とともに並びます。ファミリーごとのレコードは専用のページにあります。キー、コード、テンポ、特徴量、ピッチ、ラウドネス、メータリングの結果は Python 解析の型、StreamAnalyzer のレコードは Python ストリーミングの型、分離、トリム、ノート編集、ボイスチェンジャーのレコードは Python エフェクトの型、Audio と DecodedChannels は Python Audio クラス API を参照してください。
行列のレイアウト
行列フィールドは (行数, n_frames) の形をした 2 次元 NumPy 配列です。スペクトログラムは (n_bins, n_frames)、メルパワーは (n_mels, n_frames)、クロマグラムは (n_chroma, n_frames) です。スペクトログラムをフラットなシーケンスで受け取る関数(decompose、nn_filter)は行優先で読みます。フラットな配列は行数で reshape すると 2 次元に戻せます。
import numpy as np
mat = np.asarray(flat).reshape(rows, n) # 例: 12 ピッチクラスのクロマグラムなら reshape(12, n_frames)整数サンプルの型エイリアス
IntSamples は、サンプル位置やフラグを受け取る解析関数で使う整数配列型です。Python 整数のシーケンス、または整数型 NumPy 配列を受け取ります。
IntSamples: TypeAlias = Sequence[int] | list[int] | np.ndarray[Any, Any]ピッチクラス
PitchClass は Key.root、Chord.root、Chord.bass が使うピッチクラスです。C が 0、B が 11 で、シャープは CS、DS、FS、GS、AS と綴ります。
# Musical pitch class (chromatic scale).
class PitchClass(IntEnum):
C = 0
CS = 1
D = 2
DS = 3
E = 4
F = 5
FS = 6
G = 7
GS = 8
A = 9
AS = 10
B = 11そのほかの結果クラス
個別 API が返す追加の Python 結果クラス:
| 分野 | クラス |
|---|---|
| マスタリング | MasteringResult, MasteringStereoResult, MasteringChainResult, MasteringChainStereoResult, LoudnessMatchResult, LoudnessMatchStereoResult, StreamingLoudnessGain(streaming_loudness_gain* の戻り値) |
| マスタリングのレポート | アシスタント、プロファイル、解析ヘルパーが直接返す frozen dataclass: MasteringAudioProfile(MasteringAudioProfileLoudness, MasteringAudioProfileSpectral, MasteringAudioProfileDynamics, AudioDefects)、MasteringAssistantProfile, MasteringAssistantResult(chain_config はフラットな MasteringChainConfig のマッピング)、MasteringStreamingPreviewResult, MasteringStreamingPreviewPlatform, MasteringRepairAnalysis, MatchReferenceLoudnessResult, MatchTonalBalanceResult, MatchTonalBalanceBand, MatchEqCurveResult, MatchEstimateReferenceDelaySamplesResult, StereoMonoCompatCheckResult, StereoMonoCompatBand, StereoMonoCompatCheckLogBandsResult |
| リペア | RepairApplyResult, RepairStageReports(mastering_repair_apply の戻り値) |
| 音響 | RoomEstimate(volume、length_m、width_m、height_m、drr_db、confidence、band_absorption、rt60_bands)、RoomMorphResult(audio、sample_rate、diagnostics)、RoomMorphStereoResult(left、right、sample_rate、diagnostics。room_morph_stereo の戻り値)、RoomGeometry(room_geometry_from_estimate の戻り値となる TypedDict)、MaterialPresetName, AcousticModeName |
| 解析のリテラル型 | ChordFunctionName |
| ミキシング | MixAssistantTrack(id、channels、name、sample_rate。別のレートのトラックは呼び出しのレートへリサンプルされます)、MixResult、MixerStereoResult, SidechainCheck(ok と、最初の拒否理由 reason。エンジンの can_set_*_sidechain の戻り値) |
| プロジェクト | AssistSidecar(project.assist_sidecars() の要素型。プロジェクト編集 を参照)、NotePairValidation、ProjectAutoTempoResult |
| リアルタイムエンジンのジョブ/テレメトリ | EngineBounceOptions, EngineBounceResult, EngineFreezeOptions, EngineFreezeResult, EngineCaptureStatus, EngineTelemetry, EngineTelemetryType, EngineTelemetryError, MeterTelemetryRecord, ScopeTelemetryRecord |
| ビルド情報 | Capabilities, CapabilityCatalog, CapabilityCatalogPresets, CapabilityCatalogChain, CapabilityCatalogChainStage, CapabilityCatalogChainList, SynthParamInfo, SynthParamCondition, MasteringPresetCatalogEntry, MasteringInsertParamInfo, MasteringInsertParamUnit, MasteringInsertParamScale, MasteringInsertParamRelation, MasteringInsertParamDependency, MasteringInsertSlot, MasteringInsertTiming, MasteringProcessorCatalogEntry(機能カタログ で説明しているドキュメントに対応する frozen dataclass) |
catalog.chain(CapabilityCatalogChain)は、フラットなマスタリングチェーンキーすべてを記述します。stages、項目数付きのインデックス付き lists、どのプロセッサにも記述されないキーの params です。catalog.presets.playback_room は常に存在します。SynthParamInfo(synth_engine_param_info と synth_patch_param_info が返す)は name、type("number" または "boolean")、default、unit、integer、min、max、active_when を持ち、後ろの 3 つは該当しなければ None です。default は float | bool で、スイッチでは bool です。active_when は SynthParamCondition(key、scope("engine" または "patch")、relation("eq"、"ne"、"gt"、"ge"、"lt"、"le" のいずれか)、value)のレコードを、選択肢ごとにタプルにまとめたタプルです。どれか 1 つの選択肢の条件がすべて成り立てば、そのフィールドはボイスに届きます。無条件のフィールドでは None です。catalog.mastering_presets は name、kind、target_lufs、true_peak_ceiling_dbtp、max_limiter_gain_reduction_db を持つ MasteringPresetCatalogEntry を持ちます。リペアプリセットでは 3 つの数値フィールドが None です。MasteringProcessorCatalogEntry の slots は条件付きキー群を列挙し、causal は repair.declick、repair.declip、repair.trimSilence で false です。MasteringInsertParamInfo の記述子は id、rt_safe、type、min、max、default、unit(閉じた集合 MasteringInsertParamUnit の値)、scale(linear または log)、ui_min / ui_max([min, max] の内側に置く任意の表示範囲)、depends_on(現在値がこのキーの範囲を左右する兄弟キー。それぞれ key、relation、factor を持ち、this <relation> factor * sibling と読む)、coupled_with(受け入れ範囲を動かすそのほかの兄弟キーのタプル。min / max はそれらを既定値にして測った値)、choices、slot を持ち、MasteringInsertTiming は指定したインサート構成の latency_samples と tail_samples を持ちます。
例外
libsonare の例外階層で報告される失敗は 2 つのクラスで表し、後者は前者を継承しているので 1 本の階層です。通常の Python の呼び出し形式や型の誤りは TypeError になります。ErrorCode は libsonare の例外が運ぶコードの IntEnum で、どの原因がどのクラス・コード・CLI の終了コードになるかは失敗原因の表にあります。
SonareError.reason は ErrorReason | None です。ErrorReason は、既知の非 null な機械可読原因を列挙します。
ErrorReason = Literal['malformedJson', 'unsupportedSchemaVersion', 'notCompiledIn', 'notPersistable', 'unresolvedSource', 'unresolvedSoundFont', 'deviceUnavailable', 'deviceFormatRefused', 'engineDeviceDriven', 'releasedHandle']# Exception raised for non-OK Sonare C API return codes.
class SonareError(RuntimeError):
code: ErrorCode
entry: str | None
reason: ErrorReason | None
def __init__(self, code: int, message: str) -> None: ...
# The name of :attr:`code` shared by every binding, such as ``"InvalidParameter"``.
@property
def code_name(self) -> ErrorCodeName: ...
# Public C-ABI error codes carried by :class:`SonareError`.
class ErrorCode(IntEnum):
OK = 0
FILE_NOT_FOUND = 1
INVALID_FORMAT = 2
DECODE_FAILED = 3
INVALID_PARAMETER = 4
OUT_OF_MEMORY = 5
NOT_SUPPORTED = 6
INVALID_STATE = 7
CANCELLED = 8
ENCODE_FAILED = 9
ABI_MISMATCH = 10
STALE_RESULT = 11
UNKNOWN = 99
# Exception for an out-of-domain value or an unknown name.
class SonareValueError(SonareError, ValueError):
def __init__(self, message: str, code: int = ErrorCode.INVALID_PARAMETER) -> None: ...
code: ErrorCode
entry: str | None
reason: ErrorReason | None
# The name of :attr:`code` shared by every binding, such as ``"InvalidParameter"``.
@property
def code_name(self) -> ErrorCodeName: ...SonareError.code は C ABI のエラーコードで、ErrorCode の値です。code_name はすべてのバインディングで共通の名前で、"InvalidState" や "FileNotFound" などです。str(e) はメッセージの先頭にコードが付き、[7] Invalid state のようになります。ErrorCode.ABI_MISMATCH はバインディング専用で、読み込んだライブラリがバインディングと一致しないことを表します。INVALID_PARAMETER による引数拒否は代わりに SonareValueError になり、str(e) に接頭辞は付きません(例: spectral_centroid: samples contains a non-finite sample at index 0)。
ライブラリまたはオブジェクトの状態に由来する失敗は、常に対応するコードを持つ SonareError です。ビルドに含まれない機能や非対応の要求なら NOT_SUPPORTED、閉じたオブジェクトなら INVALID_STATE、ネイティブの結果が不正なら INVALID_FORMAT です。そのため except RuntimeError は引き続き捕捉でき、.code で場合を区別できます。ABI_MISMATCH は、読み込んだライブラリの ABI バージョンがバインディングと異なるとき、ライブラリを最初に使う時点で送出されます。これらのコードとほかのバインディング、CLI の終了コードとの対応はエラー契約にあります。
SonareValueError は、どの層で拒否したかにかかわらず、INVALID_PARAMETER として報告される引数拒否を表します。呼び出しがネイティブコードへ渡る前にバインディングが拒否した場合も、コアが拒否した場合(たとえば Project、RealtimeEngine、transcribe で未知または範囲外の ID や値を渡したとき)も同じです。Python の型違い、必須関数引数の欠落、予期しない関数キーワードは通常の TypeError です。たとえば数値の引数に数値でないものを渡すと TypeError になります。SonareValueError は SonareError と ValueError の両方を継承しているため、except ValueError、except SonareError、except RuntimeError、except SonareValueError のどれでも捕捉でき、.code == ErrorCode.INVALID_PARAMETER にも一致します。
インスタンスが持つのはメッセージだけです。問題のパラメータ名を持つ属性も、受理範囲を持つ属性もありません。構造化されたフィールドは .code のみで、SonareValueError では INVALID_PARAMETER を返します。読み込めない文書は SonareValueError ではなく、INVALID_FORMAT を持つ素の SonareError です。パラメータ名と、あるなら範囲は本文に含まれます。バッファの拒否はエントリポイントと引数を名指しし(master_audio_stereo: right must not be empty)、スカラーの拒否はフィールド名と C 型が表現できる区間を示します(sample_rate must be an integer within [-2147483648, 2147483647])。名前が必要なコードは str(e) から読み取るしかありません。文言と、文言でのマッチが壊れやすい理由は Python API を参照してください。
検証層はどこで止まるか
バインディングの検証は 2 層で、それぞれの形を知っていれば、呼び出し側で SonareValueError が出たときに何が除外できたかが分かります。
サンプルバッファは、先頭パラメータがサンプルバッファである公開エントリポイントすべてで事前検査されます。 共通の事前検査ガードを通るか、同じ検査を本体に直接書いています。検査対象のバッファは連続した 1 次元 float32 配列へ変換され、空なら拒否され、NaN と Inf を走査されます。ノート系関数に渡す F0 トラックは形だけを検査します。pYIN は無声フレームを nan で表すからです。この集合は手で管理せず導出しています。バインディングのテストが、先頭パラメータにバッファの型注釈を持つ公開関数をすべて列挙し、ガードのないものがあれば失敗します。サンプルのリストに None の要素があれば、NaN サンプルとしてではなく samples[7] is None, not a number のように名指しで報告されます。
スカラーは関数ごとではなく、変換の時点で絞り込まれます。 バインディングの ctypes 読み取りや設定構造体のフィールドを通る整数・浮動小数は、C 型が値を黙って変えてしまう場合に拒否されます。ラップする整数(c_int のサンプルレートに渡した 2**32 + 8000)、c_float で飽和する倍精度値、整数フィールドへの小数、NaN や無限大がそれです。これらは SonareValueError です。文字列や bool のように数値ですらない値は素の TypeError になるため、except ValueError では捕捉されません。メッセージにはフィールド名と区間が入ります。検査が変換の位置にあるため、その値を渡すエントリポイントすべてに効き、関数ごとの数を管理する必要がありません。
5 つのエントリポイントは、結果を返さず拒否します。 拒否は「検査して続行する」とは別の契約です。以下は、定義済みの空の結果を返す代わりに入力をそのまま拒否するものです。trim_silence、split_silence、fix_frames は空のバッファで送出します。tempogram_ratio は空の行列と、有限の正数でない factors の要素で送出します。mix_stereo はストリップがすべて空か、非有限のサンプルを含むシーンで送出します。それぞれの理由は 受け付けなくなった入力 にあります。
この層が しない ことは次のとおりです。
- 宣言されたキーと範囲を超えて値の意味を判断すること。 絞り込みは数値が表現可能かを確かめます。パラメータのマッピングは、呼び出しの前にプロセッサが宣言したキーと範囲とも照合されるため、
dynamics.compressorのratio=0.5(mastering_apply_processor: params.ratio must be finite and at least 1)、effects.modulation.chorusのdryWet=5、utility.gainのgainDbのようにプロセッサが読まないキーは、いずれもキーを名指ししたSonareValueErrorになります。未知のキーでは受け付けるキーも列挙されます。一部のエントリポイントは Python 側でドメイン規則も検査します。古典的リペア関数のn_fftが 2 の冪であること、hpssのカーネルが奇数であること、time_stretchとpitch_shiftの FFT ジオメトリがそれで、メッセージの読み方は同じです。それ以外の値の意味は、コアが判断します。 - 宣言された範囲を超えること。
mastering_apply_processor、チェーン、インサートに渡すパラメータのマッピングは、機能カタログ が宣言するキーと範囲に照らして検査されます。カタログが宣言しない規則は、コアが判断します。 - 免除対象を事前検査すること。 空のバッファが定義済みの結果になるエントリポイント(要素ごとの変換、パディング補助、テンポグラム系)は空を受け取って空を返します。一覧は 検査されないもの にあります。
- CLI 自身の引数を扱うこと。 コマンドラインの使い方の誤りは通常の
ValueErrorです。API の引数ではなくコマンドの誤りを報告するものだからです。
Project の型
Project が受け取り、返すレコードと、その引数が受け取る文字列トークンです。これらを使う Project のメンバーは Python プロジェクト API に載せています。
Project のレコード
ProjectAutomationLane は保存済みレーンの読み戻し形式です。型付きターゲットでは target_param_id はありません。インサート用フィールドは、ほかのターゲット種別では None です。ProjectKeySegment、ProjectChordSymbol、ProjectSection はプロジェクトの注釈メソッドで受け取るマッピング形式で、戻り値にも使われます。不明なピッチクラスは None、存在しないコードのローマ数字は省略されます。ProjectPosition と ProjectTimeSignatureSegment は PPQ 位置で有効な小節、拍、拍子を表します。
# One automation lane returned by :meth:`Project.automation_lanes`.
@dataclass(frozen=True, slots=True)
class ProjectAutomationLane:
track_id: int
lane_id: int
target_param_id: int | None
target_kind: ProjectAutomationTargetKind
points: tuple[AutomationPoint, ...]
send_id: str | None
insert_index: int | None
processor: str | None
param_name: str | None
# Chord annotation mapping returned by :meth:`Project.chord_annotations`.
class ProjectChordSymbol(TypedDict):
start_ppq: float
end_ppq: float
root_pc: int | None
quality: ProjectChordQuality
extensions: list[int]
slash_bass_pc: int | None
modulation_boundary: bool
roman_numeral: NotRequired[str]
# Key annotation mapping returned by :meth:`Project.key_annotations`.
class ProjectKeySegment(TypedDict):
start_ppq: float
end_ppq: float
tonic_pc: int | None
mode: ProjectKeyMode
# Effective tempo, time signature, bar, and beat at one PPQ position.
@dataclass(frozen=True, slots=True)
class ProjectPosition:
bpm: float
time_signature: ProjectTimeSignatureSegment
bar_start_ppq: float
bar_index: int
beat: int
beat_fraction: float
# Labeled PPQ interval mapping used by :meth:`Project.annotate_sections`.
class ProjectSection(TypedDict):
start_ppq: float
end_ppq: float
label: str
# The normalized time-signature segment active at a project position.
@dataclass(frozen=True, slots=True)
class ProjectTimeSignatureSegment:
start_ppq: float
numerator: int
denominator: int# Read-only, stored-order project track descriptor.
@dataclass(frozen=True, slots=True)
class ProjectTrack:
id: int
kind: ProjectTrackKind
midi_destination_id: int
gain: float
pan: float
mute: bool
solo: bool
name: str | None
channel_strip_ref: str | None = None
output_target: str | None = None
# Read-only, stored-order project clip descriptor.
@dataclass(frozen=True, slots=True)
class ProjectClip:
id: int
track_id: int
source_id: int
source_kind: ProjectSourceKind
start_ppq: float
length_ppq: float
source_offset_ppq: float
gain: float
loop_mode: ProjectLoopMode
loop_length_ppq: float | None
fade_in_ppq: float
fade_in_curve: ProjectFadeCurve
fade_out_ppq: float
fade_out_curve: ProjectFadeCurve
loop_crossfade_ppq: float
# Timeline marker stored on a headless :class:`~libsonare._project.Project`.
@dataclass(frozen=True, slots=True)
class ProjectMarker:
ppq: float
id: int
name: str | None = None
kind: MarkerKind = 'marker'
key_fifths: int = 0
key_minor: bool = False
# Read-only, stored-order project source descriptor.
@dataclass(frozen=True, slots=True)
class ProjectSource:
id: int
kind: ProjectSourceKind
num_channels: int
storage_handle_id: int
sample_rate_hint: float
name_or_uri: str
content_hash: str | None = None
external_stem_role: str | None = None
# One opaque assist sidecar stored on a :class:`Project`.
@dataclass(frozen=True)
class AssistSidecar:
module_id: str
schema_version: int
target_track_id: int
region_start_ppq: float
region_end_ppq: float
payload: bytes
# One compile diagnostic surfaced by :meth:`Project.compile`.
@dataclass(frozen=True)
class ProjectDiagnostic:
code: ProjectDiagnosticCode
severity: ProjectDiagnosticSeverity
target_id: int | None
message: str = ''
# Result of :meth:`Project.validate_midi_notes`.
@dataclass(frozen=True)
class NotePairValidation:
ok: bool
unmatched_note_ons: int
unmatched_note_offs: int
# A MIDI CC <-> automation-parameter binding (see :func:`midi_cc_learn`).
@dataclass(frozen=True, kw_only=True)
class MidiCcBinding:
cc_number: int
channel: int | None = None
kind: ProjectMidiCcBindingKind = 'controlChange7'
cc_lsb_number: int = 0
selector_msb: int = 0
selector_lsb: int = 0
consume: bool = False
param_id: int
min_value: float = 0.0
max_value: float = 1.0
# One project MIDI event: a PPQ position and a UMP message.
@dataclass(frozen=True, slots=True)
class ProjectMidiEvent:
ppq: float
word0: int
word1: int = 0
sysex: bytes | None = None
# Result of :func:`midi_route_events`.
@dataclass(frozen=True)
class MidiRouteResult:
events: list[ProjectMidiEvent]
overflowed: bool
overflow_count: int
# Result of :meth:`Project.compile` and :meth:`Project.last_bounce_compile_result`.
@dataclass(frozen=True)
class ProjectCompileResult:
diagnostics: tuple[ProjectDiagnostic, ...]
timeline: ProjectTimeline | None = None
# Project plus warning diagnostics emitted by a successful JSON load.
@dataclass(frozen=True)
class ProjectDeserializeResult:
project: Project
diagnostics: str
# Result of :meth:`Project.add_loop_recording_takes`.
@dataclass(frozen=True, slots=True)
class ProjectLoopRecordingResult:
clip_id: int
take_count: int
# Result of :meth:`Project.add_midi_clip`.
@dataclass(frozen=True, slots=True)
class ProjectMidiClipResult:
track_id: int
clip_id: int
# Result of :meth:`Project.import_external_stems`; entry ``i`` of each array is stem ``i``.
@dataclass(frozen=True, slots=True, eq=False)
class ExternalSeparatedStemImportResult:
track_ids: np.ndarray
clip_ids: np.ndarray
# A part-rig entry read back by :meth:`Project.part_rig`.
@dataclass(frozen=True, slots=True)
class PartRigEntry:
mode: PartRigMode
inserts: tuple[dict[str, object], ...] | None
# How well an :func:`align_take_to_reference` alignment was conditioned.
@dataclass(frozen=True)
class TakeAlignment:
mean_residual_frames: float
reference_frames: int
take_frames: int
# Result of :func:`align_take_to_reference`.
@dataclass(frozen=True, slots=True)
class AlignTakeToReferenceResult:
anchors: tuple[tuple[float, float], ...]
alignment: TakeAlignment
# The selected tempo and detected meter from :meth:`Project.auto_tempo`.
@dataclass(frozen=True, slots=True)
class ProjectAutoTempoResult:
bpm: float
bpm_confidence: float
time_signature: TimeSignatureProject のトークン
ProjectInstrumentKind は保存されるインストゥルメントのバックエンドを表すトークンで、synth、builtin、sf2 のいずれかです。
ProjectInstrumentKind: TypeAlias = Literal['synth', 'builtin', 'sf2']ProjectWarpMode = Literal['off', 'repitch', 'tempoSync', 'timeStretch']
ProjectTrackKind: TypeAlias = Literal['audio', 'midi', 'aux']
ProjectSourceKind: TypeAlias = Literal['audio', 'midi']
ProjectStemLayout: TypeAlias = Literal['mono', 'stereo']
ProjectFadeCurve: TypeAlias = Literal['linear', 'equalPower', 'exponential', 'logarithmic']
ProjectLoopMode: TypeAlias = Literal['off', 'loop']
ProjectOverlapPolicy: TypeAlias = Literal['disallow', 'allow']
ProjectAutomationTargetKind: TypeAlias = Literal['opaque', 'trackFaderDb', 'trackPan', 'trackSendDb', 'trackWidth', 'trackInsertParam']
ProjectMidiCcBindingKind: TypeAlias = Literal['controlChange7', 'controlChange14', 'rpn', 'nrpn']
ProjectKeyMode: TypeAlias = Literal['unknown', 'major', 'minor', 'dorian', 'phrygian', 'lydian', 'mixolydian', 'locrian']
ProjectChordQuality: TypeAlias = Literal['unknown', 'major', 'minor', 'diminished', 'augmented', 'dominant', 'halfDiminished', 'suspended']
ProjectDiagnosticSeverity: TypeAlias = Literal['error', 'warning']
ProjectDiagnosticCode: TypeAlias = Literal['ok', 'danglingSourceRef', 'clipOverlap', 'invalidTempo', 'invalidPpq', 'unsupportedGraph', 'unsupportedMixing', 'emptyAudioSource', 'invalidSampleRate', 'sourceKindMismatch', 'midiClipNoInstrument', 'raggedAudioSource', 'loopCrossfadeUnavailable', 'sharedChannelStrip', 'automationLaneConflict', 'invalidAutomationTargetKind', 'automationLaneCapacity', 'reservedAutomationRouteConflict', 'automationTargetUnrouted']これらの型を作る関数
align_take_to_reference(reference, take, sample_rate, *, take_sample_rate=None, ...) はテイクをリファレンスのタイムラインに合わせ、AlignTakeToReferenceResult を返します。アンカーはテイク自身のクリップ向けの向きで、各ペアの最初の要素がリファレンスのタイムライン上の位置、二番目がテイク内の対応する位置です。そのまま Project.set_warp_map に渡せます。
# Align a take to a reference timeline and return anchors placing it under it.
def align_take_to_reference(
reference: Sequence[float] | list[float] | np.ndarray,
take: Sequence[float] | list[float] | np.ndarray,
sample_rate: int,
*,
take_sample_rate: int | None = None,
hop_length: int | None = None,
bins_per_octave: int | None = None,
) -> AlignTakeToReferenceResult: ...mastering_repair_apply(channels, sample_rate, *, stages, ...) は、stages に渡した順序にかかわらず、チェーン固定の順序(declip、declick、decrackle、dehum、denoise、dereverb)で全チャンネルにリペアステージを適用し、RepairApplyResult を返します。
# Apply repair stages to every channel in the chain's fixed order.
def mastering_repair_apply(
channels: Sequence[Sequence[float] | np.ndarray] | np.ndarray,
sample_rate: int,
*,
stages: Sequence[RepairStage],
on_progress: Callable[[float, str], None] | None = None,
cancel: Callable[[], bool] | None = None,
) -> RepairApplyResult: ...room_geometry_from_estimate(estimate, *, source=None, listener=None) は RoomEstimate を synthesize_rir が受け取るジオメトリに変換します。配置(音源とリスナーの位置、単位はメートル)を加え、収束しなかった吸音バンドは除外します。推定値に測定可能な寸法がない場合は SonareValueError を送出します。
# Turn a room estimate into the geometry :func:`synthesize_rir` takes.
def room_geometry_from_estimate(
estimate: RoomEstimate,
*,
source: Sequence[float] | None = None,
listener: Sequence[float] | None = None,
) -> RoomGeometry: ...