2 Commits
final ... 1.0.2

Author SHA1 Message Date
Thomas Herrmann
54c8826467 Bufix OP-Z Not found error
Added Audio Device Detection (necessary in windows)
Improved Error feedback and MIDI port handling
2022-03-31 17:13:30 +02:00
Thomas Herrmann
e282eb960c Bugfix and audio optimizations
Changed to 48 kHz and reduced Buffersize to 128 for less delay in the beginning.
2022-03-31 00:40:07 +02:00
2 changed files with 33 additions and 14 deletions

BIN
dist/underbridge.exe vendored

Binary file not shown.

View File

@@ -12,6 +12,7 @@ import os
device_list = []
op_device = []
audio_device = []
loop_time = 0
inport = 0
outport = 0
@@ -36,15 +37,25 @@ def getMIDIDevice():
print (op_device)
displaymsg.set("OP-Z found")
except:
displaymsg.set("Can´t find OP-Z : MIDI Error")
displaymsg.set("Can´t find OP-Z : MIDI Error.")
def getAudioDevice():
global audio_device
p = pyaudio.PyAudio()
info = p.get_host_api_info_by_index(0)
numdevices = info.get('deviceCount')
for i in range(0, numdevices):
if (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0:
print("Input Device id ", i, " - ", p.get_device_info_by_host_api_device_index(0, i).get('name'))
try:
info = p.get_host_api_info_by_index(0)
numdevices = info.get('deviceCount')
for i in range(0, numdevices):
if (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0:
print("Input Device id ", i, " - ", p.get_device_info_by_host_api_device_index(0, i).get('name'))
for i in range(0, numdevices):
#audio_device = p.get_device_info_by_host_api_device_index(0, i).get('name')
if "OP-Z" in p.get_device_info_by_host_api_device_index(0, i).get('name') and (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0:
audio_device = i
print ("Detected OP-Z audio at Index:",audio_device, p.get_device_info_by_host_api_device_index(0, audio_device).get('name'))
except:
displaymsg.set("OP-Z Audio Device not found.")
def getBPM():
global op_device
@@ -123,7 +134,9 @@ def nextSong():
pass
def closeMidi():
pass
global outport
outport.close()
displaymsg.set("MIDI closed")
def setPath():
global path
@@ -159,26 +172,29 @@ def start_Rec():
global j
global pro
global pattern_nr
CHUNK = 1024
global audio_device
CHUNK = 128
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
RATE = 48000
RECORD_SECONDS = loop_time
WAVE_OUTPUT_FILENAME = name_input.get()+ "_" + "track" + str(j+1) + ".wav"
p = pyaudio.PyAudio()
start_MIDI()
stream = p.open(format=FORMAT,
channels=CHANNELS,
rate=RATE,
input=True,
input_device_index= audio_device,
frames_per_buffer=CHUNK
)
#print("* recording")
frames = []
start_MIDI()
for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
data = stream.read(CHUNK)
frames.append(data)
@@ -204,6 +220,7 @@ def start_Rec():
displaymsg.set("End of Recording")
def sequenceMaster():
global cancel
global pattern_nr
cancel = 0
@@ -246,13 +263,15 @@ def sequenceMaster():
pattern_nr = 0
sequenceMaster()
except:
displaymsg.set("OP-Z Audio Device Problem :(")
displaymsg.set("OP-Z Sequence error try restarting the OP-Z or press CANCEL Button")
def cancelRec():
global cancel
global outport
global j
j = 0
cancel = 1
closeMidi()
#GUI Main
buttonsize_x = 7