# HG changeset patch # User Rik # Date 1640893339 28800 # Node ID faf96757915ab050269f4ea72151564ec18b92dd # Parent d3b1d0e770e2ce3f624f9ff3f7f300abc3680d0d record.m, soundsc.m: Small code tweaks for Octave conventions. * record.m: Rename output parameter to match documentation. * soundsc.m: Use default value for function input parameter to simplify code. diff -r d3b1d0e770e2 -r faf96757915a scripts/audio/record.m --- a/scripts/audio/record.m Thu Dec 30 11:28:56 2021 -0800 +++ b/scripts/audio/record.m Thu Dec 30 11:42:19 2021 -0800 @@ -36,7 +36,7 @@ ## @seealso{@audiorecorder/audiorecorder, sound, soundsc} ## @end deftypefn -function x = record (sec, fs = 8000) +function data = record (sec, fs = 8000) if (nargin < 1) print_usage (); @@ -50,16 +50,14 @@ error ("record: sample rate FS must be a positive number"); endif - x = []; + data = []; if (sec > 0) - rec = audiorecorder (fs, 16, 1); recordblocking (rec, sec); - x = getaudiodata (rec); - + data = getaudiodata (rec); endif endfunction diff -r d3b1d0e770e2 -r faf96757915a scripts/audio/soundsc.m --- a/scripts/audio/soundsc.m Thu Dec 30 11:28:56 2021 -0800 +++ b/scripts/audio/soundsc.m Thu Dec 30 11:42:19 2021 -0800 @@ -49,16 +49,12 @@ ## @seealso{sound, @audioplayer/audioplayer, record} ## @end deftypefn -function soundsc (y, fs, nbits, yrange) +function soundsc (y, fs, nbits, yrange = []) if (nargin < 1) print_usage (); endif - if (nargin < 4) - yrange = []; - endif - if (nargin < 2 || isempty (fs)) fs = 8000; elseif (nargin == 2 && numel (fs) > 1)