---
name: "AuSoundRecordToFile"
section: "3nas"
platform: "linux"
package: "libaudio-dev"
version: "1.9.4-9"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/AuSoundRecordToFile"
---

# AuSoundRecordToFile(3nas)

create a flow to record to a file.

## Name

**AuSoundRecordToFile** - create a flow to record to a file.

## Synopsis

\#include \<audio/audiolib.h\>\
 \#include \<audio/soundlib.h\>

**AuEventHandlerRec** \***AuSoundRecordToFile**(*server*, *filename*, *source*, *gain*, *callback*, *callback\_data*, *mode*, *file\_format*, *comment*, *rate*, *data\_format*, *flow*, *volume\_mult\_elem*, *status*)\
\
     **AuServer** \**server*;\
\
     char \**filename*;\
\
     **AuDeviceID** *source*;\
\
     **AuFixedPoint** *gain*;\
\
     void (\**callback*) (**AuServer** \*, **AuEventHandlerRec** \*, **AuEvent** \*, **AuPointer**);\
\
     **AuPointer** *callback\_data*;\
\
     int *mode*;\
\
     int *file\_format*;\
\
     char \**comment*;\
\
     **AuUint32** *rate*;\
\
     int *data\_format*;\
\
     **AuFlowID** \**flow*; /\* **RETURN** \*/\
\
     int \**volume\_mult\_elem*; /\* **RETURN** \*/\
\
     **AuStatus** \**status*; /\* **RETURN** \*/

## Arguments

- *server*

  Specifies the connection to the audio server.

- *filename*

  Specifies the name of the file to record to.

- *source*

  Specifies the input device to use.

- *gain*

  Specifies the gain for the input device.

- *callback*

  Specifies the procedure to be called for additional event processing.

- *callback\_data*

  Specifies any additional arguments to be passed to the callback.

- *mode*

  Specifies the line mode for the input device. Currently the following line modes are defined: **AuDeviceInputModeNone**, **AuDeviceInputModeLineIn**, **AuDeviceInputModeMicrophone**.

- *file\_format*

  Specifies the file format. Currently, the following file formats are supported: **SoundFileFormatSnd**, **SoundFileFormatVoc**, **SoundFileFormatWave**, **SoundFileFormatAiff**, **SoundFileFormatSvx**.

- *comment*

  Specifies a comment to embedded in the file.

- *rate*

  Specifies the sample rate to record at.

- *data\_format*

  Specifies the data format. Currently, the following data formats are defined: **AuFormatULAW8**, **AuFormatLinearUnsigned8**, **AuFormatLinearSigned8**, **AuFormatLinearSigned16MSB**, **AuFormatLinearUnsigned16MSB**, **AuFormatSignedLinear16LSB**, and **AuFormatLinearUnsigned16LSB**.

- *flow*

  If non-NULL, returns the flow ID.

- *volume\_mult\_elem*

  Accord to the comment in the source, not implemented.

- *status*

  If non-NULL, flush the output buffer and return the status from the server.

## Description

**AuSoundRecordToFile** creates a flow to record from *source* to *filename* and returns a pointer to the event handler created or NULL if there was an error.

## Errors

**AuBadDevice**.

## See Also

**AuSoundRecord**, **AuSoundRecordToBucket**, **AuSoundRecordToData**, **AuSoundRecordToFileN**.

audiolib - **Network Audio System** C Language Interface
