anzaika

anzaika

Weird behaviour of SWResample converter plugin when doing s16le -> f32le resampling

Hi!

I’ll keep saying this again and again – Membrane Team, kudos to you for all the good work you have been doing!

This post is pretty much a replica of an issue on Github but I figured out Elixir Forum may have a little more visibility.

This snippet is from an Endpoint for a Membrane WebRTC Engine

alias Membrane.RTC.Engine.Endpoint.WebRTC.TrackReceiver
alias Membrane.FFmpeg.SWResample.Converter


def handle_pad_added({_, _, track_id} = pad, ctx, state) do
  structure = [
    bin_input(pad)
      |> child(:track_receiver, %TrackReceiver{
        track: state.track,
        initial_target_variant: :high
      })
      |> child(:depayloader, get_depayloader(state.track))
      |> child(:opus_decoder, %Membrane.Opus.Decoder{
        sample_rate: 16_000
      })
      |> child(:resample, %Converter{
        output_stream_format: %RawAudio{channels: 1, sample_format: :f32le, sample_rate: 16_000}
      })
      |> child({:wav_serializer, track_id}, Membrane.WAV.Serializer)
      |> child({:sink, track_id}, %Membrane.File.Sink{
        location: Path.join(state.output_dir_path, "out.wav")
      })
  ]
end

Whenever I’m resampling to s16le or s24le or s32le the resulting out.wav is perfectly fine. But resampling to f32le produces a screeching and squeaking mess. ffmpeg sees nothing wrong with the resulting file and I’m not savvy enough with audio processing to figure out the cause.

Do you have any ideas about why this might be happening?

Most Liked

DominikWolek

DominikWolek

Membrane Core Team

It seems like a bug of Converter. I’ll investigate it further and let you know on the GitHub issue.

Where Next?

Popular in Questions Top

nobody
How to bind a phoenix app to a specific ip address? could not find anything about that, nowhere, unfortunately, but for me this is quite...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
dotdotdotPaul
Okay, I’m having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I’m sure I’...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New

Other popular topics Top

9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54120 245
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement