I can only write .wav files to the current directory

fname = 'bassswoon.wav'
wav = wave.open(fname,'w')
wav.writeframes(struct.pack('h', bassswoon))

Adding a path to fname, i.e. fname = '/path/to/bassswoon.wav' does not work - the file is written neither in the intended directory ('/path/to/') nor in the working directory.

I don't see anything of use in the documentation - is it simply not possible with the wave object? Surely, there must be a way to hack it...

  • $\begingroup$ This question is off-topic. You should post at Stack Overflow. $\endgroup$ – Jason R Sep 9 '15 at 11:34
  • $\begingroup$ From what I can see, you are not writing, but you are trying to open... I suggest you to use scipy.io.wavfile module anyway. $\endgroup$ – jojek Sep 9 '15 at 11:37
  • $\begingroup$ I thought it may be of interest to other people @ DSP $\endgroup$ – yunque Sep 9 '15 at 11:38
  • $\begingroup$ @jojek see my edit for the rest of the code. I guess I may be looking at the wrong step in the process... will check scipy.io.wavfile $\endgroup$ – yunque Sep 9 '15 at 11:40

Browse other questions tagged or ask your own question.