fractal_multi_track.py 999 Bytes
Newer Older
ecofractal's avatar
ecofractal committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
'''
Multitrack Code - fractaL April 15th 2019

Here, you can find the code to build a multiple MIDI instrument sound using
different environmental variables.

@author: smjacques
'''
import pandas as pd
import fractaL.core as fractal


#import data in a dataframe(df) format
df = pd.read_csv('sample_data/multilong.csv')

test = fractal.normalize_climate_multi(df)


# Let's add some instruments to each track!
instruments_to_add = [
    'violin', 'hi wood block', 'melodic tom'
]

multitrack_data_with_instruments = []
for index, track in enumerate(test):
    multitrack_data_with_instruments.append([instruments_to_add[index]] + track)


print(multitrack_data_with_instruments)

31
'''
ecofractal's avatar
ecofractal committed
32
fractal.play_midi_from_data(multitrack_data_with_instruments,
33 34 35 36 37 38
                            track_type='multiple', key='f_major')
'''

#fractal.write_multi(multitrack_data_with_instruments, track_type='multiple')
fractal.export_midi(multitrack_data_with_instruments, bpm=12,
                    track_type='multiple')