In .NET, how do I access an audio input stream?

て烟熏妆下的殇ゞ 提交于 2019-12-13 15:27:29

问题


Using VB.NET, I want to analyze input audio streams obtained from Web radio stations (e.g.: "Flower Power Radio" via TuneIn). However, I am struggling in finding a suitable starting point.

Obviously, when entering into the Web browser a Web address (as given in above example), a stream starts flowing and is being interpreted by, in this case, said Web browser.

Only that my planned experiments do not involve the requirement for a browser; and since I do not want to replay the received audio stream, nor record it, I can also abstain from using the MediaPlayer.

I "just" want to intercept the stream's payload data in order to perform time–frequency analysis for music signals. But, how do I access this continuously delivered data?


(Edit: I should probably add, that I do not really embrace using 3rd party libraries of any sort.)


回答1:


To intercept the stream's payload data use the browser's developer tools. Press F12, go to the Network tab and select 'All'. Then press F5 to refresh the page.

Notice the first row entry which is the stream's source. From there you can check the request/responses from this stream http://flower.serverhostingcenter.com:8433/;

Now to access the downloading data use:

Dim c As New WebClient()
        Dim responseData As Byte() = c.DownloadData("http://flower.serverhostingcenter.com:8433/;")

Since the streaming is endless, the file will keep downloading. It's up to you when you want to stop it and analyse the results. You can use Async events as well.



来源:https://stackoverflow.com/questions/44940718/in-net-how-do-i-access-an-audio-input-stream

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