How to record sound in Erlang

﹥>﹥吖頭↗ 提交于 2019-12-12 04:34:25

问题


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:


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.



来源:https://stackoverflow.com/questions/43823498/how-to-record-sound-in-erlang

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!