def test_compressor(self): snd = dsp.read('tests/sounds/guitar1s.wav') ratio = 4 threshold = -10 attack = 0.2 release = 0.2 out = fx.compressor(snd, ratio, threshold, attack, release) out.write('tests/renders/fx_compressor.wav')
total_length = sum(bars) stems = {} for stem, cb in ORC.items(): stems[stem] = dsp.buffer(length=total_length) pos = 0 print('STEM', stem) for i, l in enumerate(bars): l = 3 if l <= 0 else l bar = cb(l, pos, total_length) stems[stem].dub(bar, pos) pos += l print(' %s normalize' % stem) stems[stem] = fx.norm(stems[stem], 1) print(' %s write' % stem) stems[stem].write('stem-%s.wav' % stem) print() print('MIXING', total_length) out = dsp.buffer(length=total_length) for stem, layer in stems.items(): out.dub(layer) print('COMPRESSING/WRITING', total_length) out *= 10 out = fx.compressor(out, -10, 10) out = fx.norm(out, 1) out.write('amber-bars.wav')