AudioComm PE Vaibhav
AudioComm PE Vaibhav
Receiver
- Once started, records the data for 10 seconds.
- Display the raw recorded microphone data.
Create a PPT.
- Display the raw recorded microphone data for freq = 15KHz, 10KHz and 18KHz
BLOCK DIAGRAM FOR AUDIO COMMUNICATION
TRANSMITTER RECEIVER
Data in Data in
Binary ASK ASK Binary
UART UART
Data Modulation Demodulation Data
Protocol Protocol
PYTHON CODE FOR TRANSMISSION
OF ASK AUDIO SIGNAL
import numpy as np
import sounddevice as sd
import matplotlib.pyplot as plt
if __name__ == "__main__":
# Constants
bits = '10101010'
bit_duration = 0.1 # Set bit duration to 0.1 seconds
sample_rate = 44100 # audio sample rate
frequency = 18000 # Change modulation frequency to 10 kHz
amplitude_0 = 0 # amplitude for bit '0' (Logic-Low)
amplitude_1 = 1.2 # amplitude for bit '1' (Logic-High)
# Generate the continuous signal with start and stop bits between each "10101010"
continuous_signal = []
# Add logic high for 0.5 seconds after the stop bit
gap_bits = '1' * int(0.5 / bit_duration)
gap_t, gap_signal = generate_ask_signal(gap_bits, 0.5, sample_rate, frequency, amplitude_0, amplitude_1)
continuous_signal.extend(gap_signal)
# Sampling frequency
fs = 44100 # You can adjust this according to your needs
# Duration of recording in seconds
duration = 18 # Change this to the desired duration
# Record audio
audio_data = record_audio(duration, fs)
plt.subplot(2, 1, 2)
plt.plot(time_axis_binary, binary_array)
plt.xlabel('Time (s)')
plt.ylabel('Binary Array (1 for above or equal to average, 0 for below average)')
plt.title('Binary Array vs Time')
plt.grid(True)
plt.tight_layout()
plt.show()
OUTPUT FOR 10kHz
OUTPUT FOR 15kHz
OUTPUT FOR 18kHz