def random_notes(): """Chose a random note every 6250 samples""" marimba = Marimba() audio = Audio(30) len_audio = len(audio) - 50000 tick = 0 while tick < len_audio: note = marimba.get_random_note() audio.add(tick, note) tick += 6250 audio.write_wav('samples-test')
def random_notes_2(): """Choose 100 random notes and put them in random locations throughout the duration of the audio containing the original samples""" marimba = Marimba() audio = Audio(30) len_audio = len(audio) - 50000 n_notes = 100 for i in range(n_notes): print '\t', i, 'of', n_notes note = marimba.get_random_note() start = np.random.randint(len_audio) audio.add(start, note) audio.write_wav('samples-test')
def microtonal_experiment_1(): print 'Running microtonal_experiment_1...' marimba = Marimba() audio = Audio(30) # the marimba recordings have a duration of 50000 samples. # Don't start a recording within 50000 samples of the end of the audio len_audio = len(audio) - 50000 print len_audio n_notes = 100 for i in range(n_notes): print '\t', i, 'of', n_notes note = marimba.get_random_note(cents=True) start = np.random.randint(len_audio) audio.add(start, note) audio.write_wav('samples-test') print 'Done running microtonal_experiment_1.'