How to record sound in Erlang

2019-08-24 22:15发布

I would like to build a very simple streaming application in Erlang, it will work something like team speak. Person A, B and C are all having a client application which connects to a server application. The server application makes sure it can distribute the audio message from Person A to Person B and C.

So the concept is simple and many things can already be found on the internet (like how streaming works in Erlang). What I can't seem to find is how to record audio in Erlang. There are examples with complete files (like the shoutcast example from Joe Armstrong)

The only thing I could find was that there are differences how audio input works on OS level. OSX has Core Audio, Linux has (/dev/audio & padsp. This seems to be relevant for Erlang. Windows probably has his own thing.

I'm quite new to this stuff.

My main question is: How can I get the inputs from microphones in my Erlang application? Is there a best practice and are there differences between different operating systems?

Already many thanks in advance!

Leon

1条回答
唯我独甜
2楼-- · 2019-08-24 22:29

You should use a portable abstraction layer such as SDL2 rather than figuring out how to do it yourself for each OS. There is an Erlang binding: https://github.com/ninenines/esdl2, but I don't know if the audio parts are working yet. Try it out and see. Alternatively, try the older SDL binding: https://github.com/dgud/esdl. The wxWidgets binding for Erlang doesn't seem to implement any audio features: http://erlang.org/doc/apps/wx/index.html.

查看更多
登录 后发表回答