Open Shubhabrata08 opened 8 months ago
Please investigate this task and report your deductions
import sounddevice as sd
import soundfile as sf
import numpy as np
import librosa.display
import matplotlib.pyplot as plt
def record_audio(sample_rate, duration):
audio_data = sd.rec(int(sample_rate * duration), samplerate=sample_rate, channels=1, dtype='float')
sd.wait()
return audio_data.flatten()
def extract_mfcc(audio_data, sample_rate, n_mfcc=13, hop_length=512):
mfccs = librosa.feature.mfcc(y=audio_data, sr=sample_rate, n_mfcc=n_mfcc, hop_length=hop_length)
return mfccs
# Record a short audio clip (adjust sample_rate and duration as needed)
sample_rate = 44100
duration = 5
audio_data = record_audio(sample_rate, duration)
# Extract MFCC features
mfccs = extract_mfcc(audio_data, sample_rate)
# Display MFCC features
plt.figure(figsize=(10, 4))
librosa.display.specshow(mfccs, x_axis='time')
plt.colorbar()
plt.title('MFCC')
plt.show()
portaudio sudo apt-get install libasound2-dev
sudo apt-get install portaudio19-dev
sudo apt-get install libatlas-base-dev
portAudio not found
Considering the workflow for audio recording and feature extraction is clear as per #1 , we can proceed towards the POC for the same task but on an ESP32 or Arduino board. The previous POC can be employed in dev testing when issue #2 and #3 is closed.