audiowrite

Writes audio data to an audio file using functions defined in the Audio library. Currently only .wav format files in PCM audio format are supported.

Syntax

audiowrite(filename, data, sampleRate)

audiowrite(filename, data, sampleRate, param, value)

Inputs

filename
Audio file name. Currently, only .wav format files are supported.
Type: string
data
Audio data, which is a 2D real matrix.
Type: matrix
sampleRate
Sample rate or the samples(blocks) per second
Type: integer
param-value(optional)
Optional param-value pairs which specify the parameters of the audio data written infilename. The following are the valid parameter names and their values:
artist: artist
Name of the artist.
Type: string
comment: comment
Comments.
Type: string
title: title
Title of the audio file.
Type: string
bitspersample: bitspersample
Number of bits per sample.
Type: integer

Example

Write audio data to a wav file:

inputdata = audioread('input.wav');
audiowrite('audio1.wav', inputdata, 8000, 'artist', 'Artist1', 'title', 'Some title');