macos pipe 通信_macOS和移动设备之间的有效osc通信

编程知识 更新时间:2023-04-29 08:47:15

macos pipe 通信

In the early days of my Music Technology degree, when I first came to discover Open Sound Control (OSC) and the power of network communication, the workflow used to be easy and painless. I would create a secure ad hoc network from my mac, connect to the network with my phone and the job was done. I was then able to control anything I wanted using my phone.

在我获得音乐技术学位的初期,当我第一次发现开放声音控制 (OSC)和网络通信的强大功能时,工作流程曾经很轻松,很轻松。 我可以从Mac创建一个安全的临时网络,用手机连接到网络,然后工作就完成了。 这样我就可以使用手机控制任何我想要的东西。

Those days are long gone…

那些日子已经一去不回…

Since the day apple removed the ability to create secure ad hoc networks on macOS and removed the possibility to use unsecured WiFi networks without internet access on iOS devices, it has become increasingly hard to work with OSC incoming from a mobile device. This problem appears also on Android devices running stock Android because of the OS not supporting ad hoc networks.

自从有一天苹果公司取消了在macOS上创建安全自组织网络的功能,并取消了在iOS设备上使用不安全的WiFi网络而无法访问Internet的可能性之后,使用来自移动设备的OSC变得越来越困难。 由于操作系统不支持ad hoc网络,因此在运行常规Android的Android设备上也会出现此问题。

Typically, the scenario would be something similar to this:

通常,方案类似于以下内容:

The mobile device would be unable to latch to the network due to missing internet connection or lack of security.

由于缺少Internet连接或缺乏安全性,移动设备将无法锁存到网络。

Being an academic and researcher, most of the time I have to deal with university networks. These secure networks rarely allow data throughput of this kind and unfortunately there are not many possible solutions. For this reason, I decided to write this short guide exploring a few workarounds I have found.

作为一名学者和研究人员,大多数时候我必须与大学网络打交道。 这些安全的网络很少允许这种数据吞吐量,不幸的是,解决方案并不多。 因此,我决定编写此简短指南,探讨我发现的一些变通方法

For the purpose of this article, I will be using TouchOSC to send OSC data from mobile and Pure Data to receive said data on my laptop.

出于本文的目的,我将使用TouchOSC从移动设备发送OSC数据,并使用Pure Data在笔记本电脑上接收所述数据。

仍然有效的方法 (Methods that still work)

Don’t panic! Not all hope is lost… there are still a few scenarios where you will be able to easily communicate from your mobile device to your macOS laptop via OSC.

不要惊慌! 并非所有希望都消失了……在某些情况下,您将能够通过OSC轻松地从移动设备与macOS笔记本电脑进行通信。

移动热点 (Mobile Hotspot)

If you are in an area where mobile service is present and strong, you can share your phone’s connectivity to make your other two devices talk to each other.

如果您所在的区域提供移动服务且功能强大,则可以共享手机的连接性,以使其他两个设备互相通话。

Unfortunately, this method requires us to have both the mobile service and an extra device to share said signal. Creating a hotspot from a mobile device and trying to send and receive data from the same device won’t work on the Pure Data side of things.

不幸的是,这种方法要求我们同时拥有移动服务和额外的设备来共享所述信号。 从移动设备创建热点并尝试从同一设备发送和接收数据在纯数据方面是行不通的。

使用家庭/开放式wifi连接 (Using a home/open wifi connection)

Usually home internet connections are not as strict as public or academic ones. In a home scenario, all you need to do is to make sure that both your devices are connected to the same wireless network, note down the IP address in your macOS network preferences and in your TouchOS app, and make sure that all the instances of the IP addresses and ports used are coherent between your Pure Data patch and your TouchOSC app.

通常,家庭互联网连接不如公共或学术网络严格。 在家庭场景中,您需要做的就是确保两个设备都连接到同一无线网络,在macOS网络首选项和TouchOS应用程序中记下IP地址,并确保以下所有实例使用的IP地址和端口在Pure Data修补程序和TouchOSC应用程序之间是一致的。

“解决方法” (“Workarounds”)

Because of the removed secure ad hoc network feature in the latest versions of macOS, in absence of mobile signal and/or an open wifi network, there are a few things that we can do to create a connection.

由于最新版本的macOS中已删除了安全的临时网络功能,因此在没有移动信号和/或开放的wifi网络的情况下,我们可以做一些事情来建立连接。

使用无线访问点创建安全网络 (Using a Wireless Access Point to create a secure network)

While it might not be the best solution for some, using a Wireless Access Point to create a stable, trusty and secure network remains one of the best solutions to date. In an indoor environment, using an old Wireless Access Point will do the trick, while outdoors a cheap USB modem is the way to go.

尽管对于某些人来说,这可能不是最佳的解决方案,但迄今为止,使用无线访问点创建稳定,可靠和安全的网络仍然是最佳的解决方案之一。 在室内环境中,使用旧的无线接入点可以解决问题,而在户外使用便宜的USB调制解调器则是可行的方法。

使用USB有线连接传输数据 (Using a USB-wired connection to transfer data)

This quick and dirty solution instead might be ideal to prototype and work on a project on the go, but it might not be the most optimal solution in a performative environment–unless you’re willing to work with 20m long USB cables.

取而代之的是,这种快速而肮脏的解决方案可能是在旅途中进行原型设计和工作的理想选择,但它可能并不是高性能环境中的最佳解决方案- 除非您愿意使用20m长的USB电缆。

To achieve this:

为达到这个:

  1. Enable Cellular Data and the Personal Hotspot on your mobile device, turn off WI-FI and connect the USB cable to the Mac.

    在移动设备上启用蜂窝数据和个人热点,关闭WI-FI并将USB电缆连接到Mac。
  2. On the Mac, go to the network settings and select Manage virtual interfaces, create a new virtual bridge using the USB connection.

    在Mac上,进入网络设置,然后选择管理虚拟接口,使用USB连接创建新的虚拟网桥。
  3. Note down your IP Address.

    记下您的IP地址。
  4. In TouchOSC set the host to this IP address 172.20.10.7, incoming port 9000.

    在TouchOSC中,将主机设置为此IP地址172.20.10.7,传入端口9000。
  5. In Pure Data set the IP address to the [netsend -u -b] address 172.20.10.1, using the port 9000.

    在“纯数据”中,使用端口9000将IP地址设置为[netsend -u -b]地址172.20.10.1。

Thanks to zombie314 for the idea.

感谢zombie314的想法。

结论 (Conclusion)

While these might not be ideal solutions, unfortunately, with Apple’s latest removal of secure ad hoc networks, these are the only available methods to date.

不幸的是,尽管这些可能不是理想的解决方案,但是随着Apple最新删除安全的ad hoc网络,这些是迄今为止唯一可用的方法。

Download the example patch to communicate with, and receive data from TouchOSC using Pure Data Vanilla (0.49.1) from here.

从此处下载示例补丁程序,以使用Pure Data Vanilla(0.49.1)与TouchOSC进行通信并从中接收数据。

翻译自: https://medium/swlh/effective-osc-communication-between-macos-and-mobile-bea13f6f8ffc

macos pipe 通信

更多推荐

macos pipe 通信_macOS和移动设备之间的有效osc通信

本文发布于:2023-04-21 20:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/a27c9a6a01a5cd8e22a147bac6c8d882.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:通信   设备   pipe   macos   _macOS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 94162文章数
  • 23811阅读数
  • 0评论数