Encoding Scheme for Monophonic Sounds
A - Instrument Type
B - Bass
G - Guitar
B - Instrument Setting
1 - Yamaha BB604, 1st setting
2 - Yamaha BB604, 2nd setting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| torch.pi = torch.acos(torch.zeros(1)).item() * 2 # which is 3.1415927410125732 | |
| db_to_mag = lambda x: 10 ** (x / 20) | |
| mag_to_db = lambda x: 20 * torch.log10(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| from PIL import Image | |
| def split_image(image, tile_size): | |
| """Split the image into square tiles and store their original positions.""" | |
| width, height = image.size | |
| tiles = [] | |
| positions = [] | |
| for y in range(0, height, tile_size): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| def convert_bookmarks(json_file, html_file): | |
| with open(json_file, 'r', encoding='utf-8') as f: | |
| bookmarks = json.load(f) | |
| def parse_node(node): | |
| if 'children' in node: | |
| if node['type'] == 'folder': | |
| folder_html = f"<DT><H3>{node['name']}</H3>\n<DL><p>\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_files(start_path: str, extensions: List[str] = AUDIO_EXTENSIONS) -> List[str]: | |
| """Finds all audio files in a directory recursively. | |
| Returns a list. | |
| Parameters | |
| ---------- | |
| folder : str | |
| Folder to look for audio files in, recursively. | |
| ext : List[str], optional | |
| Extensions to look for without the ., by default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Hardware latency measurement using sounddevice API | |
| Copyright (C) 2024 Francesco Papaleo | |
| This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation, either version 3 of the License, or | |
| (at your option) any later version. | |
| This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Torch Signal Generator Class | |
| Copyright (C) 2024 Francesco Papaleo | |
| This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation, either version 3 of the License, or | |
| (at your option) any later version. | |
| This program is distributed in the hope that it will be useful, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # bash_profile | |
| echo "export CLICOLOR=1" >> ~/.bash_profile | |
| echo "export LSCOLORS=GxFxCxDxBxegedabagaced" >> ~/.bash_profile | |
| echo "export TERM="xterm-color"" >> ~/.bash_profile | |
| echo "export PS1='\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\]:\[\e[0;34m\]\w\[\e[0m\]\$ '" >> ~/.bash_profile | |
| exec bash -l |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Relink brew-installed Python to Pyenv | |
| # from https://stackoverflow.com/questions/30499795/how-can-i-make-homebrew | |
| pyenv-brew-relink() { | |
| rm -f "$HOME/.pyenv/versions/*-brew" | |
| for i in $(brew --cellar)/python* ; do | |
| for p in $i/*; do | |
| echo $p |