def test_buoy_parser_02(): parser = buoyparsers.GlobalDrifterParser() doc = parser.parse('test_resources/buoydata.dat') # doc = parser.parse('/Users/egg/Temp/oceancurrents/globaldrifter/buoydata_5001_sep12.dat') doc.combine_range('TEMP') orchestra_file = 'csound_files/bowed_string.orc' renderer = CsoundRenderer(orchestra_file) sine_to_csound_map = {'LAT': 'amplitude', 'LON': 'pressure', 'TEMP': 'bow_position'} transformed_doc = doc.transform(sine_to_csound_map, renderer) result = renderer.render(transformed_doc, filename='/tmp/t.csd', play=False) known_result = '\ni 1 8.35714285714 0.336428571429 0.0 220.1 1.08011444921 0.14756946158\n</CsScore>\n\n</CsoundSynthesizer>\n' assert known_result in result
def test_csound_from_orchestra_file(): parser = MultiSineDictParser() # Generate some raw data sinelist = [] for i in range(3): sines = generate_sines(3, 128, factor=i) sinelist.append(sines) doc = parser.parse(sinelist) doc.sample_rate = 5 orchestra_file = 'csound_files/bowed_string.orc' renderer = CsoundRenderer(orchestra_file) sine_to_csound_map = {0: 'amplitude', 1: 'pressure', 2: 'bow_position'} transformed_doc = doc.transform(sine_to_csound_map, renderer) # pp(transformed_doc) result = renderer.render(transformed_doc, filename='/tmp/t.csd', play=False) known_result = 'p5 - frequency (Hz)\n \n */\n \n ; function table moved to orchestra\n \n \ni 1 0.0 0.193571428571 0.160885686814 146.7 4.90556786078 0.102379805523\ni 1 0.214285714286' assert known_result in result