-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparameters.py
78 lines (68 loc) · 1.87 KB
/
parameters.py
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
import numpy as np
import torch
from pathlib import Path
import matplotlib.pyplot as plt
import time
from typing import Union
from logs import *
types = [Union]
time.time()
# plt.ion()
# Analysis parameters
FS = 44100 # in Hertz
TIME_RESOLUTION = 0.01 # in seconds
HOP_LENGTH = int(FS * TIME_RESOLUTION) # in samples
F_MIN = 55. / 2
F_MAX = 20000.
BINS_PER_OCTAVE = 12 * 4
N_BINS = int(np.floor(BINS_PER_OCTAVE * np.log2(F_MAX / F_MIN)))
NORM = 1 # Options: 1: L1 norm, 2: L2 norm
WINDOW = ("gaussian", 50) # Options:
# "hann": Hann window
# ('tukey', 0.5): Tukey window with taper parameter 0.5
# ("gaussian", 10)
FREQUENCIES = F_MIN * 2**(np.arange(N_BINS) / BINS_PER_OCTAVE)
EPS = np.finfo(np.float32).eps
NOISE_THRESHOLD = -100 # in dB
# Path parameters
CWD = Path(__file__).parent.absolute()
AUDIO_PATH = Path('audio')
MIDI_PATH = Path('midi')
SAMPLES_INSTRUMENT = 'MyPiano'
SAMPLES_PATH = Path('samples') / Path(SAMPLES_INSTRUMENT)
SAMPLES_AUDIO_PATH = SAMPLES_PATH / Path('audio')
SAMPLES_ARRAYS_PATH = SAMPLES_PATH / Path('arrays')
SAMPLES_IMAGES_PATH = SAMPLES_PATH / Path('images')
SAMPLES_INFO_PATH = SAMPLES_PATH / Path('info')
# Plot parameters
BACKEND = 'TkAgg' # 'WXAgg'
PLOT_UNITS = False
DPI = 120
C_MAP = 'hot'
V_MIN = NOISE_THRESHOLD
V_MAX = 0
V_MIN_MOR = -30
V_MAX_MOR = 0
FULL_SCREEN = True
TIME_FORMAT = 'milliseconds' # '%M:%S'
TIME_LABEL = 'Time (mm:ss,ms)' # '(mm:ss)'
plt.switch_backend(BACKEND)
# MIDI parameters
TICKS_PER_BEAT = 960
BPM = 60
# Samples
N_PARTIALS = 8
F_REF = 440
NUMBER_REF = 69
NUMBER_F_MIN = NUMBER_REF - 12 * np.log2(F_REF / F_MIN).astype(int)
PARTIALS_DISTRIBUTION_TYPE = "linear"
LOAD_ALL = True
USE_CQT = True
MASTER_VOLUME = 0.1
# GPU parameters
DEVICE = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
if USE_CQT:
log.info('Using device: ' + str(DEVICE))
# Logs
if __name__ == '__main__':
configure_logs('parameters')