In [ ]:
import os, sys

from TimeFreqAuditoryScene import *
from IPython.display import Audio, display, clear_output
from IPython.html import widgets
from IPython.html.widgets import interactive
%matplotlib inline

In [ ]:
fs = 44100
duration = 0.1
scene = Scene()
stList = []

# declaring interval for sequence of shepard tones
k = 2.**(2./12.)
# declare gaussian envelope on log frequency
genv = GaussianSpectralEnvelope(mu_log=5., sigma_log=2.)

# Constructing the scene
for i in range(20):
    tmp_st = ShepardTone(fb=10.*(k)**i, env=genv, delay=(1.1*duration)*i, duration=duration)
    scene.add(tmp_st)

# generate sound
x = scene.generate(fs=fs)
display(Audio(x, rate=fs, autoplay=True))
# draw spectrogram
sd = SceneDrawer()
sd.draw(scene)
plt.show()

In [ ]:
scene2 = Scene()
factor = 2.**(2./12.)
duration = 0.2
dt = duration/10.
for i in range(50):
    start = np.random.rand()
    f_start = 200.+500.*np.random.rand()
    t_start = np.random.rand()*4.
    sweep = Sweep(freqs=[f_start, f_start*factor], delay=dt*i, duration=duration)
    scene2.add(sweep)


x2 = scene2.generate(fs=44100.)

display(Audio(x2, rate=fs, autoplay=False))
sd = SceneDrawer()
sd.draw(scene2)
plt.show()