1.0.7 • Published 9 months ago

taktmuster v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

Taktmuster

Taktmuster is a JavaScript library for generating and visualizing musical patterns. It includes functions for creating various waveforms, combining them into curves, and integrating metronome functionality for precise timing and rhythm analysis. This project is ideal for applications in music theory, audio engineering, and pattern generation.

Features

  • Generate various waveforms (sin, cos, toggle) with customizable parameters.
  • Merge multiple waveforms into complex curves.
  • Time-based pattern manipulation using a custom metronome.
  • Visualize curves and patterns with Chartist.js.
  • Integration with MIDI.js for potential audio output (future feature).

Installation

You can install the package using npm:

```bash npm install taktmuster ```

Usage

Below is a basic example of how to use the Taktmuster library in your project.

Import and Initialization

```javascript import Metrom from './src/Metrum.js'; import TaktmusterCurve from './src/taktMusterCurve.js';

const metrom = new Metrom(120, 4); // Initialize the metronome with 120 BPM and 4 pulses per quarter note const taktmusterCurve = new TaktmusterCurve(metrom); // Initialize a Taktmuster curve ```

Generate a Curve

You can create a waveform curve by setting the number of measures (takt), numerator (zaehler), and denominator (nenner):

```javascript const curve = taktmusterCurve.setTakt(4, 4, 4, 'sin', 'mixFinalClassic'); ```

Visualizing the Curve

Use the helper method to visualize the curve:

```javascript import { showCurve } from './src/helpers.js';

showCurve(curve, taktmusterCurve, 'my-curve'); ```

This will generate an HTML file containing the curve's visualization, saved in the `./curve-plots` directory.

API

TaktmusterCurve

  • `setTakt(taktCnt, zaehler, nenner, curveType, mixFunctionName)`:

    • taktCnt: Number of measures (default 1).
    • zaehler: Numerator for the time signature.
    • nenner: Denominator for the time signature.
    • curveType: Type of curve ('sin', 'cos', 'toggle').
    • mixFunctionName: Function name for mixing curves (`mixFinalClassic`, `mixFinal`, etc.).

Metrom

  • `setTempo(tempo, pulsePerQuarter)`: Set the tempo (BPM) and pulses per quarter note.
  • `start(callback)`: Starts the metronome and calls the `callback` function on each pulse.
  • `stop()`: Stops the metronome.

Helpers

  • `showCurve(curve, taktmuster, name, dir)`: Generates a visual representation of the curve as an HTML file.

Development

To build the project, use:

```bash npm run webpack:build ```

To watch for file changes during development:

```bash npm run webpack:watch ```

License

This project is open source and available under the Dominik Eggermann Open Source License.

1.0.2

10 months ago

1.0.1

10 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

10 months ago

1.0.0

1 year ago