view run.py @ 6:546dfcd45281

* Added functionality to calculate specific loudness of stimulus in presence of noise * Added functionality to calculate partial loudness and loudness of signal
author Carl Bussey <c.bussey@se10.qmul.ac.uk>
date Sun, 23 Feb 2014 22:50:48 +0000
parents d7b2784ff5a3
children 0ee61aeb789a
line wrap: on
line source
import cortical_model as cm
import numpy as np
import utils

t = np.array(range(44100))
sine = np.sin(2*np.pi*t*1000/44100)
sine1 = np.sin(2*np.pi*t*100/44100)
x = np.append(sine, sine1)

exc_i = cm.get_excitation_i(x, 44100, 90, verbose = True)
exc_i = np.reshape(exc_i, (1,)+np.shape(exc_i))
sl = cm.get_specific_loudness_noise(exc_i)
sl = np.reshape(sl, (39,88200))

#for i in range(39):
#    utils.plot_waveform(sl[i])

print "Loudness"
loudness = 2*np.sum(sl,0)

utils.plot_waveform(loudness)