rgill
Hi guys,
New to the forum here and somewhat new to elixir as well. I’ve been going through tutorials and doing the Dave Thomas’ course on elixir, but I’ve been looking to build something in the mean time. I had a project that I wrote in javascript which output sounds through the speakers and I was thinking of porting that to elixir for funsies.
However, I couldn’t find anything related to audio output through google or any package on hex.pm, is there anything already? Does anyone have an idea?
For reference: I was using this package in javascript (https://www.npmjs.com/package/speaker)
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
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
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
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 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
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
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
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
OvermindDL1
Hmm, not at all the usual work area for BEAM projects, but I could see someone making a NIF or Port or so being just fine for audio processing. Perhaps ‘you’ should make such a library?
rgill
Lol, that’s exactly what I was researching
Looking at rustler right now to get me started (really good packages for audio in rust), maybe I’ll hack something together.
gregvaughn
Joe Armstrong (late co-creator of Erlang) was doing some fun stuff with SonicPI
OvermindDL1
I’d imagine whipping up the Rust
rodiolibrary in rustler would make a good setup.axelson
Another set of packages to watch is https://www.membraneframework.org/ although perhaps that’s more focused on streaming than what you’re looking for (it’s also still in beta)
rgill
Update: made a small nif project that uses
rodiounder the hood. The rust part is able to play the audio, however, now I’m looking on how to stream the file from elixir down to rust, but having some difficultly regarding the types (what are the corresponding rust types for a file stream in elixir?) - need to read up on that.Essentially I want to make it so that I’ll be able to use
File.Streamfrom elixir and pass it down to rust and then be able to handle pause/play/stop etc.rgill
Yup thanks, I looked at that but that’s not exactly what I wanted.
OvermindDL1
I would just stream chunks of
binaryto the NIF. You can also have the NIF do it’s own file handling as well (pass it a name). Files on the BEAM directly are actually just Ports (PortDrivers specifically) and they send messages of file data to the process, so it’s no different to you sending binary to the NIF to fill it’s internal buffer.rgill
Yup, the types for that binary in rust got me really confused since I couldn’t figure it out. So I ended up writing the streaming part in rust as well. So from elixir you just pass a URL to the audio file and rust fetches it and plays it.
Going to implement some wrapper methods for play/pause/stop and see how it works. Also, is it a good practice to start a nif in a supervision tree?
OvermindDL1
Nif’s are just function, nothing to supervise. If however you hold a resource on the elixir side that was given by the NIF and you need to manage it, then yes for that, but you can’t supervise a NIF itself as it’s just a function call.