-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send audio outside of Max #2
Comments
More debugging information: If I use max object
I'm able to receive the data via
But it doesn't play it as audio, but displays it (which looks like spectrogram to me): Full output:
Do you know what am I doing wrong? |
Hi Valia, thanks for reporting this. (In the first place, the attribute You cannot simply receive the stream by accessing However, you can use it by creating SDP file manually, as the receiver doing internally. rtpsendreceive/source/rtpsendreceive_lib/rtpsrbase.cpp Lines 99 to 120 in 3cd8232
The receiver creates a dummy sdp file by replacing the parameters closed with
(Note that bitrate will be (samplerate / 1000) * 16 * channels) After saving this file as ffplay -re -i path/to/live.sdp Again raw rtp mode is quite unstable, if you want to just stream from Max on macOS or Window to RaspberryPi, using NetJack might be an easier option. https://github.com/jackaudio/jackaudio.github.com/wiki/WalkThrough_User_NetJack2 |
Or, If you want to just receive the stream and play it back to a speaker on RasPi: use RTSP! change the attributes of the object to
and receive on raspi with
(Of course, you need to specify the correct IP address when streaming between 2 computers) |
Thanks! I was able to connect to the Do you have a clue of what may be the problem? By the way, The other option I consider is to use sonobus but it will require installing another program and will complicate autostart. |
Which OS are you working on now for what version of Max? (Currently, I have not tested on Big Sur.) Also, check your signal vector size on Audio Settings. The buffer size of each packet currently depends on Max's audio setting. In my environment(Catalina, Macbook Pro 16inch 2019), a smaller size than 128 produces an audio glitch shortly later its start and finally sound stops. 512~ is recommended. The test patch is... I usually use
|
I've tested on both |
Hmm... Could you check actual packets sent/received with Wireshark or something? You can inspect actual RTSP request/response on [rtsp @ 0x7fb70280de00] WARNING: Path /live.sdp differs from expected
[rtsp @ 0x7fb70280de00] Parsing[7]: CSeq: 1
[rtsp @ 0x7fb70280de00] Parsing[25]: User-Agent: Lavf58.45.100
[rtsp @ 0x7fb70280de00] Sending response:
RTSP/1.0 200 OK
CSeq: 1
Server: Lavf58.45.100
Public: ANNOUNCE, PAUSE, SETUP, TEARDOWN, RECORD
[rtsp @ 0x7fb70280de00] WARNING: Path /live.sdp differs from expected
[rtsp @ 0x7fb70280de00] Updating control URI to udp://127.0.0.1:30000/live.sdp
[rtsp @ 0x7fb70280de00] Parsing[29]: Content-Type: application/sdp
[rtsp @ 0x7fb70280de00] Parsing[7]: CSeq: 2
[rtsp @ 0x7fb70280de00] Parsing[25]: User-Agent: Lavf58.45.100
[rtsp @ 0x7fb70280de00] Parsing[19]: Content-Length: 178
[rtsp @ 0x7fb70280de00] SDP: v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 58.45.100
m=audio 0 RTP/AVP 96
b=AS:768
a=rtpmap:96 L16/48000/1
a=control:streamid=0
[rtsp @ 0x7fb70280de00] sdp: v='0'
[rtsp @ 0x7fb70280de00] sdp: o='- 0 0 IN IP4 127.0.0.1'
[rtsp @ 0x7fb70280de00] sdp: s='No Name'
[rtsp @ 0x7fb70280de00] sdp: c='IN IP4 127.0.0.1'
[rtsp @ 0x7fb70280de00] sdp: t='0 0'
[rtsp @ 0x7fb70280de00] sdp: a='tool:libavformat 58.45.100'
[rtsp @ 0x7fb70280de00] sdp: m='audio 0 RTP/AVP 96'
[rtsp @ 0x7fb70280de00] sdp: b='AS:768'
[rtsp @ 0x7fb70280de00] sdp: a='rtpmap:96 L16/48000/1'
[rtsp @ 0x7fb70280de00] audio codec set to: pcm_s16be
[rtsp @ 0x7fb70280de00] audio samplerate set to: 48000
[rtsp @ 0x7fb70280de00] audio channels set to: 1
[rtsp @ 0x7fb70280de00] sdp: a='control:streamid=0'
[rtsp @ 0x7fb70280de00] Sending response:
RTSP/1.0 200 OK
CSeq: 2
Server: Lavf58.45.100
[rtsp @ 0x7fb70280de00] Parsing[66]: Transport: RTP/AVP/UDP;unicast;client_port=13840-13841;mode=record
[rtsp @ 0x7fb70280de00] Parsing[7]: CSeq: 3
[rtsp @ 0x7fb70280de00] Parsing[25]: User-Agent: Lavf58.45.100
[rtsp @ 0x7fb70280de00] Opening: rtp://127.0.0.1:5000No default whitelist set
[udp @ 0x7fb721f375c0] No default whitelist set
[udp @ 0x7fb721f375c0] end receive buffer size reported is 393216
[udp @ 0x7fb721f43dc0] No default whitelist set
[udp @ 0x7fb721f43dc0] end receive buffer size reported is 393216
[rtsp @ 0x7fb70280de00] Listening on: 5000setting jitter buffer size to 500
[rtsp @ 0x7fb70280de00] Sending response:
RTSP/1.0 200 OK
CSeq: 3
Server: Lavf58.45.100
Transport: RTP/AVP/UDP;unicast;mode=receive;source=127.0.0.1;client_port=13840-13841;server_port=5000-5001
Session: 516959051
[rtsp @ 0x7fb70280de00] Parsing[17]: Range: npt=0.000-
Failed to parse interval end specification ''
[rtsp @ 0x7fb70280de00] Parsing[7]: CSeq: 4
[rtsp @ 0x7fb70280de00] Parsing[25]: User-Agent: Lavf58.45.100
[rtsp @ 0x7fb70280de00] Parsing[18]: Session: 516959051
[rtsp @ 0x7fb70280de00] Sending response:
RTSP/1.0 200 OK
CSeq: 4
Server: Lavf58.45.100
Session: 516959051
[rtsp @ 0x7fb70280de00] All info found vq= 0KB sq= 0B f=0/0
[rtsp @ 0x7fb70280de00] stream 0: start_time: -0.023 duration: NOPTS
[rtsp @ 0x7fb70280de00] format: start_time: -0.023 duration: NOPTS (estimate from bit rate) bitrate=768 kb/s
Input #0, rtsp, from 'rtsp://127.0.0.1:30000':
Metadata:
title : No Name
Duration: N/A, start: -0.023000, bitrate: 768 kb/s
Stream #0:0, 1, 1/48000: Audio: pcm_s16be, 48000 Hz, 1 channels, s16, 768 kb/s
detected 16 logical cores
[ffplay_abuffer @ 0x7fb721e1a440] Setting 'sample_rate' to value '48000'
[ffplay_abuffer @ 0x7fb721e1a440] Setting 'sample_fmt' to value 's16'
[ffplay_abuffer @ 0x7fb721e1a440] Setting 'channels' to value '1'
[ffplay_abuffer @ 0x7fb721e1a440] Setting 'time_base' to value '1/48000'
[ffplay_abuffer @ 0x7fb721e1a440] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:(null)
[AVFilterGraph @ 0x7fb721d7d140] query_formats: 2 queried, 3 merged, 0 already done, 0 delayed
Audio frame changed from rate:48000 ch:1 fmt:s16 layout:0 channels serial:-1 to rate:48000 ch:1 fmt:s16 layout:0 channels serial:1
[ffplay_abuffer @ 0x7fb721f460c0] Setting 'sample_rate' to value '48000'
[ffplay_abuffer @ 0x7fb721f460c0] Setting 'sample_fmt' to value 's16'
[ffplay_abuffer @ 0x7fb721f460c0] Setting 'channels' to value '1'
[ffplay_abuffer @ 0x7fb721f460c0] Setting 'time_base' to value '1/48000'
[ffplay_abuffer @ 0x7fb721f460c0] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:(null)
[AVFilterGraph @ 0x7fb701e31d80] query_formats: 2 queried, 3 merged, 0 already done, 0 delayed In my case of local loopback, audio was sent from
The captured packet in WIreshark was like this. If you can confirm with Wireshark that the packet is correctly sent, the problem will be in the part of playback in ffplay(with an audio driver or something). If the packet was sent but not received, maybe the receiver or network apparatus such as a router or a switching hub is blocking packets or closing the port used for streaming. Hope it helps to solve your problem. |
Hi Tomoya! Thank you for your work!
Problem
I couldn't make this external work with pulseaudio RTP receiver and found no information online, although the problem seems quite common.
More specifically, I tried to use
mc.rtpsend~
to send audio to a Raspberry PI on the same network as Max. I expect that pulseaudiomodule-rtp-recv
should be able to receive the stream and sink it to the speaker.I can't find alternatives, but my experience with audio streaming is very limited.
Potential solution
It will be amazing if you can provide a documentation of what exactly happening under the hood. Or, event better, if you would give an example of receiving audio using pulseaudio RTP, Roc or anything else that would work on raspberry/any other linux machine.
The text was updated successfully, but these errors were encountered: