Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
54c8826467 | ||
|
e282eb960c |
BIN
dist/underbridge.exe
vendored
BIN
dist/underbridge.exe
vendored
Binary file not shown.
@@ -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
|
||||
@@ -122,8 +133,10 @@ def nextPattern():
|
||||
def nextSong():
|
||||
pass
|
||||
|
||||
def closeMidi():
|
||||
pass
|
||||
def closeMidi():
|
||||
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()
|
||||
p = pyaudio.PyAudio()
|
||||
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
|
||||
|
Reference in New Issue
Block a user