Skip to content

Commit

Permalink
More models and configs added
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Jordan authored and Matt Jordan committed Aug 25, 2023
1 parent 10c100c commit 80ba70f
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# NEURAL NETWORKS
madmom/piracy/tcn_models/*
# Compiled Python files
*.pyc

Expand Down
46 changes: 24 additions & 22 deletions bin/DBNBeatTracker
Original file line number Diff line number Diff line change
Expand Up @@ -85,28 +85,30 @@ def main():
audio_instance = pyaudio.PyAudio()

# first collect host apis to find the index of the 'WASAPI'
target_api = r'WASAPI'
wasapi_index = None
host_api_infos = []
for idx in range(audio_instance.get_host_api_count()):
host_api_info = audio_instance.get_host_api_info_by_index(idx)
host_api_infos.append(host_api_info)
if re.search(target_api, host_api_info['name']) is not None:
wasapi_index = idx
break

if wasapi_index is None:
print("WASAPI API not found in list of host API's...")
for info_dict in host_api_infos:
print(info_dict['name'])
raise Exception("No WASAPI INDEX FOUND!")


p.add_argument('--host_api', action='store_const', dest='host_api',
default=wasapi_index, const=wasapi_index)
p.add_argument('--audio_input', action='store', dest='audio_input',
type=int, help='Which input index we want to use')

try:
target_api = r'WASAPI'
wasapi_index = None
host_api_infos = []
for idx in range(audio_instance.get_host_api_count()):
host_api_info = audio_instance.get_host_api_info_by_index(idx)
host_api_infos.append(host_api_info)
if re.search(target_api, host_api_info['name']) is not None:
wasapi_index = idx
break

if wasapi_index is None:
print("WASAPI API not found in list of host API's...")
for info_dict in host_api_infos:
print(info_dict['name'])
raise Exception("No WASAPI INDEX FOUND!")


p.add_argument('--host_api', action='store_const', dest='host_api',
default=wasapi_index, const=wasapi_index)
p.add_argument('--audio_input', action='store', dest='audio_input',
type=int, help='Which input index we want to use')
except:
print("WARNING WASAPI NOT FOUND")
# ****************************************************************************
# * END CUSTOM BLOCK -- BACK TO STANDARD MADMOM CODE *
# ****************************************************************************
Expand Down
46 changes: 24 additions & 22 deletions bin/TorchBeatTracker
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,30 @@ def main():
audio_instance = pyaudio.PyAudio()

# first collect host apis to find the index of the 'WASAPI'
target_api = r'WASAPI'
wasapi_index = None
host_api_infos = []
for idx in range(audio_instance.get_host_api_count()):
host_api_info = audio_instance.get_host_api_info_by_index(idx)
host_api_infos.append(host_api_info)
if re.search(target_api, host_api_info['name']) is not None:
wasapi_index = idx
break

if wasapi_index is None:
print("WASAPI API not found in list of host API's...")
for info_dict in host_api_infos:
print(info_dict['name'])
raise Exception("No WASAPI INDEX FOUND!")


p.add_argument('--host_api', action='store_const', dest='host_api',
default=wasapi_index, const=wasapi_index)
p.add_argument('--audio_input', action='store', dest='audio_input',
type=int, help='Which input index we want to use')

try:
target_api = r'WASAPI'
wasapi_index = None
host_api_infos = []
for idx in range(audio_instance.get_host_api_count()):
host_api_info = audio_instance.get_host_api_info_by_index(idx)
host_api_infos.append(host_api_info)
if re.search(target_api, host_api_info['name']) is not None:
wasapi_index = idx
break

if wasapi_index is None:
print("WASAPI API not found in list of host API's...")
for info_dict in host_api_infos:
print(info_dict['name'])
raise Exception("No WASAPI INDEX FOUND!")


p.add_argument('--host_api', action='store_const', dest='host_api',
default=wasapi_index, const=wasapi_index)
p.add_argument('--audio_input', action='store', dest='audio_input',
type=int, help='Which input index we want to use')
except:
print("WARNING: WASAPI NOT FOUND")
# ****************************************************************************
# * END CUSTOM BLOCK -- BACK TO STANDARD MADMOM CODE *
# ****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion madmom/features/beats.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__(self, post_processor=average_predictions, online=False,
# process the pre-processed signal with a NN ensemble and the given
# post_processor
if use_torch:
from ..piracy import TORCH_TCN_REG
from ..piracy import TORCH_TCN_REG, TORCH_TCN_SMALL, TORCH_TCN_TINY
nn = TorchTCN(**TORCH_TCN_REG)
else:
nn = NeuralNetworkEnsemble.load(nn_files,
Expand Down
16 changes: 15 additions & 1 deletion madmom/piracy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
'hist_len': 10*100,
'kernel_size': 5,
'buffer_size': 10,
'torch_loc': 'madmom/piracy/tcn_models/reg_latest.ckpt'}
'torch_loc': 'madmom/piracy/tcn_models/reg/step_100000.ckpt'}

TORCH_TCN_SMALL = {'input_size': 162,
'hidden_size': 50,
'num_layers': 5,
'kernel_size': 5,
'hist_len': 10*100,
'buffer_size': 10,
'torch_loc': 'madmom/piracy/tcn_models/small/step_050000.ckpt'}

TORCH_TCN_TINY = {'input_size': 162,
'hidden_size': 25,
'num_layers': 3,
'kernel_size': 5,
'hist_len': 10*1000,
'buffer_size': 5,
'torch_loc': 'madmom/piracy/tcn_models/tiny/step_050000.ckpt'}

0 comments on commit 80ba70f

Please sign in to comment.