Some more documentation

This commit is contained in:
2022-06-22 17:34:14 +02:00
parent e66f20bb68
commit 4c233abbb9
2 changed files with 20 additions and 7 deletions

View File

@ -1 +1,13 @@
# Audio sampler # Audio sampler
Audio sampler is a tool to record the last `SecondsToRecord` from one or multiple sources. This utility will only record at max stereoaudio.
## Config
`SampleRate` the sample rate to record with, recommended default is `48000`
`SecondsToRecord` amount of seconds to keep in memory and save when triggered.
`SourcesToRecord` a list of audiodevices which will be recorded.
`SaveDirectory` the path of the save folder, meaning the folder they will be saved in.
`Shortcut` the shortcut which will trigger to save the recording.

View File

@ -22,26 +22,27 @@ conf = json.loads(data)
RATE = conf["SampleRate"] # Sample rate RATE = conf["SampleRate"] # Sample rate
RECORD_SECONDS = conf["SecondsToRecord"] # Seconds to record (aka. last X seconds) RECORD_SECONDS = conf["SecondsToRecord"] # Seconds to record (aka. last X seconds)
SourcesToRecord = conf["SourcesToRecord"] # Record all sources which contains these strings SourcesToRecord = conf["SourcesToRecord"] # Record all sources which contains these strings
SaveDirectory= conf["SaveDirectory"] SaveDirectory= conf["SaveDirectory"] # The directory to save to
shortcut = conf["Shortcut"] shortcut = conf["Shortcut"] # The shortcut to trigger the save
##### CONFIG END (aka. DO NOT FRICKING TOUCHY) ##### ##### CONFIG END #####
CHUNKSIZE = 1024*2 CHUNKSIZE = 1024*2
print("Searching for audio sources") print("Searching for audio sources")
Sources = [] Sources = []
AudioChannels = [] AudioChannels = []
Frames = [] Frames = []
p = pyaudio.PyAudio() p = pyaudio.PyAudio() # An instance of PyAudio
info = p.get_host_api_info_by_index(0) info = p.get_host_api_info_by_index(0)
numdevices = info.get('deviceCount') numdevices = info.get('deviceCount') # The amount of audio devices
samplesI = 0 samplesI = 0
saves = 0 saves = 0
cleanUp = False cleanUp = False
incomingAudioChan = -1 incomingAudioChan = -1
localAudioChan = -1 localAudioChan = -1
## Find the acutal device pointers ## Find the actual device pointers
for i in range(0, numdevices): for i in range(0, numdevices):
if (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0: if (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0:
i2 = 0 i2 = 0