# Why is there an amplitude difference in Matlab and Python?

I've been trying to read an audio file in Matlab using this code --

q = audioread('C:\Users\DELL\Downloads\cha1.wav'); figure; plot(q); 

Translated to Python, the code looks like this --

import scipy.io.wavfile

orig_sample_rate = tup
q = tup


When I try to plot these in Matlab, they produce the same waveform with different amplitudes.

Figure 1: Matlab code, Figure 2: Python code

How can I make the amplitudes the same? Scaling down did not produce accurate results. • what's there to solve? Two different programs interpret the same file differently, but with a factor? That's not a problem, that's just interpretation. – Marcus Müller Oct 21 '17 at 19:54
• Sorry, my question wasn't very clear. I want to know how to make the amplitudes the same. Scaling down by a factor did not give accurate results. – Aishwarya A R Oct 21 '17 at 20:00
• "not accurate" in which way? What's the difference? (please try to give all relevant info) – Marcus Müller Oct 21 '17 at 20:03
• Is it just that Matlab normalizes with a factor of $2^{15}$ or so? – Peter K. Oct 21 '17 at 20:36
• How are you moving from Python to Matlab to plot the second signal ? There might be some spurious gain in the conversion – itismeghasyam Oct 21 '17 at 21:41

This function of Matlab use an algorithm that normalized every data of an external medium while Pyhton doesn't do that. You just need multiply the Matlab values to 32,767.0 or divide Python values to the same value. That's number is because you are using a file with each value has 16 bits, but with sign, so $$2^{16}/2 = 32767$$