{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "

Beat Manipulator

" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Simply put your pattern in the cell below and run it as many times as you wish. Pattern syntax, scale and shift are explained here https://github.com/stunlocked1/BeatManipulator\n", "\n", "A file selection dialog will open. Note: you might need to Alt+Tab to it due to how Jupiter works (press Alt+Tab and select file selection dialog). Alternatively you can add `audio=\"path/to/audio\"` attribute into bm.beatswap to load a specified audio file.\n", "\n", "Choose any audio file, and the beatswapped version will be displayed, as well as saved next to this Jupiter Notebook file.\n", "\n", "Analyzing beats for the first time will take some time, but if you open the same file for the second time, it will load a saved beat map." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "pattern = '1, 4' # Replace this with your pattern. You can write \"test\" as a pattern to test where each beat is.\n", "scale = 1\n", "shift = 0\n", "audio = None # If you want to skip select file dialog, replace None with a path to your audio file\n", "\n", "pattern_length = None # Length of the pattern. If None, this will be inferred from the highest number in the pattern\n", "\n", "\n", "import beat_manipulator as bm, IPython\n", "print(\"Press alt+tab if file selection dialog didn't show\")\n", "path = bm.beatswap(audio=audio, pattern = pattern, scale = scale, shift = shift, length = pattern_length)\n", "IPython.display.Audio(path)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "***\n", "## Other stuff\n", "Those operate the same as the above cell" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "**Song to image**\n", "\n", "creates an image based on beat positions, so each song will generate a unique image." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "image_size = 512 # image will be a square with this size in pixels\n", "audio = None # If you want to skip select file dialog, replace None with a path to your audio file\n", "\n", "\n", "import beat_manipulator as bm, IPython\n", "print(\"Press alt+tab if file selection dialog didn't show\")\n", "path = bm.image(audio=audio, max_size = image_size)\n", "IPython.display.Image(path)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "***\n", "**osu! beatmap generator**\n", "\n", "generates an osu! beatmap from your song. This generates a hitmap, probabilities of hits at each sample, picks all ones above a threshold, and turns them into osu circles, trying to emulate actual osu beatmap. This doesn't generate sliders, however, because no known science has been able to comprehend the complexity of those.\n", "\n", "The .osz file will be generated next to this notebook, open it with osu! to install it as any other beatmap." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "difficulties = [0.2, 0.1, 0.05, 0.025, 0.01, 0.0075, 0.005, 0.0025, 0.0001] # all difficulties will be embedded in one beatmap, lower = harder.\n", "audio = None # If you want to skip select file dialog, replace None with a path to your audio file\n", "\n", "\n", "import beat_manipulator.osu\n", "print(\"Press alt+tab if file selection dialog didn't show\")\n", "beat_manipulator.osu.generate(song=audio, difficulties = difficulties)" ] } ], "metadata": { "kernelspec": { "display_name": "audio310", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.9" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "f56da36b984886453ea677d340712034d0bd218b2dc7a53ab7c38da0c6f67f35" } } }, "nbformat": 4, "nbformat_minor": 2 }