title: Create a wav file from blob audio django
body: <p>On the client side, I am sending a blob audio (wav) file. On the server side, I am trying to convert the blob file to an audio wav file. I did the following:</p>
  
  <pre><code>blob = request.FILES['file']
  name = "TEST.wav"
  audio = wave.open(name, 'wb')
  audio.setnchannels(1)
  audio.writeframes(blob.read())
  </code></pre>
  
  <p>I thought that converting the blob would be similar to converting a blob image to a jpeg file, but was very incorrect in that assumption. That didn't work; I get an error - "Error: sample width not specified." I then used setsampwidth() and tossed in an arbitrary number between 1 and 4 (after looking at the wave.py source file...I don't know why the bytes have to be between 1 and 4). After that another error is thrown - "Error: sampling rate not specified." How do I specify the sampling rate? </p>
  
  <p>What does the setnchannels(), setsampwidth() methods do? Is there an "easy" way I generate the wav file from the blob?</p>