## Copyright (C) 1995-2017 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 ## . ## -*- texinfo -*- ## @deftypefn {} {@var{y} =} lin2mu (@var{x}, @var{n}) ## Convert audio data from linear to mu-law. ## ## Mu-law values use 8-bit unsigned integers. Linear values use @var{n}-bit ## signed integers or floating point values in the range -1 @leq{} @var{x} ## @leq{} 1 if @var{n} is 0. ## ## If @var{n} is not specified it defaults to 0, 8, or 16 depending on ## the range of values in @var{x}. ## @seealso{mu2lin} ## @end deftypefn ## Author: hodor123456 ## Created: 9 March 2018 ## function to directly calculate npr ##n is greater than r function ret=npermuter(n,r) if(nargin!=2) print_usage(); endif if(r>n) printf("error: nchoosek: n must be a non-negative integer >= r\n"); return; endif ret=1; for i=1:r ret=ret*n; n=n-1; endfor endfunction