Forum / NoMachine for Mac / Unable to stream audio from Raspberry Pi to Mac
- This topic has 16 replies, 3 voices, and was last updated 5 years, 4 months ago by Bilbotine.
-
AuthorPosts
-
July 10, 2019 at 08:53 #22875hpbParticipant
I’m running NoMachine 6.7.6 on Raspberry Pi stretch, 6.7.6 on macOS Mojave 10.14.5. These are the free versions of the software.
I am able to successfully log onto my Raspberry Pi from my MacBook Pro. But I am unable to stream audio from a USB soundcard on the Pi back to my Mac.
I have set up accessibility on my MacBook Pro per the instructions in https://forums.nomachine.com/topic/no-audio-from-macbook-air-to-imac
On my Pi, under Perferences->Forwarded devices, I have the box checked for Enable audio streaming and microphone forwarding.
But…I’m not hearing anything from my Pi on my MacBook Pro. Any ideas? Thanks.
July 10, 2019 at 13:07 #22881kroyContributorDo you have PulseAudio installed on the Raspbian? Because audio is available only when the PulseAudio service is available (https://www.nomachine.com/AR07N00896). In addition, you have to make sure that your USB soundcard sink is set as the default.
July 10, 2019 at 21:47 #22883hpbParticipantNo, I do not have PulseAudio installed on the Pi. Thank you. I will give this a try and get back to you.
July 11, 2019 at 07:49 #22889hpbParticipantI installed PulseAudio but still have problems.
I now realize part of the problem is that I did not supply enough details about what I’m trying to accomplish. I have the output audio from a radio going into the mic input of a USB soundcard. I would like to hear this radio’s audio on the speakers of my Mac.
I believe PulseAudio is correctly configured with the mic input of the USB soundcard as a source. When I look at the Recording tab on pavucontrol, I see the audio varying in volume. When I reduce the volume on the radio the PulseAudio audio level in pavucontrol goes down and when I increase the volume on the radio the audio level in pavucontrol goes up. So I believe PulseAudio is capturing the audio output from the radio.
Am I misunderstanding how NoMachine’s audio forwarding works? Is the audio from the PulseAudio mic input on my Pi not going to be forwarded to my Mac? Is there a way to redirect this input audio stream on the Pi so that I can hear it on the Mac?
Thanks.
July 11, 2019 at 07:49 #22890hpbParticipantIf this will help, here is the output of my list of sources. I believe this shows my USB mic input set as the default source.
pacmd list-sources | grep -e ‘index:’ -e device.string -e ‘name:’
* index: 1
name: <alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-mono>
device.string = “hw:1”
index: 2
name: <alsa_output.platform-soc_audio.analog-stereo.monitor>
device.string = “0”
index: 3
name: <alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo.monitor
device.string = “1July 12, 2019 at 07:27 #22905hpbParticipantOne more datapoint…I removed disconnected the USB soundcard and played a YouTube video on the Pi. I hear audio coming out of the Pi when I connect headphones to the Pi’s audio jack but I hear nothing on my Mac.
I actually removed NoMachine from my Pi and reinstalled it so that it would be aware of Pulseaudio. I also performed this command on the Pi that I saw in another support thread:
sudo /usr/NX/scripts/setup/nxnode --audiosetup
July 12, 2019 at 09:45 #22912kroyContributorFirst of all check AudioInterface key in the
/usr/NX/etc/node.cfg
if there is pulseaudio set (you can skip this step if you followed mentioned earlier article and executed/usr/NX/bin/nxnode --audiosetup [path]
command after PulseAudio installation).Is the audio from the PulseAudio mic input on my Pi not going to be forwarded to my Mac?
Indeed. It’s possible to forward from client to server machine, but not in the opposite direction. However to receive audio from input device you can use module-loopback. In your case you can execute command:
pacmd load-module module-loopback source=alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-mono
July 12, 2019 at 19:12 #22915hpbParticipantIt works! Thanks you so much, especially since PulseAudio support is outside typical NoMachine usage.
I am an amateur radio operator who is looking at operating my station remotely using NoMachine. I operate mostly modern digital modes and Morse Code, which is all generated on my Raspberry Pi. It would be nice to be able to operate voice remotely, but I can very much live without it.
This is excellent support, especially for something that cost me nothing to download. Thanks!
July 15, 2019 at 08:13 #22918hpbParticipantTo close the loop on this topic so that it is properly documented for anybody searching for a solution….
I have figured out how to get voice audio from the mic of my MacBook Pro into the output of the USB soundcard connected to my Pi. This means that I’ll be able to use my Mac as a mic to talk to my amateur radio transceiver.
The final piece of the puzzle is the following PulseAudio command:
pactl load-module module-loopback source=nx_voice_out.monitor sink=alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo
When I plug in a set of headphones into the output of the USB soundcard and use pavucontrol to enable NoMachine output and increase the output, I hear the output of my Mac’s mic!
Thank you so much for the help and teaching me how to configure PulseAudio. I have many years of experience as a Linux admin, but in a business environment, so I never had the opportunity to work with PulseAudio before.
July 15, 2019 at 08:13 #22919hpbParticipantOne final question, I want to understand why the command you gave me earlier works.
pacmd load-module module-loopback source=alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-mono
There is no sink specified. According to the PulseAudio docs, when this happens, the source is sent to the default sink which on my system is:
* index: 0
name: <alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo>The * before index means this is the default sink.
So, my question is, this works because NoMachine automatically connects to the default sink on the Pi and this is how audio gets back to NoMachine on the Mac, right? Or at least this is what appears to be happening.
Right now I’m happy this all works, but I’m trying to understand why it works so that I can troubleshoot on my own.
July 15, 2019 at 09:48 #22928kroyContributorThis means that I’ll be able to use my Mac as a mic to talk to my amateur radio transceiver.
You don’t need to use module-loopback to achive that. Just enable microphone on the NoMachine menu https://www.nomachine.com/DT07M00087#6.1.
We just misunderstood. From you wrote earlier I understand that somehow you have radio pluged to the input on the USB soundcard and you want to stream that to your client machine. Thats why I propose that command.
So, my question is, this works because NoMachine automatically connects to the default sink on the Pi and this is how audio gets back to NoMachine on the Mac, right? Or at least this is what appears to be happening.
Yes, it’s exactly as you written. NoMachine connects to the default sink and set default source.
July 15, 2019 at 15:59 #22938hpbParticipantYes, I can now hear audio from my Mac’s mic on the output of the USB soundcard. Thank you! One less PulseAudio command to run.
July 15, 2019 at 15:59 #22939hpbParticipantAnd, the output of the NoMachine audio can be redirected using the Playback tab on pauvcontrol. But this is still better than running a pauvcontrol command.
Attachments:
July 18, 2019 at 08:20 #22971hpbParticipantI believe I have found a better way to send and receive audio to and from my amateur radio tranceiver. The problem with the way we were doing it meant that received audio coming from device alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo.monitor, the input of my USB soundcard, was being redirected to the output of the same soundcard, device alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo. It seemed to me like there was potential for feedback. It also bothered me that we had both ouput and input audio on the output of the USB soundcard at the same time, this just didn’t seem right.
Instead I created a dummy sink, made it the default sink, and assigned the output of the USB soundcard to the dummy sink:
pactl load-module module-null-sink sink_name=dummy
pacmd set-default-sink dummy
pacmd load-module module-loopback source=alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-mono sink=dummy
This gets received audio from the radio’s headphone jack picked up by the nx_voice_out sink because dummy is now the default sink and the received audio is sent back to the speakers/headphones of the Mac.
Next, I send audio from my Mac to the output of the USB soundcard to be input into the mic jack of my transmitter:
pactl load-module module-loopback source=nx_voice_out.monitor sink=alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo
This appears to work and I don’t have output audio from the ham transceiver also on the 0utput of the USB soundcard going back to the radio’s mic. The key here is use of the dummy sink using module-null-sink.
Does this all make sense?
July 19, 2019 at 12:09 #23002kroyContributorIt does make sense. Now inside the session on the Mac you are hearing only microphone from USB soundcard plugged to RPi. However on the headphones plugged to the same USB soundcard on RPi you can hear desktop + microphone from your Mac (don’t forgot to enable mic in NoMachine menu to make that work).
-
AuthorPosts
This topic was marked as solved, you can't post.