Changeset 4120fbc for python/demos/demo_sink_create_woodblock.py
- Timestamp:
- May 16, 2016, 3:16:00 AM (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:
- dc654f8
- Parents:
- 416ddd1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/demos/demo_sink_create_woodblock.py
r416ddd1 r4120fbc 3 3 import sys 4 4 from math import pi, e 5 from aubio import sink 5 from aubio import sink, float_type 6 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.