playlist-data-engine 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +352 -0
- package/dist/__vite-browser-external-DYxpcVy9.js +4 -0
- package/dist/constants/DefaultClasses.d.ts +46 -0
- package/dist/constants/DefaultClasses.d.ts.map +1 -0
- package/dist/constants/DefaultEnchantments.d.ts +337 -0
- package/dist/constants/DefaultEnchantments.d.ts.map +1 -0
- package/dist/constants/DefaultEnemies.d.ts +83 -0
- package/dist/constants/DefaultEnemies.d.ts.map +1 -0
- package/dist/constants/DefaultEquipment.d.ts +23 -0
- package/dist/constants/DefaultEquipment.d.ts.map +1 -0
- package/dist/constants/DefaultFeatures.d.ts +22 -0
- package/dist/constants/DefaultFeatures.d.ts.map +1 -0
- package/dist/constants/DefaultRaces.d.ts +102 -0
- package/dist/constants/DefaultRaces.d.ts.map +1 -0
- package/dist/constants/DefaultSkills.d.ts +26 -0
- package/dist/constants/DefaultSkills.d.ts.map +1 -0
- package/dist/constants/DefaultSpells.d.ts +41 -0
- package/dist/constants/DefaultSpells.d.ts.map +1 -0
- package/dist/constants/EncounterBalance.d.ts +208 -0
- package/dist/constants/EncounterBalance.d.ts.map +1 -0
- package/dist/constants/EnemyEquipment.d.ts +71 -0
- package/dist/constants/EnemyEquipment.d.ts.map +1 -0
- package/dist/constants/EnemyRarity.d.ts +79 -0
- package/dist/constants/EnemyRarity.d.ts.map +1 -0
- package/dist/constants/EnemyTemplates/Construct.d.ts +63 -0
- package/dist/constants/EnemyTemplates/Construct.d.ts.map +1 -0
- package/dist/constants/EnemyTemplates/Dragon.d.ts +68 -0
- package/dist/constants/EnemyTemplates/Dragon.d.ts.map +1 -0
- package/dist/constants/EnemyTemplates/Elemental.d.ts +64 -0
- package/dist/constants/EnemyTemplates/Elemental.d.ts.map +1 -0
- package/dist/constants/EnemyTemplates/Fiend.d.ts +62 -0
- package/dist/constants/EnemyTemplates/Fiend.d.ts.map +1 -0
- package/dist/constants/EnemyTemplates/Monstrosity.d.ts +63 -0
- package/dist/constants/EnemyTemplates/Monstrosity.d.ts.map +1 -0
- package/dist/constants/EnemyTemplates/Undead.d.ts +61 -0
- package/dist/constants/EnemyTemplates/Undead.d.ts.map +1 -0
- package/dist/constants/ItemTemplates.d.ts +40 -0
- package/dist/constants/ItemTemplates.d.ts.map +1 -0
- package/dist/constants/MagicItems.d.ts +30 -0
- package/dist/constants/MagicItems.d.ts.map +1 -0
- package/dist/constants/SpellSlots.d.ts +30 -0
- package/dist/constants/SpellSlots.d.ts.map +1 -0
- package/dist/constants/StatScaling.d.ts +113 -0
- package/dist/constants/StatScaling.d.ts.map +1 -0
- package/dist/core/analysis/AudioAnalyzer.d.ts +599 -0
- package/dist/core/analysis/AudioAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/ColorExtractor.d.ts +64 -0
- package/dist/core/analysis/ColorExtractor.d.ts.map +1 -0
- package/dist/core/analysis/EssentiaPitchDetector.d.ts +282 -0
- package/dist/core/analysis/EssentiaPitchDetector.d.ts.map +1 -0
- package/dist/core/analysis/LevelSerializer.d.ts +265 -0
- package/dist/core/analysis/LevelSerializer.d.ts.map +1 -0
- package/dist/core/analysis/MelodyContourAnalyzer.d.ts +283 -0
- package/dist/core/analysis/MelodyContourAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/MultiBandAnalyzer.d.ts +214 -0
- package/dist/core/analysis/MultiBandAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/MusicClassifier.d.ts +524 -0
- package/dist/core/analysis/MusicClassifier.d.ts.map +1 -0
- package/dist/core/analysis/PitchAnalyzer.d.ts +266 -0
- package/dist/core/analysis/PitchAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/PitchDetector.d.ts +251 -0
- package/dist/core/analysis/PitchDetector.d.ts.map +1 -0
- package/dist/core/analysis/SpectrumScanner.d.ts +52 -0
- package/dist/core/analysis/SpectrumScanner.d.ts.map +1 -0
- package/dist/core/analysis/beat/BeatInterpolator.d.ts +477 -0
- package/dist/core/analysis/beat/BeatInterpolator.d.ts.map +1 -0
- package/dist/core/analysis/beat/BeatMapGenerator.d.ts +170 -0
- package/dist/core/analysis/beat/BeatMapGenerator.d.ts.map +1 -0
- package/dist/core/analysis/beat/BeatStream.d.ts +316 -0
- package/dist/core/analysis/beat/BeatStream.d.ts.map +1 -0
- package/dist/core/analysis/beat/BeatSubdivider.d.ts +205 -0
- package/dist/core/analysis/beat/BeatSubdivider.d.ts.map +1 -0
- package/dist/core/analysis/beat/BeatTracker.d.ts +137 -0
- package/dist/core/analysis/beat/BeatTracker.d.ts.map +1 -0
- package/dist/core/analysis/beat/CompositeStreamGenerator.d.ts +180 -0
- package/dist/core/analysis/beat/CompositeStreamGenerator.d.ts.map +1 -0
- package/dist/core/analysis/beat/DensityAnalyzer.d.ts +246 -0
- package/dist/core/analysis/beat/DensityAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/beat/DifficultyVariantGenerator.d.ts +1082 -0
- package/dist/core/analysis/beat/DifficultyVariantGenerator.d.ts.map +1 -0
- package/dist/core/analysis/beat/GrooveAnalyzer.d.ts +192 -0
- package/dist/core/analysis/beat/GrooveAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/beat/OnsetStrengthEnvelope.d.ts +133 -0
- package/dist/core/analysis/beat/OnsetStrengthEnvelope.d.ts.map +1 -0
- package/dist/core/analysis/beat/PhraseAnalyzer.d.ts +230 -0
- package/dist/core/analysis/beat/PhraseAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/beat/RhythmQuantizer.d.ts +399 -0
- package/dist/core/analysis/beat/RhythmQuantizer.d.ts.map +1 -0
- package/dist/core/analysis/beat/RhythmicBalancer.d.ts +262 -0
- package/dist/core/analysis/beat/RhythmicBalancer.d.ts.map +1 -0
- package/dist/core/analysis/beat/StreamScorer.d.ts +275 -0
- package/dist/core/analysis/beat/StreamScorer.d.ts.map +1 -0
- package/dist/core/analysis/beat/TempoAwareQuantizer.d.ts +256 -0
- package/dist/core/analysis/beat/TempoAwareQuantizer.d.ts.map +1 -0
- package/dist/core/analysis/beat/TempoDetector.d.ts +220 -0
- package/dist/core/analysis/beat/TempoDetector.d.ts.map +1 -0
- package/dist/core/analysis/beat/TransientDetector.d.ts +303 -0
- package/dist/core/analysis/beat/TransientDetector.d.ts.map +1 -0
- package/dist/core/analysis/beat/beatKeyHelpers.d.ts +180 -0
- package/dist/core/analysis/beat/beatKeyHelpers.d.ts.map +1 -0
- package/dist/core/analysis/beat/index.d.ts +41 -0
- package/dist/core/analysis/beat/index.d.ts.map +1 -0
- package/dist/core/analysis/beat/utils/audioUtils.d.ts +204 -0
- package/dist/core/analysis/beat/utils/audioUtils.d.ts.map +1 -0
- package/dist/core/analysis/beat/utils/beatInterpolationDebug.d.ts +404 -0
- package/dist/core/analysis/beat/utils/beatInterpolationDebug.d.ts.map +1 -0
- package/dist/core/analysis/beat/utils/subdivideBeatMap.d.ts +61 -0
- package/dist/core/analysis/beat/utils/subdivideBeatMap.d.ts.map +1 -0
- package/dist/core/analysis/beat/utils/unifyBeatMap.d.ts +33 -0
- package/dist/core/analysis/beat/utils/unifyBeatMap.d.ts.map +1 -0
- package/dist/core/analysis/index.d.ts +18 -0
- package/dist/core/analysis/index.d.ts.map +1 -0
- package/dist/core/combat/AI/AICombatRunner.d.ts +108 -0
- package/dist/core/combat/AI/AICombatRunner.d.ts.map +1 -0
- package/dist/core/combat/AI/CombatAI.d.ts +179 -0
- package/dist/core/combat/AI/CombatAI.d.ts.map +1 -0
- package/dist/core/combat/AI/CombatMetricsTracker.d.ts +30 -0
- package/dist/core/combat/AI/CombatMetricsTracker.d.ts.map +1 -0
- package/dist/core/combat/Analysis/BalanceValidator.d.ts +170 -0
- package/dist/core/combat/Analysis/BalanceValidator.d.ts.map +1 -0
- package/dist/core/combat/Analysis/ComparativeAnalyzer.d.ts +231 -0
- package/dist/core/combat/Analysis/ComparativeAnalyzer.d.ts.map +1 -0
- package/dist/core/combat/Analysis/DifficultyCalculator.d.ts +203 -0
- package/dist/core/combat/Analysis/DifficultyCalculator.d.ts.map +1 -0
- package/dist/core/combat/Analysis/ParameterSweep.d.ts +201 -0
- package/dist/core/combat/Analysis/ParameterSweep.d.ts.map +1 -0
- package/dist/core/combat/AttackResolver.d.ts +220 -0
- package/dist/core/combat/AttackResolver.d.ts.map +1 -0
- package/dist/core/combat/CombatEngine.d.ts +388 -0
- package/dist/core/combat/CombatEngine.d.ts.map +1 -0
- package/dist/core/combat/DiceRoller.d.ts +115 -0
- package/dist/core/combat/DiceRoller.d.ts.map +1 -0
- package/dist/core/combat/InitiativeRoller.d.ts +62 -0
- package/dist/core/combat/InitiativeRoller.d.ts.map +1 -0
- package/dist/core/combat/PartyAnalyzer.d.ts +215 -0
- package/dist/core/combat/PartyAnalyzer.d.ts.map +1 -0
- package/dist/core/combat/SeededDiceRoller.d.ts +120 -0
- package/dist/core/combat/SeededDiceRoller.d.ts.map +1 -0
- package/dist/core/combat/Simulation/CombatSimulator.d.ts +366 -0
- package/dist/core/combat/Simulation/CombatSimulator.d.ts.map +1 -0
- package/dist/core/combat/SpellCaster.d.ts +113 -0
- package/dist/core/combat/SpellCaster.d.ts.map +1 -0
- package/dist/core/config/index.d.ts +24 -0
- package/dist/core/config/index.d.ts.map +1 -0
- package/dist/core/config/progressionConfig.d.ts +73 -0
- package/dist/core/config/progressionConfig.d.ts.map +1 -0
- package/dist/core/config/sensorConfig.d.ts +134 -0
- package/dist/core/config/sensorConfig.d.ts.map +1 -0
- package/dist/core/equipment/BoxOpener.d.ts +175 -0
- package/dist/core/equipment/BoxOpener.d.ts.map +1 -0
- package/dist/core/equipment/EquipmentEffectApplier.d.ts +189 -0
- package/dist/core/equipment/EquipmentEffectApplier.d.ts.map +1 -0
- package/dist/core/equipment/EquipmentModifier.d.ts +327 -0
- package/dist/core/equipment/EquipmentModifier.d.ts.map +1 -0
- package/dist/core/equipment/EquipmentSpawnHelper.d.ts +246 -0
- package/dist/core/equipment/EquipmentSpawnHelper.d.ts.map +1 -0
- package/dist/core/equipment/EquipmentValidator.d.ts +173 -0
- package/dist/core/equipment/EquipmentValidator.d.ts.map +1 -0
- package/dist/core/extensions/ExtensionManager.d.ts +517 -0
- package/dist/core/extensions/ExtensionManager.d.ts.map +1 -0
- package/dist/core/extensions/WeightedSelector.d.ts +156 -0
- package/dist/core/extensions/WeightedSelector.d.ts.map +1 -0
- package/dist/core/extensions/index.d.ts +11 -0
- package/dist/core/extensions/index.d.ts.map +1 -0
- package/dist/core/extensions/initializeDefaults.d.ts +170 -0
- package/dist/core/extensions/initializeDefaults.d.ts.map +1 -0
- package/dist/core/features/FeatureEffectApplier.d.ts +102 -0
- package/dist/core/features/FeatureEffectApplier.d.ts.map +1 -0
- package/dist/core/features/FeatureQuery.d.ts +368 -0
- package/dist/core/features/FeatureQuery.d.ts.map +1 -0
- package/dist/core/features/FeatureTypes.d.ts +199 -0
- package/dist/core/features/FeatureTypes.d.ts.map +1 -0
- package/dist/core/features/FeatureValidator.d.ts +149 -0
- package/dist/core/features/FeatureValidator.d.ts.map +1 -0
- package/dist/core/features/index.d.ts +12 -0
- package/dist/core/features/index.d.ts.map +1 -0
- package/dist/core/generation/AbilityScoreCalculator.d.ts +83 -0
- package/dist/core/generation/AbilityScoreCalculator.d.ts.map +1 -0
- package/dist/core/generation/AppearanceGenerator.d.ts +32 -0
- package/dist/core/generation/AppearanceGenerator.d.ts.map +1 -0
- package/dist/core/generation/BeatConverter.d.ts +127 -0
- package/dist/core/generation/BeatConverter.d.ts.map +1 -0
- package/dist/core/generation/ButtonMapper.d.ts +346 -0
- package/dist/core/generation/ButtonMapper.d.ts.map +1 -0
- package/dist/core/generation/ButtonPatternLibrary.d.ts +92 -0
- package/dist/core/generation/ButtonPatternLibrary.d.ts.map +1 -0
- package/dist/core/generation/CRLevelConverter.d.ts +242 -0
- package/dist/core/generation/CRLevelConverter.d.ts.map +1 -0
- package/dist/core/generation/CharacterGenerator.d.ts +194 -0
- package/dist/core/generation/CharacterGenerator.d.ts.map +1 -0
- package/dist/core/generation/ClassSuggester.d.ts +184 -0
- package/dist/core/generation/ClassSuggester.d.ts.map +1 -0
- package/dist/core/generation/EnemyEquipmentGenerator.d.ts +151 -0
- package/dist/core/generation/EnemyEquipmentGenerator.d.ts.map +1 -0
- package/dist/core/generation/EnemyGenerator.d.ts +595 -0
- package/dist/core/generation/EnemyGenerator.d.ts.map +1 -0
- package/dist/core/generation/EquipmentGenerator.d.ts +204 -0
- package/dist/core/generation/EquipmentGenerator.d.ts.map +1 -0
- package/dist/core/generation/LegendaryGenerator.d.ts +213 -0
- package/dist/core/generation/LegendaryGenerator.d.ts.map +1 -0
- package/dist/core/generation/LevelGenerator.d.ts +390 -0
- package/dist/core/generation/LevelGenerator.d.ts.map +1 -0
- package/dist/core/generation/NamingEngine.d.ts +136 -0
- package/dist/core/generation/NamingEngine.d.ts.map +1 -0
- package/dist/core/generation/PitchBeatLinker.d.ts +150 -0
- package/dist/core/generation/PitchBeatLinker.d.ts.map +1 -0
- package/dist/core/generation/RaceSelector.d.ts +58 -0
- package/dist/core/generation/RaceSelector.d.ts.map +1 -0
- package/dist/core/generation/RhythmGenerator.d.ts +597 -0
- package/dist/core/generation/RhythmGenerator.d.ts.map +1 -0
- package/dist/core/generation/SkillAssigner.d.ts +78 -0
- package/dist/core/generation/SkillAssigner.d.ts.map +1 -0
- package/dist/core/generation/SpellManager.d.ts +132 -0
- package/dist/core/generation/SpellManager.d.ts.map +1 -0
- package/dist/core/generation/SpellcastingGenerator.d.ts +255 -0
- package/dist/core/generation/SpellcastingGenerator.d.ts.map +1 -0
- package/dist/core/generation/index.d.ts +41 -0
- package/dist/core/generation/index.d.ts.map +1 -0
- package/dist/core/parser/MetadataExtractor.d.ts +66 -0
- package/dist/core/parser/MetadataExtractor.d.ts.map +1 -0
- package/dist/core/parser/PlaylistParser.d.ts +45 -0
- package/dist/core/parser/PlaylistParser.d.ts.map +1 -0
- package/dist/core/playback/SubdivisionPlaybackController.d.ts +333 -0
- package/dist/core/playback/SubdivisionPlaybackController.d.ts.map +1 -0
- package/dist/core/playback/index.d.ts +5 -0
- package/dist/core/playback/index.d.ts.map +1 -0
- package/dist/core/progression/CharacterUpdater.d.ts +203 -0
- package/dist/core/progression/CharacterUpdater.d.ts.map +1 -0
- package/dist/core/progression/LevelUpProcessor.d.ts +234 -0
- package/dist/core/progression/LevelUpProcessor.d.ts.map +1 -0
- package/dist/core/progression/PrestigeSystem.d.ts +217 -0
- package/dist/core/progression/PrestigeSystem.d.ts.map +1 -0
- package/dist/core/progression/RhythmXPCalculator.d.ts +182 -0
- package/dist/core/progression/RhythmXPCalculator.d.ts.map +1 -0
- package/dist/core/progression/SessionTracker.d.ts +169 -0
- package/dist/core/progression/SessionTracker.d.ts.map +1 -0
- package/dist/core/progression/XPCalculator.d.ts +128 -0
- package/dist/core/progression/XPCalculator.d.ts.map +1 -0
- package/dist/core/progression/stat/StatIncreaseStrategy.d.ts +97 -0
- package/dist/core/progression/stat/StatIncreaseStrategy.d.ts.map +1 -0
- package/dist/core/progression/stat/StatManager.d.ts +179 -0
- package/dist/core/progression/stat/StatManager.d.ts.map +1 -0
- package/dist/core/sensors/EnvironmentalSensors.d.ts +301 -0
- package/dist/core/sensors/EnvironmentalSensors.d.ts.map +1 -0
- package/dist/core/sensors/GamingPlatformSensors.d.ts +162 -0
- package/dist/core/sensors/GamingPlatformSensors.d.ts.map +1 -0
- package/dist/core/sensors/GeolocationProvider.d.ts +156 -0
- package/dist/core/sensors/GeolocationProvider.d.ts.map +1 -0
- package/dist/core/sensors/MotionDetector.d.ts +58 -0
- package/dist/core/sensors/MotionDetector.d.ts.map +1 -0
- package/dist/core/sensors/SteamAPIClient.d.ts +108 -0
- package/dist/core/sensors/SteamAPIClient.d.ts.map +1 -0
- package/dist/core/sensors/WeatherAPIClient.d.ts +360 -0
- package/dist/core/sensors/WeatherAPIClient.d.ts.map +1 -0
- package/dist/core/sensors/schemas/weather.schema.d.ts +144 -0
- package/dist/core/sensors/schemas/weather.schema.d.ts.map +1 -0
- package/dist/core/skills/SkillQuery.d.ts +159 -0
- package/dist/core/skills/SkillQuery.d.ts.map +1 -0
- package/dist/core/skills/SkillTypes.d.ts +233 -0
- package/dist/core/skills/SkillTypes.d.ts.map +1 -0
- package/dist/core/skills/SkillValidator.d.ts +146 -0
- package/dist/core/skills/SkillValidator.d.ts.map +1 -0
- package/dist/core/skills/index.d.ts +11 -0
- package/dist/core/skills/index.d.ts.map +1 -0
- package/dist/core/spells/SpellQuery.d.ts +194 -0
- package/dist/core/spells/SpellQuery.d.ts.map +1 -0
- package/dist/core/spells/SpellTypes.d.ts +71 -0
- package/dist/core/spells/SpellTypes.d.ts.map +1 -0
- package/dist/core/spells/SpellValidator.d.ts +129 -0
- package/dist/core/spells/SpellValidator.d.ts.map +1 -0
- package/dist/core/spells/index.d.ts +11 -0
- package/dist/core/spells/index.d.ts.map +1 -0
- package/dist/core/types/AudioProfile.d.ts +143 -0
- package/dist/core/types/AudioProfile.d.ts.map +1 -0
- package/dist/core/types/BeatMap.d.ts +1825 -0
- package/dist/core/types/BeatMap.d.ts.map +1 -0
- package/dist/core/types/ButtonMapping.d.ts +345 -0
- package/dist/core/types/ButtonMapping.d.ts.map +1 -0
- package/dist/core/types/Character.d.ts +397 -0
- package/dist/core/types/Character.d.ts.map +1 -0
- package/dist/core/types/ChartedBeatMap.d.ts +169 -0
- package/dist/core/types/ChartedBeatMap.d.ts.map +1 -0
- package/dist/core/types/Combat.d.ts +268 -0
- package/dist/core/types/Combat.d.ts.map +1 -0
- package/dist/core/types/CombatAI.d.ts +143 -0
- package/dist/core/types/CombatAI.d.ts.map +1 -0
- package/dist/core/types/Enemy.d.ts +447 -0
- package/dist/core/types/Enemy.d.ts.map +1 -0
- package/dist/core/types/Environmental.d.ts +213 -0
- package/dist/core/types/Environmental.d.ts.map +1 -0
- package/dist/core/types/Equipment.d.ts +309 -0
- package/dist/core/types/Equipment.d.ts.map +1 -0
- package/dist/core/types/ISessionTracker.d.ts +48 -0
- package/dist/core/types/ISessionTracker.d.ts.map +1 -0
- package/dist/core/types/LevelExport.d.ts +366 -0
- package/dist/core/types/LevelExport.d.ts.map +1 -0
- package/dist/core/types/Playlist.d.ts +70 -0
- package/dist/core/types/Playlist.d.ts.map +1 -0
- package/dist/core/types/Prestige.d.ts +94 -0
- package/dist/core/types/Prestige.d.ts.map +1 -0
- package/dist/core/types/Progression.d.ts +214 -0
- package/dist/core/types/Progression.d.ts.map +1 -0
- package/dist/core/types/RhythmXP.d.ts +398 -0
- package/dist/core/types/RhythmXP.d.ts.map +1 -0
- package/dist/core/utils/AbilityConstants.d.ts +31 -0
- package/dist/core/utils/AbilityConstants.d.ts.map +1 -0
- package/dist/core/utils/EffectApplierUtils.d.ts +56 -0
- package/dist/core/utils/EffectApplierUtils.d.ts.map +1 -0
- package/dist/core/utils/ImageValidator.d.ts +66 -0
- package/dist/core/utils/ImageValidator.d.ts.map +1 -0
- package/dist/core/utils/PrerequisiteValidator.d.ts +88 -0
- package/dist/core/utils/PrerequisiteValidator.d.ts.map +1 -0
- package/dist/essentia-wasm.es-BUEnKUts.js +2990 -0
- package/dist/essentia.js-model.es-CGA0xotH.js +306 -0
- package/dist/index.d.ts +176 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/playlist-data-engine.js +124 -0
- package/dist/playlist-data-engine.mjs +49251 -0
- package/dist/utils/EnchantmentLibrary.d.ts +378 -0
- package/dist/utils/EnchantmentLibrary.d.ts.map +1 -0
- package/dist/utils/arweaveGatewayManager.d.ts +485 -0
- package/dist/utils/arweaveGatewayManager.d.ts.map +1 -0
- package/dist/utils/arweaveUtils.d.ts +118 -0
- package/dist/utils/arweaveUtils.d.ts.map +1 -0
- package/dist/utils/constants.d.ts +439 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/equipmentConstants.d.ts +60 -0
- package/dist/utils/equipmentConstants.d.ts.map +1 -0
- package/dist/utils/hash.d.ts +33 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +192 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/magicItemExamples.d.ts +46 -0
- package/dist/utils/magicItemExamples.d.ts.map +1 -0
- package/dist/utils/playlistUtils.d.ts +149 -0
- package/dist/utils/playlistUtils.d.ts.map +1 -0
- package/dist/utils/random.d.ts +34 -0
- package/dist/utils/random.d.ts.map +1 -0
- package/dist/utils/sensorDashboard.d.ts +60 -0
- package/dist/utils/sensorDashboard.d.ts.map +1 -0
- package/dist/utils/validators.d.ts +189 -0
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stream Scorer for Procedural Rhythm Generation
|
|
3
|
+
*
|
|
4
|
+
* Evaluates the "interest" level of each band stream per section.
|
|
5
|
+
* Used to determine which band has the most interesting rhythm for composite generation.
|
|
6
|
+
*
|
|
7
|
+
* Part of the Procedural Rhythm Generation pipeline - Phase 3.1
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Basic usage - score band streams for interest level
|
|
12
|
+
* const scorer = new StreamScorer();
|
|
13
|
+
* const result = scorer.score(quantizedBandStreams, phraseAnalysis, densityAnalysis);
|
|
14
|
+
*
|
|
15
|
+
* // Check which band won each section
|
|
16
|
+
* for (const winner of result.sectionWinners) {
|
|
17
|
+
* console.log(`Beats ${winner.beatRange.start}-${winner.beatRange.end}: ${winner.band} won`);
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* // Compare overall band performance
|
|
21
|
+
* console.log('Band totals:', result.bandTotals);
|
|
22
|
+
* console.log('Band averages:', result.bandAverages);
|
|
23
|
+
*
|
|
24
|
+
* // Inspect individual scoring factors
|
|
25
|
+
* for (const score of result.sectionScores) {
|
|
26
|
+
* console.log(`${score.band} @ ${score.beatRange.start}: ${score.score.toFixed(2)}`);
|
|
27
|
+
* console.log(` IOI variance: ${score.factors.ioiVariance.toFixed(2)}`);
|
|
28
|
+
* console.log(` Syncopation: ${score.factors.syncopationLevel.toFixed(2)}`);
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
import type { QuantizedBandStreams } from './RhythmQuantizer.js';
|
|
33
|
+
import type { PhraseAnalysisResult } from './PhraseAnalyzer.js';
|
|
34
|
+
import type { DensityAnalysisResult } from './DensityAnalyzer.js';
|
|
35
|
+
import type { ControllerMode } from '../../types/ButtonMapping.js';
|
|
36
|
+
/**
|
|
37
|
+
* Band identifier
|
|
38
|
+
*/
|
|
39
|
+
export type Band = 'low' | 'mid' | 'high';
|
|
40
|
+
/**
|
|
41
|
+
* Scoring factors that contribute to the overall interest score
|
|
42
|
+
*/
|
|
43
|
+
export interface ScoringFactors {
|
|
44
|
+
/** Inter-Onset Interval variance (rhythmic variety) */
|
|
45
|
+
ioiVariance: number;
|
|
46
|
+
/** Syncopation level (offbeat emphasis) */
|
|
47
|
+
syncopationLevel: number;
|
|
48
|
+
/** Phrase significance from detected patterns */
|
|
49
|
+
phraseSignificance: number;
|
|
50
|
+
/** Density contribution (more notes = more interesting, to a point) */
|
|
51
|
+
densityFactor: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Score for a single section of a single band
|
|
55
|
+
*/
|
|
56
|
+
export interface SectionScore {
|
|
57
|
+
/** Beat range for this section */
|
|
58
|
+
beatRange: {
|
|
59
|
+
start: number;
|
|
60
|
+
end: number;
|
|
61
|
+
};
|
|
62
|
+
/** Which band this score is for */
|
|
63
|
+
band: Band;
|
|
64
|
+
/** Overall interest score (0.0 - 1.0, higher = more interesting) */
|
|
65
|
+
score: number;
|
|
66
|
+
/** Individual scoring factors */
|
|
67
|
+
factors: ScoringFactors;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Complete scoring result for all bands across all sections
|
|
71
|
+
*/
|
|
72
|
+
export interface StreamScoringResult {
|
|
73
|
+
/** All section scores */
|
|
74
|
+
sectionScores: SectionScore[];
|
|
75
|
+
/** Per-band total scores (sum of all section scores) */
|
|
76
|
+
bandTotals: {
|
|
77
|
+
low: number;
|
|
78
|
+
mid: number;
|
|
79
|
+
high: number;
|
|
80
|
+
};
|
|
81
|
+
/** Per-band average scores */
|
|
82
|
+
bandAverages: {
|
|
83
|
+
low: number;
|
|
84
|
+
mid: number;
|
|
85
|
+
high: number;
|
|
86
|
+
};
|
|
87
|
+
/** For each section, which band won (highest score) */
|
|
88
|
+
sectionWinners: SectionWinner[];
|
|
89
|
+
/** Configuration used for scoring */
|
|
90
|
+
config: StreamScorerConfig;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Winner for a section
|
|
94
|
+
*/
|
|
95
|
+
export interface SectionWinner {
|
|
96
|
+
/** Beat range for this section */
|
|
97
|
+
beatRange: {
|
|
98
|
+
start: number;
|
|
99
|
+
end: number;
|
|
100
|
+
};
|
|
101
|
+
/** Which band won this section */
|
|
102
|
+
winner: Band;
|
|
103
|
+
/** The winning score */
|
|
104
|
+
score: number;
|
|
105
|
+
/** Margin of victory over second place */
|
|
106
|
+
margin: number;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Band bias weights for controlling which frequency bands are favored
|
|
110
|
+
* in composite stream selection.
|
|
111
|
+
*
|
|
112
|
+
* Values are applied as multipliers to the final score:
|
|
113
|
+
* - 1.0 = no bias (neutral)
|
|
114
|
+
* - > 1.0 = favor this band
|
|
115
|
+
* - < 1.0 = disfavor this band
|
|
116
|
+
*
|
|
117
|
+
* Example: To reduce bass dominance, set { low: 0.5, mid: 1.0, high: 1.0 }
|
|
118
|
+
*/
|
|
119
|
+
export interface BandBiasWeights {
|
|
120
|
+
low: number;
|
|
121
|
+
mid: number;
|
|
122
|
+
high: number;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Configuration for stream scoring
|
|
126
|
+
*/
|
|
127
|
+
export interface StreamScorerConfig {
|
|
128
|
+
/** Number of beats per section for scoring. Default: 8 (2 measures in 4/4 time) */
|
|
129
|
+
beatsPerSection: number;
|
|
130
|
+
/** Weight for IOI variance in scoring. Default: 0.3 */
|
|
131
|
+
ioiVarianceWeight: number;
|
|
132
|
+
/** Weight for syncopation in scoring. Default: 0.3 */
|
|
133
|
+
syncopationWeight: number;
|
|
134
|
+
/** Weight for phrase significance in scoring. Default: 0.25 */
|
|
135
|
+
phraseSignificanceWeight: number;
|
|
136
|
+
/** Weight for density factor in scoring. Default: 0.15 */
|
|
137
|
+
densityWeight: number;
|
|
138
|
+
/** Grid positions considered "offbeats" for syncopation scoring.
|
|
139
|
+
* For straight_16th: 1 and 3 are offbeats (16th note subdivisions)
|
|
140
|
+
* For triplet_8th: 1 and 2 are offbeats (after the downbeat)
|
|
141
|
+
* For straight_8th: 1 is offbeat (the "and" in "1-and")
|
|
142
|
+
*/
|
|
143
|
+
offbeatGridPositions: {
|
|
144
|
+
straight_16th: number[];
|
|
145
|
+
triplet_8th: number[];
|
|
146
|
+
straight_8th: number[];
|
|
147
|
+
};
|
|
148
|
+
/** Band bias multipliers applied to final section scores.
|
|
149
|
+
* undefined = no bias (default)
|
|
150
|
+
* Range: 0.0 - 2.0 (0 = never win, 1 = neutral, 2 = strongly favored)
|
|
151
|
+
*/
|
|
152
|
+
bandBiasWeights?: BandBiasWeights;
|
|
153
|
+
/** BPM for tempo-aware density factor calculation.
|
|
154
|
+
* When provided, density is measured in notes/second (BPM-adjusted).
|
|
155
|
+
* When undefined, density falls back to notes/beat (legacy behavior).
|
|
156
|
+
* Default: undefined
|
|
157
|
+
*/
|
|
158
|
+
bpm?: number;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Get the default scoring factor weights for a controller mode.
|
|
162
|
+
*
|
|
163
|
+
* Returns the mode-specific defaults for the 4 scoring factors (ioiVarianceWeight,
|
|
164
|
+
* syncopationWeight, phraseSignificanceWeight, densityWeight). Band bias weights
|
|
165
|
+
* are the same across all modes.
|
|
166
|
+
*
|
|
167
|
+
* @param controllerMode - The controller mode to get defaults for
|
|
168
|
+
* @returns Full StreamScorerConfig with mode-specific factor weights
|
|
169
|
+
*/
|
|
170
|
+
export declare function getControllerModeScoringDefaults(controllerMode: ControllerMode): StreamScorerConfig;
|
|
171
|
+
/**
|
|
172
|
+
* Evaluates the "interest" level of each band stream per section.
|
|
173
|
+
*
|
|
174
|
+
* ## Scoring Algorithm
|
|
175
|
+
*
|
|
176
|
+
* The scoring system evaluates rhythmic interest based on four factors:
|
|
177
|
+
*
|
|
178
|
+
* 1. **IOI Variance** (Inter-Onset Interval): Measures rhythmic variety.
|
|
179
|
+
* - Higher variance = more interesting rhythms (not just straight notes)
|
|
180
|
+
* - Low variance = monotonous patterns
|
|
181
|
+
*
|
|
182
|
+
* 2. **Syncopation Level**: Measures offbeat emphasis.
|
|
183
|
+
* - Notes on grid positions 1 or 3 (16th notes) are syncopated
|
|
184
|
+
* - Syncopated rhythms are generally more interesting
|
|
185
|
+
*
|
|
186
|
+
* 3. **Phrase Significance**: Incorporates detected phrase patterns.
|
|
187
|
+
* - Sections containing significant detected phrases score higher
|
|
188
|
+
* - Encourages using sections with meaningful musical content
|
|
189
|
+
*
|
|
190
|
+
* 4. **Density Factor**: Considers note density.
|
|
191
|
+
* - Moderate density is ideal (not too sparse, not too dense)
|
|
192
|
+
* - Uses a bell curve centered around an optimal notes/second value (BPM-aware)
|
|
193
|
+
* - When BPM is configured, density is measured in notes/second for tempo-accurate scoring
|
|
194
|
+
*
|
|
195
|
+
* ## Usage
|
|
196
|
+
*
|
|
197
|
+
* ```typescript
|
|
198
|
+
* const scorer = new StreamScorer();
|
|
199
|
+
* const result = scorer.score(quantizedStreams, phraseAnalysis, densityAnalysis);
|
|
200
|
+
*
|
|
201
|
+
* // Get section winners for composite generation
|
|
202
|
+
* for (const winner of result.sectionWinners) {
|
|
203
|
+
* console.log(`Beats ${winner.beatRange.start}-${winner.beatRange.end}: ${winner.winner} wins`);
|
|
204
|
+
* }
|
|
205
|
+
*
|
|
206
|
+
* // Get average scores per band
|
|
207
|
+
* console.log('Low band avg:', result.bandAverages.low);
|
|
208
|
+
* console.log('Mid band avg:', result.bandAverages.mid);
|
|
209
|
+
* console.log('High band avg:', result.bandAverages.high);
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
export declare class StreamScorer {
|
|
213
|
+
private config;
|
|
214
|
+
constructor(config?: Partial<StreamScorerConfig>);
|
|
215
|
+
/**
|
|
216
|
+
* Score all band streams across all sections
|
|
217
|
+
*
|
|
218
|
+
* @param streams - Quantized band streams from RhythmQuantizer
|
|
219
|
+
* @param phraseAnalysis - Phrase analysis from PhraseAnalyzer
|
|
220
|
+
* @param densityAnalysis - Density analysis from DensityAnalyzer
|
|
221
|
+
* @returns Complete scoring result
|
|
222
|
+
*/
|
|
223
|
+
score(streams: QuantizedBandStreams, phraseAnalysis: PhraseAnalysisResult, densityAnalysis: DensityAnalysisResult): StreamScoringResult;
|
|
224
|
+
/**
|
|
225
|
+
* Score a single section of a single band
|
|
226
|
+
*/
|
|
227
|
+
private scoreSection;
|
|
228
|
+
/**
|
|
229
|
+
* Calculate Inter-Onset Interval variance
|
|
230
|
+
*
|
|
231
|
+
* Higher variance indicates more rhythmic variety (more interesting).
|
|
232
|
+
* Normalized to 0-1 range.
|
|
233
|
+
*/
|
|
234
|
+
private calculateIOIVariance;
|
|
235
|
+
/**
|
|
236
|
+
* Calculate syncopation level
|
|
237
|
+
*
|
|
238
|
+
* Measures emphasis on offbeats. Higher syncopation = more interesting.
|
|
239
|
+
* Normalized to 0-1 range.
|
|
240
|
+
*/
|
|
241
|
+
private calculateSyncopationLevel;
|
|
242
|
+
/**
|
|
243
|
+
* Calculate phrase significance for a section
|
|
244
|
+
*
|
|
245
|
+
* Higher if significant phrases overlap with this section.
|
|
246
|
+
* Normalized to 0-1 range.
|
|
247
|
+
*/
|
|
248
|
+
private calculatePhraseSignificance;
|
|
249
|
+
/**
|
|
250
|
+
* Calculate density factor
|
|
251
|
+
*
|
|
252
|
+
* Uses a bell curve - moderate density is ideal.
|
|
253
|
+
* When BPM is configured, density is measured in notes/second for tempo-accurate scoring.
|
|
254
|
+
* Optimal density is around 1.0 notes/second.
|
|
255
|
+
* Normalized to 0-1 range.
|
|
256
|
+
*/
|
|
257
|
+
private calculateDensityFactor;
|
|
258
|
+
/**
|
|
259
|
+
* Determine the winner for each section
|
|
260
|
+
*/
|
|
261
|
+
private determineSectionWinners;
|
|
262
|
+
/**
|
|
263
|
+
* Get the current configuration
|
|
264
|
+
*/
|
|
265
|
+
getConfig(): StreamScorerConfig;
|
|
266
|
+
/**
|
|
267
|
+
* Update configuration options.
|
|
268
|
+
* Merges the provided partial config with the existing config.
|
|
269
|
+
* Use this to set runtime values like BPM that aren't known at construction time.
|
|
270
|
+
*
|
|
271
|
+
* @param partial - Partial config to merge
|
|
272
|
+
*/
|
|
273
|
+
updateConfig(partial: Partial<StreamScorerConfig>): void;
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=StreamScorer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StreamScorer.d.ts","sourceRoot":"","sources":["../../../../src/core/analysis/beat/StreamScorer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAqC,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,KAAK,EAAE,oBAAoB,EAAkB,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAMnE;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,uDAAuD;IACvD,WAAW,EAAE,MA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,OAAO,CAAC,uBAAuB;IAwC/B;;OAEG;IACH,SAAS,IAAI,kBAAkB;IAI/B;;;;;;OAMG;IACH,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,IAAI;CAG3D"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tempo-Aware Quantization
|
|
3
|
+
*
|
|
4
|
+
* Extensible pipeline step that applies BPM-based rules to constrain the
|
|
5
|
+
* quantization grid for fundamental playability, independent of difficulty
|
|
6
|
+
* settings.
|
|
7
|
+
*
|
|
8
|
+
* ## Architecture
|
|
9
|
+
*
|
|
10
|
+
* The TempoAwareQuantizer plugs into the decide-then-quantize flow:
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* decideGrids() → RhythmQuantizer base decisions
|
|
14
|
+
* ↓
|
|
15
|
+
* TempoAwareQuantizer.applyRules() → BPM-constrained decisions
|
|
16
|
+
* ↓
|
|
17
|
+
* quantizeToGrids() → Quantize from original timestamps to final grid
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Rules are consulted during grid decision-making, not applied post-hoc to
|
|
21
|
+
* already-quantized data. This means there is only ONE quantization pass.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const quantizer = new TempoAwareQuantizer({
|
|
26
|
+
* enabled: true,
|
|
27
|
+
* rules: [new HighBpmGridRestrictionRule()],
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* // Get base grid decisions from RhythmQuantizer
|
|
31
|
+
* const baseDecisions = rhythmQuantizer.decideGrids(transients, beatMap, 'mid');
|
|
32
|
+
*
|
|
33
|
+
* // Apply BPM-aware rules
|
|
34
|
+
* const finalDecisions = quantizer.applyRules(baseDecisions, {
|
|
35
|
+
* bpm: beatMap.quarterNoteBpm,
|
|
36
|
+
* quarterNoteInterval: beatMap.quarterNoteInterval,
|
|
37
|
+
* band: 'mid',
|
|
38
|
+
* transients,
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
import type { GridDecision } from './RhythmQuantizer.js';
|
|
43
|
+
import { RhythmQuantizer } from './RhythmQuantizer.js';
|
|
44
|
+
import type { TransientResult } from './TransientDetector.js';
|
|
45
|
+
import type { UnifiedBeatMap } from '../../types/BeatMap.js';
|
|
46
|
+
/**
|
|
47
|
+
* Context passed to tempo quantization rules.
|
|
48
|
+
*/
|
|
49
|
+
export interface TempoRuleContext {
|
|
50
|
+
/** Current BPM from the UnifiedBeatMap */
|
|
51
|
+
bpm: number;
|
|
52
|
+
/** Quarter note interval in seconds */
|
|
53
|
+
quarterNoteInterval: number;
|
|
54
|
+
/** Frequency band being processed */
|
|
55
|
+
band: 'low' | 'mid' | 'high';
|
|
56
|
+
/** Raw transients for this band (original timestamps, not quantized) */
|
|
57
|
+
transients: TransientResult[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A rule that can modify grid decisions based on tempo context.
|
|
61
|
+
*
|
|
62
|
+
* Rules are applied in order. Each rule's `apply()` receives the grid
|
|
63
|
+
* decisions (possibly already modified by earlier rules) and returns
|
|
64
|
+
* the (possibly modified) decisions.
|
|
65
|
+
*
|
|
66
|
+
* When overriding a grid decision, rules should:
|
|
67
|
+
* - Set `confidence: 1.0` (forced/authoritative)
|
|
68
|
+
* - Clear `straightAvgOffset` and `tripletAvgOffset`
|
|
69
|
+
*
|
|
70
|
+
* This matches the pattern used by `RhythmQuantizer.getBandGridType()` for
|
|
71
|
+
* forced grid decisions, and ensures that `collectGridDecisions()` in
|
|
72
|
+
* RhythmGenerator correctly prefers BPM-forced decisions over
|
|
73
|
+
* lower-confidence auto-detected ones.
|
|
74
|
+
*/
|
|
75
|
+
export interface TempoQuantizationRule {
|
|
76
|
+
/** Unique identifier for this rule (e.g., 'high-bpm-grid-restriction') */
|
|
77
|
+
id: string;
|
|
78
|
+
/** Human-readable description of what this rule does */
|
|
79
|
+
description: string;
|
|
80
|
+
/**
|
|
81
|
+
* Check if this rule applies given the BPM and context.
|
|
82
|
+
*
|
|
83
|
+
* @param bpm - Current BPM
|
|
84
|
+
* @param context - Tempo context with band, transients, and beat info
|
|
85
|
+
* @returns `true` if this rule should be applied
|
|
86
|
+
*/
|
|
87
|
+
applies(bpm: number, context: TempoRuleContext): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Modify grid decisions based on this rule.
|
|
90
|
+
*
|
|
91
|
+
* Receives the raw transients and original grid decisions so it can
|
|
92
|
+
* make informed decisions (e.g., check transient positions before
|
|
93
|
+
* overriding).
|
|
94
|
+
*
|
|
95
|
+
* @param decisions - Current grid decisions (may already be modified by prior rules)
|
|
96
|
+
* @param context - Tempo context with BPM, band, transients, and beat info
|
|
97
|
+
* @returns Modified grid decisions
|
|
98
|
+
*/
|
|
99
|
+
apply(decisions: GridDecision[], context: TempoRuleContext): GridDecision[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Configuration for the high BPM grid restriction rule.
|
|
103
|
+
*/
|
|
104
|
+
export interface HighBpmGridRestrictionConfig {
|
|
105
|
+
/**
|
|
106
|
+
* BPM threshold above which 16th notes are restricted to 8th notes.
|
|
107
|
+
* At this BPM, a 16th note is ~94ms — at the edge of playability.
|
|
108
|
+
* Default: 160.
|
|
109
|
+
*/
|
|
110
|
+
restrict16thBpm?: number;
|
|
111
|
+
/**
|
|
112
|
+
* BPM threshold above which triplets are also restricted to straight 8th.
|
|
113
|
+
* At this BPM, a triplet 8th is ~100ms — at the edge of playability.
|
|
114
|
+
* Default: 200.
|
|
115
|
+
*/
|
|
116
|
+
restrictTripletBpm?: number;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Restricts grid types at high BPMs for fundamental playability.
|
|
120
|
+
*
|
|
121
|
+
* At high tempos, 16th notes and triplets become unplayable:
|
|
122
|
+
* - 160 BPM = 93.75ms per 16th note
|
|
123
|
+
* - 200 BPM = 100ms per triplet 8th
|
|
124
|
+
*
|
|
125
|
+
* This rule modifies grid decisions (not quantization) so the quantization
|
|
126
|
+
* pass snaps transients from their original timestamps to the coarser grid.
|
|
127
|
+
*
|
|
128
|
+
* Only applies to `mid` and `high` bands — `low` is already forced to
|
|
129
|
+
* `straight_8th` by `RhythmQuantizer.getBandGridType()`.
|
|
130
|
+
*
|
|
131
|
+
* When overriding a grid decision:
|
|
132
|
+
* - Sets `confidence: 1.0` (forced/authoritative)
|
|
133
|
+
* - Clears `straightAvgOffset` and `tripletAvgOffset` (they no longer reflect
|
|
134
|
+
* the chosen grid)
|
|
135
|
+
*
|
|
136
|
+
* This matches the pattern used by `RhythmQuantizer.getBandGridType()` at
|
|
137
|
+
* line 714-719 for forced grid decisions.
|
|
138
|
+
*/
|
|
139
|
+
export declare class HighBpmGridRestrictionRule implements TempoQuantizationRule {
|
|
140
|
+
readonly id = "high-bpm-grid-restriction";
|
|
141
|
+
readonly description = "Restricts 16th notes and triplets to 8th notes at high BPMs for playability";
|
|
142
|
+
private readonly restrict16thBpm;
|
|
143
|
+
private readonly restrictTripletBpm;
|
|
144
|
+
constructor(config?: HighBpmGridRestrictionConfig);
|
|
145
|
+
applies(bpm: number, context: TempoRuleContext): boolean;
|
|
146
|
+
apply(decisions: GridDecision[], context: TempoRuleContext): GridDecision[];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Configuration for the TempoAwareQuantizer.
|
|
150
|
+
*/
|
|
151
|
+
export interface TempoAwareQuantizerConfig {
|
|
152
|
+
/**
|
|
153
|
+
* Ordered list of tempo quantization rules to apply.
|
|
154
|
+
* Rules are applied in array order — earlier rules' modifications
|
|
155
|
+
* are visible to later rules.
|
|
156
|
+
*/
|
|
157
|
+
rules: TempoQuantizationRule[];
|
|
158
|
+
/**
|
|
159
|
+
* Whether tempo-aware quantization is enabled (default: true).
|
|
160
|
+
* When disabled, `applyRules()` returns the decisions unchanged.
|
|
161
|
+
*/
|
|
162
|
+
enabled?: boolean;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Default configuration for tempo-aware quantization.
|
|
166
|
+
*
|
|
167
|
+
* Includes the `HighBpmGridRestrictionRule` with default thresholds:
|
|
168
|
+
* - 16th notes restricted at 160 BPM
|
|
169
|
+
* - Triplets restricted at 200 BPM
|
|
170
|
+
*/
|
|
171
|
+
export declare const DEFAULT_TEMPO_AWARE_CONFIG: TempoAwareQuantizerConfig;
|
|
172
|
+
/**
|
|
173
|
+
* Applies BPM-based rules to constrain the quantization grid.
|
|
174
|
+
*
|
|
175
|
+
* Plugs into the decide-then-quantize flow as a middleware layer between
|
|
176
|
+
* grid decision and quantization:
|
|
177
|
+
*
|
|
178
|
+
* ```
|
|
179
|
+
* RhythmQuantizer.decideGrids() → base grid decisions
|
|
180
|
+
* ↓
|
|
181
|
+
* TempoAwareQuantizer.decideGrids() → BPM-constrained decisions
|
|
182
|
+
* ↓
|
|
183
|
+
* RhythmQuantizer.quantizeToGrids() → quantize from original timestamps
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* Internally holds a `RhythmQuantizer` instance for the base grid decisions.
|
|
187
|
+
* Can also be used in standalone mode via `applyRules()` if you already have
|
|
188
|
+
* base grid decisions and just want to apply tempo rules.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* // Full flow: base decisions → rules → final decisions
|
|
193
|
+
* const tempoQuantizer = new TempoAwareQuantizer({
|
|
194
|
+
* rules: [new HighBpmGridRestrictionRule({ restrict16thBpm: 170 })],
|
|
195
|
+
* });
|
|
196
|
+
* const finalDecisions = tempoQuantizer.decideGrids(
|
|
197
|
+
* transients, unifiedBeatMap, 'mid'
|
|
198
|
+
* );
|
|
199
|
+
*
|
|
200
|
+
* // Standalone: apply rules to existing decisions
|
|
201
|
+
* const modified = tempoQuantizer.applyRules(baseDecisions, context);
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
export declare class TempoAwareQuantizer {
|
|
205
|
+
private readonly config;
|
|
206
|
+
private readonly rhythmQuantizer;
|
|
207
|
+
/**
|
|
208
|
+
* Create a new TempoAwareQuantizer.
|
|
209
|
+
*
|
|
210
|
+
* @param config - Configuration specifying rules and enabled state.
|
|
211
|
+
* Defaults to `DEFAULT_TEMPO_AWARE_CONFIG` (high BPM restriction rule).
|
|
212
|
+
* @param rhythmQuantizer - Optional RhythmQuantizer instance for base grid
|
|
213
|
+
* decisions. When omitted, a default RhythmQuantizer is created. Pass an
|
|
214
|
+
* existing instance to share configuration (e.g., intensity filtering).
|
|
215
|
+
*/
|
|
216
|
+
constructor(config?: TempoAwareQuantizerConfig, rhythmQuantizer?: RhythmQuantizer);
|
|
217
|
+
/**
|
|
218
|
+
* Get the current configuration.
|
|
219
|
+
*
|
|
220
|
+
* @returns A copy of the current configuration
|
|
221
|
+
*/
|
|
222
|
+
getConfig(): TempoAwareQuantizerConfig;
|
|
223
|
+
/**
|
|
224
|
+
* Decide grid types with BPM-aware rule application.
|
|
225
|
+
*
|
|
226
|
+
* Orchestrates the full flow:
|
|
227
|
+
* 1. Gets base grid decisions from `RhythmQuantizer.decideGrids()`
|
|
228
|
+
* 2. Builds a `TempoRuleContext` from the beat map and transients
|
|
229
|
+
* 3. Applies each applicable rule in order
|
|
230
|
+
* 4. Returns the final, BPM-constrained grid decisions
|
|
231
|
+
*
|
|
232
|
+
* The returned grid decisions are suitable for passing directly to
|
|
233
|
+
* `RhythmQuantizer.quantizeToGrids()` for the actual quantization pass.
|
|
234
|
+
*
|
|
235
|
+
* @param transients - Raw transients for this band (original timestamps)
|
|
236
|
+
* @param unifiedBeatMap - Unified beat map providing BPM and beat grid
|
|
237
|
+
* @param band - Frequency band being processed ('low', 'mid', or 'high')
|
|
238
|
+
* @returns Grid decisions with BPM-based constraints applied
|
|
239
|
+
*/
|
|
240
|
+
decideGrids(transients: TransientResult[], unifiedBeatMap: UnifiedBeatMap, band: 'low' | 'mid' | 'high'): GridDecision[];
|
|
241
|
+
/**
|
|
242
|
+
* Apply tempo-aware rules to existing grid decisions.
|
|
243
|
+
*
|
|
244
|
+
* Iterates through the configured rules in order. Each rule's `apply()`
|
|
245
|
+
* receives the decisions (possibly modified by earlier rules) and returns
|
|
246
|
+
* the modified decisions. This chaining allows rules to build on each other.
|
|
247
|
+
*
|
|
248
|
+
* When disabled (config `enabled: false`), returns decisions unchanged.
|
|
249
|
+
*
|
|
250
|
+
* @param decisions - Grid decisions from `RhythmQuantizer.decideGrids()`
|
|
251
|
+
* @param context - Tempo context with BPM, band, transients, and beat info
|
|
252
|
+
* @returns Modified grid decisions with tempo rules applied
|
|
253
|
+
*/
|
|
254
|
+
applyRules(decisions: GridDecision[], context: TempoRuleContext): GridDecision[];
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=TempoAwareQuantizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TempoAwareQuantizer.d.ts","sourceRoot":"","sources":["../../../../src/core/analysis/beat/TempoAwareQuantizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAM7D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,0CAA0C;IAC1C,GAAG,EAAE,MAAM,CAAC;IAEZ,uCAAuC;IACvC,mBAAmB,EAAE,MAAM,CAAC;IAE5B,qCAAqC;IACrC,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IAE7B,wEAAwE;IACxE,UAAU,EAAE,eAAe,EAAE,CAAC;CACjC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,qBAAq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