/** * NAM Model JSON Structure * * Sources: * - https://neural-amp-modeler.readthedocs.io/en/latest/model-file.html * - https://github.com/sdatkinson/neural-amp-modeler/blob/main/nam/models/metadata.py * - https://github.com/sdatkinson/neural-amp-modeler/blob/main/nam/train/metadata.py */ export type GearType = "amp" | "pedal" | "pedal_amp" | "amp_cab" | "amp_pedal_cab" | "preamp" | "studio"; export type ToneType = "clean" | "overdrive" | "crunch" | "hi_gain" | "fuzz"; export interface NamModelDate { year: number; month: number; day: number; hour?: number; minute?: number; second?: number; } export interface NamModelTrainingData { latency?: { manual?: number; calibrated?: number; }; checks?: { input_clipping?: boolean; output_clipping?: boolean; latency?: boolean; }; } export interface NamModelTrainingSettings { ignore_checks?: boolean; } export interface NamModelTraining { settings?: NamModelTrainingSettings; data?: NamModelTrainingData; validation_esr?: number; } export interface NamModelMetadata { /** Display name */ name?: string; /** Creator/author */ modeled_by?: string; /** Type of gear modeled */ gear_type?: GearType; /** Manufacturer (e.g., "Fender") */ gear_make?: string; /** Model name (e.g., "Deluxe Reverb") */ gear_model?: string; /** Tone character */ tone_type?: ToneType; /** Input calibration level in dBu */ input_level_dbu?: number; /** Output calibration level in dBu */ output_level_dbu?: number; /** Training date */ date?: NamModelDate; /** Loudness (legacy/plugin-specific) */ loudness?: number; /** Gain (legacy/plugin-specific) */ gain?: number; } /** * Activation descriptor. Architecture 1 (A1) WaveNets store the activation as a * plain name string (e.g. "Tanh"). Architecture 2 (A2) stores an object with a * `type` and activation-specific parameters (e.g. PReLU negative slopes). */ export interface NamActivationConfig { type: string; [key: string]: unknown; } export type NamActivation = string | NamActivationConfig; /** * Architecture 2 (A2) 1x1-convolution / FiLM conditioning sub-block descriptor. * `out_channels` is present on head/input mixers; the FiLM blocks carry `shift`. */ export interface NamSubBlockConfig { active: boolean; shift?: boolean; groups?: number; out_channels?: number; } export interface NamModelLayerConfig { input_size: number; condition_size: number; head_size: number; channels: number; kernel_size: number; dilations: number[]; /** A1: activation name. A2: descriptor(s), one entry per stacked sub-layer. */ activation: NamActivation | ReadonlyArray; head_bias: boolean; /** A1 only: whether the layer is gated. A2 uses `gating_mode` instead. */ gated?: boolean; /** A2 only: gating strategy ("none" | "gated" | "blended"), or one per sub-layer. */ gating_mode?: string | ReadonlyArray; /** A2 only: bottleneck width. */ bottleneck?: number; /** A2 only: grouped-convolution parameters. */ groups_input?: number; groups_input_mixin?: number; /** A2 only: secondary activation after the FiLM stage. */ secondary_activation?: NamActivation | ReadonlyArray; /** A2 only: 1x1 head/layer mixers. */ head1x1?: NamSubBlockConfig; layer1x1?: NamSubBlockConfig; /** A2 only: FiLM conditioning sub-blocks. */ conv_pre_film?: NamSubBlockConfig; conv_post_film?: NamSubBlockConfig; input_mixin_pre_film?: NamSubBlockConfig; input_mixin_post_film?: NamSubBlockConfig; activation_pre_film?: NamSubBlockConfig; activation_post_film?: NamSubBlockConfig; layer1x1_post_film?: NamSubBlockConfig; head1x1_post_film?: NamSubBlockConfig; } export interface NamModelConfig { /** * WaveNet layer stack. Only present for the "WaveNet" architecture; other * architectures (LSTM, ConvNet, …) describe their config with different keys * and omit `layers` entirely, so this is undefined for them. */ layers?: NamModelLayerConfig[]; /** Output head config. Present (often null) on both A1 and A2 WaveNets. */ head?: unknown; /** Output head scale. Present on both A1 and A2 WaveNets. */ head_scale?: number; /** A2 only: nested conditioning model evaluated before the main stack. */ condition_dsp?: NamModel; } export interface NamModel { /** Semantic version of the file format */ version: string; /** Model architecture ("WaveNet", "LSTM", "ConvNet", etc.) */ architecture: string; /** Architecture-specific configuration */ config: NamModelConfig; /** Model parameters/weights */ weights: number[]; /** Optional metadata */ metadata?: NamModelMetadata; /** Optional training information */ training?: NamModelTraining; } export declare namespace NamModel { const parse: (json: string) => NamModel; /** * True for WaveNet "Architecture 2" (A2) models. A2 replaces the A1 `gated` * boolean with a `gating_mode` and introduces a `bottleneck`, so the presence * of either field on any layer identifies the generation. */ const isArchitecture2: (model: NamModel) => boolean; } //# sourceMappingURL=NamModel.d.ts.map