0

For my project on audio analysis, I have downloaded several .wav files while converted some of my .mp3 files to .wav files. But when these .wav files are read using wavfile.read() function. the dimension of the data returned is varies from file to file. Consider my code to read .wav file -

from pyAudioAnalysis import audioBasicIO
from pyAudioAnalysis import audioFeatureExtraction
import matplotlib.pyplot as plt
from scipy.io import wavfile
import MySQLdb

[Fs, x] = wavfile.read("B128.wav");

print "Sampling Frequency : "
print Fs
print "Data : "
print x

The output when B128.wav is read is -

enter image description here

Output when file song.wav is read -

enter image description here

the file B128.wav was downloaded from a website, while song.wav is made converting a .mp3 file to .wav using an online converter tool.

My question is that why the data part is having different dimensions for same file format and how to convert them into a (1xN) dimension

Anil_M
  • 10,893
  • 6
  • 47
  • 74
GAURANG VYAS
  • 689
  • 5
  • 16
  • Have you googled 'wavfile.read'? It leads me to [this answer](http://stackoverflow.com/questions/28117228/data-returned-by-scipy-io-wavfile-read). – Sangbok Lee Apr 03 '17 at 13:49
  • I assume B128.wav is 16-bit PCM mono (one channel), while song.wav is 8-bit PCM stereo (two channels). See the [docs](https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.io.wavfile.write.html) for `scipy.io.wavfile.write()` for an overview of WAV formats. – acidtobi Apr 03 '17 at 13:52
  • @Sangbok Lee help appreciated. Goolged this but couldnot find similar question on stackeroverflow – GAURANG VYAS Apr 03 '17 at 13:56
  • @acidtobi thanks for extra information – GAURANG VYAS Apr 03 '17 at 13:57

0 Answers0