In [1]:
from essentia import standard

In [11]:
from  IPython.lib.display import Audio

In [6]:
import numpy
from matplotlib import *
%matplotlib inline

In [3]:
Maker = standard.AudioOnsetsMarker()

In [54]:
pas = 44100

In [67]:
l = [sin(i*2*3.14/pas) for i in range(pas)]
l_h = [sin(i*2*3.14/pas) + 0.8*sin(i*4*3.14/pas) + 0.6*sin(i*8*3.14/pas) for i in range(pas)]

In [68]:
subplot(2,1,1)
plot(l)
subplot(2,1,2)
plot(l_h)


Out[68]:
[<matplotlib.lines.Line2D at 0x7f88e302c4d0>]

In [65]:
n = numpy.array(l, dtype=float32)
s = Maker(n)

In [66]:
Audio(s, rate = pas)


Out[66]:

In [70]:
def append(s1,s2):
    r = []
    for i in s1:
        r.append(i)
    for j in s2:
        r.append(j)
    return numpy.array(r, dtype=float32)

In [71]:
l_l_h = append(l, l_h)

In [72]:
plot(l_l_h)


Out[72]:
[<matplotlib.lines.Line2D at 0x7f88e2f0f990>]

In [73]:
a = Maker(l_l_h)

In [74]:
Audio(a, rate = pas)


Out[74]:

LA 55 110 220 440 880 1760 3520 7040


In [75]:
LA = [55, 110, 220, 440, 880, 1760, 3520, 7040]

In [81]:
l_LA = [sin(i*2*j*3.14/pas) for j in LA for i in range(pas) ]

In [82]:
a = Maker(l_LA)

In [83]:
Audio(a, rate = pas)


Out[83]:

In [84]:
plot(l_LA)


Out[84]:
[<matplotlib.lines.Line2D at 0x7f88e2e4e610>]

In [85]:
hist(l_LA)


Out[85]:
(array([ 72268.,  31873.,  26038.,  23594.,  22580.,  22616.,  23604.,
         26061.,  31881.,  72285.]),
 array([ -9.99999999e-01,  -7.99999999e-01,  -5.99999999e-01,
         -3.99999999e-01,  -1.99999999e-01,   7.25163929e-10,
          2.00000001e-01,   4.00000000e-01,   6.00000000e-01,
          8.00000000e-01,   1.00000000e+00]),
 <a list of 10 Patch objects>)

In [87]:
black = { 'do': [32.7,65.41,130.81,261.63,523.25,1046.5,2093,4186.01],
         're': [36.71,73.42,146.83,293.66,587.33,1174.66,2349.32,4698.64],
         'mi': [41.2,82.41,164.81,329.63,659.26,1318.51,2637.02,5274.04],
         'fa': [43.65,87.31,174.61,349.23,698.46,1396.91,2793.83,5587.65],
         'sol': [49,98,196,392,783.99,1567.98,3135.96,6271.93],
         'la': [55, 110, 220, 440, 880, 1760, 3520, 7040],
         'si': [61.74,123.47,246.94,493.88,987.77,1975.53,3951.07,7902.13],
         }

In [137]:
Partition = ['do', 're', 'mi']
Hauteur = [0,0,0]
Duree = [1,1,2]
def Sequence(Partition, Hauteur, Duree):
    P = []
    Sequence_C = []
    for i in xrange(len(Partition)):
        for j in range(Duree[i]):
            P.append(Partition[i])
        
            Sequence_C.append([sin(numpy.pi*2*j*black[Partition[i]][Hauteur[i]]/pas) for i in xrange(len(Partition)) for j in xrange(pas)])
        
    S = Sequence_C[0]
    for i in (xrange(len(Sequence_C)-1)):
        S = append(S, Sequence_C[i+1])
        
    return S

In [138]:
S_phd = Sequence(Partition, Hauteur, Duree)

In [139]:
a = Maker(S_phd)

In [136]:
Audio(a, rate = pas)


Out[136]:

In [140]:
plot(S_phd)


Out[140]:
[<matplotlib.lines.Line2D at 0x7f88e2a89e10>]

In [126]:
Pi


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-126-38a0d74848bd> in <module>()
----> 1 Pi

NameError: name 'Pi' is not defined

In [151]:
plot(sin([2*numpy.pi*i*100 for i in range(10000)]))


Out[151]:
[<matplotlib.lines.Line2D at 0x7f88dfa0cfd0>]

In [147]:
100:1


  File "<ipython-input-147-d6e9e2d71575>", line 1
    100:1
       ^
SyntaxError: invalid syntax

In [ ]: