Trying to turn it into 6/8


In [3]:
# Imports
%matplotlib inline
import pardir; pardir.pardir() # Allow imports from parent directory
import fibonaccistretch as fib

In [4]:
# Setting up basics
tresillo_rhythm = [1,0,0,1,0,0,1,0]
tempo = 93.0

In [ ]:
# Leads to 11/8
fib.fibonacci_stretch_track("../data/humannature_30s.mp3",
                            original_rhythm=tresillo_rhythm,
                            target_rhythm=[1,0,0,1,0,0],
#                             overlay_clicks=True,
                            tempo=tempo)

In [ ]:
# Leads to 7/8
fib.fibonacci_stretch_track("../data/humannature_30s.mp3",
                            original_rhythm=tresillo_rhythm,
                            target_rhythm=[1,0,1,0],
#                             overlay_clicks=True,
                            tempo=tempo)

In [ ]:
# Custom rhythm, kind of works jittery
fib.fibonacci_stretch_track("../data/humannature_30s.mp3",
                            original_rhythm=[1,0,0,0,1,0,1,0],
                            target_rhythm=[1,0,0,1,0,0],
                            overlay_clicks=True,
                            tempo=tempo)

In [ ]:
# Works better
fib.fibonacci_stretch_track("../data/humannature_30s.mp3",
                            original_rhythm=[1,0,1,0,1,0,1,0],
                            target_rhythm=[1,0,0,1,0,0],
                            overlay_clicks=True,
                            tempo=tempo)

In [ ]:
# Hear without clicks
fib.fibonacci_stretch_track("../data/humannature_30s.mp3",
                            original_rhythm=[1,0,1,0,1,0,1,0],
                            target_rhythm=[1,0,0,1,0,0],
#                             overlay_clicks=True,
                            tempo=tempo)

Outputs

Section 3 of the paper


In [7]:
plt_size = (16,2)
render_track = False

(a) Original


In [8]:
fib.fibonacci_stretch_track("../data/humannature_30s.mp3",
                            original_rhythm=tresillo_rhythm,
                            stretch_factor=0,
                            overlay_clicks=True,
                            render_track=render_track,
                            plt_size=plt_size,
                            tempo=tempo)


Out[8]:
(array([ 0.        ,  0.        ,  0.        , ..., -0.02945009,
        -0.02734863, -0.02521479]),
 array([  16384,  130560,  244736,  358912,  473088,  587264,  701440,
         815616,  929792, 1043968, 1158144]))

(b) Stretched by factor of 1


In [9]:
fib.fibonacci_stretch_track("../data/humannature_30s.mp3",
                            original_rhythm=tresillo_rhythm,
                            stretch_factor=1,
                            overlay_clicks=True,
                            render_track=render_track,
                            plt_size=plt_size,
                            tempo=tempo)


Out[9]:
(array([ 0.        ,  0.        ,  0.        , ...,  0.01238489,
         0.01729694,  0.01882838]),
 array([  16384,  130048,  243712,  357376,  471040,  584704,  698368,
         812032,  925696, 1039360, 1153024]))

(c) To 6/8


In [10]:
# Works better
fib.fibonacci_stretch_track("../data/humannature_30s.mp3",
                            original_rhythm=[1,0,1,0,1,0,1,0],
                            target_rhythm=[1,0,0,1,0,0],
                            overlay_clicks=True,
                            render_track=render_track,
                            plt_size=plt_size,
                            tempo=tempo)


Out[10]:
(array([ 0.        ,  0.        ,  0.        , ..., -0.00902728,
        -0.01323787, -0.01210051]),
 array([  16384,  130048,  243712,  357376,  471040,  584704,  698368,
         812032,  925696, 1039360, 1153024]))

In [11]:
import matplotlib
from matplotlib.font_manager import findfont, FontProperties
matplotlib.rcParams['font.family']
font = findfont(FontProperties(family=['sans-serif']))
font


Out[11]:
u'/Users/usdivad/Documents/tech/erasmus/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf'

In [12]:
reload(fib)


Out[12]:
<module 'fibonaccistretch' from '/Users/usdivad/Documents/tech/fibonacciswing/nbs/../fibonaccistretch.pyc'>

In [ ]: