en fr

Sysquake Pro – Table of Contents

Sysquake – Table of Contents

Sysquake for LaTeX – Table of Contents

Extension - Audio Input

This section describes functions which record sounds. Currently, these functions are available on Windows and macOS.

Functions

audiorecord

Record audio samples.

Syntax

samples = audiorecord(t)
samples = audiorecord(t, options)

Description

audiorecord(t) records audio samples for t seconds and returns them in an array of single numbers. On computers which support them, the default sample rate is 44.1 kHz and the default number of channels is 2 (stereo). The result has 2 columns (one per channel) and as many rows as samples.

audiorecord(t,options) uses the specified options, which are typically built with audiorecordset.

Example

samples = audiorecord(1);
audioplay(samples);

See also

audiorecordset, audioplay

audiorecordset

Options for audio.

Syntax

options = audiorecordset
options = audiorecordset(name1=value1, ...)
options = audiorecordset(name1, value1, ...)
options = audiorecordset(options0, name1=value1, ...)
options = audiorecordset(options0, name1, value1, ...)

Description

audiorecordset(name1,value1,...) creates the option argument used by audiorecord. Options are specified with name/value pairs, where the name is a string which must match exactly the names in the table below. Case is significant. Options which are not specified have a default value. The result is a structure whose fields correspond to each option. Without any input argument, audiorecordset creates a structure with all the default options. Note that audiorecord also interprets the lack of an option argument, or the empty array [], as a request to use the default values.

When its first input argument is a structure, audiorecordset adds or changes fields which correspond to the name/value pairs which follow.

Here is the list of permissible options:

NameDefaultMeaning
SampleRate44100sample rate in Hz
Stereotruetrue for stereo, false for mono

Default values may be different on platforms with limited audio capabilities.

Examples

Default options:

audiorecordset
  SampleRate: 44100
  Stereo: true

Record in mono:

samples = audiorecord(1, audiorecordset(Stereo=false));

See also

audiorecord