Question
A)Determine the longest word (highest in terms of seconds) in the sentence you recorded B)Print the longest word and along with its duration in seconds
A)Determine the longest word (highest in terms of seconds) in the sentence you recorded
B)Print the longest word and along with its duration in seconds using fprintf()
matlab
%% Read audio data
% Clear Workspace
clear all; close all; clc;
% Load the audio along with Sampling frequency
[my_audio,fs]=audioread('my_sentence.wav');
% Play the same audio
soundsc(my_audio,fs)
% Visualize the Audio file
figure;
plot(my_audio);
xlabel('Sample Indices');
ylabel('Amplitude in Volts');
title('Original Audio');
%% Extract Each Word
% Word 'one'
one=my_audio(9878:1.375e4);
% Word 'two'
two=my_audio(1.705e4:2.056e4);
% Word 'three'
three=my_audio(2.282e4:2.681e4);
% Word 'four'
four=my_audio(2.857e4:3.216e4);
% Jumble the words
repeat_once=[one;one;two;two;three;three;four;four];
% Play the Jumbled audio
soundsc(repeat_once,fs);
% Write the Jumbled audio file
audiowrite('repeat_once.wav',repeat_once,fs);
%% Time Domain
% Time domain
time=(1:length(my_audio))./fs;
figure;
% Plot My audio in Time domain
plot(time,my_audio);
xlabel('Time in Seconds');
ylabel('Amplitude');
% Word Four in Seconds
time_four=length(four)/fs
% Word three in Seconds
time_three=length(three)/fs
% Word two in Seconds
time_two=length(two)/fs
% Word one in Seconds
time_one=length(one)/fs
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started