membraneframework / membrane_core

The core of the Membrane Framework, advanced multimedia processing framework
https://membrane.stream
Apache License 2.0
1.22k stars 34 forks source link

Documenting latency configuration in membrane_portaudio_plugin #820

Closed thbar closed 2 weeks ago

thbar commented 3 weeks ago

(coming from https://github.com/membraneframework/membrane_portaudio_plugin)

I was wondering how to configure latency, so I look inside the code and thought since it is a very common question in audio processing, maybe you would be open to adding an example directly in the readme over there?

This appears to work with the onboard MacBook Air card (didn't test out with my real sound cards so far):

Mix.install([
  {:membrane_portaudio_plugin, "~> 0.19.2"}
])

Membrane.PortAudio.print_devices()

defmodule MyPipeline do
  use Membrane.Pipeline

  alias Membrane.PortAudio

  @impl true
  def handle_init(_ctx, _opts) do
    structure =
      child(:pa_src, %PortAudio.Source{portaudio_buffer_size: 32, latency: :low})
      |> child(:pa_sink, %PortAudio.Sink{portaudio_buffer_size: 32, latency: :low})

    {[spec: structure], %{}}
  end
end

Membrane.Pipeline.start_link(MyPipeline)

:timer.sleep(10_000)
mat-hek commented 3 weeks ago

👋 @thbar https://github.com/membraneframework/membrane_portaudio_plugin/pull/59 WDYT?

thbar commented 2 weeks ago

@mat-hek perfect! Thanks!