Clear Filters
Clear Filters

May I ask how to get the value of amplitude from one wav. file?

7 views (last 30 days)
May I ask how to get the value of amplitude from one wav. file? Because I want to do distortion wav. file..

Accepted Answer

Image Analyst
Image Analyst on 29 Apr 2016
The amplitude is the value of the array at that element. If you want the max value over all elements, use max().
[y,Fs] = audioread('guitartune.wav'); % y can have + and - amplitudes.
amplitudes = abs(y); % abs(y) is the amplitudes in an all-positive sense
maxY = max(abs(y)); % maxY is the highest amplitude.
  7 Comments
Image Analyst
Image Analyst on 30 Apr 2016
You can simply use multiplication and division to scale your vector or matrix to anything you want.
desiredMax = 0.1;
yScaled = y * desiredMax / maxY;

Sign in to comment.

More Answers (0)

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!