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 @@
|
|
|
1
|
+
{"version":3,"file":"DifficultyVariantGenerator.d.ts","sourceRoot":"","sources":["../../../../src/core/analysis/beat/DifficultyVariantGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAkB,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAWnE;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,cAAc,GAAG,iBAAiB,GAAG,cAAc,CAAC;AAE9F;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,gBAAgB,EAM5C,CAAC;AAmBF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,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KG;IACH,OAAO,CAAC,wBAAwB;IA4ChC;;;;;;;;;OASG;IACH,OAAO,CAAC,wBAAwB;IA0DhC;;;;;;;;;OASG;IACH,OAAO,CAAC,yBAAyB;IA8CjC;;OAEG;IACH,SAAS,IAAI,uBAAuB;IAIpC;;;;;;;;OAQG;IACH,OAAO,CAAC,wBAAwB;IA2BhC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,uBAAuB;CA4ClC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GrooveAnalyzer - A "groove meter" system for rhythm games
|
|
3
|
+
*
|
|
4
|
+
* Rewards consistency in timing feel rather than proximity to perfect center.
|
|
5
|
+
* Inspired by Devil May Cry's style meter - it's not about being mechanically
|
|
6
|
+
* perfect, it's about establishing and maintaining a consistent "pocket."
|
|
7
|
+
*
|
|
8
|
+
* Core Philosophy:
|
|
9
|
+
* - Hitting consistently 30ms behind the beat = GOOD (you're in a pocket)
|
|
10
|
+
* - Hitting perfectly on beat after establishing a behind-beat pocket = BAD (you broke the feel)
|
|
11
|
+
* - The meter charges when you maintain consistency to YOUR established pocket,
|
|
12
|
+
* not to absolute perfection
|
|
13
|
+
*/
|
|
14
|
+
import type { GrooveResult, GrooveState, GrooveAnalyzerOptions, BeatAccuracy, DifficultyPreset, GroovePenaltyConfig } from '../../types/BeatMap.js';
|
|
15
|
+
import type { GrooveStats } from '../../types/RhythmXP.js';
|
|
16
|
+
/**
|
|
17
|
+
* Analyzes groove/feel consistency in rhythm game play
|
|
18
|
+
*
|
|
19
|
+
* The GrooveAnalyzer tracks timing patterns and rewards players for maintaining
|
|
20
|
+
* a consistent "pocket" - whether that's ahead of the beat (push), behind (pull),
|
|
21
|
+
* or centered (neutral).
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const grooveAnalyzer = new GrooveAnalyzer();
|
|
26
|
+
*
|
|
27
|
+
* // On each button press during gameplay
|
|
28
|
+
* const buttonResult = beatStream.checkButtonPress(timestamp);
|
|
29
|
+
* const grooveResult = grooveAnalyzer.recordHit(buttonResult.offset, beatStream.getCurrentBpm());
|
|
30
|
+
*
|
|
31
|
+
* // When user misses a beat (doesn't press)
|
|
32
|
+
* grooveAnalyzer.recordMiss();
|
|
33
|
+
*
|
|
34
|
+
* // Read the groove state for UI display
|
|
35
|
+
* if (grooveResult.pocketDirection !== 'neutral') {
|
|
36
|
+
* console.log(`${grooveResult.pocketDirection} groove: ${grooveResult.hotness}%`);
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class GrooveAnalyzer {
|
|
41
|
+
private options;
|
|
42
|
+
private recentOffsets;
|
|
43
|
+
private establishedOffset;
|
|
44
|
+
private pocketDirection;
|
|
45
|
+
private hotness;
|
|
46
|
+
private streakLength;
|
|
47
|
+
private hitCount;
|
|
48
|
+
private lastBpm;
|
|
49
|
+
private grooveStartTime;
|
|
50
|
+
private maxHotness;
|
|
51
|
+
private maxGrooveStreak;
|
|
52
|
+
private hotnessSamples;
|
|
53
|
+
private grooveHitCount;
|
|
54
|
+
private previousDirection;
|
|
55
|
+
/**
|
|
56
|
+
* Create a new GrooveAnalyzer instance
|
|
57
|
+
*
|
|
58
|
+
* @param options - Optional configuration to customize groove analysis behavior
|
|
59
|
+
*/
|
|
60
|
+
constructor(options?: Partial<GrooveAnalyzerOptions>);
|
|
61
|
+
/**
|
|
62
|
+
* Set difficulty level for groove penalties.
|
|
63
|
+
*
|
|
64
|
+
* Updates the penalty values (hotnessLossOnMiss, hotnessLossOnBreak) based on
|
|
65
|
+
* a difficulty preset. This allows dynamic difficulty changes during gameplay.
|
|
66
|
+
*
|
|
67
|
+
* @param options - Difficulty configuration
|
|
68
|
+
* @param options.preset - The difficulty preset ('easy', 'medium', 'hard', or 'custom')
|
|
69
|
+
* @param options.customPenalties - Custom penalties to use when preset is 'custom'
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* // Set to hard difficulty
|
|
74
|
+
* grooveAnalyzer.setDifficulty({ preset: 'hard' });
|
|
75
|
+
*
|
|
76
|
+
* // Set to custom difficulty with specific penalty values
|
|
77
|
+
* grooveAnalyzer.setDifficulty({
|
|
78
|
+
* preset: 'custom',
|
|
79
|
+
* customPenalties: { hotnessLossOnMiss: 30, hotnessLossOnBreak: 25 }
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
setDifficulty(options: {
|
|
84
|
+
preset: DifficultyPreset;
|
|
85
|
+
customPenalties?: Partial<GroovePenaltyConfig>;
|
|
86
|
+
}): void;
|
|
87
|
+
/**
|
|
88
|
+
* Record a button press hit and get groove analysis
|
|
89
|
+
*
|
|
90
|
+
* This is the main method called after each button press during gameplay.
|
|
91
|
+
* It updates the pocket tracking, calculates consistency, and adjusts hotness.
|
|
92
|
+
*
|
|
93
|
+
* IMPORTANT: When accuracy is 'miss' or 'wrongKey', this method will:
|
|
94
|
+
* - NOT update the pocket tracking (the offset is not valid for groove)
|
|
95
|
+
* - Decrease hotness by hotnessLossOnMiss
|
|
96
|
+
* - Reset the streak
|
|
97
|
+
* - Return inPocket: false
|
|
98
|
+
*
|
|
99
|
+
* This ensures that missed beats and wrong key presses hurt the groove score
|
|
100
|
+
* rather than contributing to it.
|
|
101
|
+
*
|
|
102
|
+
* @param offset - Timing offset in seconds (negative = early/push, positive = late/pull)
|
|
103
|
+
* @param bpm - Current BPM of the song (used for BPM-aware window calculation)
|
|
104
|
+
* @param currentTime - Current audio time for groove duration tracking (use buttonResult.matchedBeat.time)
|
|
105
|
+
* @param accuracy - Accuracy level from BeatStream.checkButtonPress(). When 'miss' or 'wrongKey', treats as a miss.
|
|
106
|
+
* @returns GrooveResult with current groove state and hit analysis
|
|
107
|
+
*/
|
|
108
|
+
recordHit(offset: number, bpm: number, currentTime?: number, accuracy?: BeatAccuracy): GrooveResult;
|
|
109
|
+
/**
|
|
110
|
+
* Record a missed beat (user didn't press)
|
|
111
|
+
*
|
|
112
|
+
* Reduces hotness by configured miss penalty (default: 10).
|
|
113
|
+
* Resets streak but does NOT clear the established pocket.
|
|
114
|
+
* Captures endedGrooveStats if the miss ends the groove (hotness drops to 0).
|
|
115
|
+
*
|
|
116
|
+
* @param currentTime - Current audio time for groove duration tracking (optional)
|
|
117
|
+
* @returns GrooveResult representing current state after miss
|
|
118
|
+
*/
|
|
119
|
+
recordMiss(currentTime?: number): GrooveResult;
|
|
120
|
+
/**
|
|
121
|
+
* Get current groove analyzer state snapshot
|
|
122
|
+
*
|
|
123
|
+
* @returns GrooveState with all current values including lifetime statistics
|
|
124
|
+
*/
|
|
125
|
+
getState(): GrooveState;
|
|
126
|
+
/**
|
|
127
|
+
* Reset the analyzer to initial state
|
|
128
|
+
*
|
|
129
|
+
* Clears all tracking data including established pocket,
|
|
130
|
+
* hotness, streak, and hit count.
|
|
131
|
+
*/
|
|
132
|
+
reset(): void;
|
|
133
|
+
/**
|
|
134
|
+
* Get groove statistics for end bonus calculation.
|
|
135
|
+
* Call this when hotness drops to 0 or at session end.
|
|
136
|
+
*
|
|
137
|
+
* @param currentAudioTime - Current audio time for duration calculation (defaults to hitCount-based estimation)
|
|
138
|
+
* @returns GrooveStats or null if no groove was active
|
|
139
|
+
*/
|
|
140
|
+
getGrooveStats(currentAudioTime?: number): GrooveStats | null;
|
|
141
|
+
/**
|
|
142
|
+
* Reset groove lifetime tracking.
|
|
143
|
+
* Called internally when hotness drops to 0 or direction changes.
|
|
144
|
+
* Can also be called externally to force a reset (e.g., at session end).
|
|
145
|
+
*/
|
|
146
|
+
resetGrooveStats(): void;
|
|
147
|
+
/**
|
|
148
|
+
* Check if a pocket has been established
|
|
149
|
+
*
|
|
150
|
+
* A pocket is established after minHitsForPocket consistent hits.
|
|
151
|
+
*
|
|
152
|
+
* @returns true if pocket is established
|
|
153
|
+
*/
|
|
154
|
+
private hasPocket;
|
|
155
|
+
/**
|
|
156
|
+
* Calculate the current pocket window size
|
|
157
|
+
*
|
|
158
|
+
* Uses tier-based window sizes with BPM scaling.
|
|
159
|
+
* Window shrinks as you climb tiers (D → C → B → A → S → SS).
|
|
160
|
+
*
|
|
161
|
+
* @param bpm - Current BPM
|
|
162
|
+
* @returns Pocket window size in seconds
|
|
163
|
+
*/
|
|
164
|
+
private calculatePocketWindow;
|
|
165
|
+
/**
|
|
166
|
+
* Update the running average of recent offsets
|
|
167
|
+
*
|
|
168
|
+
* Uses simple moving average of recent hits within the averaging window.
|
|
169
|
+
*/
|
|
170
|
+
private updateRunningAverage;
|
|
171
|
+
/**
|
|
172
|
+
* Calculate consistency score using quadratic falloff
|
|
173
|
+
*
|
|
174
|
+
* Returns 1.0 at pocket center, 0.0 at or beyond window edge.
|
|
175
|
+
* Uses quadratic falloff for more forgiving feel near center.
|
|
176
|
+
*
|
|
177
|
+
* @param distanceFromPocket - Absolute distance from pocket center in seconds
|
|
178
|
+
* @param pocketWindow - Current pocket window size in seconds
|
|
179
|
+
* @returns Consistency score (0.0 - 1.0)
|
|
180
|
+
*/
|
|
181
|
+
private calculateConsistency;
|
|
182
|
+
/**
|
|
183
|
+
* Determine groove direction from offset
|
|
184
|
+
*
|
|
185
|
+
* Uses configurable dead zone (±10ms by default = 20ms total) for neutral classification.
|
|
186
|
+
*
|
|
187
|
+
* @param offset - Timing offset in seconds
|
|
188
|
+
* @returns GrooveDirection ('push', 'pull', or 'neutral')
|
|
189
|
+
*/
|
|
190
|
+
private determineDirection;
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=GrooveAnalyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GrooveAnalyzer.d.ts","sourceRoot":"","sources":["../../../../src/core/analysis/beat/GrooveAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAER,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,E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B7D;;;;OAIG;IACH,gBAAgB,IAAI,IAAI;IAQxB;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IAIjB;;;;;;;;OAQG;IACH,OAAO,CAAC,qBAAqB;IAgB7B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAK5B;;;;;;;;;OASG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;CAI7B"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Onset Strength Envelope (OSE) Calculator
|
|
3
|
+
*
|
|
4
|
+
* Implements the perceptual onset strength envelope extraction as described in
|
|
5
|
+
* Ellis, D.P.W. (2007) "Beat Tracking by Dynamic Programming"
|
|
6
|
+
*
|
|
7
|
+
* The onset strength envelope is a time series that peaks at moments where
|
|
8
|
+
* new sonic events (notes, drum hits, etc.) are likely to occur. This is
|
|
9
|
+
* the foundation for the Ellis beat tracking algorithm.
|
|
10
|
+
*
|
|
11
|
+
* Reference: https://www.ee.columbia.edu/~dpwe/pubs/Ellis07-beattrack.pdf
|
|
12
|
+
*/
|
|
13
|
+
import type { OSEConfig } from '../../types/BeatMap.js';
|
|
14
|
+
/**
|
|
15
|
+
* Result of onset strength envelope calculation
|
|
16
|
+
*/
|
|
17
|
+
export interface OSEResult {
|
|
18
|
+
/** Onset strength envelope values (one per frame) */
|
|
19
|
+
envelope: Float32Array;
|
|
20
|
+
/** Number of frames */
|
|
21
|
+
numFrames: number;
|
|
22
|
+
/** Hop size in seconds */
|
|
23
|
+
hopSizeSeconds: number;
|
|
24
|
+
/** Effective sample rate after resampling */
|
|
25
|
+
effectiveSampleRate: number;
|
|
26
|
+
/** Original audio duration in seconds */
|
|
27
|
+
duration: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Onset Strength Envelope Calculator
|
|
31
|
+
*
|
|
32
|
+
* Calculates the perceptual onset strength envelope from audio,
|
|
33
|
+
* following the Ellis 2007 algorithm.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const ose = new OnsetStrengthEnvelope({
|
|
38
|
+
* targetSampleRate: 8000,
|
|
39
|
+
* melBands: 40,
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* const result = ose.calculate(audioBuffer);
|
|
43
|
+
* // result.envelope contains the onset strength values
|
|
44
|
+
* // Peaks in the envelope correspond to likely beat positions
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare class OnsetStrengthEnvelope {
|
|
48
|
+
private config;
|
|
49
|
+
/**
|
|
50
|
+
* Create a new Onset Strength Envelope calculator
|
|
51
|
+
*
|
|
52
|
+
* ## Configuration Options
|
|
53
|
+
*
|
|
54
|
+
* OSE parameters can be configured using either mode-based configs or direct numeric values.
|
|
55
|
+
*
|
|
56
|
+
* **Precedence**: When both mode and direct value are provided, mode takes precedence.
|
|
57
|
+
* For example, if both `hopSizeMode` and `hopSizeMs` are set, `hopSizeMode` wins.
|
|
58
|
+
*
|
|
59
|
+
* @param config - Configuration options (all optional, defaults provided)
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* // Using mode-based configuration (recommended)
|
|
64
|
+
* const ose = new OnsetStrengthEnvelope({
|
|
65
|
+
* hopSizeMode: { mode: 'standard' }, // 4ms (Ellis 2007 paper spec)
|
|
66
|
+
* melBandsMode: { mode: 'detailed' }, // 64 bands
|
|
67
|
+
* gaussianSmoothMode: { mode: 'smooth' } // 40ms
|
|
68
|
+
* });
|
|
69
|
+
*
|
|
70
|
+
* // Using direct numeric values (backward compatible)
|
|
71
|
+
* const ose = new OnsetStrengthEnvelope({
|
|
72
|
+
* hopSizeMs: 4,
|
|
73
|
+
* melBands: 40,
|
|
74
|
+
* gaussianSmoothMs: 20
|
|
75
|
+
* });
|
|
76
|
+
*
|
|
77
|
+
* // Mixed - mode takes precedence (hopSizeMs is ignored)
|
|
78
|
+
* const ose = new OnsetStrengthEnvelope({
|
|
79
|
+
* hopSizeMode: { mode: 'hq' }, // Uses 2ms
|
|
80
|
+
* hopSizeMs: 10 // Ignored because hopSizeMode is set
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
constructor(config?: OSEConfig);
|
|
85
|
+
/**
|
|
86
|
+
* Calculate the onset strength envelope from an audio buffer
|
|
87
|
+
*
|
|
88
|
+
* Implements the Ellis algorithm:
|
|
89
|
+
* 1. Resample to 8kHz (reduces computation, focuses on beat-relevant frequencies)
|
|
90
|
+
* 2. Compute Mel spectrogram using STFT
|
|
91
|
+
* 3. Convert to dB, take first-order difference, half-wave rectify
|
|
92
|
+
* 4. Sum across Mel bands to get onset strength
|
|
93
|
+
* 5. Apply high-pass filter (removes DC)
|
|
94
|
+
* 6. Smooth with Gaussian window
|
|
95
|
+
* 7. Normalize by standard deviation (critical for DP balance)
|
|
96
|
+
*
|
|
97
|
+
* @param audioBuffer - Web Audio API AudioBuffer to analyze
|
|
98
|
+
* @returns Onset strength envelope result
|
|
99
|
+
*/
|
|
100
|
+
calculate(audioBuffer: AudioBuffer): OSEResult;
|
|
101
|
+
/**
|
|
102
|
+
* Get the current configuration
|
|
103
|
+
*
|
|
104
|
+
* @returns The current configuration
|
|
105
|
+
*/
|
|
106
|
+
getConfig(): Required<OSEConfig>;
|
|
107
|
+
/**
|
|
108
|
+
* Find peaks in the onset strength envelope
|
|
109
|
+
* Useful for debugging and visualization
|
|
110
|
+
*
|
|
111
|
+
* @param envelope - Onset strength envelope
|
|
112
|
+
* @param threshold - Minimum peak height (default: 0.5)
|
|
113
|
+
* @returns Array of frame indices where peaks occur
|
|
114
|
+
*/
|
|
115
|
+
findPeaks(envelope: Float32Array, threshold?: number): number[];
|
|
116
|
+
/**
|
|
117
|
+
* Convert frame index to time in seconds
|
|
118
|
+
*
|
|
119
|
+
* @param frameIndex - Frame index
|
|
120
|
+
* @param hopSizeSeconds - Hop size in seconds
|
|
121
|
+
* @returns Time in seconds
|
|
122
|
+
*/
|
|
123
|
+
frameToTime(frameIndex: number, hopSizeSeconds: number): number;
|
|
124
|
+
/**
|
|
125
|
+
* Convert time in seconds to frame index
|
|
126
|
+
*
|
|
127
|
+
* @param time - Time in seconds
|
|
128
|
+
* @param hopSizeSeconds - Hop size in seconds
|
|
129
|
+
* @returns Frame index (rounded)
|
|
130
|
+
*/
|
|
131
|
+
timeToFrame(time: number, hopSizeSeconds: number): number;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=OnsetStrengthEnvelope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnsetStrengthEnvelope.d.ts","sourceRoot":"","sources":["../../../../src/core/analysis/beat/OnsetStrengthEnvelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACR,SAAS,EAIZ,MAAM,wBAAwB,CAAC;AA8BhC;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,qDAAqD;IACrD,QAAQ,EAAE,YAAY,CAAC;IACvB,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,MAAM,CAAsB;IAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;gBACS,MAAM,GAAE,SAAc;IA0BlC;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS;IAmH9C;;;;OAIG;IACH,SAAS,IAAI,QAAQ,CAAC,SAAS,CAAC;IAIhC;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,GAAE,MAAY,GAAG,MAAM,EAAE;IAepE;;;;;;OAMG;IACH,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM;IAI/D;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM;CAG5D"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phrase Analyzer for Procedural Rhythm Generation
|
|
3
|
+
*
|
|
4
|
+
* Analyzes quantized rhythm streams to detect duplicate multi-beat phrases.
|
|
5
|
+
* These detected phrases form a song-specific pattern library used for:
|
|
6
|
+
* - Density enhancement (prefer inserting detected patterns over interpolation)
|
|
7
|
+
* - Pitch detection integration (via sourceBand and timestamps)
|
|
8
|
+
*
|
|
9
|
+
* Part of the Procedural Rhythm Generation pipeline - Phase 2.1
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Basic usage - analyze phrases in quantized streams
|
|
14
|
+
* const analyzer = new PhraseAnalyzer();
|
|
15
|
+
* const result = analyzer.analyze(quantizedBandStreams);
|
|
16
|
+
*
|
|
17
|
+
* // Access all detected phrases
|
|
18
|
+
* console.log(`Found ${result.phrases.length} unique phrases`);
|
|
19
|
+
*
|
|
20
|
+
* // Get the most significant phrases (best patterns to reuse)
|
|
21
|
+
* for (const phrase of result.mostSignificantPhrases) {
|
|
22
|
+
* console.log(`Phrase: ${phrase.sizeInBeats} beats, ${phrase.occurrences.length} occurrences`);
|
|
23
|
+
* console.log(` Source band: ${phrase.sourceBand}`);
|
|
24
|
+
* console.log(` Significance: ${phrase.significance.toFixed(2)}`);
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* // Access phrases by band for targeted analysis
|
|
28
|
+
* const lowBandPhrases = result.phrasesByBand.get('low');
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
import type { GeneratedBeat, GeneratedRhythmMap } from './RhythmQuantizer.js';
|
|
32
|
+
/**
|
|
33
|
+
* A single occurrence of a rhythmic phrase within the song
|
|
34
|
+
*/
|
|
35
|
+
export interface PhraseOccurrence {
|
|
36
|
+
/** Index into UnifiedBeatMap.beats[] where this occurrence starts */
|
|
37
|
+
beatIndex: number;
|
|
38
|
+
/** Start time in seconds (for pitch analysis reference) */
|
|
39
|
+
startTimestamp: number;
|
|
40
|
+
/** End time in seconds (for pitch analysis reference) */
|
|
41
|
+
endTimestamp: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A detected rhythmic phrase with all its occurrences
|
|
45
|
+
*/
|
|
46
|
+
export interface RhythmicPhrase {
|
|
47
|
+
/** Unique identifier for this phrase (hash of pattern) */
|
|
48
|
+
id: string;
|
|
49
|
+
/** The actual rhythm pattern (array of GeneratedBeat, relative to phrase start) */
|
|
50
|
+
pattern: GeneratedBeat[];
|
|
51
|
+
/** Size in beats: 1, 2, 4, or 8 */
|
|
52
|
+
sizeInBeats: number;
|
|
53
|
+
/** Which frequency band this phrase was detected in */
|
|
54
|
+
sourceBand: 'low' | 'mid' | 'high';
|
|
55
|
+
/** All locations where this pattern occurs */
|
|
56
|
+
occurrences: PhraseOccurrence[];
|
|
57
|
+
/** Weighted significance score (larger size + more occurrences = higher) */
|
|
58
|
+
significance: number;
|
|
59
|
+
/** Whether the pattern has rhythmic variation (excludes straight quarters/eighths) */
|
|
60
|
+
hasVariation: boolean;
|
|
61
|
+
/** Whether this phrase can be inserted elsewhere for density enhancement */
|
|
62
|
+
availableForReuse: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Result of phrase analysis for a single band
|
|
66
|
+
*/
|
|
67
|
+
export interface BandPhraseAnalysis {
|
|
68
|
+
/** Band name */
|
|
69
|
+
band: 'low' | 'mid' | 'high';
|
|
70
|
+
/** All phrases detected in this band */
|
|
71
|
+
phrases: RhythmicPhrase[];
|
|
72
|
+
/** Phrases grouped by size (1, 2, 4, 8 beats) */
|
|
73
|
+
phrasesBySize: Map<number, RhythmicPhrase[]>;
|
|
74
|
+
/** Phrases that have variation (excludes straight quarters/eighths) */
|
|
75
|
+
phrasesWithVariation: RhythmicPhrase[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Complete phrase analysis result for all bands
|
|
79
|
+
*/
|
|
80
|
+
export interface PhraseAnalysisResult {
|
|
81
|
+
/** All phrases across all bands */
|
|
82
|
+
phrases: RhythmicPhrase[];
|
|
83
|
+
/** Phrases grouped by source band */
|
|
84
|
+
phrasesByBand: Map<'low' | 'mid' | 'high', RhythmicPhrase[]>;
|
|
85
|
+
/** Top N phrases by significance score */
|
|
86
|
+
mostSignificantPhrases: RhythmicPhrase[];
|
|
87
|
+
/** Phrases grouped by size (1, 2, 4, 8 beats) */
|
|
88
|
+
phrasesBySize: Map<number, RhythmicPhrase[]>;
|
|
89
|
+
/** Phrases available for density enhancement (hasVariation && availableForReuse) */
|
|
90
|
+
patternLibrary: RhythmicPhrase[];
|
|
91
|
+
/** Per-band analysis details */
|
|
92
|
+
bandAnalysis: {
|
|
93
|
+
low: BandPhraseAnalysis;
|
|
94
|
+
mid: BandPhraseAnalysis;
|
|
95
|
+
high: BandPhraseAnalysis;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Configuration for phrase analysis
|
|
100
|
+
*/
|
|
101
|
+
export interface PhraseAnalyzerConfig {
|
|
102
|
+
/** Phrase sizes to check (in beats). Default: [1, 2, 4, 8] */
|
|
103
|
+
phraseSizes: number[];
|
|
104
|
+
/** Minimum number of occurrences for a phrase to be considered significant. Default: 3 */
|
|
105
|
+
minOccurrences: number;
|
|
106
|
+
/** Number of top significant phrases to include in mostSignificantPhrases. Default: 10 */
|
|
107
|
+
topSignificantCount: number;
|
|
108
|
+
/** Whether to include phrases without variation in results. Default: false */
|
|
109
|
+
includePhrasesWithoutVariation: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Minimum number of notes a phrase pattern must contain.
|
|
112
|
+
* Can be a static number or a function of phrase size in beats.
|
|
113
|
+
* Default: (sizeInBeats) => 1 + sizeInBeats
|
|
114
|
+
*
|
|
115
|
+
* Examples:
|
|
116
|
+
* - 1-beat phrase needs ≥2 notes
|
|
117
|
+
* - 2-beat phrase needs ≥3 notes
|
|
118
|
+
* - 4-beat phrase needs ≥5 notes
|
|
119
|
+
*/
|
|
120
|
+
minNotesPerPhrase?: number | ((sizeInBeats: number) => number);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Analyzes quantized rhythm streams to detect duplicate multi-beat phrases.
|
|
124
|
+
*
|
|
125
|
+
* ## Algorithm Overview
|
|
126
|
+
*
|
|
127
|
+
* 1. For each band (low/mid/high) and each phrase size (1/2/4/8 beats):
|
|
128
|
+
* - Extract all phrases of that size from the stream
|
|
129
|
+
* - Normalize the phrases (reset beatIndex to 0, preserve gridPosition)
|
|
130
|
+
* - Create a hash of each normalized pattern
|
|
131
|
+
* - Group identical patterns by hash
|
|
132
|
+
*
|
|
133
|
+
* 2. Filter out uninteresting patterns:
|
|
134
|
+
* - Straight quarter notes (single note at gridPosition 0, straight_16th)
|
|
135
|
+
* - Straight eighth notes (notes at gridPosition 0 and 2 only, straight_16th)
|
|
136
|
+
*
|
|
137
|
+
* 3. Calculate significance scores:
|
|
138
|
+
* - Larger phrases are more significant (8-beat > 1-beat)
|
|
139
|
+
* - More occurrences increases significance
|
|
140
|
+
* - Significance = sizeWeight * occurrenceWeight
|
|
141
|
+
*
|
|
142
|
+
* 4. Build pattern library for density enhancement
|
|
143
|
+
*
|
|
144
|
+
* ## Usage
|
|
145
|
+
*
|
|
146
|
+
* ```typescript
|
|
147
|
+
* const analyzer = new PhraseAnalyzer();
|
|
148
|
+
* const result = analyzer.analyze(quantizedStreams);
|
|
149
|
+
*
|
|
150
|
+
* // Access pattern library for density enhancement
|
|
151
|
+
* const patterns = result.patternLibrary;
|
|
152
|
+
*
|
|
153
|
+
* // Find phrases for a specific band
|
|
154
|
+
* const lowBandPhrases = result.phrasesByBand.get('low');
|
|
155
|
+
*
|
|
156
|
+
* // Get top significant phrases
|
|
157
|
+
* const topPhrases = result.mostSignificantPhrases;
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export declare class PhraseAnalyzer {
|
|
161
|
+
private config;
|
|
162
|
+
constructor(config?: Partial<PhraseAnalyzerConfig>);
|
|
163
|
+
/**
|
|
164
|
+
* Analyze quantized band streams for rhythmic phrases
|
|
165
|
+
*
|
|
166
|
+
* @param streams - Quantized band streams from RhythmQuantizer
|
|
167
|
+
* @returns Complete phrase analysis result
|
|
168
|
+
*/
|
|
169
|
+
analyze(streams: {
|
|
170
|
+
low: GeneratedRhythmMap;
|
|
171
|
+
mid: GeneratedRhythmMap;
|
|
172
|
+
high: GeneratedRhythmMap;
|
|
173
|
+
}): PhraseAnalysisResult;
|
|
174
|
+
/**
|
|
175
|
+
* Resolve the minimum notes required for a given phrase size
|
|
176
|
+
*/
|
|
177
|
+
private getMinNotes;
|
|
178
|
+
/**
|
|
179
|
+
* Analyze a single band for phrases
|
|
180
|
+
*/
|
|
181
|
+
private analyzeBand;
|
|
182
|
+
/**
|
|
183
|
+
* Extract a phrase candidate starting at a given beat index
|
|
184
|
+
*/
|
|
185
|
+
private extractPhraseCandidate;
|
|
186
|
+
/**
|
|
187
|
+
* Create a hash of a pattern for comparison
|
|
188
|
+
*
|
|
189
|
+
* The hash includes:
|
|
190
|
+
* - Beat indices (relative to phrase start)
|
|
191
|
+
* - Grid positions
|
|
192
|
+
* - Grid types
|
|
193
|
+
*
|
|
194
|
+
* NOTE: Intensity is deliberately excluded from the hash. Identical rhythms
|
|
195
|
+
* with different intensities should be recognized as the same pattern.
|
|
196
|
+
* Intensity varies naturally between occurrences of the same rhythm.
|
|
197
|
+
*/
|
|
198
|
+
private hashPattern;
|
|
199
|
+
/**
|
|
200
|
+
* Check if a pattern has rhythmic variation
|
|
201
|
+
*
|
|
202
|
+
* Uninteresting patterns (excluded):
|
|
203
|
+
* - Straight quarter notes: single note at beat 0, gridPosition 0, straight_16th
|
|
204
|
+
* - Straight eighth notes: notes at gridPosition 0 and 2 only, straight_16th
|
|
205
|
+
*
|
|
206
|
+
* Interesting patterns (included):
|
|
207
|
+
* - Any pattern with gridPosition 1 or 3 (16th note subdivisions)
|
|
208
|
+
* - Any pattern with triplet grid
|
|
209
|
+
* - Any pattern with varying intensity
|
|
210
|
+
* - Any syncopated pattern
|
|
211
|
+
*/
|
|
212
|
+
private hasPatternVariation;
|
|
213
|
+
/**
|
|
214
|
+
* Count how many beats have exactly the specified note count
|
|
215
|
+
*/
|
|
216
|
+
private countBeatsWithNoteCount;
|
|
217
|
+
/**
|
|
218
|
+
* Calculate significance score for a phrase
|
|
219
|
+
*
|
|
220
|
+
* Significance is weighted by:
|
|
221
|
+
* - Size: Larger phrases are more significant (8-beat > 1-beat)
|
|
222
|
+
* - Occurrences: More occurrences increases significance
|
|
223
|
+
*
|
|
224
|
+
* Formula: significance = sizeWeight * occurrenceWeight
|
|
225
|
+
* - sizeWeight = sizeInBeats (linear weight)
|
|
226
|
+
* - occurrenceWeight = log2(occurrences) (logarithmic to avoid over-weighting)
|
|
227
|
+
*/
|
|
228
|
+
private calculateSignificance;
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=PhraseAnalyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PhraseAnalyzer.d.ts","sourceRoot":"","sources":["../../../../src/core/analysis/beat/PhraseAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAY,MAAM,sBAAsB,CAAC;AAMxF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAElB,2DAA2D;IAC3D,cAAc,EAAE,MAAM,CAAC;IAEvB,yDAAyD;IAC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