UNPKG

u-he-preset-randomizer

Version:

Create random u-he synth presets through randomization and merging of your existing presets.

39 lines (38 loc) 2.17 kB
/** * @file Core randomization logic for preset generation. * Provides functions to generate fully random presets, randomize existing presets, * and merge multiple presets with statistical weighting. */ import { type ParamsModel } from './analyzer.js'; import type { Config } from './config.js'; import type { Preset } from './parser.js'; import type { PresetLibrary } from './presetLibrary.js'; /** * Generates fully randomized presets based on statistical distributions from the preset library. */ export declare function generateFullyRandomPresets(presetLibrary: PresetLibrary, paramModel: ParamsModel, config: Config): PresetLibrary; /** * Randomize a given preset, with specific randomization ratio */ export declare function generateRandomizedPresets(presetLibrary: PresetLibrary, paramModel: ParamsModel, config: Config): PresetLibrary; /** * Merge multiple presets together, with randomization amount */ export declare function generateMergedPresets(presetLibrary: PresetLibrary, paramModel: ParamsModel, config: Config): PresetLibrary; export declare function getRandomArrayItem<T>(list: T[]): T | undefined; /** * Validates that presets are compatible for merging by checking parameter structure * @param presets Array of presets to validate for merge compatibility * @throws Error if presets are incompatible */ export declare function validateMergeCompatibility(presets: Preset[]): void; /** * Get a random value from the parameter model, with optional frequency weighting * @param paramModelEntry The parameter model entry containing values and frequencies * @param useFrequencyWeighting If true, values that appear more often in presets are more likely to be selected * @returns A random value, or undefined if no values available */ export declare function getRandomValue(paramModelEntry: ParamsModel[string], useFrequencyWeighting: boolean): string | number | undefined; export declare function calculateRandomMergeRatios(amount: number): number[]; export declare function randomizePreset(basePreset: Preset, paramModel: ParamsModel, config: Config): Preset; export declare function getPresetDescriptionSuffix(config: Config): string;