Skip to content

Instantly share code, notes, and snippets.

@wiccy46
Created July 22, 2019 16:21
Show Gist options
  • Select an option

  • Save wiccy46/1fdd01cc261a04e26b8f6092007a31f9 to your computer and use it in GitHub Desktop.

Select an option

Save wiccy46/1fdd01cc261a04e26b8f6092007a31f9 to your computer and use it in GitHub Desktop.
[bandwidth2q]Convert frequency bandwidth to q factor. #python
# This code covert formant bandwidth to q
import sys
f0 = map(float, sys.argv[1].strip('[]').split(','))
bw = map(float, sys.argv[2].strip('[]').split(','))
q = []
if (not len(f0)==len(bw)):
print "Error: Two arguments need to have the same lenght. "
print 'Usage: First argument list of fundamental frequency, e.g "[19, 299, 449]"'
print 'Second arugment list of bandwidth, e.g "[10, 30, 40]"'
print ""
else :
for i in range(len(f0)):
q.append(int(f0[i]/bw[i]))
print ""
print "Resonance: " + str(q)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment