Mercurial > forge
changeset 9178:3de14784cdc6 octave-forge
audio: miscellaneous: moving clip.m from audio to miscellanous. Updating DESCRIPTION of both packages. Creating NEWS file for both packages
author | jpicarbajal |
---|---|
date | Sun, 11 Dec 2011 15:04:33 +0000 |
parents | 28c58459a4ee |
children | 4a694893cce9 |
files | main/audio/DESCRIPTION main/audio/NEWS main/audio/inst/clip.m main/miscellaneous/DESCRIPTION main/miscellaneous/INDEX main/miscellaneous/NEWS main/miscellaneous/inst/clip.m |
diffstat | 7 files changed, 83 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/main/audio/DESCRIPTION Sun Dec 11 03:30:40 2011 +0000 +++ b/main/audio/DESCRIPTION Sun Dec 11 15:04:33 2011 +0000 @@ -1,11 +1,11 @@ Name: Audio Version: 1.1.4 -Date: 2009-05-03 +Date: 2011-12-11 Author: Paul Kienzle <pkienzle@users.sf.net> Maintainer: Paul Kienzle <pkienzle@users.sf.net> Title: Audio Description: Audio recording, processing and playing tools. -Depends: octave (>= 2.9.7) +Depends: octave (>= 2.9.7), miscellaneous (>= ) Autoload: yes License: GPL version 2 or later Url: http://octave.sf.net
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main/audio/NEWS Sun Dec 11 15:04:33 2011 +0000 @@ -0,0 +1,8 @@ +Summary of important user-visible changes for releases of the audio package + +=============================================================================== +audio-X.Y.Z Release Date: 2011-YY-XX Release Manager: +=============================================================================== + +* Created this NEWS file. +* Fuction clip was moved to miscellaneous package.
--- a/main/audio/inst/clip.m Sun Dec 11 03:30:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -## Copyright (C) 1999 Paul Kienzle -## -## This program 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 2 of the License, or -## (at your option) any later version. -## -## This program 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 this program; If not, see <http://www.gnu.org/licenses/>. - -## Clip values outside the range to the value at the boundary of the -## range. -## -## X = clip(X) -## Clip to range [0, 1] -## -## X = clip(X, hi) -## Clip to range [0, hi] -## -## X = clip(X, [lo, hi]) -## Clip to range [lo, hi] - -## TODO: more clip modes, such as three level clip(X, [lo, mid, hi]), which -## TODO: sends everything above hi to hi, below lo to lo and between to -## TODO: mid; or infinite peak clipping, which sends everything above mid -## TODO: to hi and below mid to lo. - -function x = clip (x, range) - - if (nargin == 2) - if (length(range) == 1) - range = [0, range]; - end - elseif (nargin == 1) - range = [0, 1]; - else - usage("X = clip(X [, range])"); - end - try wfi = warning("query", "Octave:fortran-indexing").state; - catch wfi = "off"; - end - unwind_protect - x (find (x > range (2))) = range (2); - x (find (x < range (1))) = range (1); - unwind_protect_cleanup - warning(wfi, "Octave:fortran-indexing"); - end_unwind_protect - -endfunction - -%!error clip -%!error clip(1,2,3) -%!assert (clip(pi), 1) -%!assert (clip(-pi), 0) -%!assert (clip([-1.5, 0, 1.5], [-1, 1]), [-1, 0, 1]); -%!assert (clip([-1.5, 0, 1.5]', [-1, 1]'), [-1, 0, 1]'); -%!assert (clip([-1.5, 1; 0, 1.5], [-1, 1]), [-1, 1; 0, 1]); -%!assert (isempty(clip([],1)));
--- a/main/miscellaneous/DESCRIPTION Sun Dec 11 03:30:40 2011 +0000 +++ b/main/miscellaneous/DESCRIPTION Sun Dec 11 15:04:33 2011 +0000 @@ -1,6 +1,6 @@ Name: Miscellaneous Version: 1.0.11 -Date: 2011-05-20 +Date: 2011-12-11 Author: Various Authors Maintainer: The Octave Community Title: Miscellaneous functions
--- a/main/miscellaneous/INDEX Sun Dec 11 03:30:40 2011 +0000 +++ b/main/miscellaneous/INDEX Sun Dec 11 15:04:33 2011 +0000 @@ -21,3 +21,4 @@ csvexplode server publish + clip
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main/miscellaneous/NEWS Sun Dec 11 15:04:33 2011 +0000 @@ -0,0 +1,8 @@ +Summary of important user-visible changes for releases of the miscellaneous package + +=============================================================================== +miscellaneous-X.Y.Z Release Date: 2011-YY-XX Release Manager: +=============================================================================== + +* This NEWS file was created. +* Function clip imported from audio.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main/miscellaneous/inst/clip.m Sun Dec 11 15:04:33 2011 +0000 @@ -0,0 +1,63 @@ +## Copyright (C) 1999 Paul Kienzle +## +## This program 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 2 of the License, or +## (at your option) any later version. +## +## This program 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 this program; If not, see <http://www.gnu.org/licenses/>. + +## Clip values outside the range to the value at the boundary of the +## range. +## +## X = clip(X) +## Clip to range [0, 1] +## +## X = clip(X, hi) +## Clip to range [0, hi] +## +## X = clip(X, [lo, hi]) +## Clip to range [lo, hi] + +## TODO: more clip modes, such as three level clip(X, [lo, mid, hi]), which +## TODO: sends everything above hi to hi, below lo to lo and between to +## TODO: mid; or infinite peak clipping, which sends everything above mid +## TODO: to hi and below mid to lo. + +function x = clip (x, range) + + if (nargin == 2) + if (length(range) == 1) + range = [0, range]; + end + elseif (nargin == 1) + range = [0, 1]; + else + usage("X = clip(X [, range])"); + end + try wfi = warning("query", "Octave:fortran-indexing").state; + catch wfi = "off"; + end + unwind_protect + x (find (x > range (2))) = range (2); + x (find (x < range (1))) = range (1); + unwind_protect_cleanup + warning(wfi, "Octave:fortran-indexing"); + end_unwind_protect + +endfunction + +%!error clip +%!error clip(1,2,3) +%!assert (clip(pi), 1) +%!assert (clip(-pi), 0) +%!assert (clip([-1.5, 0, 1.5], [-1, 1]), [-1, 0, 1]); +%!assert (clip([-1.5, 0, 1.5]', [-1, 1]'), [-1, 0, 1]'); +%!assert (clip([-1.5, 1; 0, 1.5], [-1, 1]), [-1, 1; 0, 1]); +%!assert (isempty(clip([],1)));