Skip to content

butterkitty/traktor-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Traktor Utilities Suite

A comprehensive set of tools for analyzing and optimizing your Traktor DJ library. This suite includes a powerful library analyzer and a precision cue alignment tool.

Tools Overview

πŸ” Traktor Library Analyzer (traktor_library_analyzer.py)

Generates a comprehensive HTML report of your Traktor collection with interactive analytics, insights, and actionable recommendations for library optimization.

⚑ Cue Alignment Tool (align_cues_to_autogrid.py)

Aligns all cues in your Traktor NML file to the AutoGrid with 5ms precision, ensuring perfect beat synchronization for seamless mixing.


πŸ” Traktor Library Analyzer

What it does

The analyzer provides deep insights into your Traktor collection:

  • πŸ“Š Interactive Analytics: Genre distribution, BPM analysis, key distribution, quality metrics
  • 🎯 Smart Insights: Identifies tracks needing attention (missing genres, poor quality, alignment issues)
  • πŸ“ˆ Visual Charts: Beautiful Chart.js visualizations of your library statistics
  • πŸ”§ Actionable Reports: Click insights to see specific tracks that need fixes
  • ⚑ Library Tools: Built-in button to run cue alignment directly from the web interface
  • πŸ“± Responsive Design: Works perfectly on desktop and mobile browsers

Key Features

  • Cue Point Analysis: Well-cued (6+ cues), moderately cued (3-5 cues), poorly cued (≀2 cues)
  • Quality Assessment: Audio quality analysis with bitrate and format detection
  • Alignment Detection: Identifies tracks with misaligned cues (5ms precision)
  • Missing Data Detection: Finds tracks without genres, keys, or proper metadata
  • Interactive Filtering: Click any insight to see the specific tracks involved
  • Professional Reporting: Clean, modern HTML interface with export capabilities

Usage

# Analyze your collection
python3 traktor_library_analyzer.py collection.nml

# Open the generated report
open traktor_library_report.html

Sample Output

🎡 Traktor Library Analyzer
========================================
πŸ“ Parsing NML file: collection.nml
Successfully parsed 193 tracks from collection.nml
πŸ“Š Calculating statistics...
πŸ“„ Generating HTML report: traktor_library_report.html

βœ… Analysis complete!
πŸ“Š Total tracks analyzed: 193
⏱️  Total duration: 17h 46m
πŸ’Ύ Total size: 3.4 GB
🎯 Total cue points: 1,117 across 191 tracks
πŸ“Š Insight metrics:
   β€’ Missing genre: 7/193 tracks
   β€’ Low quality: 12/193 tracks  
   β€’ Well-cued (6+ cues): 99/193 tracks
   β€’ Poorly cued (≀2 cues): 19/193 tracks
   β€’ Missing keys: 3/193 tracks
   β€’ Misaligned cues: 0/193 tracks

🌐 Open traktor_library_report.html in your web browser!

⚑ Cue Alignment Tool

What it does

The alignment tool analyzes each track in your Traktor collection and:

  1. Finds the AutoGrid cue and extracts the BPM information
  2. Calculates the nearest beat position for each hot cue
  3. Updates cue positions to align with the musical grid (5ms precision)
  4. Preserves the original file and creates a new aligned version

Usage

Basic usage

python3 align_cues_to_autogrid.py collection.nml

This creates collection_aligned.nml with all cues aligned to the AutoGrid.

Specify output file

python3 align_cues_to_autogrid.py collection.nml my_aligned_collection.nml

Get help

python3 align_cues_to_autogrid.py --help

How it works

  1. Parses the NML file: Reads the XML structure of your Traktor collection
  2. Finds AutoGrid: For each track, locates the AutoGrid cue and extracts BPM and start time
  3. Calculates beat positions: Uses the formula beat_duration = 60.0 / BPM to determine beat spacing
  4. Aligns cues: Finds the nearest beat position for each hot cue and updates its position
  5. Preserves originals: Only updates cues that are more than 5ms off the grid to avoid unnecessary changes

Example output

Found 193 tracks in collection.nml

[1/193] Processing: ARTBAT - Afterparty (Original Mix)
  AutoGrid: BPM=126.000, Start=217.015s
    Cue 0: 45.902s -> 45.714s
    Cue 1: 76.379s -> 76.190s
    Cue 2: 106.855s -> 106.667s

Successfully aligned 208 cues across 193 tracks
Output saved to: collection_aligned.nml

πŸ“‹ Requirements

  • Python 3.6 or higher
  • No additional dependencies required (uses only standard library)

πŸš€ Workflow Recommendations

Optimal DJ Library Workflow

  1. πŸ“Š Analyze First: Run the analyzer to get comprehensive insights

    python3 traktor_library_analyzer.py collection.nml
  2. πŸ” Review Issues: Open the HTML report and click through insights to identify problems

  3. ⚑ Fix Alignment: Use the built-in "Align Cues" button or run manually:

    python3 align_cues_to_autogrid.py collection.nml collection_fixed.nml
  4. βœ… Verify Results: Re-analyze the aligned collection to confirm improvements

Professional Tips

  • 🎯 Cue Standards: Aim for 6+ cues per track for optimal DJ performance
  • πŸ”§ Fix Priorities: Address poorly cued tracks first, then quality and metadata issues
  • ⚑ Precision Mixing: 5ms alignment tolerance ensures beat-perfect transitions
  • πŸ“ˆ Regular Analysis: Run monthly analysis to maintain library health

πŸ› οΈ Technical Details

Analyzer Specifications

  • Time Complexity: O(n) linear processing of tracks
  • Memory Usage: Efficient streaming parser for large collections
  • Output Format: Modern responsive HTML with Chart.js visualizations
  • Data Processing: Comprehensive metadata extraction and statistical analysis

Alignment Specifications

  • Precision: 5ms alignment tolerance for professional mixing
  • Time Format: Handles Traktor's mixed time formats (AutoGrid in seconds, cues in milliseconds)
  • Beat Calculation: Standard musical timing: beat_duration = 60.0 / BPM
  • Grid Reference: Uses AutoGrid BPM when available, falls back to track BPM
  • Safety: Only processes tracks with valid AutoGrid cues

⚠️ Important Notes

  • πŸ”’ Backup First: Always keep a backup of your original NML file
  • 🎡 AutoGrid Required: Tracks without AutoGrid cues will be skipped in alignment
  • πŸ“Š Analysis Safe: The analyzer only reads your collection (no modifications)
  • ⚑ Precision Focus: 5ms alignment tolerance balances accuracy with musical feel
  • πŸ”„ Verification: Both tools use identical logic for perfect consistency

πŸ› Troubleshooting

"No AutoGrid found for track"

The track needs to be analyzed in Traktor first to create the AutoGrid.

"Error parsing XML file"

Verify your NML file isn't corrupted by opening it in Traktor.

Alignment shows 0 tracks but analyzer shows misaligned tracks

This indicates a bug - both tools should show consistent results. Please report this issue.

Charts not loading in HTML report

Ensure you're opening the HTML file in a modern web browser with JavaScript enabled.


πŸ“„ License

This tool suite is provided as-is for educational and personal use. Use at your own risk and always backup your data.


🎡 Happy Mixing! 🎧

About

A collection of utilities for the DJ software Traktor Pro

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published