Ejemplo n.º 1
0
def blend():
    blend = []
    for i in range(882000):
        t = i / 44100
        s = (math.sin(math.pi * f * t))**6
        y = ((1 - s) * brown_v[i] + s * white[i])
        blend.append(y)
        print(blend)
    stdaudio.playSamples(blend)
    stdaudio.wait()
Ejemplo n.º 2
0
    curve(x0, y0, xm, ym + delta, var / beta, beta, n - 1)
    curve(xm, ym + delta, x1, y1, var / beta, beta, n - 1)


import stdaudio
import math

SAMPLE_RATE = 44100
CONCERT_A = 440
DURATION = 5

# generate an array with 5 seconds of the A tone
# 44100 * 5 = 220500 samples

num_samples = SAMPLE_RATE * DURATION

# array of samples
samples = []
for i in range(num_samples):
    # time in seconds
    t = i / SAMPLE_RATE
    semitone = math.floor(t)
    f = CONCERT_A * (2**(semitone / 12.0))
    y = math.sin(2.0 * math.pi * f * t)
    samples += [y]

print(samples)
stdaudio.playSamples(samples)
stdaudio.wait()
help(stdaudio)
Ejemplo n.º 3
0
    hi = tone(2*hz, t)
    lo = tone(hz/2, t)
    h = superpose(hi, lo, .5, .5)
    return superpose(a, h, .5, .5)

#-----------------------------------------------------------------------

# Read sound samples from standard input, add harmonics, and play
# the resulting the sound to standard audio.

while not stdio.isEmpty():
    pitch = stdio.readInt()
    duration = stdio.readFloat()
    a = note(pitch, duration)
    stdaudio.playArray(a)
stdaudio.wait()

#-----------------------------------------------------------------------

# python playthattunedeluxe.py < ascale.txt

# python playthattunedeluxe.py < elise.txt

# python playthattunedeluxe.py < entertainer.txt

# python playthattunedeluxe.py < firstcut.txt

# python playthattunedeluxe.py < freebird.txt

# python playthattunedeluxe.py < looney.txt