Created
July 22, 2019 16:21
-
-
Save wiccy46/1fdd01cc261a04e26b8f6092007a31f9 to your computer and use it in GitHub Desktop.
[bandwidth2q]Convert frequency bandwidth to q factor. #python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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