diff --git a/.gitignore b/.gitignore index 697e56f..3750a68 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -*.wav \ No newline at end of file +*.wav +config.json +.vscode \ No newline at end of file diff --git a/audioCircReplayTest.py b/audioCircReplayTest.py index fd9845b..7e1fbb0 100644 --- a/audioCircReplayTest.py +++ b/audioCircReplayTest.py @@ -3,14 +3,27 @@ import pyaudio, numpy, keyboard, time import scipy.io.wavfile as wav from sys import getsizeof import os +from os.path import exists +import json +import shutil -##### CONFIG ##### +##### CONFIG (Now read from file) ##### -RATE=48000 # Sample rate -RECORD_SECONDS = 20 # Seconds to record (aka. last X seconds) -SourcesToRecord = ["VoiceMeeter VAIO3 Output"] # Record all sources which contains these strings -SaveDirectory= "D:\AudioSnippetTool\Recordings" -shortcut = 'alt+1' +if(not exists("config.json")): + shutil.copy("config.json.example", "config.json") + print("No config found. Created default config") + +with open('config.json', 'r') as myfile: + data = myfile.read() + +# parse file +conf = json.loads(data) + +RATE = conf["SampleRate"] # Sample rate +RECORD_SECONDS = conf["SecondsToRecord"] # Seconds to record (aka. last X seconds) +SourcesToRecord = conf["SourcesToRecord"] # Record all sources which contains these strings +SaveDirectory= conf["SaveDirectory"] +shortcut = conf["Shortcut"] ##### CONFIG END (aka. DO NOT FRICKING TOUCHY) ##### diff --git a/config.json.example b/config.json.example new file mode 100644 index 0000000..b2e8db9 --- /dev/null +++ b/config.json.example @@ -0,0 +1,7 @@ +{ + "SampleRate": 48000, + "SecondsToRecord": 20, + "SourcesToRecord": [], + "SaveDirectory": ".", + "Shortcut": "alt+1" +} \ No newline at end of file