changeset 19681:0165d9607624

Deprecate audio functions loadaudio, playaudio, saveaudio, and setaudio. * NEWS: Announce deprecation. * scripts/deprecated/loadaudio.m, scripts/deprecated/playaudio.m, scripts/deprecated/saveaudio.m, scripts/deprecated/setaudio.m: Move from scripts/audio. Add deprecation warnings to code and to docstrings. * audio.txi: Remove from manual. * lin2mu.m, mu2lin.m, record.m: Remove seealso links. * scripts/deprecated/module.mk: Add to build system in deprecated directory. * scripts/audio/module.mk: Remove from build system in audio directory.
author Mike Miller <mtmiller@ieee.org>
date Sat, 31 Jan 2015 10:23:52 -0500
parents 408361a8c72f
children 16f21db320b5
files NEWS doc/interpreter/audio.txi scripts/audio/lin2mu.m scripts/audio/loadaudio.m scripts/audio/module.mk scripts/audio/mu2lin.m scripts/audio/playaudio.m scripts/audio/record.m scripts/audio/saveaudio.m scripts/audio/setaudio.m scripts/deprecated/loadaudio.m scripts/deprecated/module.mk scripts/deprecated/playaudio.m scripts/deprecated/saveaudio.m scripts/deprecated/setaudio.m
diffstat 15 files changed, 359 insertions(+), 326 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Sat Jan 31 02:42:15 2015 -0500
+++ b/NEWS	Sat Jan 31 10:23:52 2015 -0500
@@ -195,14 +195,18 @@
       finite               | isfinite
       fmod                 | rem
       fnmatch              | glob or regexp
+      loadaudio            | audioread
       luinc                | ilu or ichol
       nfields              | numfields
       octave_tmp_file_name | tempname
+      playaudio            | audioplayer
+      saveaudio            | audiowrite
       syl                  | sylvester
       usage                | print_usage
 
       allow_noninteger_range_as_index
       do_braindead_shortcircuit_evaluation
