Git Product home page Git Product logo

beat-machine

The Beat Machine is a free tool for creating "every other beat is missing" remixes -- and many other kind of beat edits, too.

To use The Beat Machine from your browser, try the official web interface at https://beatmachine.branchpanic.me.

Installation

PyPI Version

TBM is available on PyPI and can be installed with pip install beatmachine.

Usage

TBM is built on effects, which modify on the beats of a song. For example, the swap effect swaps beats and can be used to create the "beats 2 and 4 are swapped" sound.

The easiest way to get started is to download some of the presets from the examples directory. You can use them like so:

$ python -m beatmachine -i in.mp3 -e swap_2_4.json -o out.mp3

The CLI reads effects as an array of JSON objects. Each object represents an effect, and effects are applied sequentially. You can either specify this inline or provide a path to a JSON file. For example, to swap beats 2 and 4:

$ python -m beatmachine -i in.mp3 -e '[{"type": "swap", "x_period": 2, "y_period": 4}]' -o out.mp3

Using python -m beatmachine.dump_schema, you can generate a JSON schema that describes the effects array. This includes definitions of all valid effects.

You can also look at the individual classes in beatmachine.effects to see their parameters. For example, here is the source for the remove effect. The JSON object for an effect must have a key called type with the value of __effect_name__. It can have additional keys for parameters defined in __effect_schema__. So, some examples of valid remove effects are { "type": "remove" } and { "type": "remove", "period": 4 }.

(TODO: add a human-readable list of effects and their parameters.)

(TODO: document the --serialize flag, which can be used to speed up repeated processing. See #54.)

API

The beatmachine.Beats class lets you modify beats using a Python script.

import beatmachine as bm

beats = bm.Beats.from_song('in.mp3')
beats.apply(bm.effects.RemoveEveryNth(2)).save('out.mp3')

This opens up some interesting possibilities, like turning beats into a NumPy array that you can modify further.

import beatmachine as bm
import numpy as np

beats = bm.Beats.from_song('in.mp3')
y = np.flip(beats.to_ndarray())

Be warned that the API is largely untested outside of the core from_song -> apply -> save path.

(TODO: more detailed docs will eventually live on the wiki.)

Attribution

The default beat detector is powered by CPJKU/madmom. View its license here.

TBM's Projects

desktop icon desktop

Offline desktop app for The Beat Machine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.