<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>

  <TITLE>savewave</TITLE>

  <TYPE>Scilab Function</TYPE>

  <DATE>Jul 2005</DATE>

  <SHORT_DESCRIPTION name="savewave">save data into a sound  wav file.</SHORT_DESCRIPTION>

  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>savewave(filename,x [, rate ]);</CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>

  <PARAM>
    <PARAM_INDENT>
    <PARAM_ITEM>
        <PARAM_NAME>filename</PARAM_NAME>

        <PARAM_DESCRIPTION>
          <SP>: a string. The path of the output wav file</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>

      <PARAM_ITEM>
        <PARAM_NAME>x</PARAM_NAME>

        <PARAM_DESCRIPTION>
          <SP>: a mxn matrix where m is the number of channels and n the
          number of samples for each channel</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>

      <PARAM_ITEM>
        <PARAM_NAME>rate</PARAM_NAME>

        <PARAM_DESCRIPTION>
          <SP>: a scalar giving the sampling rate (number of sample per
          second) 22050 is the default value.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    </PARAM_INDENT>
  </PARAM>

  <DESCRIPTION>
    <P>save x into a wav sound file. you can transform other sound files into
    wav file with the <VERB>sox</VERB> program.</P>
  </DESCRIPTION>

  <EXAMPLE>
// At first we create 0.5 seconds of sound parameters.
t=soundsec(0.5);
// Then we generate the sound.
s=sin(2*%pi*440*t)+sin(2*%pi*220*t)/2+sin(2*%pi*880*t)/2;
[nr,nc]=size(t);
s(nc/2:nc)=sin(2*%pi*330*t(nc/2:nc));
savewave(TMPDIR+'/foo.wav',s);
  </EXAMPLE>

  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>loadwave</LINK>
    </SEE_ALSO_ITEM>

    <SEE_ALSO_ITEM>
      <LINK>analyze</LINK>
    </SEE_ALSO_ITEM>

    <SEE_ALSO_ITEM>
      <LINK>mapsound</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>
</MAN>
