Sounds Logical
Send Page To a Friend

Table Of Contents Previous Page Next Page

[M-Pack 1 overview]

M-Pack 1: WAV file processing: MATLAB function reference

wavscale
Version 1.2 Requires MATLAB 6.0 (R12) or later

Linearly maps all elements of the input matrix on to the output range -1:+1. Useful for scaling audio WAV data which has been read with wavin using the 'raw' scale option.

File format: m-file
Editable source code:
yes
Utilises non-editable functions: no
Platform:
PC/Windows
Required MATLAB Toolboxes: none (except core MATLAB)
Demo version limitations: p-code only (non-editable); 2000 sample length limit (then silence)
Syntax:

y=wavscale(x);

Arguments:
Input:
x

matrix of input data. For example, if x is read from a WAV file using wavin, then the dimensions will be (Number of samples * Number of Channels).

Output:
y matrix of output data, linearly normalised to the amplitude range -1:+1.Same dimensions as input matrix.

The normalization is applied across the entire data set (i.e. across all channels), using a range determined by the minimum value across the entire data set and the maximum value across the entire data set.

 

  wavin    WAV file reading
  wavnormalize WAV file normalization
Examples:
The following example demonstrates how to read a WAV file using wavin with the 'raw' scale setting, then normalize it using wavscale:
 
Read a 4-channel WAV file named 4channel.wav located in the directory ..\WAVFiles using the 'raw' scale setting and explore the data range:
  [x,fs]=wavin('..\WAVfiles\4channel.wav');
  >> [min(x) max(x)]
  ans = -10254 -12067 -18884 -31783
         22258  22219  26018  19188
   
Now normalize using wavscale and explore the resulting data range (observing that the results are confined to -1:+1 across all channels):
  y=wavscale(x);
  >> [min(y) max(y)]
  ans = -0.2551 -0.3178 -0.5537 -1.0000
         0.8699  0.8685  1.0000  0.7637
 

Top Of Page Table Of Contents Previous Page Next Page

Send Page To a Friend

home - news - products - store - support - site map - company info
© 2007 Sounds Logical. All rights reserved.
Sounds Logical
legal notice - privacy statement