Esempio n. 1
0
def ParallelProcessing(location):
    Antilocation = location[1:4]

    P, S = ComputeRIRs(c, Fs, ReceiverLoc, SourceLoc, Antilocation, RoomSize,
                       beta, nsample, mtype, order, dim, orientation,
                       hp_filter)
    e_cont, Yd = ANCInAction(P, S, x, T, L, mu)
    Pd_dB, fd, Pe_dB, fe, EstimatedAttenuation, components = metrics(
        e_cont, Yd, Fs, T)

    features = np.append(Antilocation, EstimatedAttenuation)
    features = np.append(features, components)
    return features
Esempio n. 2
0
def ParallelProcessing(location):
    SourceLoc       = location[0:3]
    ReceiverLoc     = location[3:6]
    Antilocation    = location[6:9]

    P, S            =   ComputeRIRs(c,Fs,ReceiverLoc,SourceLoc,Antilocation,RoomSize,beta,nsample,mtype,order,dim,orientation,hp_filter)
    PSpecFlat       =   SpectralFlatness(P, Fs)
    SSpecFlat       =   SpectralFlatness(S, Fs)
    e_cont, Yd  	=  	ANCInAction(P, S, x, T, L, mu)
    # Pd_dB, fd, Pe_dB, fe, EstimatedAttenuation, components =   metrics(e_cont, Yd, Fs, T)
    ANCRed          =   metrics(e_cont, Yd, Fs, T)
    features        =   np.append(location, [PSpecFlat, SSpecFlat, ANCRed])
    return features
Esempio n. 3
0
print "Computing RIRs"

P, S = ComputeRIRs(c, Fs, ReceiverLoc, SourceLoc, AntiNoiseLoc,
                   RoomSize, beta, nsample, mtype, order, dim,
                   orientation, hp_filter)

print "Simulating ANC"

error, Yd = ANCInAction(P, S, x, T, L, mu)

# Pd_dB, fd, Pe_dB, fe, attenuation, components\
# = metrics(error, Yd, Fs, T)# print "Estimated \
# Attenuation is : ", attenuation, components

ANCRed = metrics(error, Yd, Fs, T)

#
# Generate Dynamic Power Spectral Density Graphs

TimeDynamics(
    Pd_dB,
    fd,
    Pe_dB,
    fe,
    attenuation,
    SourceLoc,
    ReceiverLoc,
    AntiNoiseLoc)
RIRTimeDomain(P, Fs)
EnergyDecayCurve(P, Fs, S)
Esempio n. 4
0
    #
    signal_das = mics.process(FD=False)
    signal_das = normalize(signal_das)
    centerMicSignal = room_bf.mic_array.signals[-1, :]
    centerMicSignal = normalize(centerMicSignal)

    #
    P, S = room_bf.rir[0]
    P = P[:rirlen]
    P = normalize(P)
    S = S[:rirlen]
    S = normalize(S)
    error_b, Yd_b = ANCInActionBeamer(P, S, xtone, centerMicSignal, T * 8000,
                                      L, mu)
    error, Yd = ANCInAction(P, S, xtone, T * 8000, L, mu)
    ANCRedB = metrics(error_b, Yd_b, Fs, T * 8000)
    ANCRed = metrics(error, Yd, Fs, T * 8000)

    result = result.append(
        {
            'Alpha': alpha,
            'ANCRed': ANCRed,
            'ANCRedBeam': ANCRedB
        },
        ignore_index=True)
    print alpha, ANCRed, ANCRedB

# plot the room and resulting beamformer before simulation
fig, ax = room_bf.plot(freq=[300, 450, 500], img_order=1)
ax.legend(['300', '450', '500'])
plt.xlabel('x')
Esempio n. 5
0
    #                     sigma2_n*np.eye(mics.Lg*mics.M))
    # output          =   mics.process()
    # out             =   pra.normalize(pra.highpass(output, Fs))

    # input_mic       =   pra.normalize(pra.highpass(mics.signals[mics.M//2], Fs))
    # input_mic       =   normalize(input_mic)

    P, S = roomPoly.rir[0]
    P = P[:rirlen]
    P = normalize(P)
    S = S[:rirlen]
    P = normalize(S)

    error_b, Yd_b = ANCInActionBeamer(P, S, xtone, out, T * 8000, L, mu)
    error, Yd = ANCInAction(P, S, xtone, T * 8000, L, mu)
    Pd_dBB, fdB, Pe_dBB, feB, ANCRedB = metrics(error_b, Yd_b, Fs, T * 8000)
    Pd_dB, fd, Pe_dB, fe, ANCRed = metrics(error, Yd, Fs, T * 8000)

    result = result.append(
        {
            'Alpha': alpha,
            'ANCRed': ANCRed,
            'ANCRedBeam': ANCRedB
        },
        ignore_index=True)
    print alpha, ANCRed, ANCRedB

TimeDynamics(Pd_dBB, fdB, Pe_dBB, feB, ANCRedB)

fig, ax = roomPoly.plot(freq=[280, 320, 350], img_order=1)
ax.legend(['300', '450', '500'])