title: Using sklearn on audio files of different lengths
body: <p>I'm new to ML and wanted to try a project myself to learn, so please excuse any blatant mistakes. I'm trying to classify a few files (ringtones and such) using audiolab and sklearn in python. </p>
  
  <p>Here's the code:</p>
  
  <pre><code>from scikits.audiolab.pysndfile.matapi import oggread, wavread
  
  import numpy as np
  
  from sklearn import svm
  
  files = ["Basic_Bell.ogg", "Beep-Beep.ogg", "Beep_Once.ogg", "Calling_You.ogg",  "Time_Up.ogg"]
  labels = [2,1,1,2,2]
  train = []
  
  for f in files:
      data, fs, enc = oggread("Tones/"+f)
      train.append(data)
  
  clf = svm.SVC()
  clf.fit(train, labels)
  </code></pre>
  
  <p>I'm getting an error message:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/athul/Projects/Audio Analysis/read.py", line 18, in &lt;module&gt;
      clf.fit(train, labels)
    File "/usr/local/lib/python2.7/dist-packages/sklearn/svm/base.py", line 150, in fit
      X = check_array(X, accept_sparse='csr', dtype=np.float64, order='C')
    File "/usr/local/lib/python2.7/dist-packages/sklearn/utils/validation.py", line 373, in check_array
      array = np.array(array, dtype=dtype, order=order, copy=copy)
  ValueError: setting an array element with a sequence.
  </code></pre>
  
  <p>In my (limited) understanding this seems to be issue because the train data has different sizes and hence numpy can't convert it into a matrix, so how do I fix this? Can I pad it? If so whats the size I should use? Or is this a mistake on my part? </p>