npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

beat-parser-core

v1.0.2

Published

TypeScript library for parsing musical beats and rhythmic patterns

Readme

@beat-parser/core

A powerful, production-ready TypeScript library for parsing musical beats and rhythmic patterns from audio data. Built for both browser and Node.js environments with Web Worker support for heavy processing tasks.

npm version License: MIT TypeScript

Features

🎵 Advanced Beat Detection

  • Hybrid algorithm combining onset detection, tempo tracking, and spectral analysis
  • Genre-adaptive processing with optimizations for different music styles
  • Multi-pass analysis for improved accuracy and confidence scoring
  • Variable tempo support for complex musical pieces

🚀 Performance Optimized

  • Web Worker support for non-blocking processing
  • Streaming processing for large audio files
  • Batch processing for multiple files
  • Memory efficient with automatic cleanup
  • Progressive reporting with real-time progress callbacks

🔧 Developer Friendly

  • TypeScript first with comprehensive type definitions
  • Plugin system for extensible functionality
  • Multiple output formats (JSON, XML, CSV)
  • Comprehensive error handling with detailed error messages
  • Modern ES modules with CommonJS compatibility

🌐 Universal Compatibility

  • Browser support with Web Audio API integration
  • Node.js support for server-side processing
  • Multiple audio formats: WAV, MP3, FLAC, OGG, M4A
  • Configurable sample rates and processing parameters

Quick Start

Installation & Setup

For complete installation instructions, environment setup, and configuration options, see Setup Guide.

npm install @beat-parser/core

Basic Example

import { BeatParser } from '@beat-parser/core';

// Create parser and process audio
const parser = new BeatParser();
const result = await parser.parseBuffer(audioData, {
  targetPictureCount: 16,
  selectionMethod: 'adaptive'
});

console.log('Detected beats:', result.beats.length);
console.log('Tempo:', result.tempo, 'BPM');

// Always cleanup
await parser.cleanup();

Worker Processing

import { BeatParserWorkerClient } from '@beat-parser/core';

const workerClient = new BeatParserWorkerClient();
const result = await workerClient.parseBuffer(audioData, {
  progressCallback: (progress) => console.log(`${progress.percentage}%`)
});
await workerClient.terminate();

Documentation

Core Documentation


## Performance Benchmarks

Based on comprehensive testing across multiple platforms:

| Audio Duration | Processing Time | Memory Usage | Typical Results |
|---------------|-----------------|--------------|----------------|
| 5 seconds     | <3 seconds     | <10MB        | 8-12 beats     |
| 30 seconds    | <15 seconds    | <25MB        | 40-60 beats    |
| 2 minutes     | <60 seconds    | <50MB        | 160-240 beats  |
| 5 minutes     | <150 seconds   | <100MB       | 400-600 beats  |

**Key Performance Features:**
- **Web Worker processing**: 40-70% performance improvement
- **Memory efficient**: Automatic cleanup with bounded growth
- **Streaming support**: Process large files without loading everything into memory
- **Real-time capable**: <1.0x processing time for most audio

## Key Classes

### BeatParser
Main parser class for beat detection and audio processing.
```typescript
const parser = new BeatParser(config?);
const result = await parser.parseFile(filePath, options?);

BeatParserWorkerClient

Web Worker client for background processing.

const client = new BeatParserWorkerClient(options?);
const result = await client.parseBuffer(audioData, options?);

For complete API documentation, see API.md

Error Handling

Robust error handling with descriptive messages:

try {
  const result = await parser.parseBuffer(audioData);
} catch (error) {
  if (error.message.includes('Invalid or empty audio data')) {
    // Handle invalid input
  } else if (error.message.includes('Unsupported audio format')) {
    // Handle format issues
  }
  // Full error handling guide in API.md
}

Compatibility

Browsers: Chrome 66+, Firefox 60+, Safari 13.1+, Edge 79+
Node.js: 18.0.0+ with npm 8.0.0+
Audio Formats: WAV, MP3, FLAC, OGG, M4A

For complete compatibility details, see SETUP.md.

Contributing

We welcome contributions! See CONTRIBUTING.md for:

  • Development setup instructions
  • Code standards and guidelines
  • Testing requirements
  • Pull request process

Quick Start:

git clone https://github.com/username/beat-parser.git
cd beat-parser
npm install
npm test

Performance Tips

  1. Use Web Workers for processing files >30 seconds
  2. Enable streaming for files >2 minutes
  3. Always call cleanup() after processing
  4. Batch process multiple files for efficiency
  5. Adjust confidence threshold based on accuracy needs

For complete performance optimization guide, see API.md.

Troubleshooting

Common solutions:

  • Worker not supported: Use main thread BeatParser instead
  • Audio file not found: Verify file path and permissions
  • Unsupported format: Convert to supported format (WAV, MP3, FLAC, OGG, M4A)
  • High memory usage: Use streaming processing and call cleanup()

For complete troubleshooting guide, see Setup Guide.

📚 Documentation

Essential Documentation

Project Resources

License

MIT License. See LICENSE file for details.

Links


Developed with ❤️ for the audio processing community.