Spaces:
Running
Running
File size: 4,559 Bytes
9cbe524 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"<h1><b><center>Beat Manipulator</center></b></h1>"
]
},
{
"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
}
|