Changeset f264b17 for python/demos/demo_sink_create_woodblock.py
- Timestamp:
- Jun 22, 2016, 1:00:10 PM (8 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 4b9443c4
- Parents:
- 60fc05b (diff), 6769586 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/demos/demo_sink_create_woodblock.py
r60fc05b rf264b17 3 3 import sys 4 4 from math import pi, e 5 from aubio import sink 6 from numpy import arange, resize,sin, exp, zeros5 from aubio import sink, float_type 6 from numpy import arange, sin, exp, zeros 7 7 8 8 if len(sys.argv) < 2: 9 print 'usage: %s <outputfile> [samplerate]' % sys.argv[0]9 print('usage: %s <outputfile> [samplerate]' % sys.argv[0]) 10 10 sys.exit(1) 11 11 … … 26 26 # create a sine lookup table 27 27 tablelen = 1000 28 sinetable = arange(tablelen + 1, dtype = 'float32')28 sinetable = arange(tablelen + 1, dtype = float_type) 29 29 sinetable = 0.7 * sin(twopi * sinetable/tablelen) 30 sinetone = zeros((duration,), dtype = 'float32')30 sinetone = zeros((duration,), dtype = float_type) 31 31 32 32 # compute sinetone at floating point period … … 40 40 41 41 # apply some envelope 42 float_ramp = arange(duration, dtype = 'float32')42 float_ramp = arange(duration, dtype = float_type) 43 43 sinetone *= exp( - e * float_ramp / duration / decay) 44 44 sinetone[:attack] *= exp( e * ( float_ramp[:attack] / attack - 1 ) )
Note: See TracChangeset
for help on using the changeset viewer.