Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inputFilePath = 'input.wav';
- outputFilePath = 'output_with_tremolo.wav';
- modulatorAmplitude = 0.95; % Adjust the modulation depth as needed
- modulatorFrequency = 400; % Adjust the modulation frequency as needed
- addTremolo(inputFilePath, outputFilePath, modulatorAmplitude, modulatorFrequency);
- function addTremolo(inputFilePath, outputFilePath, modulatorAmplitude, modulatorFrequency)
- [inputWave, fs] = audioread(inputFilePath);
- t = (0:length(inputWave) - 1) / fs;
- modulatorSignal = 1 + modulatorAmplitude * sin(2 * pi * modulatorFrequency * t);
- outputWave = inputWave .* modulatorSignal';
- audiowrite(outputFilePath, outputWave, fs);
- figure;
- subplot(3, 1, 1);
- plot(t(1:1000), inputWave(1:1000));
- title('Input Wave');
- subplot(3, 1, 2);
- plot(t(1:1000), outputWave(1:1000));
- title('Output Wave (with Tremolo)');
- subplot(3, 1, 3);
- plot(t(1:1000), modulatorSignal(1:1000));
- title('Modulator Signal');
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement