I'm working on processing signal from microphone. The input I have is just 12 values in list I must preprocess somehow. But the only one solution I find here is just to use multiple if blocks.
mic.init()
while True:
mic_map = mic.get_map()
print(len(mic_map[:]))
b = mic.get_dir(mic_map)
if b[0]:
print("-90 degree")
pass
elif b[1]:
print("-60 degree")
pass
elif b[2]:
print("-30 degree")
pass
elif b[3]:
print("0 degree")
pass
elif b[4]:
print("+30 degree")
pass
elif b[5]:
print("+60 degree")
pass
elif b[6]:
print("+90 degree")
pass
elif b[7]:
print("+120 degree")
pass
elif b[8]:
print("+150 degree")
pass
elif b[9]:
print("+-180 degree")
pass
elif b[10]:
print("-150 degree")
pass
elif b[11]:
print("-120 degree")
pass
Is there any possibilities to make better solution here. Thank you.
UPD. I'm sorry for not providing needed information about some methods.
mic.get_map()
is returning a list with 256 values, like an image.
And mic.get_dir()
returns a list with 12 values in it.