Using TouchOSC to draw into a 16 step array? communication back'n'forth? Show Array content in TouchOSC?
@esaruoho said:
and also feel a bit like there's no "TouchOSC with PureData for idiots" blog-post for iPad / macOS going on, or at least i haven't been able to find it.
As I mentioned in another recent thread of yours where you were exploring iPad control options, I had some experiences with this type of setup several years ago:
https://forum.pdpatchrepo.info/topic/10184/touchosc-direct-usb-connection-finally-possible-with-midimux
I just tested it & it's still working. (7 years later!) I have midimux & TouchOSC running on the iPad, and studiomux & Pd running on my Mac. As mentioned in my old thread, the iPad must be connected to wifi (any active network, doesn't matter which) in order to send OSC data over the tethered USB connection.
And yes, you will most certainly need to know the IP addresses of the Mac & iPad (for use with [netsend] in Pd, and with TouchOSC on the iPad). I don't know of a way to ensure that they will be persistent, I've always had to reenter them manually every time. Also make sure your in/out port numbers are in order (again, on the Pd side for [netsend] and [netreceive], and on the iPad you can set the in/out port numbers in midimux).
Ah, and finally I'm using [netreceive -u -b] into [oscparse] and [list trim] for receiving in Pd, and [oscformat foo bar etc] into [list prepend send] then [list trim] then [netsend -u -b] for sending out from Pd.
Using TouchOSC to draw into a 16 step array? communication back'n'forth? Show Array content in TouchOSC?
@ddw_music said:
It's much more common to transmit OSC messages over a LAN using UDP.
From my perspective here: I've been using OSC successfully for years, never ran into any of the headaches you're reporting. I made some suggestions of what has worked for me. Then you do something different from what was suggested ("so i decided to ditch UDP and just use TCP" -- why?) ... and then it doesn't work. So I feel at this point like my ability to help is somewhat limited.
hjh
so the reason why i moved from udp was that i couldn't get a connection going on between TouchOSC on iPad, TouchOSC on macOS, TouchOSC Bridge app and PureData.
I could try again, but it looked like UDP required me to know the IP address of both the laptop and the iPad, and that really threw me (i don't know how to figure out what the IP address of the iPad is, or how to make sure it's always the same, same for macOS).
btw after unsuccessfully getting anything going with TCP, i ended up just creating a regular array on TouchOSC and inputting it into PureData, which i got working. the fancier PD + TouchOSC compilation zip provided by @whale-av still sounds very very good and nice, if only i could comprehend what else i need to add to it for it to receive the OSC / UDP.
unfortunately my "also in Finland" go-to-guy on TouchOSC wasn't able to help me with the UDP or TCP connection either. i'm trying to all of this tethered via USB-cable, which normally works for at least MIDI and TouchOSC "on -iPad-editing" via Server inside TouchOSC.
just couldn't figure out UDP/TCP.
i apologize for switching contexts and jumping around from udp to tcp, i have maybe an hour every 2-3 days to try and get something going, and also feel a bit like there's no "TouchOSC with PureData for idiots" blog-post for iPad / macOS going on, or at least i haven't been able to find it.
I've resisted OSC since 2009 pretty much but now that I can control most of my script with TouchOSC on the iPad, it's quite mesmerizing. just getting this stepsequencer going (and back'n'forth communication between PureData and TouchOSC on iPad so i press a button on PureData and TouchOSC also lights up, type thing) would be pretty amazing but i'm probably going about it the wrong way all the time.
I'll try to stick with UDP, since it was mentioned that oscparse only works with that.
Using TouchOSC to draw into a 16 step array? communication back'n'forth? Show Array content in TouchOSC?
hmm. try as i might, i'm just not getting a connection going.
i've used what @ddw_music said about [netreceive -u -b 7878] -> [oscparse] -> [print]
but to no avail.
on the iPad, I've set OSC to connect to TCP SERVER
set to port 7878.
on TouchOSC on macOS, I've set up OSC -> Connections 1 -> TCP Client and used Browse to find the iPad Mini.
In theory, I should now be rolling. instead, PD tells me warning: MIDI timing FIFO overflowed
- nothing appears on the console, and the iPad keeps trying to reconnect to the server (I've got the Editor Network Server Enabled so can edit the TouchOSC script while using it on the iPad)
I don't know what I'm doing wrong anymore. I need to be using both Bridge, MIDI and now OSC.
Using TouchOSC to draw into a 16 step array? communication back'n'forth? Show Array content in TouchOSC?
@whale-av said:
@esaruoho This being a new thread I had forgotten that you were using a wired USB connection.
Yes, that means that you are limited to midi only.
Is that really true? I used to use TouchOSC on an Android tablet. I could connect USB to the computer, and then on the tablet, open a tethered network connection, and this would assign a new IP address to the computer. Then I could use the IP address in TouchOSC and it 100% worked for OSC.
Unfortunately that feature has been removed from the Android versions on my current devices (but these are skinned Android forks, not "real" Android, so the feature might still exist). For iOS: https://support.apple.com/en-gb/guide/iphone/iph45447ca6/ios
Connect a Mac or PC to your Personal Hotspot
You can use Wi-Fi, a USB cable, or Bluetooth to connect a Mac or PC to your Personal Hotspot. Do one of the following:
...
Use USB: Connect iPhone and your computer with a cable. If you receive an alert that says Trust this Computer?, tap Trust. In your computer’s network preferences, choose iPhone, then configure the network settings.
...
After that, the Mac should have an IP address that directly connected to the mobile, through the cable. There's no reason at this point TouchOSC would be prevented from sending and receiving OSC messages (while allowing MIDI...? that doesn't make any sense).
"just not sure how to get PD and TouchOSC to talk to eachother so that this would work."
The first thing I teach in my class about getting data from an external device is: print out the data so that you understand what's coming in.
This goes for MIDI, OSC, Arduino, computer vision packages -- you can't do much of anything without knowing the format of the messages coming in.
You should get print outs something like:
print: list 1 fader1 0.777236
The specific keyword and number of arguments will be different for the multi-slider, but you can find that out by reading the console window.
The real message coming from TouchOSC is like /1/fader1 0.777236
. [oscparse] splits the command path /1/fader1
into separate symbols. ([mrpeach/unpackOSC] doesn't do that -- from this object, you would get print: /1/fader1 0.777236
.)
At this point, with [oscparse], you will run into the problem whale-av mentioned: 1
in the printed message is a symbol, but if you try to match it using [route 1], it will fail because [route] will be looking for a number. That's the workaround I posted: [oscparse] --> [fudiformat] --> [fudiparse] --> ...
Then the other detail is that you need to drop the list
type tag before routing.
And [route] will give you the argument values, now split into one dataflow pathway per control.
hjh
Using TouchOSC to draw into a 16 step array? communication back'n'forth? Show Array content in TouchOSC?
@esaruoho This being a new thread I had forgotten that you were using a wired USB connection.
Yes, that means that you are limited to midi only.
It will be possible to talk both ways but you will be limited to 127 steps for your controls.. so much lower resolution than OSC...... unless you use the pitchbend in TouchOSC and the [bendin] and [bendout] objects in Pd..... see below.
Also I am not sure that you can change data and colour for the same GUI through midi, but you could use 2 GUI's.... a fader and a "push" button or text label above or on top of the fader for the colour.
The 127 step resolution can be improved using pitchbend to get 14-bit resolution...... https://vi-control.net/community/threads/touchosc-has-been-updated.110551/page-3
I am almost certain that Gui objects in TouchOSC can talk midi and OSC at the same time.
But I doubt that it will communicate over wireless (required for OSC messages) and USB at the same time.
So the patch I posted was for OSC wireless....... sorry.
The communications between Pd and touchOSC are set in the abstraction [osc-s-r] within the [globpitcharray1] patch in the zip I posted.
There is a TouchOSC layout plom.touchosc in the zip that should be used with this patch (for a test demo).
You would need to fix the IP address of the Ipad (static address) and use that address for [netsend] and [netreceive] in [osc-s-r] ....... if you ever get over your fear of using Wi-Fi for this.... or just feel like trying it to see what it will do.......
David.
MPE support in Pure Data?
@jj37592 You should I think just send one note and then bend it.
There are standard rpn messages for changing the bend range....... recognised in hardware synths as they are General midi standard compatible..... even the Microsoft GS Wavetable synth reads them.
The bend range......
"You can set it with both CC#100&101 (RPN LSB&MSB) first to 0 and then adjust the range with CC#6 (Data Entry MSB) in semitones."
.... from https://forum.cockos.com/showthread.php?t=69372
I know nothing about Reaper, but it probably accepts OSC and user definable NRPN messages as well?
If Reaper will not accept the RPN messages, but the pitch bend range can be set somewhere (or the note can be bent by other means), then OSC messages might be easiest from Pd.
If you need NRPN......... nrpn.pd
NRPN messages are 14-bit..... like [bendin] ..... so the highest resolution in midi...... but OSC can do better!.
David.
No sound. Failed install?
HI,
a newbie, I am trying to install and use Pd 0.53.0 on a Fedora 35 machine.
I think I installed (from source) fine, but I do not get any sound.
I am not sure what I am supposed to check and do.
Some info on my install below.
Thanks for your help.
Below, I doubt line audio APIs: PortAudio ALSA OSS
is how it should be, but I am not sure how to fix.
pd 0.53.0 is now configured
Platform: Linux
Debug build: no
Universal build: no
Localizations: yes
Source directory: .
Installation prefix: /usr/local
Compiler: gcc
CPPFLAGS: -DNDEBUG
CFLAGS: -ffast-math -fno-finite-math-only -funroll-loops -fomit-frame-pointer -O3 -g -O2
LDFLAGS:
INCLUDES:
LIBS: -lpthread -ldl
External extension: pd_linux
External CFLAGS: -fPIC
External LDFLAGS: -Wl,--export-dynamic -fPIC
fftw: no
wish(tcl/tk): wish
audio APIs: PortAudio ALSA OSS
midi APIs: ALSA OSS
libpd: no
$ ./pd -listdev
audio input devices:
0. USB Device 0x46d:0x825 (hardware)
1. USB Device 0x46d:0x825 (plug-in)
2. HDA Intel PCH (hardware)
3. HDA Intel PCH (plug-in)
4. HDA NVidia (hardware)
5. HDA NVidia (plug-in)
6. Trust PC Headset (hardware)
7. Trust PC Headset (plug-in)
audio output devices:
0. USB Device 0x46d:0x825 (hardware)
1. USB Device 0x46d:0x825 (plug-in)
2. HDA Intel PCH (hardware)
3. HDA Intel PCH (plug-in)
4. HDA NVidia (hardware)
5. HDA NVidia (plug-in)
6. Trust PC Headset (hardware)
7. Trust PC Headset (plug-in)
API number 1
MIDI input devices:
1. ALSA MIDI device #1
MIDI output devices:
1. ALSA MIDI device #1
priority 94 scheduling failed.```
If I try to set to something different from HDA Intel, I get
ALSA input error (snd_pcm_open): Device or resource busy
ALSA output error (snd_pcm_open): No such file or directory
`
Broken Square Waves?
Hi, I'm looking for someone with a deeper understanding of PD and audio synthesis to help me understand why my patch sounds the way it sounds. I don't know why the audio is generated this way. I don't know if it is because of some expected behavior of square waves and the math behind it, or if it is because of some quirk of PD and the way I'm generating the square wave. If you think you can help, please stay with me, I don't know who to go to or what to study to help me understand this.
I was attempting to make a square wave from scratch, I saw some tutorials and I know there are more "proper" ways of doing this, but the simplest I could think of was -1 and 1 alternating. The osc I built is a metronome with a route alternating between -1 and 1 at a given hertz. But the result doesn't sound like a single square wave, there are some harmonics, almost like having senoidal waves mixed with the square wave.
Experimenting, I noticed a cycle of the resonances going from 1hz to 1378.125hz where it completely stops, like zero hz, or one tick in several, several minutes. Other cycles multiples of this frequency exist, like this:
n=1378.125hz
Cycle0 = 1 to n* 2^0
Cycle1 = n*(2^0) to n*(2^1)
Cycle2 = n*(2^1) to n*(2^2)
Cycle3 = n*(2^2) to n*(2^2)
? Cyclen= n2^(n-1) to n(2^n) ?
C0 and C1 are very similar, with subtle differences, but inside of C2 it seems like 2 times C0 or C1 (I didn't check it, but it sounds like this). Inside C3 there are 3 times, and next, C4, 4 times, and so on, the same cycle but more times and faster in each power of two.
I have made a patch that makes it easy to clone the osc to generate each Cycle. For example, clone 10 times to get audio files from C0 through C9.
Where do the resonances come from? Why these cycles exist? Are they some kind of harmonic series? Why 1378.125hz? Is this expected from the math, or is it a quirk result of some PD object (like inputing very low numbers to the metronome)? Does someone understand why this is happening?
main_oscs_cycles.pd
square-from-scratch-osc.pd used in main
square-from-scratch-osc-lineramp.pd used in main
Arduino->Pd with Open Sound Control
@cfry I used the Arduino library "OSC" by Adrian Freed and in it there are lots of Arduino examples and a few Pd examples using the mrpeach library (which I don't use anymore since vanilla started talking OSC natively). If you can give me a better sense of what you are having trouble with I can make a more helpful example, e.g. do you need bidirectional messaging? What data are you passing (if any)? What Arduino library would you prefer to use (I see there are more now than when I started)? is it over WiFi or ethernet or something else?
But maybe this example from the OSC lib is all you need: UDPSendMessage.ino
Edit: I found my knockoff ethernet shield and wrote this Arduino sender and Pd receiver,. It includes an example of how to route numbers in the OSC path. Hope this helps.
testOSCSend.ino
osc rcv dump.pd
Using Pd to remote control OBS
@Harlekin If you want TouchOSC to control OBS you don't need Pd....... just connect TouchOSC directly to the ports of osc4obs and make your remote.touchosc layout file.
If you want to do some other processing in Pd then connect TouchOSC to Pd directly (in and out)...... and then connect your processed control from PD to osc4obs directly (in and out).
osc4obs facilitates that by creating separate OSC in and out ports.
You will have to do that also if you want to use TouchOSC and Pd in an either/or situation as osc4obs only has one set of osc ports and is making a tcp connection with OBS.
OBS websocket is a tcp connection and so it is possible that osc4obs is requiring tcp for the OSC connections...... in which case remove the -u flag from [netsend] and [netreceive] in my examples below.
It could also be expecting ascii instead of binary in which case remove the -b flag (but I doubt that)....
Externals for Pd are written in C so if you are adept there is some help in Pd/doc/6.externs .....
Basically you need to make a websocket client that replicates osc4obs with outlets and inlets instead of the osc ports.
BUT... you could try the iemnet [tcpclient] first (NOT the [udpclient]...!).... and that should work.
Just replace both [netsend] and [netreceive] with the one [tcpclient]...... connect it to OBS and look at the output using a [print] object.
If OBS is on the same computer the connect message will be [connect 127.0.0.1 4444(
Remove the password from the OBS websocket unless you find that a password can be added to the [connect( message for [tcpclient]...... before or after the port number? preceded by "password" or "passwd"?...... guesswork...... and [tcpclient] might well not accept a password as it is not mentioned in the help file.
Once you are looking at a print of the received messages the problem will be to decode the proprietary message format (it will not be OSC)....... it might be easy.... or not.
If lucky there will probably be the ascii strings you are looking for or a decimal representation of them somewhere in the message.
If you go the osc4obs route then it is quite easy to use [oscformat] and [oscparse] in vanilla instead of creating an external.......
...... vanilla osc.zip
P.S. try to avoid integers within the OSC address (header) as they arrive in Pd as symbols at the output of [oscparse] ....... and are then difficult to route. So what/ever/6 data is best avoided if possible and what/ever/six data is easier to deal with in Pd...... but I have included a solution in the zip file above.
Be careful in TouchOSC to avoid message feedback (much like midi feedback)......... and the same applies in Pd. In Pd you can include "set" at the start of a message (without the quote marks)...... which will set a message in the next object or message box but not send it onward until that object or message is banged.
David.