MATLAB Answers

Add echo to audio signal in matlab

98 ビュー (過去 30 日間)
Priyamvada Shankar
Priyamvada Shankar 2019 年 3 月 24 日
編集済み: Mohamed Gsmal 2021 年 1 月 16 日
Write a function called echo_gen that adds an echo effect to an audio recording. The function is to be called like this: output = echo_gen(input, fs, delay, amp); where input is a column vector with values between -1 and 1 representing a time series of digitized sound data. The input argument fs is the sampling rate. The sampling rate specifies how many samples we have in the data each second. For example, an audio CD uses 44,100 samples per second. The input argument delay represent the delay of the echo in seconds. That is, the echo should start after delay seconds have passed from the start of the audio signal. Finally, amp specifies the amplification of the echo which normally should be a value less than 1, since the echo is typically not as loud as the original signal. The output of the function is a column vector containing the original sound with the echo superimposed. The output vector will be longer than the input vector if the delay is not zero (round to the nearest number of points needed to get the delay, as opposed to floor or ceil). A sound recording has values between -1 and 1, so if the echo causes some values to be outside of this range, you will need to normalize the entire vector, so that all values adhere to this requirement. MATLAB has several sample audio files included that you can try: splat, gong, and handel are a few examples. Try the following: load gong % loads two variables, y and Fs sound(y, Fs) % Outputs sound

  2 件のコメント

KALYAN ACHARJYA 2019 年 3 月 24 日
Have you checked here and here?
Walter Roberson
Walter Roberson 2019 年 3 月 24 日


回答 (3 件)

Priyamvada Shankar
Priyamvada Shankar 2019 年 3 月 24 日
They are not working

  22 件のコメント

表示 19 件の古いコメント
Walter Roberson
Walter Roberson 2019 年 8 月 16 日
Mukti Awad: those messages come from an academic code grading system. You are responsible for writing your own code for assignments. If you present your own code and it is not just a copy of the above code, then someone might be willing to have a look at it.
Washida Kami
Washida Kami 2020 年 4 月 1 日
@Walter Roberson Nobody asked for your help, why do you sound so pissed off in all the comments?
Walter Roberson
Walter Roberson 2020 年 4 月 1 日
Washida Kami:
Nobody asked for your help
Priyamvada Shankar and Mukti Awad asked for my help.
why do you sound so pissed off in all the comments?
The first ten thousand times that someone asked me to do their homework for them: they were the worst. The second ten thousand times: they were the worst too. After that, things started to go downhill.


Sarthak Shukrey
Sarthak Shukrey 2019 年 7 月 24 日
can someone provide with a descriptive answer for the same ? I'm getting same error :(

  0 件のコメント


ABHIJIT BISWAS 2020 年 11 月 30 日
編集済み: ABHIJIT BISWAS 2020 年 11 月 30 日
%Perfectly working
function echo_sound = echo_gen(input, fs, delay, amp)
new_sr = round(fs*delay);
no_echo = [input; zeros(new_sr,1)];
echo_effect = [zeros(new_sr,1); input*amp];
echo_sound = no_echo + echo_effect;
norm_factor = max(abs(echo_sound));
if norm_factor > 1
echo_sound = echo_sound./norm_factor;

  1 件のコメント

Mohamed Gsmal
Mohamed Gsmal 2021 年 1 月 16 日
echo cancelation??


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by