How to set up a UDP Audio Stream
7 vues (au cours des 30 derniers jours)
I'm working on realtime audio processing algorithm benchmarking on an ARM development board, which is only equipped with a 1000MBit Ethernet port for external communication.
So I want to use this port to stream realtime audio via UDP from my computer to the board and stream the processed data back to my computer to record it in MATLAB and output it through my Computer's soundcard with the help of the dsp toolbox's UDP sender and receiver.
Each UDP Packet should be started with a 16 bit "header" with an 8Bit running packet counter followed by an 8 Bit frame size information and then contain the actual data, encoded in 32Bit floating point values, already sorted in the Byte Order the ARM needs.
I wrote a mex function, receiving one double value and giving back four uint8 values in the right order, representing the bytes of the floating point number to build a vector of integers that will be sent encoded as uint8.
This already works for single transfers.
My approach for streaming was, to schedule the UDP transfer with a timer, however I always get the Error Message
Error while evaluating TimerFcn for timer 'timer-23'
Message too long
So, do I get it right, that MATLAB is just to slow to process the task in the given time? If yes, how could I speed up transmission and get it working the way I want? As this is just a one channel stream, wich should be augmented to a multichannel stream, a performant solution would be really important.
This is the code I currently run:
US=dsp.UDPSender('RemoteIPAddress', '126.96.36.199', 'RemoteIPPort', 5050);
UR=dsp.UDPReceiver('LocalIPPort', 1112, 'RemoteIPAddress', '188.8.131.52');
%Audio File Reader
%extracting a mono version
t=timer('ExecutionMode', 'fixedRate', 'TimerFcn', @sendUDPpacket, 'Period', 1/PacketRate, 'TasksToExecute', FramesToSend);
function sendUDPpacket(obj, event, string_arg)