# Writing a wav file: writewav

### 15.1.12 Writing a wav file: writewav

The writewav command writes sound data to a wav file.

- writewav takes two arguments:
  - filename, the name of a file.
  - s, the sound data. This can either be in the same format as that returned by the readwav command or (for a mono sound) a list of the digital data of the sound which will use the default parameters (16 bits, 44100 Hz).
- writewav(filename,s) writes the sound to the file filename.

#### Example.

Input:

writewav("la.wav",2^14*sin(2*pi*440*soundsec(1)))

Output: There will be a file la.wav containing a sound of frequency 440 Hz sampled 44100 times per second.