Exemple #1
0
def list_of_notes(notes_count, base_note):
    loop = sampler.Loop(base_note)
    for n in range(notes_count):
        if n != 0:
            factor = 2**(n / 12)  # semitones factor
            new_note = loop.sample(131 * factor, 44100)  # what the new note is
            new_note = smoothing(new_note)  # smooth out the note
            notes.append(new_note)  # add that to the note array
def list_of_notes(notes_count, base_note):
    loop = sampler.Loop(base_note)
    for n in range(notes_count):
        if n != 0:
            factor = 2**(n / 12)  #semitones factor
            new_note = loop.sample(131 * factor, 44100)
            new_note = smoothing(new_note) 
            notes.append(new_note)
def list_of_notes(notes_count, base_note):

    notes = []
    A3 = np.sin(np.linspace(0., 2. * np.pi * 220, 44100))
    notes.append(A3)

    loop = sampler.Loop(base_note)
    for n in range(notes_count):
        if n != 0:
            factor = 2**(n / 12)  #semitones factor
            new_note = loop.sample(220 * factor, 44100)
            new_note = smoothing(new_note)
            notes.append(new_note)
Exemple #4
0
import numpy as np
from scipy.io import wavfile

import sampler

def wavwrite(f, s):
    wavfile.write(f, 44100, (32767 * s).astype(np.int16))

refa4 = 0.5 * np.sin(np.linspace(0, 2*np.pi*440, 44100))
wavwrite('refa4.wav', refa4)
loop = sampler.Loop(refa4)
shifta5 = loop.sample(880, 44100)
wavwrite('shifta5.wav', shifta5)