+      setaudio
 
  ** The following functions were deprecated in Octave 3.8 and will be
     removed from Octave 4.2 (or whatever version is the second major
--- a/doc/interpreter/audio.txi	Sat Jan 31 02:42:15 2015 -0500
+++ b/doc/interpreter/audio.txi	Sat Jan 31 10:23:52 2015 -0500
@@ -176,24 +176,8 @@
 
 @DOCSTRING(mu2lin)
 
-@DOCSTRING(loadaudio)
-
-@DOCSTRING(saveaudio)
-
-The following functions for audio I/O require special A/D hardware and
-operating system support.  It is assumed that audio data in linear
-encoding can be played and recorded by reading from and writing to
-@file{/dev/dsp}, and that similarly @file{/dev/audio} is used for mu-law
-encoding.  These file names are system-dependent.  Improvements so that
-these functions will work without modification on a wide variety of
-hardware are welcome.
-
-@DOCSTRING(playaudio)
-
 @DOCSTRING(record)
 
-@DOCSTRING(setaudio)
-
 @DOCSTRING(wavread)
 
 @DOCSTRING(wavwrite)
--- a/scripts/audio/lin2mu.m	Sat Jan 31 02:42:15 2015 -0500
+++ b/scripts/audio/lin2mu.m	Sat Jan 31 10:23:52 2015 -0500
@@ -25,7 +25,7 @@
 ##
 ## If @var{n} is not specified it defaults to 0, 8, or 16 depending on
 ## the range of values in @var{x}.
-## @seealso{mu2lin, loadaudio, saveaudio}
+## @seealso{mu2lin}
 ## @end deftypefn
 
 
--- a/scripts/audio/loadaudio.m	Sat Jan 31 02:42:15 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-## Copyright (C) 1995-2013 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} loadaudio (@var{name}, @var{ext}, @var{bps})
-## Load audio data from the file @file{@var{name}.@var{ext}} into the
-## vector @var{x}.
-##
-## The extension @var{ext} determines how the data in the audio file is
-## interpreted; the extensions @file{lin} (default) and @file{raw}
-## correspond to linear, the extensions @file{au}, @file{mu}, or @file{snd}
-## to mu-law encoding.
-##
-## The argument @var{bps} can be either 8 (default) or 16, and specifies
-## the number of bits per sample used in the audio file.
-## @seealso{lin2mu, mu2lin, saveaudio, playaudio, setaudio, record}
-## @end deftypefn
-
-
-## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at>
-## Created: 10 April 1994
-## Adapted-By: jwe
-
-function X = loadaudio (name, ext, bps)
-
-  if (nargin == 0 || nargin > 3)
-    print_usage ();
-  endif
-
-  if (nargin == 1)
-    ext = "lin";
-  endif
-
-  if (nargin < 3)
-    bps = 8;
-  elseif (bps != 8 && bps != 16)
-    error ("loadaudio: BPS must be either 8 or 16");
-  endif
-
-  name = [name, ".", ext];
-  num = fopen (name, "rb");
-
-  if (strcmp (ext, "lin") || strcmp (ext, "raw") || strcmp (ext, "pcm"))
-    if (bps == 8)
-      [Y, c] = fread (num, inf, "uchar");
-      X = Y - 127;
-    else
-      [X, c] = fread (num, inf, "short");
-    endif
-  elseif (strcmp (ext, "mu") || strcmp (ext, "au")
-          || strcmp (ext, "snd") || strcmp (ext, "ul"))
-    [Y, c] = fread (num, inf, "uchar");
-    ## remove file header
-    m = find (Y(1:64) == 0, 1, "last");
-    if (! isempty (m))
-      Y(1:m) = [];
-    endif
-    X = mu2lin (Y, bps);
-  else
-    fclose (num);
-    error ("loadaudio: unsupported extension");
-  endif
-
-  fclose (num);
-
-endfunction
-
--- a/scripts/audio/module.mk	Sat Jan 31 02:42:15 2015 -0500
+++ b/scripts/audio/module.mk	Sat Jan 31 10:23:52 2015 -0500
@@ -2,12 +2,8 @@
 
 audio_FCN_FILES = \
   audio/lin2mu.m \
-  audio/loadaudio.m \
   audio/mu2lin.m \
-  audio/playaudio.m \
   audio/record.m \
-  audio/saveaudio.m \
-  audio/setaudio.m \
   audio/wavread.m \
   audio/wavwrite.m \
   audio/@audioplayer/__get_properties__.m \
--- a/scripts/audio/mu2lin.m	Sat Jan 31 02:42:15 2015 -0500
+++ b/scripts/audio/mu2lin.m	Sat Jan 31 10:23:52 2015 -0500
@@ -24,7 +24,7 @@
 ## is 0.
 ##
 ## If @var{n} is not specified it defaults to 0.
-## @seealso{lin2mu, loadaudio, saveaudio}
+## @seealso{lin2mu}
 ## @end deftypefn
 
 ## Author:  Andreas Weingessel <Andreas.Weingessel@ci.tuwien.ac.at>
--- a/scripts/audio/playaudio.m	Sat Jan 31 02:42:15 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-## Copyright (C) 1995-2013 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} playaudio (@var{name}, @var{ext})
-## @deftypefnx {Function File} {} playaudio (@var{x})
-## Play the audio file @file{@var{name}.@var{ext}} or the audio data
-## stored in the vector @var{x}.
-## @seealso{lin2mu, mu2lin, loadaudio, saveaudio, setaudio, record}
-## @end deftypefn
-
-## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at>
-## Created: 11 April 1994
-## Adapted-By: jwe
-
-function playaudio (name, ext)
-
-  if (nargin < 1 || nargin > 2)
-    print_usage ();
-  endif
-
-  if (nargin == 1 && isnumeric (name))
-    ## play a vector
-    if (! isvector (name))
-      error ("playaudio: X must be a vector");
-    endif
-    X = name(:) + 127;
-    unwind_protect
-      file = tempname ();
-      fid = fopen (file, "wb");
-      fwrite (fid, X, "uchar");
-      fclose (fid);
-      [status, out] = system (sprintf ('cat "%s" > /dev/dsp', file));
-      if (status != 0)
-        system (sprintf ("paplay --raw \"%s\"", file));
-      endif
-    unwind_protect_cleanup
-      unlink (file);
-    end_unwind_protect
-  elseif (nargin >= 1 && ischar (name))
-    ## play a file
-    if (nargin == 1)
-      name = [name ".lin"];
-    elseif (nargin == 2)
-      name = [name "." ext];
-    endif
-    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
-  else
-    print_usage ();
-  endif
-
-endfunction
-
-
-%% Test input validation
-%!error playaudio ()
-%!error playaudio (1,2,3)
-%!error <X must be a vector> playaudio (magic (3))
-%!error <unsupported extension> playaudio ("file", "abc")
-%!error playaudio ({"abc"})
-
--- a/scripts/audio/record.m	Sat Jan 31 02:42:15 2015 -0500
+++ b/scripts/audio/record.m	Sat Jan 31 10:23:52 2015 -0500
@@ -22,7 +22,7 @@
 ## default value for @var{sampling_rate} is 8000 samples per second, or
 ## 8kHz.  The program waits until the user types @key{RET} and then
 ## immediately starts to record.
-## @seealso{lin2mu, mu2lin, loadaudio, saveaudio, playaudio, setaudio}
+## @seealso{lin2mu, mu2lin}
 ## @end deftypefn
 
 ## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at>
--- a/scripts/audio/saveaudio.m	Sat Jan 31 02:42:15 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-## Copyright (C) 1995-2013 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {} saveaudio (@var{name}, @var{x}, @var{ext}, @var{bps})
-## Save a vector @var{x} of audio data to the file
-## @file{@var{name}.@var{ext}}.  The optional parameters @var{ext} and
-## @var{bps} determine the encoding and the number of bits per sample used
-## in the audio file (see @code{loadaudio}); defaults are @file{lin} and
-## 8, respectively.
-## @seealso{lin2mu, mu2lin, loadaudio, playaudio, setaudio, record}
-## @end deftypefn
-
-## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at>
-## Created: 5 September 1994
-## Adapted-By: jwe
-
-function saveaudio (name, x, ext, bps)
-
-  if (nargin < 2 || nargin > 4)
-    print_usage ();
-  endif
-
-  if (nargin == 2)
-    ext = "lin";
-  endif
-
-  if (nargin < 4)
-    bps = 8;
-  elseif (bps != 8 && bps != 16)
-    error ("saveaudio: BPS must be either 8 or 16");
-  endif
-
-  [nr, nc] = size (x);
-  if (nc != 1)
-    if (nr == 1)
-      x = x';
-      nr = nc;
-    else
-      error ("saveaudio: X must be a vector");
-    endif
-  endif
-
-  num = fopen ([name, ".", ext], "wb");
-
-  if (strcmp (ext, "lin") || strcmp (ext, "raw"))
-    if (bps == 8)
-      ld = max (abs (x));
-      if (ld > 127)   # convert 16 to 8 bit
-        if (ld < 16384)
-          sc = 64 / ld;
-        else
-          sc = 1 / 256;
-        endif
-        x = fix (x * sc);
-      endif
-      x = x + 127;
-      c = fwrite (num, x, "uchar");
-    else
-      c = fwrite (num, x, "short");
-    endif
-  elseif (strcmp (ext, "mu") || strcmp (ext, "au")
-          || strcmp (ext, "snd") || strcmp (ext, "ul"))
-    y = lin2mu (x);
-    c = fwrite (num, y, "uchar");
-  else
-    fclose (num);
-    error ("saveaudio: unsupported extension");
-  endif
-
-  fclose (num);
-
-endfunction
-
--- a/scripts/audio/setaudio.m	Sat Jan 31 02:42:15 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-## Copyright (C) 1995-2013 John W. Eaton
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or (at
-## your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn  {Function File} {} setaudio ()
-## @deftypefnx {Function File} {} setaudio (@var{w_type})
-## @deftypefnx {Function File} {} setaudio (@var{w_type}, @var{value})
-## Execute the shell command @samp{mixer}, possibly with optional
-## arguments @var{w_type} and @var{value}.
-## @end deftypefn
-
-## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at>
-## Created: 5 October 1994
-## Adapted-By: jwe
-
-function setaudio (w_type, value)
-
-  if (nargin == 0)
-    system ("mixer");
-  elseif (nargin == 1)
-    system (sprintf ("mixer %s", w_type));
-  elseif (nargin == 2)
-    system (sprintf ("mixer %s %d", w_type, value));
-  else
-    print_usage ();
-  endif
-
-endfunction
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/loadaudio.m	Sat Jan 31 10:23:52 2015 -0500
@@ -0,0 +1,93 @@
+## Copyright (C) 1995-2013 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} loadaudio (@var{name}, @var{ext}, @var{bps})
+##
+## @code{loadaudio} is deprecated and will be removed in Octave version 4.4.
+## Please use @code{audioread} in all new code.
+##
+## Load audio data from the file @file{@var{name}.@var{ext}} into the
+## vector @var{x}.
+##
+## The extension @var{ext} determines how the data in the audio file is
+## interpreted; the extensions @file{lin} (default) and @file{raw}
+## correspond to linear, the extensions @file{au}, @file{mu}, or @file{snd}
+## to mu-law encoding.
+##
+## The argument @var{bps} can be either 8 (default) or 16, and specifies
+## the number of bits per sample used in the audio file.
+## @seealso{lin2mu, mu2lin, saveaudio, playaudio, setaudio, record}
+## @end deftypefn
+
+
+## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at>
+## Created: 10 April 1994
+## Adapted-By: jwe
+
+function X = loadaudio (name, ext, bps)
+
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "loadaudio is obsolete and will be removed from a future version of Octave, please use audioread instead");
+  endif
+
+  if (nargin == 0 || nargin > 3)
+    print_usage ();
+  endif
+
+  if (nargin == 1)
+    ext = "lin";
+  endif
+
+  if (nargin < 3)
+    bps = 8;
+  elseif (bps != 8 && bps != 16)
+    error ("loadaudio: BPS must be either 8 or 16");
+  endif
+
+  name = [name, ".", ext];
+  num = fopen (name, "rb");
+
+  if (strcmp (ext, "lin") || strcmp (ext, "raw") || strcmp (ext, "pcm"))
+    if (bps == 8)
+      [Y, c] = fread (num, inf, "uchar");
+      X = Y - 127;
+    else
+      [X, c] = fread (num, inf, "short");
+    endif
+  elseif (strcmp (ext, "mu") || strcmp (ext, "au")
+          || strcmp (ext, "snd") || strcmp (ext, "ul"))
+    [Y, c] = fread (num, inf, "uchar");
+    ## remove file header
+    m = find (Y(1:64) == 0, 1, "last");
+    if (! isempty (m))
+      Y(1:m) = [];
+    endif
+    X = mu2lin (Y, bps);
+  else
+    fclose (num);
+    error ("loadaudio: unsupported extension");
+  endif
+
+  fclose (num);
+
+endfunction
+
--- a/scripts/deprecated/module.mk	Sat Jan 31 02:42:15 2015 -0500
+++ b/scripts/deprecated/module.mk	Sat Jan 31 10:23:52 2015 -0500
@@ -20,12 +20,16 @@
   deprecated/java_unsigned_conversion.m \
   deprecated/javafields.m \
   deprecated/javamethods.m \
+  deprecated/loadaudio.m \
   deprecated/luinc.m \
   deprecated/nfields.m \
   deprecated/octave_tmp_file_name.m \
+  deprecated/playaudio.m \
   deprecated/re_read_readline_init_file.m \
   deprecated/read_readline_init_file.m \
+  deprecated/saveaudio.m \
   deprecated/saving_history.m \
+  deprecated/setaudio.m \
   deprecated/strmatch.m \
   deprecated/syl.m \
   deprecated/usage.m
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/playaudio.m	Sat Jan 31 10:23:52 2015 -0500
@@ -0,0 +1,99 @@
+## Copyright (C) 1995-2013 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} playaudio (@var{name}, @var{ext})
+## @deftypefnx {Function File} {} playaudio (@var{x})
+##
+## @code{playaudio} is deprecated and will be removed in Octave version 4.4.
+## Please use @code{audioplayer} in all new code.
+##
+## Play the audio file @file{@var{name}.@var{ext}} or the audio data
+## stored in the vector @var{x}.
+## @seealso{lin2mu, mu2lin, loadaudio, saveaudio, setaudio, record}
+## @end deftypefn
+
+## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at>
+## Created: 11 April 1994
+## Adapted-By: jwe
+
+function playaudio (name, ext)
+
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "playaudio is obsolete and will be removed from a future version of Octave, please use audioplayer instead");
+  endif
+
+  if (nargin < 1 || nargin > 2)
+    print_usage ();
+  endif
+
+  if (nargin == 1 && isnumeric (name))
+    ## play a vector
+    if (! isvector (name))
+      error ("playaudio: X must be a vector");
+    endif
+    X = name(:) + 127;
+    unwind_protect
+      file = tempname ();
+      fid = fopen (file, "wb");
+      fwrite (fid, X, "uchar");
+      fclose (fid);
+      [status, out] = system (sprintf ('cat "%s" > /dev/dsp', file));
+      if (status != 0)
+        system (sprintf ("paplay --raw \"%s\"", file));
+      endif
+    unwind_protect_cleanup
+      unlink (file);
+    end_unwind_protect
+  elseif (nargin >= 1 && ischar (name))
+    ## play a file
+    if (nargin == 1)
+      name = [name ".lin"];
+    elseif (nargin == 2)
+      name = [name "." ext];
+    endif
+    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
+  else
+    print_usage ();
+  endif
+
+endfunction
+
+
+%% Test input validation
+%!error playaudio ()
+%!error playaudio (1,2,3)
+%!error <X must be a vector> playaudio (magic (3))
+%!error <unsupported extension> playaudio ("file", "abc")
+%!error playaudio ({"abc"})
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/saveaudio.m	Sat Jan 31 10:23:52 2015 -0500
@@ -0,0 +1,100 @@
+## Copyright (C) 1995-2013 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} saveaudio (@var{name}, @var{x}, @var{ext}, @var{bps})
+##
+## @code{saveaudio} is deprecated and will be removed in Octave version 4.4.
+## Please use @code{audiowrite} in all new code.
+##
+## Save a vector @var{x} of audio data to the file
+## @file{@var{name}.@var{ext}}.  The optional parameters @var{ext} and
+## @var{bps} determine the encoding and the number of bits per sample used
+## in the audio file (see @code{loadaudio}); defaults are @file{lin} and
+## 8, respectively.
+## @seealso{lin2mu, mu2lin, loadaudio, playaudio, setaudio, record}
+## @end deftypefn
+
+## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at>
+## Created: 5 September 1994
+## Adapted-By: jwe
+
+function saveaudio (name, x, ext, bps)
+
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "saveaudio is obsolete and will be removed from a future version of Octave, please use audiowrite instead");
+  endif
+
+  if (nargin < 2 || nargin > 4)
+    print_usage ();
+  endif
+
+  if (nargin == 2)
+    ext = "lin";
+  endif
+
+  if (nargin < 4)
+    bps = 8;
+  elseif (bps != 8 && bps != 16)
+    error ("saveaudio: BPS must be either 8 or 16");
+  endif
+
+  [nr, nc] = size (x);
+  if (nc != 1)
+    if (nr == 1)
+      x = x';
+      nr = nc;
+    else
+      error ("saveaudio: X must be a vector");
+    endif
+  endif
+
+  num = fopen ([name, ".", ext], "wb");
+
+  if (strcmp (ext, "lin") || strcmp (ext, "raw"))
+    if (bps == 8)
+      ld = max (abs (x));
+      if (ld > 127)   # convert 16 to 8 bit
+        if (ld < 16384)
+          sc = 64 / ld;
+        else
+          sc = 1 / 256;
+        endif
+        x = fix (x * sc);
+      endif
+      x = x + 127;
+      c = fwrite (num, x, "uchar");
+    else
+      c = fwrite (num, x, "short");
+    endif
+  elseif (strcmp (ext, "mu") || strcmp (ext, "au")
+          || strcmp (ext, "snd") || strcmp (ext, "ul"))
+    y = lin2mu (x);
+    c = fwrite (num, y, "uchar");
+  else
+    fclose (num);
+    error ("saveaudio: unsupported extension");
+  endif
+
+  fclose (num);
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/setaudio.m	Sat Jan 31 10:23:52 2015 -0500
@@ -0,0 +1,56 @@
+## Copyright (C) 1995-2013 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Function File} {} setaudio ()
+## @deftypefnx {Function File} {} setaudio (@var{w_type})
+## @deftypefnx {Function File} {} setaudio (@var{w_type}, @var{value})
+##
+## @code{setaudio} is deprecated and will be removed in Octave version 4.4.
+## Please scale the audio signal in all new code or use the operating system's
+## native tools to adjust audio input and output levels.
+##
+## Execute the shell command @samp{mixer}, possibly with optional
+## arguments @var{w_type} and @var{value}.
+## @end deftypefn
+
+## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at>
+## Created: 5 October 1994
+## Adapted-By: jwe
+
+function setaudio (w_type, value)
+
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "setaudio is obsolete and will be removed from a future version of Octave, please scale the audio signal instead");
+  endif
+
+  if (nargin == 0)
+    system ("mixer");
+  elseif (nargin == 1)
+    system (sprintf ("mixer %s", w_type));
+  elseif (nargin == 2)
+    system (sprintf ("mixer %s %d", w_type, value));
+  else
+    print_usage ();
+  endif
+
+endfunction
+