You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: get_started/simple_pipeline.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ That might not look too simple for now but don't worry, there'll be a lot of new
50
50
51
51
The code above is one of the simplest examples of Membrane usage. It plays an mp3 file through your device's `portaudio`. Let's make it work.
52
52
53
-
###Prerequisites
53
+
## Prerequisites
54
54
55
55
First we need to get all the libraries that Membrane needs to operate in our case. You can read about them more if you'd like, but for now we'll just jump to installation:
Alternatively, you can use our docker image that already contains all libraries you need to smoothly run any membrane code. You can read more about how to do it [here](https://tutorials.membraneframework.org/tutorials/videoroom/2_EnvironmentPreparation.html#setting-environment-with-the-use-of-docker).
67
67
68
-
###Creating a Project
68
+
## Creating a Project
69
69
70
70
By installing Elixir you'll get a bunch of useful tools. One of them is [Mix](https://hexdocs.pm/mix/Mix.html). As you can read in its documentation preface:
71
71
> Mix is a build tool that provides tasks for creating, compiling, and testing Elixir projects, managing its dependencies, and more.
@@ -91,7 +91,7 @@ defp deps do
91
91
]
92
92
end
93
93
```
94
-
###Our first Pipeline
94
+
## Our first Pipeline
95
95
96
96
The pipeline is one of the basic concepts of Membrane. It's a schema of how the data packets are flowing through our application.
97
97
@@ -127,7 +127,7 @@ Since we want to spawn children processes and link them, we will use the [`spec_
127
127
128
128
>If the concept of callbacks and behaviours is new to you, you should probably take some time to read about OTP in Elixir (especially the part starring GenServer and Supervisor). You can find the proper guide [here](https://elixir-lang.org/getting-started/mix-otp/agent.html)
129
129
130
-
####Elements
130
+
## Elements
131
131
132
132
The elements we'd like to use to play our mp3 will be:
133
133
@@ -157,7 +157,7 @@ children = %{
157
157
158
158
The keys in the `children` keyword list (`file`, `decoder`, `converter`, `portaudio`) are just convenient names we gave our elements to refer to them later. We're going to need them for linking.
159
159
160
-
####Linking elements
160
+
## Linking elements
161
161
162
162
Now we should link them in the proper order. Each Membrane Element can be one of three types: Source, Sink or Filter. The main difference is that Source provides only output pads, Sink only input and Filter both input and output pads. That means only a Source element start pipelines (it's not prepared to receive any data from other elements), Sink can only end pipelines (it will not send any data to subsequent elements), and Filters can be in the middle (they receive, process and send data further). In our case the links declaration will look like this:
163
163
@@ -172,7 +172,7 @@ links = [
172
172
173
173
The file Source reads bytes from our mp3 file and sends them to decoder. Decoder, after decoding, sends them to converter. Converter, after conversion sends them to our portaudio sink, which receives them and plays music through Portaudio 🎶
174
174
175
-
####Parent Spec
175
+
## Parent Spec
176
176
177
177
Last but not least we need group our elements and links together into a proper structure:
178
178
@@ -225,7 +225,7 @@ defmodule Hello do
225
225
end
226
226
```
227
227
228
-
###Running a pipeline
228
+
## Running a pipeline
229
229
230
230
You can start your pipeline from any place in the code but it's convenient to use Elixir's interactive console:
0 commit comments