returns a new AudioStream object and starts to record from the default input audio device.
AudioRecord[inputdev]
records from the input audio device inputdev.
AudioRecord[astream]
starts recording an AudioStream object astream that is connected to an input device.
AudioRecord
returns a new AudioStream object and starts to record from the default input audio device.
AudioRecord[inputdev]
records from the input audio device inputdev.
AudioRecord[astream]
starts recording an AudioStream object astream that is connected to an input device.
Details and Options
- AudioRecord can be used to perform programmatic audio capture from any input audio device.
- The inputdev can be any device available in $AudioInputDevices.
- With multiple streams connected to the same device, only one stream can record at a given time.
- Use AudioPause or AudioStop to pause or stop the recording.
- Audio[astream] returns an Audio object including all the captured data available in astream.
- The following options can be given:
-
GeneratedAssetFormat Automatic the format of the result GeneratedAssetLocation $GeneratedAssetLocation the location of the result MaxDuration ∞ maximum duration of recording - AudioRecord records until the stream is paused or stopped. Use MaxDuration->dur to record for the specified duration dur.
- By default, the recorded audio is placed under the "Audio" directory in $WolframDocumentsDirectory.
Examples
open all close allBasic Examples (1)
Scope (3)
Create an input stream and start recording from a specific device:
recording = AudioRecord[$DefaultAudioInputDevice]AudioStop[recording]Start the recording of an existing AudioStream:
astream = AudioStream[$DefaultAudioInputDevice];recording = AudioRecord[astream]AudioStop[recording]AudioPause keeps the information about the recording position and the data:
rec = AudioRecord[];AudioPause[]
rec["Position"]
first = Normal@Audio[rec];AudioStop resets the recording:
AudioRecord[rec];AudioStop[]
rec["Position"]
second = Audio[rec];AudioPlot[{first, second}]Options (2)
MaxDuration (1)
Use MaxDuration to set the maximum duration of the recording:
AudioRecord[MaxDuration -> 2]Audio[%]GeneratedAssetLocation (1)
Use the GeneratedAssetLocation option to control the storage location for the recording:
rec = AudioRecord[GeneratedAssetLocation -> "rec.wav"];AudioStop[rec]rec["GeneratedAssetLocation"]If None is specified, an in-core Audio object is created:
rec = AudioRecord[GeneratedAssetLocation -> None];AudioStop[rec]rec["GeneratedAssetLocation"]Properties & Relations (1)
Unlike AudioCapture, AudioRecord does not block the kernel:
rec = AudioRecord[];
Plot3D[{Re[Sin[x + I y]], Im[Sin[x + I y]]}, {x, -2Pi, 2Pi}, {y, 0, 2}, BoxRatios -> Automatic, Ticks -> {Range[-2Pi, 2Pi, Pi], {0, 1, 2}}, Mesh -> None, PlotStyle -> {Yellow, Cyan}, AxesLabel -> Automatic]
Pause[2];
AudioStop[rec];
Audio[rec]Possible Issues (1)
Only a single stream can record from a specific device at any time:
astream1 = AudioRecord[$DefaultAudioInputDevice];astream2 = AudioRecord[$DefaultAudioInputDevice];Stop the first recording and try again:
AudioStop[astream1]astream2 = AudioRecord[$DefaultAudioInputDevice];AudioStop[astream2]Related Guides
Text
Wolfram Research (2018), AudioRecord, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioRecord.html (updated 2021).
CMS
Wolfram Language. 2018. "AudioRecord." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/AudioRecord.html.
APA
Wolfram Language. (2018). AudioRecord. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioRecord.html
BibTeX
@misc{reference.wolfram_2026_audiorecord, author="Wolfram Research", title="{AudioRecord}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/AudioRecord.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_audiorecord, organization={Wolfram Research}, title={AudioRecord}, year={2021}, url={https://reference.wolfram.com/language/ref/AudioRecord.html}, note=[Accessed: 13-June-2026]}