Beispiel #1
0
def create_figure(source, target):
    s, meta = h5load(source)
    s = Signal(s, meta['fs'])
    ax = s.plot_spectrogram(clim=CLIM, ylim=YLIM, title='')
    fig = ax.get_figure()
    fig.tight_layout()
    fig.savefig(target, dpi=600)
Beispiel #2
0
def create_figure(source, target):
    s, meta = h5load(source)
    s = Signal(s, meta['fs'])
    ax = s.plot_spectrogram(ylim=YLIM, clim=CLIM, title='')
    fig = ax.get_figure()
    #fig.subplots_adjust(bottom=0.2, left=0.2)
    fig.tight_layout()
    fig.savefig(target, dpi=600)
Beispiel #3
0
def create_figure(source, target, plotargs=None):
    if plotargs is None:
        plotargs = {}
    s, meta = h5load(source)
    s = Signal(s, meta['fs'])
    ax = s.plot_spectrogram(clim=CLIM,
                            xlim=XLIM,
                            ylim=YLIM,
                            title='',
                            **plotargs)
    fig = ax.get_figure()
    #fig.subplots_adjust(bottom=0.2, left=0.2)
    fig.tight_layout()
    fig.savefig(target, dpi=600)
Beispiel #4
0
def main():

    # Without turbulence

    #model.settings['turbulence']['include'] = False
    model.settings['turbulence']['include'] = False
    model.settings['turbulence']['amplitude'] = False
    model.settings['turbulence']['phase'] = False
    signal = mono(rcv.auralise())
    signal = Signal(signal.take(nsamples).toarray(), fs)


    without = signal


    # With turbulence (logamp)

    model.settings['turbulence']['include'] = True
    model.settings['turbulence']['amplitude'] = True
    model.settings['turbulence']['phase'] = False
    signal = mono(rcv.auralise())
    signal = Signal(signal.take(nsamples).toarray(), fs)

    #_ = signal.plot_spectrogram(ylim=(0.0, 4000.0), clim=(-40, +60))

    with_logamp = signal


    # With turbulence (phase)

    model.settings['turbulence']['include'] = True
    model.settings['turbulence']['amplitude'] = False
    model.settings['turbulence']['phase'] = True
    signal = mono(rcv.auralise())
    signal = Signal(signal.take(nsamples).toarray(), fs)


    # In[21]:

    #Audio(data=signal, rate=signal.fs)


    # In[22]:

    _ = signal.plot_spectrogram(ylim=(0.0, 4000.0), clim=(-40, +60))


    # In[23]:

    with_phase = signal


    # ## With turbulence (logamp and phase)

    # In[24]:

    model.settings['turbulence']['include'] = True
    model.settings['turbulence']['amplitude'] = True
    model.settings['turbulence']['phase'] = True
    signal = mono(rcv.auralise())
    signal = Signal(signal.take(nsamples).toarray(), fs)


    # In[25]:

    #Audio(data=signal, rate=signal.fs)


    # In[26]:

    _ = signal.plot_spectrogram(ylim=(0.0, 4000.0), clim=(-40, +60))


    # In[27]:

    with_logamp_and_phase = signal


    # In[28]:

    signals = Signal([without, with_logamp, with_phase, with_logamp_and_phase], fs)


    # In[29]:

    labels = ['Without', 'Logamp', 'Phase', 'Both']


    # In[30]:

    fig = signals.plot_levels(labels=labels)


    # In[31]:

    _ = signals.plot_third_octaves(labels=labels)


    # ## Save figures and audio files

    # In[34]:

    #with sns.axes_style(rc={"axes.grid":False}):

    clim = (0.0, +70)
    ylim = (0.0, 4000.0)

    for signal, label in zip(signals, labels):
        signal.normalize().to_wav("../audio/auralisation_flight_{}.wav".format(label.lower()))
        fig = signal.plot_spectrogram(ylim=ylim, clim=clim, title="")
        fig.subplots_adjust(bottom=0.2, left=0.2)
        fig.savefig("../figures/auralisation_flight_{}.eps".format(label.lower()))