Skip to content

Commit

Permalink
Merge pull request #270 from membraneframework/livebooks-cleanup
Browse files Browse the repository at this point in the history
Livebooks cleanup
  • Loading branch information
bartkrak authored Feb 12, 2024
2 parents 3dfc758 + 5439ae7 commit 0111b1d
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 53 deletions.
5 changes: 1 addition & 4 deletions livebooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@ This folder contains interactive livebook examples. To launch them you need to i

## Installation

It is recommended to install Livebook via command line ([see official installation guide](https://github.com/livebook-dev/livebook#escript)).

If livebook was installed directly from the official page, one should add `$PATH` variable to the Livebook environment:
![Setting path](./assets/path_set.png "Title")
It is recommended to install Livebook via command line ([see official installation guide](https://github.com/livebook-dev/livebook#escript)).
Binary file removed livebooks/assets/path_set.png
Binary file not shown.
Binary file added livebooks/audio_mixer/assets/sample.mp3
Binary file not shown.
Binary file removed livebooks/audio_mixer/assets/sample_music_short.mp3
Binary file not shown.
18 changes: 5 additions & 13 deletions livebooks/audio_mixer/audio_mixer.livemd
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,14 @@ Mix.install([
{:membrane_core, "~> 1.0"},
{:membrane_audio_mix_plugin, "~> 0.16.0"},
{:membrane_file_plugin, "~> 0.16.0"},
{:membrane_mp3_mad_plugin, "~> 0.18.0"},
{:membrane_ffmpeg_swresample_plugin, "~> 0.19.0"},
{:membrane_aac_fdk_plugin, "~> 0.18.0"},
{:membrane_mp3_mad_plugin, "~> 0.18.2"},
{:membrane_ffmpeg_swresample_plugin, "~> 0.19.1"},
{:membrane_aac_fdk_plugin, "~> 0.18.5"},
{:membrane_kino_plugin, github: "membraneframework-labs/membrane_kino_plugin", tag: "v0.3.1"},
{:membrane_tee_plugin, "~> 0.12.0"}
])
```

## Installation

To run this demo one needs to install native dependencies:

1. [MP3 MAD](https://github.com/membraneframework/membrane_mp3_mad_plugin/tree/v0.14.0#installation)
2. [AAC FDK](https://github.com/membraneframework/membrane_aac_fdk_plugin#installation)
3. [SWResample FFmpeg](https://github.com/membraneframework/membrane_ffmpeg_swresample_plugin#installation)

## Description

This is an example of mixing multiple short "beep" sound into background music, one by one, every second.
Expand All @@ -35,7 +27,7 @@ Define all constants.
```elixir
n_beeps = 30
beep_filepath = "./assets/beep.aac"
background_filepath = "./assets/sample_music_short.mp3"
background_filepath = "./assets/sample.mp3"
:ok
```

Expand Down Expand Up @@ -75,7 +67,7 @@ background_audio_input =
child(:file_source, %File.Source{location: background_filepath})
|> child(:decoder_mp3, MP3.MAD.Decoder)
|> child(:converter, %Converter{
input_stream_format: %RawAudio{channels: 2, sample_format: :s24le, sample_rate: 44_100},
input_stream_format: %RawAudio{channels: 2, sample_format: :s24le, sample_rate: 48_000},
output_stream_format: %RawAudio{channels: 1, sample_format: :s16le, sample_rate: 44_100}
})
|> get_child(:mixer)
Expand Down
Binary file modified livebooks/playing_mp3_file/assets/sample.mp3
Binary file not shown.
17 changes: 4 additions & 13 deletions livebooks/playing_mp3_file/playing_mp3_file.livemd
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,13 @@ Logger.configure(level: :error)
Mix.install([
{:membrane_core, "~> 1.0"},
{:membrane_file_plugin, "~> 0.16.0"},
{:membrane_mp3_mad_plugin, "~> 0.18.0"},
{:membrane_ffmpeg_swresample_plugin, "~> 0.19.0"},
{:membrane_aac_fdk_plugin, "~> 0.18.0"},
{:membrane_mp3_mad_plugin, "~> 0.18.2"},
{:membrane_ffmpeg_swresample_plugin, "~> 0.19.1"},
{:membrane_aac_fdk_plugin, "~> 0.18.5"},
{:membrane_kino_plugin, github: "membraneframework-labs/membrane_kino_plugin", tag: "v0.3.1"}
])
```

## Installation

To run this demo one needs to install native dependencies:

1. [MP3 MAD](https://github.com/membraneframework/membrane_mp3_mad_plugin/tree/v0.14.0#installation)
2. [AAC FDK](https://github.com/membraneframework/membrane_aac_fdk_plugin#installation)
3. [SWResample FFmpeg](https://github.com/membraneframework/membrane_ffmpeg_swresample_plugin#installation)

## Description

This is example of loading `MP3` audio from the file, transcoding it to the `AAC` codec, and playing it via `Membrane.Kino.Player`.
Expand Down Expand Up @@ -50,15 +42,14 @@ alias Membrane.{
Kino
}

# https://freemusicarchive.org/music/Paper_Navy/All_Grown_Up/08_Swan_Song/
audio_path = "./assets/sample.mp3"
kino = Membrane.Kino.Player.new(audio: true)

spec =
child(:file_source, %File.Source{location: audio_path})
|> child(:decoder_mp3, MP3.MAD.Decoder)
|> child(:converter, %FFmpeg.SWResample.Converter{
input_stream_format: %RawAudio{channels: 2, sample_format: :s24le, sample_rate: 44_100},
input_stream_format: %RawAudio{channels: 2, sample_format: :s24le, sample_rate: 48_000},
output_stream_format: %RawAudio{channels: 2, sample_format: :s16le, sample_rate: 44_100}
})
|> child(:encoder_aac, AAC.FDK.Encoder)
Expand Down
8 changes: 1 addition & 7 deletions livebooks/rtmp/rtmp_receiver.livemd
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@ Logger.configure(level: :error)
Mix.install([
{:membrane_core, "~> 1.0"},
{:membrane_realtimer_plugin, "~> 0.9.0"},
{:membrane_rtmp_plugin, "~> 0.19.0"},
{:membrane_rtmp_plugin, "~> 0.21.0"},
{:membrane_kino_plugin, github: "membraneframework-labs/membrane_kino_plugin", tag: "v0.3.1"}
])
```

## Installation

To run this demo one needs to install native dependencies:

1. [H264 FFmpeg](https://github.com/membraneframework/membrane_h264_ffmpeg_plugin/#installation)

## Description

Defines a server that receives a media stream from the RTMP source and plays it directly in the notebook.
Expand Down
6 changes: 0 additions & 6 deletions livebooks/rtmp/rtmp_sender.livemd
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ Mix.install([
])
```

## Installation

To run this demo one needs to install native dependencies:

1. [H264 FFmpeg](https://github.com/membraneframework/membrane_h264_ffmpeg_plugin/#installation)

## Description

Defines a pipeline downloading [Big Buck Bunny](https://en.wikipedia.org/wiki/Big_Buck_Bunny) trailer video and audio from Membranes' asset samples page using the `Hackney` plugin, and sending it via `RTMP` to the other Livebook.
Expand Down
6 changes: 1 addition & 5 deletions livebooks/soundwave/soundwave.livemd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Logger.configure(level: :error)
Mix.install([
{:membrane_core, "~> 1.0"},
{:membrane_raw_audio_parser_plugin, "~> 0.4.0"},
{:membrane_portaudio_plugin, "~> 0.18.0"},
{:membrane_portaudio_plugin, "~> 0.18.3"},
{:vega_lite, "~> 0.1.8"},
{:kino_vega_lite, "~> 0.1.11"}
])
Expand All @@ -19,10 +19,6 @@ This livebook example shows how to perform real-time soundwave plotting with the

By following that example you will learn how to read the audio from the microphone, how is audio represented, and how to create your custom Membrane element that plots the soundwave with the use of the elixir bindings to the Vega-Lite.

## Installation

You need to have `FFmpeg` installed. For installation details take a look [here](https://www.ffmpeg.org/).

## Soundwave plotting sink

Since there is no plugin in the `Membrane Framework`, that already provides an element capable of plotting soundwave, we need to write one on our own.
Expand Down
6 changes: 1 addition & 5 deletions livebooks/speech_to_text/speech_to_text.livemd
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@ Mix.install(
{:bumblebee, "~> 0.4.2"},
{:exla, "~> 0.6.4"},
{:membrane_core, "~> 1.0"},
{:membrane_portaudio_plugin, "~> 0.18.0"}
{:membrane_portaudio_plugin, "~> 0.18.3"}
],
config: [
nx: [default_backend: EXLA.Backend]
]
)
```

## Prerequisites

On Linux, you need to install PortAudio, for example with `sudo apt install portaudio19-dev`. Check [membrane_portaudio_plugin](https://github.com/membraneframework/membrane_portaudio_plugin#installation) for details.

## Introduction

This livebook example shows how to perform a real-time speech-to-text conversion with the use of the [Membrane Framework](https://github.com/membraneframework) and the [Bumblebee](https://github.com/elixir-nx/bumblebee).
Expand Down

0 comments on commit 0111b1d

Please sign in to comment.