Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE HELP IN PYTHON When we are in an airplane, we count on the pilots and control towers maintaining clear communication. The voice signal of

PLEASE HELP IN PYTHON
When we are in an airplane, we count on the pilots and control towers maintaining clear communication. The voice signal of the pilot can be impacted by the turbine noise making it difficult for pilots voices to come across communication channels clearly. Training an Adaline Neural Network (ANN) to filter the noise creates clearer signals between pilots and control tower operators leading to safer flights. For this assignment, you use ANN to simulate filtering a pilots signal.
ANN also known as Adaptive Linear Neuron or later as Adaptive Linear Element, are single-layer artificial neural networks. Adaline differs from the standard perceptron during the learning phase, when the weights are adjusted according to the weighted sum of the inputs also known as the net. In the standard perceptron, the net is passed to the activation function and the function's output is used for adjusting the weights.
The outputs of the Adaline are real numbers as opposed to the binary outputs of the perceptron. Adaline uses a linear function as a transfer function instead of a hardlim. Using Adaline in this manner, establishes a mathematical function to assess the networks performance during learning and makes the network suitable for modeling nonlinear problems, which the perceptron cannot model.
For this assignment, you apply the Adaline Neural Network to a real-world problem by solving problems. Fill out the section that is missing code needed to complete the script below.
import numpy as np
import scipy.io.wavfile
import matplotlib.pyplot as plt
#Problem:
#There is a voice signal of a pilot affected by an turbine of the airplane (mixed.wav, have a listen!). We have access to the contaminated signal and the noisy signal of the turbine (noise.wav, have a listen!). An Adeline neural network has to be trained to filter the noise from the contaminated signal and recover the cleaned voice of the pilot (you have to provide this wav file, although I also attached my result as a reference for you, have a liste!).
#This Adaline has only one output (neuron) and 'n_inputs' inputs. The idea is to use this Adaline as a real time adaptive filter (the main application it is used for). Therefore, the noise signal will be the input of the Adaline although, to feed this signal ino the network, you will have to go across the signal (sample by sample) taking slices of size 'n_inputs'. We want our Adaline to respond to each sample of the noise input (or the slice that starts with such a sample) with the corresponding sample of the voice+noise signal (target T, e.i. mixed.wav).
#During some few first inputs, the Adaline will not be capable of responding as we wish, but soon (after some slices have been input) it will adapt and the response will resemble our target T (mixed.wav) more and more. Notice that since our output tends to T (and finally equals T), thus such output is not really the signal we are looking for (then which?). Also, since the Adaline is an adaptive filter you only have to input the whole noise signal once (the training lasts as long as there is T and Noise to train), because by the time the signal is reaching the end, the network has to be already well adapted (the cleaned voiced is already accessible).
#Read the signals for this assignment:
# the turbine noise which we have access to
samplerate, P = scipy.io.wavfile.read('noise.WAV')
# our target
samplerate, T = scipy.io.wavfile.read('mixed.WAV')
#Prepare the signals for this problem:
# preprocessing the signals
T= T-np.mean(T)
T= T/max(T)
P= P-np.mean(P)
P= P/max(P)
# lenght of the training
l=len(T)
# Number of inputs of the network
n_inputs=3
# learning rate
alpha=0.01
#Initialize weights W and error E:
# please use this instead of pure randomly
W=0.001*np.ones(n_inputs)
# initialize in 0
E=np.zeros(l)
#Train the network:
# Write your code here
#Save final signals:
# who is cleaned?
cleaned=np.int16(cleaned/np.max(cleaned)*32767)
scipy.io.wavfile.write('cleaned.WAV', samplerate,cleaned)
#Print the final signals:
time = np.linspace(0., l, T.shape[0])
plt.plot(time, cleaned , label="The cleaned Voice Signal")
plt.legend()
plt.xlabel("Time [s]")
plt.ylabel("Amplitude")
plt.show()
plt.plot(time, T, label="Voice+Noise (Target T)")
plt.legend()
plt.xlabel("Time [s]")
plt.ylabel("Amplitude")
plt.show()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions