Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

src/a/u/audiogen-0.0.2/audiogen/sampler.py   audiogen(Download)
from StringIO import StringIO
 
from .util import hard_clip
from .util import normalize
 
	fmt = { 1: '<B', 2: '<h', 4: '<i' }[width]
	return (struct.pack(fmt, int(sample)) for sample in \
			normalize(hard_clip(generator, min, max),\
				min, max, -2**(width * 8 - 1), 2**(width * 8 - 1) - 1))
#	scale = float(2**(width * 8) - 1) / (max - min)