From e5e2ba7396b22cee86534b8e69dbca0d2ea165cf Mon Sep 17 00:00:00 2001 From: XilefTech <52332196+XilefTech@users.noreply.github.com> Date: Sat, 26 Jun 2021 16:31:08 +0200 Subject: [PATCH 1/4] added keyboard shortcut to the configs --- audioCircReplayTest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audioCircReplayTest.py b/audioCircReplayTest.py index 0ef20ff..16c35ab 100644 --- a/audioCircReplayTest.py +++ b/audioCircReplayTest.py @@ -7,7 +7,7 @@ from sys import getsizeof RATE=48000 # Sample rate RECORD_SECONDS = 20 # Seconds to record (aka. last X seconds) -SourcesToRecord = ["VoiceMeeter VAIO3 Output", "Aux"] # Record all sources which contains these strings +shortcut = 'alt+1' ##### CONFIG END (aka. DO NOT FRICKING TOUCHY) ##### From d767422d1542f1ef792b3c143e20cee685268e93 Mon Sep 17 00:00:00 2001 From: XilefTech <52332196+XilefTech@users.noreply.github.com> Date: Sat, 26 Jun 2021 16:32:09 +0200 Subject: [PATCH 2/4] added config option for recording save path --- audioCircReplayTest.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/audioCircReplayTest.py b/audioCircReplayTest.py index 16c35ab..63089f5 100644 --- a/audioCircReplayTest.py +++ b/audioCircReplayTest.py @@ -2,11 +2,13 @@ import pyaudio, numpy, keyboard, time import scipy.io.wavfile as wav from sys import getsizeof +import os ##### CONFIG ##### RATE=48000 # Sample rate RECORD_SECONDS = 20 # Seconds to record (aka. last X seconds) +SaveDirectory= "D:\AudioSnippetTool\Recordings" shortcut = 'alt+1' ##### CONFIG END (aka. DO NOT FRICKING TOUCHY) ##### @@ -45,17 +47,29 @@ while(i <= len(SourcesToRecord)): # Save the replay def on_triggered(): global cb, saves - print("Saving replay..", end = "") + + print("Saving replay...") + + # save current working directory and switch to saving path + cwd = os.getcwd() + os.chdir(SaveDirectory) + + # save the audio cutUpBuffers = [] i = 0 name = time.strftime("%Y-%m-%d_%H-%M-%S-out-") while(i < len(Frames) - 1): - wav.write(name + str(saves) + str(i) + '.wav',RATE,numpy.hstack(Frames[i][-320:])) + print("Saving file: " + name + str(saves) + str(i) + '.wav', "to", os.getcwd()) + wav.write(name + str(saves) + str(i) + '.wav', RATE, numpy.hstack(Frames[i][-320:])) i += 1 saves+=1 - print("[DONE]") -shortcut = 'alt+1' + # return back to original working directory + os.chdir(cwd) + print("Saving done") + + +# add the keyboard hotkey listener keyboard.add_hotkey(shortcut, on_triggered) print(" There are " + str(len(SourcesToRecord)) + " SourcesToRecord. Frames: " + str(len(Frames))) From 5d80086eabf2f5ca242776a5962c0fb08ee3c548 Mon Sep 17 00:00:00 2001 From: XilefTech <52332196+XilefTech@users.noreply.github.com> Date: Sun, 27 Jun 2021 12:24:40 +0200 Subject: [PATCH 3/4] re-added accidentally deleted line --- audioCircReplayTest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/audioCircReplayTest.py b/audioCircReplayTest.py index 63089f5..5d08862 100644 --- a/audioCircReplayTest.py +++ b/audioCircReplayTest.py @@ -8,6 +8,7 @@ import os RATE=48000 # Sample rate RECORD_SECONDS = 20 # Seconds to record (aka. last X seconds) +SourcesToRecord = ["VoiceMeeter VAIO3 Output", "Aux"] # Record all sources which contains these strings SaveDirectory= "D:\AudioSnippetTool\Recordings" shortcut = 'alt+1' @@ -92,6 +93,7 @@ try: cleanUp = False if(cleanUp): + print("cleanup") while(i < len(SourcesToRecord)): Frames[i] = Frames[i].pop(0) Frames[i] = Frames[i].pop(0) From f45166c9b82cb062778b58e9e537964e0defdf77 Mon Sep 17 00:00:00 2001 From: XilefTech <52332196+XilefTech@users.noreply.github.com> Date: Sun, 27 Jun 2021 12:25:49 +0200 Subject: [PATCH 4/4] why did this get commited as well? --- audioCircReplayTest.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/audioCircReplayTest.py b/audioCircReplayTest.py index 5d08862..fd9845b 100644 --- a/audioCircReplayTest.py +++ b/audioCircReplayTest.py @@ -8,7 +8,7 @@ import os RATE=48000 # Sample rate RECORD_SECONDS = 20 # Seconds to record (aka. last X seconds) -SourcesToRecord = ["VoiceMeeter VAIO3 Output", "Aux"] # Record all sources which contains these strings +SourcesToRecord = ["VoiceMeeter VAIO3 Output"] # Record all sources which contains these strings SaveDirectory= "D:\AudioSnippetTool\Recordings" shortcut = 'alt+1' @@ -93,7 +93,6 @@ try: cleanUp = False if(cleanUp): - print("cleanup") while(i < len(SourcesToRecord)): Frames[i] = Frames[i].pop(0) Frames[i] = Frames[i].pop(0)