Skip to main content

BEAT CRAFT

While you focus on your game's logic, BeatCraft assists you in creating authentic music for your game! IIf you're curious about how it works, check out the Wiki for more information.

Listen to a sample of the results here

Installation

BeatCraft is available on PyPI. To install it, run:

pip install beatcraft

If you encounter conflicts, refer to the dependencies we utilize here.

It's advisable to run your pip command with constraints to avoid potential dependency conflicts:

pip install beatcraft -c constraints.txt

here is the constrains.txt file:

pandas==2.2.3
numpy>=1.26.0
matplotlib==3.9.2
gradio==4.44.0
torchmetrics==1.4.2
encodec==0.1.1

Usage

To use BeatCraft in your Python code, start by importing it:

from beat_craft_sdk.core import BeatCraft

sdk = BeatCraft()

Define the parameter

You can define parameters using BeatCraftConfig:

bcconfig = BeatCraftConfig(file_name='output_bt')

Initialize BeatCraft with your configuration

sdk = BeatCraft(bcconfig)
melodies = sdk.compose_melody()
print(f"{melodies}")

The result will be a list of paired notes and their durations (note values):

[(1, 65), (1, 67), (0.5, 64), (0.25, 67), (0.25, 62), (2, 62), (0.25, 65), (1, 62), (2, 59), (0.5, 65), (4, 67), (1, 62), (0.25, 0), (0.25, 67), (1, 60), (0.5, 0), (0.25, 67)]

By default, the algorithm uses a Genetic Algorithm. However, you can change the melody generation algorithm:

sdk = BeatCraft()
sdk.set_melody_engine(CraftingBackingTrack())
melodies = sdk.compose_melody()

Play the Generated MIDI Melody

Would you like to listen to the generated MIDI melody? Here’s how:

sdk.play_generated_music('../.outputx/output_bt.mid')

Now that you have a beautiful melody. It's time to generate the full music

# Convert the midi file into wav
conv = AudioConverter('../.outputx/output_bt.mid','../.outputx/output_bt.wav')
conv.midi_to_wav()

# lets make the music
sdk = BeatCraft()
sdk.generate_rythm('../.outputx/output_bt.wav','../.outputx')

Contact

For inquiries, please reach out to Arif Akbarul Huda at omayib@gmail.com

Metadata

Release files for beatcraft 1.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for beatcraft 1.1.5
File Size Uploaded
beatcraft-1.1.5.tar.gz 15.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for beatcraft 1.1.5
File Interpreter ABI Platform
beatcraft-1.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 33.8 kB

Release files / beatcraft-1.1.5.tar.gz

Download URL beatcraft-1.1.5.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f8f501b202e73a4306ea8ef7d188218c3cee08a04a25f61ea0e0420ad37e2c4f
BLAKE2b-256 checksum
How to use checksums
2f4ce9004fd87558771fd10e8f556f4c32126e5787e0d47e2d00b3b4fb92e9f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / beatcraft-1.1.5-py3-none-any.whl

Download URL beatcraft-1.1.5-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ae4835ed2fcf79655e17ecc2dd871b67be1bd664ffb34d42c3b1e6a8be07c72
BLAKE2b-256 checksum
How to use checksums
a0cd6d32b838a4c2d61dd1a8ebb7a9a4ae7fa2d87191dac59baa6402c14d808d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.1.5 This release

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page