jonast
Hi folks, what’s the easiest way to use Membrane to resample from PCM single channel 8000Hz sample rate s16le to something I can use in the Whisper bumblebee model? (I believe 16000Hz 32f?)
For simplicity, let’s say I’d like to do this in a LiveBook and I’ve got a Binary of the raw 16bit audio frames loaded in memory
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I’ve been working on Breeze, a high-performance web framework for Go.
The main idea is pretty simple:
keep the hot path small, avoid unn...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
jerzywilczek
you should use our FFmpeg SWResample plugin. The docs contain an example of a thing similar to what you want to do, except for the fact that the input is a file instead of a in-memory binary. Let me know if you have any trouble!
jonast
Ah, thanks so much for the quick response. I guess I was wondering if there was a way to just reasonless from binary to binary without having to set up a pipeline etc
Will dig into how pipelines work
jerzywilczek
Unfortunately it might not work currently. I checked our github and apparently there is some kind of a bug in our swresample plugin : (
jonast
Thanks so much for your help, I sort-of got it working in a LiveBook notebook now using this code
It creates the output file with the correct format and I can use it as input for bumblebee. However, I still have a couple of questions
Is there an equivalent to the file plugin that lets me input and output a binary? I’m sorry if I missed this in the membrane docs somewhere
This minimal notebook above somehow ends up with each cell in “aborted” state, even though the output file is successfully created and the output of the cell looks good:
.play()on the pipeline as the membrane docs suggest here?Thanks so much for your help, I really appreciate it <3
jerzywilczek
handle_element_end_of_stream) for one input case, the automatic implementation disappears, so when:file_srcreturns end of stream, membrane tries to callResampling.Pipeline.handle_element_end_of_stream(:file_src, _, _, _)and fails to find an implementation. The fix for this is simple: you need to define The second problem is returning theplayback: :stoppedaction, which doesn’t exist in membrane core v0.11. You should returnterminate: :normalinstead.{:ok, supervisor_pid, pipeline_pid}in case of success, because the pipeline is always spawned under a dedicated supervisor. The supervisor never restarts the pipeline, but it makes sure that the pipeline and its children terminate properly.play()function was replaced with returning theplayback: :playingaction, which you did in yourhandle_init. I’m sorry the guides are outdated, we decided it would be better for now to focus on releasing core 1.0 and rewrite the old guides after that, since then the API will not change every couple months.Hope this helps, let me know if you need anything else!
anzaika
Gotta say that the bug manifests itself only if you’re having a WAV bin at the end of pipeline.
Seeping buffers directly from SWResample into Whisper works just fine
@jonast Here’s a repo with the code that helped me immensely GitHub - lawik/membrane_transcription: Prototype transcription for Membrane · GitHub
jonast
Thanks so much both, that’s super useful. I can confirm that the resampled audio file plays as intended and the LiveBook no longer crashes
Will have a go at writing a BinarySrc plugin now
jerzywilczek
Cool! if you have any questions be sure to ask!
jonast
I’ve got it working pretty quickly, but it’s pretty hacky. It just takes the whole Binary and sends it the first time it gets a
demand, irrespective of size etc. I’m also not sure if it’s alright to not do any cleanup or handle anything other thandemand(but I think it is alright)Ideally, I’d like to change this source to “push” data to the next elements in the pipeline, rather than having it pulled. In reality, I’ve got a Phoenix project where I’ve got a websocket connection where I’m receiving raw audio frames (from Twilio), which I’d then like to push into this resampling (and later, transcription) pipeline as they become available.
Any pointers on how best to accomplish that?
mat-hek
If you cannot / don’t want to handle back pressure, you should change the pad mode to
pushand not receive the demands at all, like the UDP source does. This of course works under the assumption that you won’t send more data than the pipeline can process.
Also, instead of passing data through options, you can send binaries to the source using regular messages and forward them through the output pad in the
handle_infocallback.