Exemplo n.º 1
0
def crnsong_01():
    parser = crnparsers.HourlyCrnParser()

    # Get six stations that pretty much cover CONUS
    stations = parser.find_stations(('Darrington', 'Barbara', 'Northgate', 'Port Aransas', 'Old Town', 'Brunswick'))
    print stations

    fields = set(('T_CALC', 'SOIL_TEMP_10', 'SOIL_TEMP_50', 'SOLARAD', 'P_CALC'))
    #fields = set(('T_CALC', 'SOLARAD', 'SOIL_TEMP_10', 'SOIL_TEMP_50'))
    years = range(2008, 2013)
    doc = parser.parse(stations, years, fields)
    assert len(doc) == len(stations)
    doc.combine_all_ranges()

    # MIDI output
    mrenderer = MidiCCRenderer(sample_rate=24) #24 is the natural fit.
    sine_to_midi_map = {'T_CALC': 74, 'SOIL_TEMP_10': 75, 'SOIL_TEMP_50' : 76, 'SOLARAD' : 77, 'P_CALC' : 78} # sine to cc# # 1 is mod wheel, for bowing using the Serenade reaktor patch
    #sine_to_midi_map = {'T_CALC': 74, 'SOLARAD': 75, 'SOIL_TEMP_10': 76, 'SOIL_TEMP_50' : 77}
    transformed_doc = doc.transform(sine_to_midi_map, mrenderer)

    # Create graph
    vrenderer = LineGraphRenderer()
    # No mapping because LineGraphRenderer doesn't need one.
    vrenderer.render(transformed_doc, showplot=True, outfile='/tmp/test.svg')

    # Output MIDI
    mrenderer.render(transformed_doc, output_file='t.mid')
Exemplo n.º 2
0
def crnsong_01():
    parser = crnparsers.HourlyCrnParser()

    # Get six stations that pretty much cover CONUS
    stations = parser.find_stations(('Darrington', 'Barbara', 'Northgate',
                                     'Port Aransas', 'Old Town', 'Brunswick'))
    print stations

    fields = set(
        ('T_CALC', 'SOIL_TEMP_10', 'SOIL_TEMP_50', 'SOLARAD', 'P_CALC'))
    #fields = set(('T_CALC', 'SOLARAD', 'SOIL_TEMP_10', 'SOIL_TEMP_50'))
    years = range(2008, 2013)
    doc = parser.parse(stations, years, fields)
    assert len(doc) == len(stations)
    doc.combine_all_ranges()

    # MIDI output
    mrenderer = MidiCCRenderer(sample_rate=24)  #24 is the natural fit.
    sine_to_midi_map = {
        'T_CALC': 74,
        'SOIL_TEMP_10': 75,
        'SOIL_TEMP_50': 76,
        'SOLARAD': 77,
        'P_CALC': 78
    }  # sine to cc# # 1 is mod wheel, for bowing using the Serenade reaktor patch
    #sine_to_midi_map = {'T_CALC': 74, 'SOLARAD': 75, 'SOIL_TEMP_10': 76, 'SOIL_TEMP_50' : 77}
    transformed_doc = doc.transform(sine_to_midi_map, mrenderer)

    # Create graph
    vrenderer = LineGraphRenderer()
    # No mapping because LineGraphRenderer doesn't need one.
    vrenderer.render(transformed_doc, showplot=True, outfile='/tmp/test.svg')

    # Output MIDI
    mrenderer.render(transformed_doc, output_file='t.mid')
Exemplo n.º 3
0
def test_midi_renderer_01():
    parser = MultiSineDictParser()

    # Generate some raw data
    sinelist = []
    for i in range(3):
        sines = generate_sines(3, 120, factor=i)
        sinelist.append(sines)

    doc = parser.parse(sinelist)
    doc.sample_rate = 5

    renderer = MidiCCRenderer()
    sine_to_midi_map = {0: 74, 1: 75, 2: 76} # sine to cc#
    transformed_doc = doc.transform(sine_to_midi_map, renderer)
    renderer.render(transformed_doc, output_file='/tmp/t.mid')
Exemplo n.º 4
0
def build_data():
    parser = GriddedDataParser()
    doc = parser.parse()
    doc.resample(.1403)  # Trial and error to get 30 min of data

    # renderer = LineGraphRenderer()
    # plot = renderer.render(doc, showplot=True, render_separate=True)

    # Produce MIDI data
    renderer = MidiCCRenderer()
    # divide 20 by 1.782
    renderer.tempo = 20
    var_to_midi_map = {'air': 74, 'prate': 75, 'rhum': 76, 'wspd': 77}
    transformed_doc = doc.transform(var_to_midi_map, renderer)
    renderer.render(
        transformed_doc,
        output_file=
        '/Users/egg/Documents/Work In Progress/geothermophone/midi/geothermophone.mid'
    )
Exemplo n.º 5
0
def build_data():
    parser = GriddedDataParser()
    doc = parser.parse()
    doc.resample(.1403) # Trial and error to get 30 min of data

    # renderer = LineGraphRenderer()
    # plot = renderer.render(doc, showplot=True, render_separate=True)

    # Produce MIDI data
    renderer = MidiCCRenderer()
    # divide 20 by 1.782
    renderer.tempo = 20
    var_to_midi_map = {'air': 74,
                       'prate': 75,
                       'rhum': 76,
                       'wspd': 77}
    transformed_doc = doc.transform(var_to_midi_map, renderer)
    renderer.render(transformed_doc,
                    output_file='/Users/egg/Documents/Work In Progress/geothermophone/midi/geothermophone.mid')
Exemplo n.º 6
0
def midi(doc):
    renderer = MidiCCRenderer()
    sine_to_midi_map = {'LAT': 74, 'LON': 75, 'TEMP': 76} # sine to cc#
    transformed_doc = doc.transform(sine_to_midi_map, renderer)

    renderer.render(transformed_doc, output_file='output.mid')