-
Notifications
You must be signed in to change notification settings - Fork 644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementing Kaldi Spectrogram #119
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
aa91ff2
adding function signature
jamarshon 171a846
adding function signature2
jamarshon e59d1bc
pow2
jamarshon 555b530
add test
jamarshon fcb34b5
more
jamarshon 6da16c8
implement strides
jamarshon ac8e279
more
jamarshon 4c22533
done
jamarshon 275e09b
compare kaldi with function
jamarshon 6da401b
add files
jamarshon 9486ace
mse < 5
jamarshon 3fbf2d9
mse < 1e-5
jamarshon 76d6baa
remove print
jamarshon a1d0a2b
abs
jamarshon 733f8d1
remove return
jamarshon 2c73928
done
jamarshon 1da2428
push
jamarshon 1e25535
flake8
jamarshon 64bbf47
update comment
jamarshon e749923
apply feedback: all constants
jamarshon e37013f
apply feedback
jamarshon 2d2e881
rename data files to have prefix spec
jamarshon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+141 Bytes
...ets/kaldi/spec-0.0016-0-4.6680-0.6250-0.2500-0.82-false-false-false-false-false-povey.ark
Binary file not shown.
Binary file added
BIN
+117 Bytes
...aldi/spec-0.0121-0-4.9643-0.8750-0.1875-0.98-false-false-false-true-false-rectangular.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
...ets/kaldi/spec-0.0378-0-3.7770-0.5000-0.6250-0.76-false-true-true-true-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...ssets/kaldi/spec-0.0545-0-0.0732-1.0000-0.7500-0.81-false-true-true-true-true-hanning.ark
Binary file not shown.
Binary file added
BIN
+93 Bytes
...ts/kaldi/spec-0.1005-0-0.3739-0.5625-0.6250-0.19-false-false-true-true-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
...assets/kaldi/spec-0.1088-0-0.6933-0.5000-0.7500-0.51-true-true-false-true-false-povey.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...ts/kaldi/spec-0.1777-0-3.8992-1.0000-0.3125-0.96-true-false-false-true-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+81 Bytes
...assets/kaldi/spec-0.2043-0-1.9538-0.5000-0.3750-0.96-true-false-true-false-true-povey.ark
Binary file not shown.
Binary file added
BIN
+101 Bytes
...ssets/kaldi/spec-0.2384-0-0.3080-0.3750-0.2500-0.98-true-false-false-false-true-povey.ark
Binary file not shown.
Binary file added
BIN
+45 Bytes
...ts/kaldi/spec-0.2669-0-2.4329-0.6250-1.1875-0.18-false-true-false-true-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+149 Bytes
...sets/kaldi/spec-0.3067-0-2.7461-0.3750-0.1250-0.52-true-false-false-true-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+45 Bytes
...ets/kaldi/spec-0.3340-0-0.5962-0.2500-0.5625-0.38-false-false-true-false-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+453 Bytes
...ssets/kaldi/spec-0.4268-0-2.4431-0.5625-0.0625-0.95-true-true-true-true-false-hamming.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
...assets/kaldi/spec-0.4774-0-0.6982-1.1250-1.1250-0.27-false-true-false-true-true-povey.ark
Binary file not shown.
Binary file added
BIN
+129 Bytes
...assets/kaldi/spec-0.4828-0-2.6861-0.6875-0.3750-0.15-true-false-true-false-true-povey.ark
Binary file not shown.
Binary file added
BIN
+41 Bytes
...kaldi/spec-0.4992-0-3.7665-0.4375-1.1250-0.42-false-false-true-false-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...ts/kaldi/spec-0.5440-0-1.6641-0.9375-0.8750-0.13-true-true-true-true-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
...s/kaldi/spec-0.5785-0-2.8162-1.1250-1.0625-0.17-false-false-false-true-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+93 Bytes
...ssets/kaldi/spec-0.7797-0-2.5119-0.6250-0.5000-0.69-true-false-false-false-true-povey.ark
Binary file not shown.
Binary file added
BIN
+41 Bytes
...ets/kaldi/spec-0.8072-0-4.0404-0.5000-1.1875-0.74-false-false-false-true-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+101 Bytes
...ets/kaldi/spec-0.8418-0-4.1771-0.3125-0.2500-0.48-false-false-true-true-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+93 Bytes
...ssets/kaldi/spec-0.8431-0-0.0728-0.7500-0.8125-0.10-true-false-true-false-false-povey.ark
Binary file not shown.
Binary file added
BIN
+53 Bytes
...ts/kaldi/spec-0.8850-0-3.9292-0.3750-0.7500-0.27-true-false-false-true-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...ets/kaldi/spec-0.9625-0-2.5481-0.6875-1.0000-0.06-false-true-true-true-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
...kaldi/spec-0.9826-0-0.7377-0.3750-0.6875-0.70-false-false-true-false-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+33 Bytes
...ssets/kaldi/spec-0.9854-0-3.8819-0.2500-1.0000-0.54-true-false-false-false-true-povey.ark
Binary file not shown.
Binary file added
BIN
+157 Bytes
...ets/kaldi/spec-0.9864-0-3.6583-1.0625-0.6250-0.23-false-false-true-false-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+53 Bytes
...ts/kaldi/spec-1.0303-0-4.4583-0.3750-0.8750-0.39-false-true-false-true-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+89 Bytes
...assets/kaldi/spec-1.0743-0-0.4642-1.1250-0.6250-0.39-true-true-true-true-true-hanning.ark
Binary file not shown.
Binary file added
BIN
+69 Bytes
...assets/kaldi/spec-1.0788-0-1.4420-0.1875-0.3125-0.53-true-true-true-true-true-hanning.ark
Binary file not shown.
Binary file added
BIN
+341 Bytes
...ssets/kaldi/spec-1.0802-0-4.5077-0.8750-0.1250-0.54-true-false-false-false-true-povey.ark
Binary file not shown.
Binary file added
BIN
+45 Bytes
...ets/kaldi/spec-1.0816-0-0.2050-0.1875-0.6875-0.02-false-false-true-true-false-hamming.ark
Binary file not shown.
Binary file added
BIN
+117 Bytes
...ts/kaldi/spec-1.1385-0-4.7380-0.6250-0.3125-0.23-true-false-false-false-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+237 Bytes
test/assets/kaldi/spec-1.1575-0-3.0941-0.5625-0.1250-1.00-true-true-true-true-true-povey.ark
Binary file not shown.
Binary file added
BIN
+245 Bytes
...ts/kaldi/spec-1.3142-0-4.8914-0.8750-0.1875-0.34-true-true-false-false-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
...ts/kaldi/spec-1.3189-0-3.6830-1.1250-1.1250-0.88-false-false-false-false-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+33 Bytes
...ts/kaldi/spec-1.3235-0-3.8538-0.2500-1.0625-0.07-false-false-true-false-true-blackman.ark
Binary file not shown.
Binary file added
BIN
+53 Bytes
...s/kaldi/spec-1.3389-0-1.6152-0.3750-0.5000-0.21-false-false-false-true-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+273 Bytes
...ets/kaldi/spec-1.3612-0-2.9585-0.8750-0.0625-0.66-false-false-true-true-true-blackman.ark
Binary file not shown.
Binary file added
BIN
+221 Bytes
...ts/kaldi/spec-1.3887-0-3.3198-0.3750-0.1250-0.14-false-false-true-false-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+129 Bytes
...sets/kaldi/spec-1.4127-0-2.6264-0.8750-0.3750-0.69-false-false-true-false-false-povey.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...sets/kaldi/spec-1.5178-0-2.8631-1.0000-0.8125-0.95-true-true-true-true-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+361 Bytes
...ts/kaldi/spec-1.5403-0-0.0133-1.1875-0.2500-0.59-true-false-true-false-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+105 Bytes
...kaldi/spec-1.5551-0-3.0664-0.7500-0.3750-0.18-false-true-false-false-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+181 Bytes
...ets/kaldi/spec-1.5669-0-0.5190-0.8750-0.2500-0.56-true-true-false-false-true-blackman.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
.../kaldi/spec-1.5754-0-0.9540-1.0000-0.9375-0.20-false-false-true-true-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...ssets/kaldi/spec-1.5959-0-0.9033-0.7500-1.0000-0.14-true-true-true-true-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...kaldi/spec-1.6923-0-3.5626-0.6875-1.0625-0.27-true-false-true-false-false-rectangular.ark
Binary file not shown.
Binary file added
BIN
+89 Bytes
...s/kaldi/spec-1.6972-0-1.0863-1.1875-0.8750-0.86-true-true-true-true-false-rectangular.ark
Binary file not shown.
Binary file added
BIN
+221 Bytes
...ets/kaldi/spec-1.7440-0-0.5308-0.5000-0.1250-0.33-true-true-false-false-false-hamming.ark
Binary file not shown.
Binary file added
BIN
+45 Bytes
...ts/kaldi/spec-1.7642-0-0.4833-0.2500-0.8125-0.94-false-true-false-true-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+121 Bytes
...ets/kaldi/spec-1.8072-0-0.8085-0.5000-0.2500-0.96-false-true-true-false-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+273 Bytes
.../kaldi/spec-1.8468-0-2.0534-1.0000-0.1875-0.35-false-true-true-false-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...sets/kaldi/spec-1.8836-0-4.5145-0.8750-1.0625-0.40-false-false-true-true-true-hanning.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
...ts/kaldi/spec-1.8946-0-4.1442-0.3125-0.8750-0.73-true-true-true-true-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+89 Bytes
...assets/kaldi/spec-1.8988-0-3.0931-1.0625-0.3125-0.35-true-true-true-true-true-hanning.ark
Binary file not shown.
Binary file added
BIN
+129 Bytes
...ets/kaldi/spec-1.9093-0-2.4939-0.7500-0.5000-0.47-true-false-true-false-true-blackman.ark
Binary file not shown.
Binary file added
BIN
+121 Bytes
...ets/kaldi/spec-1.9501-0-4.3519-0.4375-0.2500-0.61-false-false-true-false-true-hanning.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...s/kaldi/spec-2.0137-0-3.1007-0.6250-1.0625-0.67-true-false-true-true-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+93 Bytes
...ts/kaldi/spec-2.0175-0-2.9099-1.0000-0.5625-0.28-true-false-true-false-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+33 Bytes
...ssets/kaldi/spec-2.1114-0-4.5618-0.2500-0.8750-0.61-true-true-false-false-false-povey.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
...ssets/kaldi/spec-2.1472-0-0.2000-1.1250-0.8750-0.58-true-true-false-true-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+85 Bytes
...sets/kaldi/spec-2.1947-0-1.8065-0.8750-0.7500-0.45-false-true-false-false-false-povey.ark
Binary file not shown.
Binary file added
BIN
+77 Bytes
...ets/kaldi/spec-2.2457-0-1.7040-0.7500-0.5625-0.98-true-false-false-false-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...ets/kaldi/spec-2.2893-0-1.0286-0.2500-0.5000-0.80-true-false-true-false-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...s/kaldi/spec-2.3371-0-4.4192-0.8125-0.6250-0.30-true-false-true-true-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...ssets/kaldi/spec-2.3789-0-3.0234-0.1875-0.3750-0.54-true-false-true-true-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+33 Bytes
.../assets/kaldi/spec-2.3831-0-4.8325-0.2500-1.1250-0.34-true-true-true-false-true-povey.ark
Binary file not shown.
Binary file added
BIN
+165 Bytes
...sets/kaldi/spec-2.4230-0-0.6363-0.8750-0.3125-0.77-true-true-true-false-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
.../kaldi/spec-2.4378-0-1.4617-0.9375-0.3750-0.53-true-false-true-true-false-rectangular.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...aldi/spec-2.4454-0-1.9360-1.0000-0.9375-0.66-false-true-false-false-false-rectangular.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
.../kaldi/spec-2.4480-0-3.8782-0.5625-1.1250-0.10-false-true-true-false-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+53 Bytes
...ts/kaldi/spec-2.5164-0-2.7455-0.8750-0.9375-0.55-false-true-false-false-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+77 Bytes
...aldi/spec-2.5316-0-2.3286-0.7500-0.7500-0.61-false-false-false-false-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+89 Bytes
...ssets/kaldi/spec-2.5487-0-3.8457-1.1875-0.9375-0.63-true-true-true-true-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
.../kaldi/spec-2.6121-0-4.3165-0.6875-1.1875-0.19-false-true-true-true-false-rectangular.ark
Binary file not shown.
Binary file added
BIN
+101 Bytes
...sets/kaldi/spec-2.6768-0-2.4181-1.1250-0.6875-0.14-true-true-false-false-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+93 Bytes
...aldi/spec-2.6988-0-2.3417-1.0000-0.6875-0.38-false-false-true-false-false-rectangular.ark
Binary file not shown.
Binary file added
BIN
+45 Bytes
...ets/kaldi/spec-2.7457-0-1.3662-0.2500-0.8750-0.74-false-true-false-true-true-blackman.ark
Binary file not shown.
Binary file added
BIN
+41 Bytes
...ets/kaldi/spec-2.8577-0-4.1431-0.3750-1.0000-1.00-false-true-true-false-false-hamming.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...ts/kaldi/spec-2.8693-0-4.3801-0.7500-1.0000-0.95-true-true-true-true-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
...sets/kaldi/spec-2.8888-0-0.4078-0.3125-0.6250-0.25-false-true-true-true-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+157 Bytes
...ts/kaldi/spec-2.9074-0-1.6849-1.1250-0.6250-0.79-false-true-true-false-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
...s/kaldi/spec-2.9303-0-3.5172-0.5000-0.5000-0.04-true-false-true-true-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+49 Bytes
...ssets/kaldi/spec-3.0700-0-3.5254-0.7500-0.8750-0.96-false-true-false-true-false-povey.ark
Binary file not shown.
Binary file added
BIN
+81 Bytes
.../assets/kaldi/spec-3.1297-0-0.3513-0.4375-0.3125-0.20-true-true-true-true-false-povey.ark
Binary file not shown.
Binary file added
BIN
+81 Bytes
...sets/kaldi/spec-3.2080-0-1.8656-0.3125-0.4375-0.55-false-false-true-true-true-hanning.ark
Binary file not shown.
Binary file added
BIN
+101 Bytes
.../kaldi/spec-3.2523-0-3.5376-0.3125-0.2500-0.46-false-false-true-true-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+221 Bytes
...aldi/spec-3.3896-0-0.4666-1.1250-0.2500-0.05-false-true-false-false-false-rectangular.ark
Binary file not shown.
Binary file added
BIN
+41 Bytes
...sets/kaldi/spec-3.5370-0-1.7032-0.3750-0.8750-0.17-false-true-true-false-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+45 Bytes
...ts/kaldi/spec-3.5378-0-3.6594-0.2500-0.6250-0.54-true-true-true-true-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...sets/kaldi/spec-3.5847-0-3.6357-1.0000-0.3125-0.79-false-false-false-true-false-povey.ark
Binary file not shown.
Binary file added
BIN
+89 Bytes
...ets/kaldi/spec-3.6057-0-1.6902-1.0625-0.6875-0.65-false-true-true-true-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+341 Bytes
...s/kaldi/spec-3.6308-0-1.1407-0.3125-0.0625-0.17-false-true-true-true-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
.../kaldi/spec-3.6498-0-0.2005-0.9375-1.1250-0.37-false-true-true-false-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+45 Bytes
...ets/kaldi/spec-3.6648-0-4.6742-0.6250-1.1875-0.88-false-true-false-true-true-blackman.ark
Binary file not shown.
Binary file added
BIN
+93 Bytes
...sets/kaldi/spec-3.6701-0-3.7451-0.8125-0.2500-0.19-true-false-true-true-true-blackman.ark
Binary file not shown.
Binary file added
BIN
+37 Bytes
...kaldi/spec-3.7232-0-0.4912-0.3750-0.8750-0.34-false-true-false-false-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+45 Bytes
.../kaldi/spec-3.7605-0-1.6813-0.2500-0.5625-0.27-true-true-true-false-false-rectangular.ark
Binary file not shown.
Binary file added
BIN
+93 Bytes
...assets/kaldi/spec-3.7632-0-3.7271-0.6875-0.3125-0.86-true-true-true-true-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+89 Bytes
...sets/kaldi/spec-3.7759-0-1.7002-1.0625-0.6875-0.42-false-false-true-true-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+33 Bytes
...ets/kaldi/spec-3.7921-0-3.4087-0.2500-1.0000-0.54-true-true-true-false-false-blackman.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
...ets/kaldi/spec-3.7954-0-3.5651-0.5000-0.8125-0.06-false-true-true-false-true-blackman.ark
Binary file not shown.
Binary file added
BIN
+45 Bytes
...sets/kaldi/spec-3.7990-0-3.0026-0.6250-1.0000-0.82-false-true-false-true-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+89 Bytes
...ssets/kaldi/spec-3.8659-0-1.7487-1.1875-0.3750-1.00-true-true-true-true-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
...sets/kaldi/spec-3.9039-0-3.8315-0.3125-0.7500-0.55-false-true-true-false-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
.../kaldi/spec-3.9510-0-0.3903-1.1250-1.0000-0.41-true-false-false-true-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...kaldi/spec-3.9659-0-3.8318-0.1875-0.3750-0.58-false-false-true-false-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...ets/kaldi/spec-4.0045-0-3.0610-0.6250-1.0625-0.74-false-false-true-false-true-hanning.ark
Binary file not shown.
Binary file added
BIN
+53 Bytes
...ets/kaldi/spec-4.0187-0-4.8148-0.3750-0.6875-0.68-true-true-false-false-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+89 Bytes
...ts/kaldi/spec-4.0320-0-2.2019-1.1250-0.2500-0.78-true-true-true-true-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+141 Bytes
...s/kaldi/spec-4.0468-0-0.5053-0.3125-0.1875-0.52-false-true-true-true-true-rectangular.ark
Binary file not shown.
Binary file added
BIN
+45 Bytes
...ets/kaldi/spec-4.0627-0-4.1729-0.6250-1.1250-0.89-false-false-false-false-false-povey.ark
Binary file not shown.
Binary file added
BIN
+89 Bytes
...ssets/kaldi/spec-4.0736-0-0.9155-1.0625-0.5625-0.82-false-true-true-true-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+221 Bytes
...ets/kaldi/spec-4.1131-0-3.9204-0.5000-0.1250-0.39-false-true-true-false-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+93 Bytes
.../kaldi/spec-4.1816-0-1.6650-0.8125-0.3750-0.37-true-false-true-true-false-rectangular.ark
Binary file not shown.
Binary file added
BIN
+45 Bytes
...ets/kaldi/spec-4.1897-0-1.2668-0.1875-0.6250-0.74-true-false-true-false-false-hamming.ark
Binary file not shown.
Binary file added
BIN
+221 Bytes
...ets/kaldi/spec-4.2217-0-3.6775-0.3125-0.1250-0.01-true-false-true-false-false-hamming.ark
Binary file not shown.
Binary file added
BIN
+93 Bytes
...ets/kaldi/spec-4.2785-0-0.7201-0.8125-0.8125-0.30-false-false-true-false-true-hanning.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...ssets/kaldi/spec-4.3304-0-1.0538-0.8750-1.1250-0.92-true-false-true-false-false-povey.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...sets/kaldi/spec-4.3942-0-3.9813-0.7500-0.6875-0.27-false-true-true-true-true-blackman.ark
Binary file not shown.
Binary file added
BIN
+61 Bytes
...ets/kaldi/spec-4.4432-0-2.0441-0.5000-0.6875-0.77-false-false-true-true-false-hanning.ark
Binary file not shown.
Binary file added
BIN
+105 Bytes
...ets/kaldi/spec-4.4459-0-0.5135-0.2500-0.1875-0.29-false-false-true-false-true-hanning.ark
Binary file not shown.
Binary file added
BIN
+261 Bytes
...sets/kaldi/spec-4.4807-0-3.5660-0.6250-0.1250-0.08-false-true-false-false-false-povey.ark
Binary file not shown.
Binary file added
BIN
+33 Bytes
...ets/kaldi/spec-4.5486-0-1.3248-0.1875-1.1250-0.91-false-false-true-false-true-hanning.ark
Binary file not shown.
Binary file added
BIN
+41 Bytes
...ssets/kaldi/spec-4.5535-0-2.1772-0.4375-0.8750-0.21-true-false-true-true-true-hanning.ark
Binary file not shown.
Binary file added
BIN
+57 Bytes
...ssets/kaldi/spec-4.5835-0-0.3781-0.8750-0.8750-0.04-true-false-true-true-true-hamming.ark
Binary file not shown.
Binary file added
BIN
+133 Bytes
...ts/kaldi/spec-4.5882-0-1.0111-0.3750-0.1875-0.78-false-true-false-false-true-blackman.ark
Binary file not shown.
Binary file added
BIN
+101 Bytes
...kaldi/spec-4.6297-0-2.4900-0.5000-0.2500-0.03-false-false-true-true-false-rectangular.ark
Binary file not shown.
Binary file added
BIN
+81 Bytes
...sets/kaldi/spec-4.6749-0-4.8853-0.2500-0.2500-0.48-false-true-false-false-false-povey.ark
Binary file not shown.
Binary file added
BIN
+53 Bytes
...ts/kaldi/spec-4.6971-0-1.3632-0.8750-0.9375-0.44-false-true-false-true-false-blackman.ark
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import random | ||
|
||
# Path to the compute-spectrogram-feats executable. | ||
EXE_PATH = '/scratch/jamarshon/kaldi/src/featbin/compute-spectrogram-feats' | ||
|
||
# Path to the scp file. An example of its contents would be "my_id /scratch/jamarshon/audio/test/assets/kaldi_file.wav" | ||
# where the space separates an id from a wav file. | ||
SCP_PATH = 'scp:/scratch/jamarshon/downloads/a.scp' | ||
# The directory to which the stft features will be written to. | ||
OUTPUT_DIR = 'ark:/scratch/jamarshon/audio/test/assets/kaldi/' | ||
|
||
# The number of samples inside the input wave file read from `SCP_PATH` | ||
WAV_LEN = 20 | ||
|
||
# How many output files should be generated. | ||
NUMBER_OF_OUTPUTS = 100 | ||
|
||
WINDOWS = ['hamming', 'hanning', 'povey', 'rectangular', 'blackman'] | ||
|
||
|
||
def generate_rand_boolean(): | ||
# Generates a random boolean ('true', 'false') | ||
return 'true' if random.randint(0, 1) else 'false' | ||
|
||
|
||
def generate_rand_window_type(): | ||
# Generates a random window type | ||
return WINDOWS[random.randint(0, len(WINDOWS) - 1)] | ||
|
||
|
||
def run(): | ||
for i in range(NUMBER_OF_OUTPUTS): | ||
inputs = { | ||
'blackman_coeff': '%.4f' % (random.random() * 5), | ||
'dither': '0', | ||
'energy_floor': '%.4f' % (random.random() * 5), | ||
'frame_length': '%.4f' % (float(random.randint(2, WAV_LEN - 1)) / 16000 * 1000), | ||
'frame_shift': '%.4f' % (float(random.randint(1, WAV_LEN - 1)) / 16000 * 1000), | ||
'preemphasis_coefficient': '%.2f' % random.random(), | ||
'raw_energy': generate_rand_boolean(), | ||
'remove_dc_offset': generate_rand_boolean(), | ||
'round_to_power_of_two': generate_rand_boolean(), | ||
'snip_edges': generate_rand_boolean(), | ||
'subtract_mean': generate_rand_boolean(), | ||
'window_type': generate_rand_window_type() | ||
} | ||
|
||
fn = 'spec-' + ('-'.join(list(inputs.values()))) | ||
|
||
arg = [ | ||
EXE_PATH, | ||
'--blackman-coeff=' + inputs['blackman_coeff'], | ||
'--dither=' + inputs['dither'], | ||
'--energy-floor=' + inputs['energy_floor'], | ||
'--frame-length=' + inputs['frame_length'], | ||
'--frame-shift=' + inputs['frame_shift'], | ||
'--preemphasis-coefficient=' + inputs['preemphasis_coefficient'], | ||
'--raw-energy=' + inputs['raw_energy'], | ||
'--remove-dc-offset=' + inputs['remove_dc_offset'], | ||
'--round-to-power-of-two=' + inputs['round_to_power_of_two'], | ||
'--sample-frequency=16000', | ||
'--snip-edges=' + inputs['snip_edges'], | ||
'--subtract-mean=' + inputs['subtract_mean'], | ||
'--window-type=' + inputs['window_type'], | ||
SCP_PATH, | ||
OUTPUT_DIR + fn + '.ark' | ||
] | ||
|
||
print(fn) | ||
print(inputs) | ||
print(' '.join(arg)) | ||
|
||
try: | ||
subprocess.call(arg) | ||
except Exception: | ||
pass | ||
|
||
|
||
if __name__ == '__main__': | ||
run() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
import math | ||
import os | ||
import test.common_utils | ||
import torch | ||
import torchaudio | ||
import torchaudio.compliance.kaldi as kaldi | ||
import unittest | ||
|
||
|
||
def extract_window(window, wave, f, frame_length, frame_shift, snip_edges): | ||
# just a copy of ExtractWindow from feature-window.cc in python | ||
def first_sample_of_frame(frame, window_size, window_shift, snip_edges): | ||
if snip_edges: | ||
return frame * window_shift | ||
else: | ||
midpoint_of_frame = frame * window_shift + window_shift // 2 | ||
beginning_of_frame = midpoint_of_frame - window_size // 2 | ||
return beginning_of_frame | ||
|
||
sample_offset = 0 | ||
num_samples = sample_offset + wave.size(0) | ||
start_sample = first_sample_of_frame(f, frame_length, frame_shift, snip_edges) | ||
end_sample = start_sample + frame_length | ||
|
||
if snip_edges: | ||
assert(start_sample >= sample_offset and end_sample <= num_samples) | ||
else: | ||
assert(sample_offset == 0 or start_sample >= sample_offset) | ||
|
||
wave_start = start_sample - sample_offset | ||
wave_end = wave_start + frame_length | ||
if wave_start >= 0 and wave_end <= wave.size(0): | ||
window[f, :] = wave[wave_start:(wave_start + frame_length)] | ||
else: | ||
wave_dim = wave.size(0) | ||
for s in range(frame_length): | ||
s_in_wave = s + wave_start | ||
while s_in_wave < 0 or s_in_wave >= wave_dim: | ||
if s_in_wave < 0: | ||
s_in_wave = - s_in_wave - 1 | ||
else: | ||
s_in_wave = 2 * wave_dim - 1 - s_in_wave | ||
window[f, s] = wave[s_in_wave] | ||
|
||
|
||
class Test_Kaldi(unittest.TestCase): | ||
test_dirpath, test_dir = test.common_utils.create_temp_assets_dir() | ||
test_filepath = os.path.join(test_dirpath, 'assets', 'kaldi_file.wav') | ||
|
||
def _test_get_strided_helper(self, num_samples, window_size, window_shift, snip_edges): | ||
waveform = torch.arange(num_samples).float() | ||
output = kaldi._get_strided(waveform, window_size, window_shift, snip_edges) | ||
|
||
# from NumFrames in feature-window.cc | ||
n = window_size | ||
if snip_edges: | ||
m = 0 if num_samples < window_size else 1 + (num_samples - window_size) // window_shift | ||
else: | ||
m = (num_samples + (window_shift // 2)) // window_shift | ||
|
||
self.assertTrue(output.dim() == 2) | ||
self.assertTrue(output.shape[0] == m and output.shape[1] == n) | ||
|
||
window = torch.empty((m, window_size)) | ||
|
||
for r in range(m): | ||
extract_window(window, waveform, r, window_size, window_shift, snip_edges) | ||
self.assertTrue(torch.allclose(window, output)) | ||
|
||
def test_get_strided(self): | ||
# generate any combination where 0 < window_size <= num_samples and | ||
# 0 < window_shift. | ||
for num_samples in range(1, 20): | ||
for window_size in range(1, num_samples + 1): | ||
for window_shift in range(1, 2 * num_samples + 1): | ||
for snip_edges in range(0, 2): | ||
self._test_get_strided_helper(num_samples, window_size, window_shift, snip_edges) | ||
|
||
def _create_data_set(self): | ||
# used to generate the dataset to test on. this is not used in testing (offline procedure) | ||
test_dirpath = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) | ||
test_filepath = os.path.join(test_dirpath, 'assets', 'kaldi_file.wav') | ||
sr = 16000 | ||
x = torch.arange(0, 20).float() | ||
# between [-6,6] | ||
y = torch.cos(2 * math.pi * x) + 3 * torch.sin(math.pi * x) + 2 * torch.cos(x) | ||
# between [-2^30, 2^30] | ||
y = (y / 6 * (1 << 30)).long() | ||
# clear the last 16 bits because they aren't used anyways | ||
y = ((y >> 16) << 16).float() | ||
jamarshon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
torchaudio.save(test_filepath, y, sr) | ||
sound, sample_rate = torchaudio.load(test_filepath, normalization=False) | ||
print(y >> 16) | ||
self.assertTrue(sample_rate == sr) | ||
self.assertTrue(torch.allclose(y, sound)) | ||
|
||
def test_spectrogram(self): | ||
sound, sample_rate = torchaudio.load_wav(self.test_filepath) | ||
kaldi_output_dir = os.path.join(self.test_dirpath, 'assets', 'kaldi') | ||
files = list(filter(lambda x: x.startswith('spec'), os.listdir(kaldi_output_dir))) | ||
print('Results:', len(files)) | ||
|
||
for f in files: | ||
print(f) | ||
kaldi_output_path = os.path.join(kaldi_output_dir, f) | ||
kaldi_output_dict = {k: v for k, v in torchaudio.kaldi_io.read_mat_ark(kaldi_output_path)} | ||
|
||
assert len(kaldi_output_dict) == 1 and 'my_id' in kaldi_output_dict, 'invalid test kaldi ark file' | ||
kaldi_output = kaldi_output_dict['my_id'] | ||
|
||
args = f.split('-') | ||
args[-1] = os.path.splitext(args[-1])[0] | ||
assert len(args) == 13, 'invalid test kaldi file name' | ||
|
||
spec_output = kaldi.spectrogram( | ||
sound, | ||
blackman_coeff=float(args[1]), | ||
dither=float(args[2]), | ||
energy_floor=float(args[3]), | ||
frame_length=float(args[4]), | ||
frame_shift=float(args[5]), | ||
preemphasis_coefficient=float(args[6]), | ||
raw_energy=args[7] == 'true', | ||
remove_dc_offset=args[8] == 'true', | ||
round_to_power_of_two=args[9] == 'true', | ||
snip_edges=args[10] == 'true', | ||
subtract_mean=args[11] == 'true', | ||
window_type=args[12]) | ||
|
||
error = spec_output - kaldi_output | ||
mse = error.pow(2).sum() / spec_output.numel() | ||
max_error = torch.max(error.abs()) | ||
|
||
print('mse:', mse.item(), 'max_error:', max_error.item()) | ||
self.assertTrue(spec_output.shape, kaldi_output.shape) | ||
self.assertTrue(torch.allclose(spec_output, kaldi_output, atol=1e-3, rtol=0)) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains 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 file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import kaldi |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the tests were done with
dither=0.
and theenergy_floor
set to a random value.