music.stretches¶
- music.stretches(x, durations=(1, 4, 8, 12), sample_rate=44100)[source]¶
Makes a sequence of squeezes of the fragment in x.
- Parameters:
- xarray_like
The samples made to repeat as original or squeezed. Assumed to be in the form (channels, samples), i.e. x[1][120] is the 120th sample of the second channel.
- durations
listofnumbers Durations in seconds for each repeat of x.
Notes
This function is useful to render musical sequences given any material. PS: not clear if this function is already useful.
Examples
>>> asound = horizontal_stack(*[note_with_vibrato(freq=i, vibrato_freq=j) ... for i, j in zip([220,440,330,440,330], ... [.5,15,6,5,30])]) >>> s = stretches(asound) >>> s = stretches(asound, ... durations=[.2, .3] * 10 + [.1, .2, .3, .4] * 8 + ... [.5, 1.5, .5, 1., 5., .5, .25, .25, .5, 1., .5] * 2) >>> write_wav_mono(durations, 'stretches.wav')