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,477 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beat Interpolator
|
|
3
|
+
*
|
|
4
|
+
* Post-processing pass that runs AFTER BeatMap generation to fill gaps
|
|
5
|
+
* where detected beats are missing. Uses dense section priority to determine
|
|
6
|
+
* the quarter note interval, then generates interpolated beats using the
|
|
7
|
+
* Adaptive Phase-Locked Grid algorithm.
|
|
8
|
+
*
|
|
9
|
+
* The Adaptive Phase-Locked approach uses anchor points (detected beats) to
|
|
10
|
+
* track tempo drift and maintain phase alignment throughout the track.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const interpolator = new BeatInterpolator({
|
|
15
|
+
* minAnchorConfidence: 0.3,
|
|
16
|
+
* gridSnapTolerance: 0.05,
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* const interpolatedBeatMap = interpolator.interpolate(beatMap);
|
|
20
|
+
*
|
|
21
|
+
* // Access original detected beats
|
|
22
|
+
* console.log(interpolatedBeatMap.detectedBeats.length);
|
|
23
|
+
*
|
|
24
|
+
* // Access merged beats (interpolated + detected override)
|
|
25
|
+
* console.log(interpolatedBeatMap.mergedBeats.length);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
import type { BeatMap, BeatInterpolationOptions, InterpolatedBeatMap } from '../../types/BeatMap.js';
|
|
29
|
+
/**
|
|
30
|
+
* Beat Interpolator
|
|
31
|
+
*
|
|
32
|
+
* Generates interpolated beats to fill gaps in detected beat maps using
|
|
33
|
+
* the Pace + Anchors model with dense section priority.
|
|
34
|
+
*/
|
|
35
|
+
export declare class BeatInterpolator {
|
|
36
|
+
private options;
|
|
37
|
+
/**
|
|
38
|
+
* Create a new BeatInterpolator
|
|
39
|
+
*
|
|
40
|
+
* @param options - Configuration options (all optional, defaults provided)
|
|
41
|
+
*/
|
|
42
|
+
constructor(options?: BeatInterpolationOptions);
|
|
43
|
+
/**
|
|
44
|
+
* Get the current configuration
|
|
45
|
+
*
|
|
46
|
+
* @returns The current configuration
|
|
47
|
+
*/
|
|
48
|
+
getConfig(): Required<BeatInterpolationOptions>;
|
|
49
|
+
/**
|
|
50
|
+
* Interpolate beats in a BeatMap
|
|
51
|
+
*
|
|
52
|
+
* Main entry point that orchestrates the interpolation process:
|
|
53
|
+
* 1. Detect quarter note interval using dense section priority
|
|
54
|
+
* 2. Analyze gaps between detected beats
|
|
55
|
+
* 3. Generate beat grid using selected algorithm
|
|
56
|
+
* 4. Merge detected beats with interpolated beats
|
|
57
|
+
*
|
|
58
|
+
* @param beatMap - The beat map to interpolate
|
|
59
|
+
* @returns Interpolated beat map with two output streams
|
|
60
|
+
*/
|
|
61
|
+
interpolate(beatMap: BeatMap): InterpolatedBeatMap;
|
|
62
|
+
/**
|
|
63
|
+
* Detect quarter note interval using dense section priority
|
|
64
|
+
*
|
|
65
|
+
* Algorithm:
|
|
66
|
+
* 1. Identify dense sections (consecutive beats at similar intervals)
|
|
67
|
+
* 2. Build weighted histogram of intervals
|
|
68
|
+
* 3. Find primary peak (most weighted interval = quarter note)
|
|
69
|
+
* 4. Calculate confidence based on peak prominence and dense section contribution
|
|
70
|
+
*
|
|
71
|
+
* @param beats - Detected beats to analyze
|
|
72
|
+
* @returns Quarter note detection result
|
|
73
|
+
*/
|
|
74
|
+
private detectQuarterNote;
|
|
75
|
+
/**
|
|
76
|
+
* Identify dense sections in the beat sequence
|
|
77
|
+
*
|
|
78
|
+
* A dense section is a sequence of consecutive beats (3+ by default)
|
|
79
|
+
* where the intervals between beats are consistent (low variance).
|
|
80
|
+
*
|
|
81
|
+
* @param beats - Beats to analyze
|
|
82
|
+
* @returns Array of dense sections
|
|
83
|
+
*/
|
|
84
|
+
private identifyDenseSections;
|
|
85
|
+
/**
|
|
86
|
+
* Identify tempo clusters from dense sections
|
|
87
|
+
*
|
|
88
|
+
* Builds on identifyDenseSections() output to group dense sections by tempo
|
|
89
|
+
* similarity and create verified tempo clusters for multi-tempo detection.
|
|
90
|
+
*
|
|
91
|
+
* Algorithm:
|
|
92
|
+
* 1. Convert dense sections to cluster candidates with BPM
|
|
93
|
+
* 2. Group sections by tempo similarity (within tempoSectionThreshold)
|
|
94
|
+
* 3. Merge adjacent sections with similar tempo into clusters
|
|
95
|
+
* 4. Filter clusters by minClusterBeats requirement
|
|
96
|
+
* 5. Return only verified clusters
|
|
97
|
+
*
|
|
98
|
+
* @param beats - Detected beats to analyze
|
|
99
|
+
* @returns Array of verified tempo clusters
|
|
100
|
+
*/
|
|
101
|
+
private identifyTempoClusters;
|
|
102
|
+
/**
|
|
103
|
+
* Find conflicting tempo clusters
|
|
104
|
+
*
|
|
105
|
+
* Checks if any two verified clusters have tempos that differ by more than
|
|
106
|
+
* the tempoSectionThreshold. Filters out octave-related tempos (e.g., 60 BPM
|
|
107
|
+
* vs 120 BPM are considered the same tempo).
|
|
108
|
+
*
|
|
109
|
+
* @param clusters - Verified tempo clusters to analyze
|
|
110
|
+
* @returns Array of conflicting cluster pairs, or null if no conflicts
|
|
111
|
+
*/
|
|
112
|
+
private findConflictingClusters;
|
|
113
|
+
/**
|
|
114
|
+
* Check if two tempos are octave multiples
|
|
115
|
+
*
|
|
116
|
+
* Used to filter out false "conflicts" where two clusters are actually
|
|
117
|
+
* at the same tempo but detected at different octaves (e.g., 60 BPM vs 120 BPM).
|
|
118
|
+
*
|
|
119
|
+
* @param tempoA - First tempo in BPM
|
|
120
|
+
* @param tempoB - Second tempo in BPM
|
|
121
|
+
* @param tolerance - Tolerance for ratio comparison (default: 0.1 = 10%)
|
|
122
|
+
* @returns True if tempos are ~0.5x or ~2x each other
|
|
123
|
+
*/
|
|
124
|
+
private isOctaveMultiple;
|
|
125
|
+
/**
|
|
126
|
+
* Filter out octave multiples from a list of tempos
|
|
127
|
+
*
|
|
128
|
+
* When multiple tempos are detected but some are octave multiples of others,
|
|
129
|
+
* we keep only one representative tempo. This prevents false detection of
|
|
130
|
+
* "multiple tempos" when the track is actually at a consistent tempo but
|
|
131
|
+
* detected at different octaves (e.g., 60 BPM and 120 BPM).
|
|
132
|
+
*
|
|
133
|
+
* Algorithm:
|
|
134
|
+
* 1. Sort tempos in ascending order
|
|
135
|
+
* 2. For each tempo, check if it's an octave multiple of any already-kept tempo
|
|
136
|
+
* 3. If not an octave multiple of any kept tempo, add it to the result
|
|
137
|
+
*
|
|
138
|
+
* @param tempos - Array of tempo values in BPM
|
|
139
|
+
* @returns Filtered array with octave multiples removed
|
|
140
|
+
*/
|
|
141
|
+
private filterOctaveMultiples;
|
|
142
|
+
/**
|
|
143
|
+
* Find the crossing point between two tempo clusters
|
|
144
|
+
*
|
|
145
|
+
* Core boundary detection algorithm for the crossing paths strategy:
|
|
146
|
+
* 1. If NO beats between clusters → automatic boundary (no evidence of drift)
|
|
147
|
+
* 2. If beats exist between clusters:
|
|
148
|
+
* - Interpolate forwards from Cluster 1 with drift
|
|
149
|
+
* - Interpolate backwards from Cluster 2 with drift
|
|
150
|
+
* - At crossing point, measure gap between forward and backward positions
|
|
151
|
+
* - If gap < threshold → drift bridged it → no boundary
|
|
152
|
+
* - If gap > threshold → sudden jump → return boundary timestamp
|
|
153
|
+
*
|
|
154
|
+
* @param cluster1 - First tempo cluster (earlier in time)
|
|
155
|
+
* @param cluster2 - Second tempo cluster (later in time)
|
|
156
|
+
* @param allBeats - All detected beats in the track
|
|
157
|
+
* @returns Crossing point analysis result
|
|
158
|
+
*/
|
|
159
|
+
private findCrossingPoint;
|
|
160
|
+
/**
|
|
161
|
+
* Measure the gap between forwards and backwards interpolation at crossing point
|
|
162
|
+
*
|
|
163
|
+
* Compares forwards and backwards interpolation results at the crossing point
|
|
164
|
+
* to determine if tempo drift could bridge the gap between clusters.
|
|
165
|
+
*
|
|
166
|
+
* @param forwardsResult - Result of forwards drift interpolation
|
|
167
|
+
* @param backwardsResult - Result of backwards drift interpolation
|
|
168
|
+
* @param c1Interval - Cluster 1's interval (for reference)
|
|
169
|
+
* @param c2Interval - Cluster 2's interval (for reference)
|
|
170
|
+
* @returns Gap measurement result
|
|
171
|
+
*/
|
|
172
|
+
private measureGapAtCrossing;
|
|
173
|
+
/**
|
|
174
|
+
* Assign connecting beats to sections based on phase alignment
|
|
175
|
+
*
|
|
176
|
+
* For each beat between clusters, check phase alignment with both clusters
|
|
177
|
+
* and assign to the one with better alignment.
|
|
178
|
+
*
|
|
179
|
+
* @param connectingBeats - Beats between the two clusters
|
|
180
|
+
* @param cluster1 - First cluster (earlier in time)
|
|
181
|
+
* @param cluster2 - Second cluster (later in time)
|
|
182
|
+
* @param boundaryTimestamp - The determined boundary timestamp
|
|
183
|
+
* @returns Beats assigned to each section
|
|
184
|
+
*/
|
|
185
|
+
private assignBeatsToSections;
|
|
186
|
+
/**
|
|
187
|
+
* Calculate phase alignment between a beat and a cluster's tempo grid
|
|
188
|
+
*
|
|
189
|
+
* Binary check: returns 1 if beat is within tolerance of expected grid position,
|
|
190
|
+
* 0 otherwise.
|
|
191
|
+
*
|
|
192
|
+
* @param beatTimestamp - Timestamp of the beat to check
|
|
193
|
+
* @param clusterAnchor - Anchor timestamp (e.g., first or last beat of cluster)
|
|
194
|
+
* @param clusterInterval - Cluster's interval in seconds
|
|
195
|
+
* @param tolerance - Tolerance as ratio of interval (default: 0.1 = 10%)
|
|
196
|
+
* @returns 1 if aligned, 0 if not
|
|
197
|
+
*/
|
|
198
|
+
private calculatePhaseAlignment;
|
|
199
|
+
/**
|
|
200
|
+
* Run full multi-tempo analysis to detect section boundaries
|
|
201
|
+
*
|
|
202
|
+
* This is the expensive part that only runs when:
|
|
203
|
+
* 1. enableMultiTempo option is true
|
|
204
|
+
* 2. Multiple tempo clusters have been detected
|
|
205
|
+
*
|
|
206
|
+
* Uses the crossing paths strategy to determine exact boundaries between sections.
|
|
207
|
+
*
|
|
208
|
+
* @param beats - All detected beats in the track
|
|
209
|
+
* @param clusters - Verified tempo clusters
|
|
210
|
+
* @param duration - Track duration in seconds
|
|
211
|
+
* @returns TempoSection array with boundaries, or null if no valid sections
|
|
212
|
+
*/
|
|
213
|
+
private runMultiTempoAnalysis;
|
|
214
|
+
/**
|
|
215
|
+
* Re-interpolate boundary regions between tempo sections
|
|
216
|
+
*
|
|
217
|
+
* When multi-tempo is applied, beats near section boundaries need to be
|
|
218
|
+
* re-interpolated using the correct tempo for each section.
|
|
219
|
+
*
|
|
220
|
+
* @param mergedBeats - Current merged beats (single-tempo interpolation)
|
|
221
|
+
* @param tempoSections - Detected tempo sections with boundaries
|
|
222
|
+
* @param detectedBeats - Original detected beats
|
|
223
|
+
* @param downbeatConfig - Downbeat configuration
|
|
224
|
+
* @returns Re-interpolated merged beats
|
|
225
|
+
*/
|
|
226
|
+
private reinterpolateBoundaryRegions;
|
|
227
|
+
/**
|
|
228
|
+
* Check if multi-tempo re-analysis can be applied to a beat map
|
|
229
|
+
*
|
|
230
|
+
* Used by UI to determine whether to show a "Re-analyze with Multi-Tempo" button.
|
|
231
|
+
*
|
|
232
|
+
* @param interpolatedBeatMap - The interpolated beat map to check
|
|
233
|
+
* @returns true if multi-tempo analysis is available and not yet applied
|
|
234
|
+
*/
|
|
235
|
+
canApplyMultiTempo(interpolatedBeatMap: InterpolatedBeatMap): boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Calculate weighted intervals between beats
|
|
238
|
+
*
|
|
239
|
+
* Weight factors:
|
|
240
|
+
* - Is the interval from a dense section? (higher weight)
|
|
241
|
+
* - Is the interval consistent with neighbors? (higher weight)
|
|
242
|
+
* - Are the bounding beats high-confidence? (higher weight)
|
|
243
|
+
*
|
|
244
|
+
* @param beats - Beats to analyze
|
|
245
|
+
* @param denseSections - Identified dense sections
|
|
246
|
+
* @returns Array of weighted intervals
|
|
247
|
+
*/
|
|
248
|
+
private calculateWeightedIntervals;
|
|
249
|
+
/**
|
|
250
|
+
* Build a histogram of intervals
|
|
251
|
+
*
|
|
252
|
+
* Uses bucketing to group similar intervals together.
|
|
253
|
+
*
|
|
254
|
+
* @param weightedIntervals - Weighted intervals to histogram
|
|
255
|
+
* @returns Map of interval buckets to total weights
|
|
256
|
+
*/
|
|
257
|
+
private buildIntervalHistogram;
|
|
258
|
+
/**
|
|
259
|
+
* Find peaks in the interval histogram
|
|
260
|
+
*
|
|
261
|
+
* Returns peaks sorted by weight (descending).
|
|
262
|
+
*
|
|
263
|
+
* @param histogram - Interval histogram
|
|
264
|
+
* @returns Array of peaks with interval and weight
|
|
265
|
+
*/
|
|
266
|
+
private findHistogramPeaks;
|
|
267
|
+
/**
|
|
268
|
+
* Calculate simple average interval (fallback method)
|
|
269
|
+
*
|
|
270
|
+
* @param beats - Beats to analyze
|
|
271
|
+
* @returns Average interval in seconds
|
|
272
|
+
*/
|
|
273
|
+
private calculateAverageInterval;
|
|
274
|
+
/**
|
|
275
|
+
* Analyze gaps between detected beats
|
|
276
|
+
*
|
|
277
|
+
* Identifies:
|
|
278
|
+
* - Half-note gaps (exactly 2x quarter note)
|
|
279
|
+
* - Anomalies (single unusual intervals)
|
|
280
|
+
* - Grid alignment score
|
|
281
|
+
*
|
|
282
|
+
* @param beats - Beats to analyze
|
|
283
|
+
* @param quarterNote - Detected quarter note interval
|
|
284
|
+
* @returns Gap analysis result
|
|
285
|
+
*/
|
|
286
|
+
private analyzeGaps;
|
|
287
|
+
/**
|
|
288
|
+
* Generate beat grid using the selected algorithm
|
|
289
|
+
*
|
|
290
|
+
* Delegates to the appropriate algorithm implementation based on options.
|
|
291
|
+
*
|
|
292
|
+
* @param beatMap - Original beat map
|
|
293
|
+
* @param quarterNote - Quarter note detection
|
|
294
|
+
* @param gapAnalysis - Gap analysis result
|
|
295
|
+
* @returns Array of beats with source information
|
|
296
|
+
*/
|
|
297
|
+
private generateGrid;
|
|
298
|
+
/**
|
|
299
|
+
* Interpolate forwards from a start anchor through connecting beats with drift
|
|
300
|
+
*
|
|
301
|
+
* Used by the crossing paths strategy to determine how tempo evolves when
|
|
302
|
+
* interpolating from one cluster towards another. Each detected beat encountered
|
|
303
|
+
* can push/pull the tempo based on phase alignment.
|
|
304
|
+
*
|
|
305
|
+
* @param startAnchor - Starting beat timestamp (anchor point)
|
|
306
|
+
* @param initialInterval - Initial tempo as interval in seconds
|
|
307
|
+
* @param connectingBeats - Beats to interpolate through (sorted by timestamp)
|
|
308
|
+
* @param adaptationRate - How quickly tempo adapts (0-1)
|
|
309
|
+
* @param stopAtTimestamp - Optional timestamp to stop interpolation at
|
|
310
|
+
* @returns Drift interpolation result with final tempo and beat positions
|
|
311
|
+
*/
|
|
312
|
+
private interpolateForwardsWithDrift;
|
|
313
|
+
/**
|
|
314
|
+
* Interpolate backwards from an end anchor through connecting beats with drift
|
|
315
|
+
*
|
|
316
|
+
* Used by the crossing paths strategy to determine how tempo evolves when
|
|
317
|
+
* interpolating from one cluster backwards towards another. Each detected beat
|
|
318
|
+
* encountered can push/pull the tempo (in reverse time direction).
|
|
319
|
+
*
|
|
320
|
+
* @param endAnchor - Ending beat timestamp (anchor point)
|
|
321
|
+
* @param initialInterval - Initial tempo as interval in seconds
|
|
322
|
+
* @param connectingBeats - Beats to interpolate through (sorted by timestamp)
|
|
323
|
+
* @param adaptationRate - How quickly tempo adapts (0-1)
|
|
324
|
+
* @param stopAtTimestamp - Optional timestamp to stop interpolation at
|
|
325
|
+
* @returns Drift interpolation result with final tempo and beat positions
|
|
326
|
+
*/
|
|
327
|
+
private interpolateBackwardsWithDrift;
|
|
328
|
+
/**
|
|
329
|
+
* Approach 2: Adaptive Phase-Locked Grid
|
|
330
|
+
*
|
|
331
|
+
* Handles tempo drift by:
|
|
332
|
+
* 1. Starting with quarter note interval
|
|
333
|
+
* 2. Phase tracking at each detected beat anchor
|
|
334
|
+
* 3. Allowing tempo to drift slightly between anchors
|
|
335
|
+
*
|
|
336
|
+
* @param beatMap - Original beat map
|
|
337
|
+
* @param quarterNote - Quarter note detection
|
|
338
|
+
* @returns Grid beats with source information
|
|
339
|
+
*/
|
|
340
|
+
private interpolateAdaptivePhaseLocked;
|
|
341
|
+
/**
|
|
342
|
+
* Merge detected beats with grid beats
|
|
343
|
+
*
|
|
344
|
+
* Detected beats override interpolated beats at the same position.
|
|
345
|
+
*
|
|
346
|
+
* @param detectedBeats - Original detected beats
|
|
347
|
+
* @param gridBeats - Grid beats (interpolated)
|
|
348
|
+
* @param downbeatConfig - Downbeat configuration from the BeatMap
|
|
349
|
+
* @returns Merged beats with source information
|
|
350
|
+
*/
|
|
351
|
+
private mergeBeats;
|
|
352
|
+
/**
|
|
353
|
+
* Reassign beat positions (beatInMeasure, isDownbeat, measureNumber)
|
|
354
|
+
* based on the merged beat sequence using the provided downbeat configuration.
|
|
355
|
+
*
|
|
356
|
+
* Supports multiple segments for time signature changes within a track.
|
|
357
|
+
*
|
|
358
|
+
* IMPORTANT: Measure numbers CONTINUE across segment boundaries.
|
|
359
|
+
* When time signature changes, measure number doesn't reset - it keeps
|
|
360
|
+
* incrementing. Only the beatsPerMeasure changes.
|
|
361
|
+
*
|
|
362
|
+
* @param beats - Merged beats to update
|
|
363
|
+
* @param downbeatConfig - Downbeat configuration from BeatMap (undefined = default)
|
|
364
|
+
*/
|
|
365
|
+
private reassignBeatPositions;
|
|
366
|
+
/**
|
|
367
|
+
* Compute measure offsets for each segment to continue numbering across boundaries
|
|
368
|
+
*
|
|
369
|
+
* @param segments - Array of downbeat segments (must be ordered by startBeat)
|
|
370
|
+
* @param totalBeats - Total number of beats
|
|
371
|
+
* @returns Array of measure offsets for each segment
|
|
372
|
+
*/
|
|
373
|
+
private computeMeasureOffsets;
|
|
374
|
+
/**
|
|
375
|
+
* Find the index of the active segment for a given beat index
|
|
376
|
+
* Segments are contiguous - each covers beats until the next segment starts
|
|
377
|
+
*
|
|
378
|
+
* @param segments - Array of downbeat segments (must be ordered by startBeat)
|
|
379
|
+
* @param beatIndex - The beat index to find the active segment for
|
|
380
|
+
* @returns The index of the active segment
|
|
381
|
+
*/
|
|
382
|
+
private findActiveSegmentIndex;
|
|
383
|
+
/**
|
|
384
|
+
* Calculate confidence score from components
|
|
385
|
+
*/
|
|
386
|
+
private calculateConfidence;
|
|
387
|
+
/**
|
|
388
|
+
* Create an interpolated beat
|
|
389
|
+
*/
|
|
390
|
+
private createInterpolatedBeat;
|
|
391
|
+
/**
|
|
392
|
+
* Create a detected beat with source info
|
|
393
|
+
*/
|
|
394
|
+
private createDetectedBeat;
|
|
395
|
+
/**
|
|
396
|
+
* Find a beat near a given timestamp within tolerance
|
|
397
|
+
*/
|
|
398
|
+
private findBeatNear;
|
|
399
|
+
/**
|
|
400
|
+
* Find the nearest anchor beat to a given time
|
|
401
|
+
*/
|
|
402
|
+
private findNearestAnchor;
|
|
403
|
+
/**
|
|
404
|
+
* Calculate tempo drift ratio (max local tempo / min local tempo)
|
|
405
|
+
*/
|
|
406
|
+
private calculateTempoDriftRatio;
|
|
407
|
+
/**
|
|
408
|
+
* Create an empty interpolated beat map (edge case)
|
|
409
|
+
*/
|
|
410
|
+
private createEmptyInterpolatedBeatMap;
|
|
411
|
+
/**
|
|
412
|
+
* Create a single-beat interpolated beat map (edge case)
|
|
413
|
+
*/
|
|
414
|
+
private createSingleBeatInterpolatedBeatMap;
|
|
415
|
+
/**
|
|
416
|
+
* Convert an InterpolatedBeatMap to JSON string
|
|
417
|
+
*
|
|
418
|
+
* @param interpolatedBeatMap - Interpolated beat map to serialize
|
|
419
|
+
* @returns JSON string
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```typescript
|
|
423
|
+
* const interpolator = new BeatInterpolator();
|
|
424
|
+
* const interpolatedBeatMap = interpolator.interpolate(beatMap);
|
|
425
|
+
*
|
|
426
|
+
* // Serialize to JSON for storage
|
|
427
|
+
* const json = BeatInterpolator.toJSON(interpolatedBeatMap);
|
|
428
|
+
* localStorage.setItem('beatmap', json);
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
static toJSON(interpolatedBeatMap: InterpolatedBeatMap): string;
|
|
432
|
+
/**
|
|
433
|
+
* Parse an InterpolatedBeatMap from JSON string
|
|
434
|
+
*
|
|
435
|
+
* @param jsonString - JSON string to parse
|
|
436
|
+
* @returns Interpolated beat map
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* ```typescript
|
|
440
|
+
* // Load from storage
|
|
441
|
+
* const json = localStorage.getItem('beatmap');
|
|
442
|
+
* const interpolatedBeatMap = BeatInterpolator.fromJSON(json);
|
|
443
|
+
*
|
|
444
|
+
* // Use the loaded beat map
|
|
445
|
+
* console.log(interpolatedBeatMap.mergedBeats.length);
|
|
446
|
+
* ```
|
|
447
|
+
*/
|
|
448
|
+
static fromJSON(jsonString: string): InterpolatedBeatMap;
|
|
449
|
+
/**
|
|
450
|
+
* Save an InterpolatedBeatMap to a file (Node.js only)
|
|
451
|
+
*
|
|
452
|
+
* @param interpolatedBeatMap - Interpolated beat map to save
|
|
453
|
+
* @param filePath - Path to save to
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```typescript
|
|
457
|
+
* const interpolator = new BeatInterpolator();
|
|
458
|
+
* const interpolatedBeatMap = interpolator.interpolate(beatMap);
|
|
459
|
+
* await BeatInterpolator.saveToFile(interpolatedBeatMap, './beatmap.json');
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
static saveToFile(interpolatedBeatMap: InterpolatedBeatMap, filePath: string): Promise<void>;
|
|
463
|
+
/**
|
|
464
|
+
* Load an InterpolatedBeatMap from a file (Node.js only)
|
|
465
|
+
*
|
|
466
|
+
* @param filePath - Path to load from
|
|
467
|
+
* @returns Interpolated beat map
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* ```typescript
|
|
471
|
+
* const interpolatedBeatMap = await BeatInterpolator.loadFromFile('./beatmap.json');
|
|
472
|
+
* console.log(interpolatedBeatMap.mergedBeats.length);
|
|
473
|
+
* ```
|
|
474
|
+
*/
|
|
475
|
+
static loadFromFile(filePath: string): Promise<InterpolatedBeatMap>;
|
|
476
|
+
}
|
|
477
|
+
//# sourceMappingURL=BeatInterpolator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BeatInterpolator.d.ts","sourceRoot":"","sources":["../../../../src/core/analysis/beat/BeatInterpolator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAER,OAAO,EAEP,wBAAwB,EACxB,mBAAmB,EAatB,MAAM,wBAAwB,CAAC;AAsGhC;;;;;GAKG;AACH,qBAAa,gBAAgB;IACzB,OAAO,CAAC,OAAO,CAAqC;IAEpD;;;;OAIG;gBACS,OAAO,GAAE,wBAA6B;IAIlD;;;;OAIG;IACH,SAAS,IAAI,QAAQ,CAAC,wBAAwB,CAAC;IAI/C;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,mBAAmB;IAmJlD;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,iBAAiB;IAyDzB;;;;;;;;OAQG;IACH,OAAO,CAAC,qBAAqB;IAwE7B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,qBAAqB;IAuE7B;;;;;;;;;OASG;IACH,OAAO,CAAC,uBAAuB;IAmC/B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,qBAAqB;IAuB7B;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,iBAAiB;IAyGzB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,oBAAoB;IAgE5B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,qBAAqB;IAkC7B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,uBAAuB;IAuB/B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,qBAAqB;IA6F7B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,4BAA4B;IA0BpC;;;;;;;OAOG;IACH,kBAAkB,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,OAAO;IAarE;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,0BAA0B;IA+ClC;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;IAiB9B;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAwC1B;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;IAYhC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,WAAW;IA6DnB;;;;;;;;;OASG;IACH,OAAO,CAAC,YAAY;IAWpB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,4BAA4B;IAgEpC;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,6BAA6B;IAgErC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,8BAA8B;IA4FtC;;;;;;;;;OASG;IACH,OAAO,CAAC,UAAU;IAmDlB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,qBAAqB;IA6C7B;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IA2B7B;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;IAiB9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAQ3B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAkB9B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAS1B;;OAEG;IACH,OAAO,CAAC,YAAY;IAmBpB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAuBzB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAqBhC;;OAEG;IACH,OAAO,CAAC,8BAA8B;IA4CtC;;OAEG;IACH,OAAO,CAAC,mCAAmC;IAsD3C;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,MAAM;IAyE/D;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB;IA0ExD;;;;;;;;;;;;OAYG;WACU,UAAU,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYlG;;;;;;;;;;;OAWG;WACU,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAW5E"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beat Map Generator
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates the beat detection pipeline to generate complete beat maps:
|
|
5
|
+
* 1. Load/decode audio
|
|
6
|
+
* 2. Calculate Onset Strength Envelope (OSE)
|
|
7
|
+
* 3. Estimate Tempo
|
|
8
|
+
* 4. Run DP Beat Tracker
|
|
9
|
+
* 5. Detect Downbeats
|
|
10
|
+
* 6. Assemble BeatMap
|
|
11
|
+
*
|
|
12
|
+
* Supports JSON serialization and file I/O for caching beat maps.
|
|
13
|
+
*/
|
|
14
|
+
import type { BeatMap, BeatMapGeneratorOptions, BeatMapGenerationProgress, DownbeatConfig } from '../../types/BeatMap.js';
|
|
15
|
+
/**
|
|
16
|
+
* Progress callback type
|
|
17
|
+
*/
|
|
18
|
+
export type ProgressCallback = (progress: BeatMapGenerationProgress) => void;
|
|
19
|
+
export declare class BeatMapGenerator {
|
|
20
|
+
private options;
|
|
21
|
+
private state;
|
|
22
|
+
/**
|
|
23
|
+
* Create a new BeatMapGenerator
|
|
24
|
+
*
|
|
25
|
+
* @param options - Configuration options (all optional, defaults provided)
|
|
26
|
+
*/
|
|
27
|
+
constructor(options?: BeatMapGeneratorOptions);
|
|
28
|
+
/**
|
|
29
|
+
* Get the current configuration
|
|
30
|
+
*
|
|
31
|
+
* @returns The current configuration
|
|
32
|
+
*/
|
|
33
|
+
getConfig(): Required<BeatMapGeneratorOptions>;
|
|
34
|
+
/**
|
|
35
|
+
* Generate a beat map from an audio URL
|
|
36
|
+
*
|
|
37
|
+
* IMPORTANT: The typical workflow is to generate FIRST with default config,
|
|
38
|
+
* examine the beat map to identify the correct downbeat, then use
|
|
39
|
+
* reapplyDownbeatConfig() to set it. You usually don't know the correct
|
|
40
|
+
* downbeat until after seeing the generated beat map.
|
|
41
|
+
*
|
|
42
|
+
* @param audioUrl - URL of the audio file
|
|
43
|
+
* @param audioId - Unique identifier for the audio source
|
|
44
|
+
* @param downbeatConfig - Optional manual downbeat configuration (defaults to beat 0 = downbeat, 4/4 time)
|
|
45
|
+
* If provided, will be stored in the resulting BeatMap
|
|
46
|
+
* @param onProgress - Optional progress callback
|
|
47
|
+
* @returns Generated beat map
|
|
48
|
+
*/
|
|
49
|
+
generateBeatMap(audioUrl: string, audioId: string, downbeatConfig?: DownbeatConfig, onProgress?: ProgressCallback): Promise<BeatMap>;
|
|
50
|
+
/**
|
|
51
|
+
* Generate a beat map from an AudioBuffer
|
|
52
|
+
*
|
|
53
|
+
* IMPORTANT: The typical workflow is to generate FIRST with default config,
|
|
54
|
+
* examine the beat map to identify the correct downbeat, then use
|
|
55
|
+
* reapplyDownbeatConfig() to set it. You usually don't know the correct
|
|
56
|
+
* downbeat until after seeing the generated beat map.
|
|
57
|
+
*
|
|
58
|
+
* @param audioBuffer - Decoded audio buffer
|
|
59
|
+
* @param audioId - Unique identifier for the audio source
|
|
60
|
+
* @param downbeatConfig - Optional manual downbeat configuration (defaults to beat 0 = downbeat, 4/4 time)
|
|
61
|
+
* If provided, will be stored in the resulting BeatMap
|
|
62
|
+
* @param onProgress - Optional progress callback
|
|
63
|
+
* @returns Generated beat map
|
|
64
|
+
*/
|
|
65
|
+
generateBeatMapFromBuffer(audioBuffer: AudioBuffer, audioId: string, downbeatConfig?: DownbeatConfig, onProgress?: ProgressCallback): Promise<BeatMap>;
|
|
66
|
+
/**
|
|
67
|
+
* Get the current generation progress
|
|
68
|
+
*
|
|
69
|
+
* @returns Current progress or null if no generation is active
|
|
70
|
+
*/
|
|
71
|
+
getProgress(): BeatMapGenerationProgress | null;
|
|
72
|
+
/**
|
|
73
|
+
* Cancel the current generation
|
|
74
|
+
*/
|
|
75
|
+
cancel(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Apply intensity threshold to filter weak beats
|
|
78
|
+
*
|
|
79
|
+
* @param beats - Beats to filter
|
|
80
|
+
* @returns Filtered beats
|
|
81
|
+
*/
|
|
82
|
+
private applyIntensityThreshold;
|
|
83
|
+
/**
|
|
84
|
+
* Apply measure labels to beats based on downbeat configuration
|
|
85
|
+
*
|
|
86
|
+
* Calculates beatInMeasure, isDownbeat, and measureNumber for each beat
|
|
87
|
+
* based on the provided downbeat configuration.
|
|
88
|
+
*
|
|
89
|
+
* IMPORTANT: Measure numbers CONTINUE across segment boundaries.
|
|
90
|
+
* When time signature changes, measure number doesn't reset - it keeps
|
|
91
|
+
* incrementing. Only the beatsPerMeasure changes.
|
|
92
|
+
*
|
|
93
|
+
* @param beats - Beats to label (with timestamps)
|
|
94
|
+
* @param config - Downbeat configuration
|
|
95
|
+
* @returns Beats with measure information populated
|
|
96
|
+
*/
|
|
97
|
+
private applyMeasureLabels;
|
|
98
|
+
/**
|
|
99
|
+
* Compute measure offsets for each segment to continue numbering across boundaries
|
|
100
|
+
*
|
|
101
|
+
* @param segments - Array of downbeat segments (must be ordered by startBeat)
|
|
102
|
+
* @param totalBeats - Total number of beats
|
|
103
|
+
* @returns Array of measure offsets for each segment
|
|
104
|
+
*/
|
|
105
|
+
private computeMeasureOffsets;
|
|
106
|
+
/**
|
|
107
|
+
* Find the index of the active segment for a given beat index
|
|
108
|
+
* Segments are contiguous - each covers beats until the next segment starts
|
|
109
|
+
*
|
|
110
|
+
* @param segments - Array of downbeat segments (must be ordered by startBeat)
|
|
111
|
+
* @param beatIndex - The beat index to find the active segment for
|
|
112
|
+
* @returns The index of the active segment
|
|
113
|
+
*/
|
|
114
|
+
private findActiveSegmentIndex;
|
|
115
|
+
/**
|
|
116
|
+
* Filter beats by how well they align with the tempo grid.
|
|
117
|
+
*
|
|
118
|
+
* This post-processing step removes beats that deviate significantly from
|
|
119
|
+
* the expected quarter-note grid based on the detected tempo.
|
|
120
|
+
*
|
|
121
|
+
* @param beats - Beats to filter
|
|
122
|
+
* @param tempoEstimate - Tempo estimate with beat period
|
|
123
|
+
* @param filterThreshold - Grid alignment threshold (0.0-1.0)
|
|
124
|
+
* @returns Filtered beats
|
|
125
|
+
*/
|
|
126
|
+
private filterBeatsByGridAlignment;
|
|
127
|
+
/**
|
|
128
|
+
* Update progress state
|
|
129
|
+
*/
|
|
130
|
+
private updateProgress;
|
|
131
|
+
/**
|
|
132
|
+
* Fetch and decode audio from a URL
|
|
133
|
+
*/
|
|
134
|
+
private fetchAndDecode;
|
|
135
|
+
/**
|
|
136
|
+
* Convert a BeatMap to JSON string
|
|
137
|
+
*
|
|
138
|
+
* @param beatMap - Beat map to serialize
|
|
139
|
+
* @returns JSON string
|
|
140
|
+
*/
|
|
141
|
+
static toJSON(beatMap: BeatMap): string;
|
|
142
|
+
/**
|
|
143
|
+
* Parse a BeatMap from JSON string
|
|
144
|
+
*
|
|
145
|
+
* @param jsonString - JSON string to parse
|
|
146
|
+
* @returns Beat map
|
|
147
|
+
*/
|
|
148
|
+
static fromJSON(jsonString: string): BeatMap;
|
|
149
|
+
/**
|
|
150
|
+
* Save a BeatMap to a file (Node.js only)
|
|
151
|
+
*
|
|
152
|
+
* @param beatMap - Beat map to save
|
|
153
|
+
* @param filePath - Path to save to
|
|
154
|
+
*/
|
|
155
|
+
static saveToFile(beatMap: BeatMap, filePath: string): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Load a BeatMap from a file (Node.js only)
|
|
158
|
+
*
|
|
159
|
+
* @param filePath - Path to load from
|
|
160
|
+
* @returns Beat map
|
|
161
|
+
*/
|
|
162
|
+
static loadFromFile(filePath: string): Promise<BeatMap>;
|
|
163
|
+
}
|
|
164
|
+
export interface BeatMapGeneratorInstance {
|
|
165
|
+
/** Instance method for toJSON - serializes a beat map */
|
|
166
|
+
toJSON(beatMap: BeatMap): string;
|
|
167
|
+
/** Instance method for fromJSON - parses a beat map */
|
|
168
|
+
fromJSON(jsonString: string): BeatMap;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=BeatMapGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BeatMapGenerator.d.ts","sourceRoot":"","sources":["../../../../src/core/analysis/beat/BeatMapGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAER,OAAO,EAEP,uBAAuB,EAEvB,yBAAyB,EAEzB,cAAc,EAEjB,MAAM,wBAAwB,CAAC;AAiBhC;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,yBAAyB,KAAK,IAAI,CAAC;AA+D7E,qBAAa,gBAAgB;IACzB,OAAO,CAAC,OAAO,CAAoC;IACnD,OAAO,CAAC,KAAK,CAAgC;IAE7C;;;;OAIG;gBACS,OAAO,GAAE,uBAA4B;IAqCjD;;;;OAIG;IACH,SAAS,IAAI,QAAQ,CAAC,uBAAuB,CAAC;IAI9C;;;;;;;;;;;;;;OAcG;IACG,eAAe,CACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,cAAc,EAC/B,UAAU,CAAC,EAAE,gBAAgB,GAC9B,OAAO,CAAC,OAAO,CAAC;IAuBnB;;;;;;;;;;;;;;OAcG;IACG,yBAAyB,CAC3B,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,cAAc,EAC/B,UAAU,CAAC,EAAE,gBAAgB,GAC9B,OAAO,CAAC,OAAO,CAAC;IA8JnB;;;;OAIG;IACH,WAAW,IAAI,yBAAyB,GAAG,IAAI;IAI/C;;OAEG;IACH,MAAM,IAAI,IAAI;IAYd;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IAS/B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,kBAAkB;IA0C1B;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IA2B7B;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;IAe9B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,0BAA0B;IAkClC;;OAEG;IACH,OAAO,CAAC,cAAc;IAUtB;;OAEG;YACW,cAAc;IAqB5B;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAoBvC;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAoB5C;;;;;OAKG;WACU,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY1E;;;;;OAKG;WACU,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAWhE;AAGD,MAAM,WAAW,wBAAwB;IACrC,yDAAyD;IACzD,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC,uDAAuD;IACvD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;CACzC"}
|