-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsettings.py
More file actions
69 lines (53 loc) · 2.26 KB
/
settings.py
File metadata and controls
69 lines (53 loc) · 2.26 KB
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
import numpy as np
from methods import *
# Define input type: 'mic', 'wav' or 'sin'
input_type = 'wav'
# If input_type is wav, specify path to a wav file
wavefile_name = 'tests/queen_F.wav'
# If play sound live while recording/processing
# If using mic input: no feedback protection, use headphones
play_sound = True
# Display or not the plot of time domain and frequency domain of full input and output signals
plot_end = False
# Plot some windows input and output frequency spectrum,
# (every 100 iterations of main for loop, this can open a lot of matplotlib windows)
# SLOW DOWNS A LOT THE CODE, CANT DO LIVE WITH THIS SET TO TRUE
# Set play_sound to false to use it
plot_window = False
# Key: to shift towards notes that belong to the key
# If want to use all notes: KEY='chromatic'
KEY = 'F'
# Window size (usually a power of two between 1024 and 8192)
WINDOW_SIZE = int(4096)
# Overlap: 0 ,0.5 or 0.75
WINDOW_OVERLAP = 0.75
# To specfiy amount of zero padding: change power of 2 for FFT_SIZE
# Power of 2 = 0 :no padding, 1: half signal half zeros , 2: one quarter signal three quarters 0 ...
# Good FFT size: 4096 or 8192
FFT_SIZE = 2**1 * WINDOW_SIZE
# Window functions
# Best setup: sine-sine
# If overlap 0: rect-rect automatically set
analysis_window_type = 'sine'
synthesis_window_type = 'sine'
# Set audio rate in Hz
RATE = 44100
# Threshold for silence function
SILENCE_THRESHOLD = 200
# Recording time if input_type is mic or sin
RECORD_SECONDS = 5
# Sinus frequency if input_type is sin
f = 466
# Output names
if input_type == 'sin':
WAVE_OUTPUT_FILENAME = "sin_" + str(f) + "_W" + str(WINDOW_SIZE) + "_FFT" + str(FFT_SIZE) + "_O" + \
str(WINDOW_OVERLAP) + '_w_ ' + analysis_window_type + '_' + synthesis_window_type + ".wav"
WAVE_OUTPUT_FILENAME_NO_MODIF = "sin_" + str(f) + ".wav"
elif input_type=='wav':
WAVE_OUTPUT_FILENAME = wavefile_name + "_W" + str(WINDOW_SIZE) + "_FFT" + str(FFT_SIZE) + "_O" + \
str(WINDOW_OVERLAP) + ".wav"
WAVE_OUTPUT_FILENAME_NO_MODIF = 'voice_no_modif.wav'
elif input_type=='mic':
WAVE_OUTPUT_FILENAME = "mic_W" + str(WINDOW_SIZE) + "_FFT" + str(FFT_SIZE) + "_O" + \
str(WINDOW_OVERLAP) + ".wav"
WAVE_OUTPUT_FILENAME_NO_MODIF = 'mic_no_modif.wav'