Writing Binary Files

From GNU Radio
Jump to navigation Jump to search

The File Sink block takes incoming samples and saves them to local storage.

Block Options for Data Types

By default the File Sink block uses a 32-bit float format for saving interleaved I and Q:

Storing binary files file sink complex floats.png


Opening the block's properties, other formats can be selected from the drop down menu:

Storing binary files file sink types drop down.png


Another common type is float, represented by orange, which stores real samples as 32-bit floats.

Storing binary files file sink real floats.png


Data may also be stored as 16-bit integers using the short type represented by yellow. Both real and complex samples may be stored with this type, which will be discussed later in this tutorial.

Storing binary files file sink short ints.png


The path can also be entered directly as a text string:

Storing binary files file extension example.png


The File Sink also has a File parameter which needs to be defined. Click on the three dots:

Storing binary files navigate to path.png


On Ubuntu a window will appear which will allows navigation to different directories so the file can be saved. The file can be saved anywhere, including the home directory although for this example it is saved in /opt/tutorials and the output filename is binary_file.

Storing binary files save file.png


Note that by default a file sink uses the Overwrite function, meaning each time the flowgraph is run the binary file in that location will be replaced by all of the new samples. The Append function is described later in this tutorial.