Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function modifyVocalVolume(inputFilePath, dBValue, outputFilePath)
- [inputSignal, sampleRate] = audioread(inputFilePath);
- leftChannel = inputSignal(:, 1);
- rightChannel = inputSignal(:, 2);
- scalingFactor = 10^(dBValue/20);
- modifiedLeftChannel = leftChannel * scalingFactor;
- modifiedRightChannel = rightChannel * scalingFactor;
- outputSignal = [modifiedLeftChannel, modifiedRightChannel];
- audiowrite(outputFilePath, outputSignal, sampleRate);
- t = (0:length(inputSignal)-1) / sampleRate;
- figure;
- subplot(2, 1, 1);
- plot(t, leftChannel, 'b', t, rightChannel, 'r');
- title('Input Vocals');
- xlabel('Time (s)');
- ylabel('Amplitude');
- legend('Left Channel', 'Right Channel');
- subplot(2, 1, 2);
- plot(t, modifiedLeftChannel, 'b', t, modifiedRightChannel, 'r');
- title('Output Vocals');
- xlabel('Time (s)');
- ylabel('Amplitude');
- legend('Left Channel', 'Right Channel');
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement