2.7.18 expWAV


Menu Information

File: Export: Sound (WAV)

Brief Information

Export data as Microsoft PCM wave file

Command Line Usage

expWAV fname:="sound.wav";

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Channel Mode mode

Input

int

mono

This variable specifies the channel mode.
Option list

  • mono:Mono
    Mono channel
  • stereo:Stereo
    Stereo channel
Input Worksheet iw

Input

Worksheet

<active>

Specify the input range to be converted to WAV

Left Channel left

Input

int

1

Specify which column of the worksheet is the left channel. And it will represent the Channel when Channel Mode selected as moto.

Right Channel right

Input

int

2

Specify which column of the worksheet is the Right channel. It is only avaliable when Channel Mode selected as Stereo

Start Row r1

Input

int

1

The begin of the data to be exported

End Row r2

Input

int

0

The end of the data to be exported

File Name fname

Input

string

fname$

Specify the path and filename of the output WAV file

Sample Bits bits

Input

int

bit16

Specify the Sample Bits of the output WAV file
Option list

  • 8 Bits
    8 Bits
  • 16 Bits
    16 Bits
  • 32 Bits
    32 Bits

Description

The expWAV function exports worksheet data as Microsoft PCM wave file. It can be accessed from menu or command window

  • Menu: Select Data: Import from File: Multiple ASCII...
  • Command window: expWAV -d

Noted that the value of the Sampling Interval in the worksheet must be larger than 22Hz.

Examples

  • Code Sample
/*
This script shows how to import a sound wave file and do some processing then export the result. 
The sample data is located in exe_path\Samples\Signal Processing\.
1. Import a wav file to a new book.
2. Perform low-pass filters on the data to remove the high frequency part of the sound.
3. Export the data to a new wav file.
*/
// Import the wav file
fname$ = system.path.program$ + "Samples\Signal Processing\sample.wav";
newbook s:=0;
newsheet col:=1;
impWav options.SparkLines:=0;
string bkn$=%H;
// Remove the high frequency part
fft_filters [bkn$]1!col(1) cutoff:=2000 oy:=(<input>,<new name:="Low Frequency of the Sound">);
// Set the new wav column's format to be short(2) type
wks.col2.format=1;
wks.col2.numerictype=3;

// Export to a new wav file;
fname$="";
expWav iw:=[bkn$]1 left:=2;

Related X-Functions