0
votes

I need to play an wav file on Octave. When I call playaudio("sample","wav") function. I get this error :

error: playaudio does not support given extension

error: called from:

error: /usr/share/octave/3.2.4/m/audio/playaudio.m at line 70, column 7

How could I solve this problem? How can I make playaudio support wav. format.

1
Maybe you find this question/answer to be helpful. It appears that you have to use wavread first. - Schorsch

1 Answers

1
votes

The source code for the playaudio function is very straightforward:

if (any (strcmp (ext, {"lin", "raw"})))
  [status, out] = system (sprintf ('cat "%s" > /dev/dsp', name));
  if (status != 0)
    system (sprintf ('paplay --raw "%s"', name));
  endif
elseif (any (strcmp (ext, {"mu", "au" "snd", "ul"})))
  [status, out] = system (sprintf ('cat "%s" > /dev/audio', name));
  if (status != 0)
    system (sprintf ('paplay "%s"', name));
  endif
else
  error ("playaudio: unsupported extension '%s'", ext);
endif

As you can see, it's simply doing a system call with the paplay utility available in all Linux systems using the PulseAudio sound server. If you have the permission to edit the playaudio.m file yourself, just add the "wav" extension to the list as in:

elseif (any (strcmp (ext, {"mu", "au" "snd", "ul", "wav"})))

It should work out of the box.

I'll submit this patch to the GNU Octave bug tracking system. Thanks for reporting the issue.


Patch submitted: https://savannah.gnu.org/patch/index.php?8441