explanation of the code line per line
explanation of the code line per line
volume = 2;
x = x * volume;
audiowrite('1ST_RICARDO.wav', x, Fs * 2);
Saves the audio, but with the sampling frequency doubled (Fs * 2), effectively speeding it up.
Reverb Effect
x = x / max(abs(x));
decay = 0.7;
Sets the decay factor for the reverb effect (how much the echo diminishes).
matlab
Adds the delayed, decayed version of the audio (x) to the original, simulating reverb.
matlab
matlab
x = x / max(abs(x));
delay_seconds = 0.5;
decay = 0.6;
den = 1;
y = y / max(abs(y));
sound(y, Fs);
nth = 6000;
mth = 80;
vector = x(lth:nth);
Selects a segment of the audio.
y = flipud(x);
sound(y, Fs);
Pitch Shift
semitone_shift = 2;
num_samples = length(x);
t = (0:num_samples-1) / Fs;
t_resampled = t * pitch_shift_factor;
sound(y, new_sample_rate);
audiowrite('2ND_RICARDO.wav', y, new_sample_rate);
Tremolo Effect
t = (0:length(x)-1) / Fs;
y = x .* tremolo';
sound(y, Fs);
Bitcrusher Effect
bits = 8;
x = x / max(abs(x(:)));
dither = rand(size(x)) * 2 - 2;
y = y / max(abs(y(:)));
sound(y, Fs);
audiowrite('processed_audio_with_dither.wav', y, Fs);