Jump to content

Using OSC


Rangarajan

Recommended Posts

Hi,

I am getting back to Opusmodus after a long time. I am excited about the support for OSC in this new release.

 

I have two questions:

1) Normally when we use OSC to send to a destination, we use an "address" like "/a/b/c". A device that has this destination "address" is expected to receive the message and act on it. How and where do we specify that address in "osc-thread" function. Just to give an example, a couple of years ago, I had written an article on how to control Reaktor using OSC. If I want to do something similar using OM, what is the procedure?

2) There could be occasions where I want to ping the destination at regular intervals. How do I do that in OM? 

 

A detailed example will be quite useful.

 

Regards,

Rangarajan

Link to comment
Share on other sites

Good to see Rangarajan.

This example should help.

In this example I use the Reaktor "Drive.ens" from the Reaktor Blocks. 

OSC Threads.opmo

 

To hear the OSC messages in action you need to create a score and send the midi messages to the Reaktor possibly on :port 0 and :channel 1.

 

Best wishes,

Janusz

Link to comment
Share on other sites

Thanks again for the example code.


To test this example, I started Reaktor 6, and loaded the "Drive.ens" as you had suggested. Then enabled "OSC Activate" under "OSC Settings". To see if any OSC message was being received, I watched the "Incoming OSC Monitor" pane.

 

I was able to run the example after making one minor correction - the variable "seed" had to be defined first (a minor issue). Also changed the IP address to what my Reaktor displayed under "OSC Settings".

 

When I ran the example, nothing happened, but of course, there was no error message as well. "Incoming OSC Monitor" pane in Reaktor did not display anything, indicating it did not receive any message from outside. What is supposed to happen when the example program runs?

 

1) "osc-thread"function takes an ID as its second argument. Can you explain how this ID is mapped to a control on Reaktor? I believe this is crucial. Don't we also have to configure this appropriately in Reaktor? 

2) What does "osc-thread" really do? Does it not send the data given to it to the controller at the other end?

 

Would it be possible for you to include any additional code that is needed to actually make Reaktor play something (need not be interesting)? Right now I don't hear anything at all, so it is difficult to understand what is going on. Since OSC is a great addition to the current release of OM, it would be nice to include detailed documentation on the correct use of the feature.

 

Regards,

Rangarajan

Link to comment
Share on other sites

First you need to define and link the thread IDs with the Reaktor controllers. Each Drive.ens controller (button or slider) should receive one ID thread message.

In the Reaktor you can assign a OSC thread ID with a right mouse click on the controller selecting "MIDi & OSC Learn":

 

Screenshot 2019-03-14 at 21.15.59.png

 

You should send only one thread at a time.

Stop the thread and trigger next one etc...

 

The new function END-ALL-OSC-THREADS will destroy all OSC threads.

Please note, you need to update your app first (1.3.24667) before you can use the new function. To do that simply select 'Check for Updates..." from Opusmodus menu.

 

Tomorrow I will create a Drive.ens - for Reaktor 6 - with ID controllers already linked, as well a simple score for LCI to play with.

Link to comment
Share on other sites

Dear Rangarajan,

 

Here it is.

 

OSC threads and Reaktor 6:

1. Expand the Reaktor-Drive.ens.zip file first.

Reaktor-Drive.ens.zip

 

2. Move the Reaktor-Drive.ens file into the '~/Opusmodus/Instruments' directory, this will allow you to star the Reaktor form the Opusmodus app.

3. Add the 'OSC Threads.opmo' file into the Opusmodus Navigator.

OSC Threads.opmo

 

4. Evaluate the DATA parameters.

5. Evaluate the SCORE.

6. Press START button in the Live Coding Instrument - you should hear a sound coming from your Reaktor instrument.

7. Now you are ready to run the OSC threads.

 

You can end any thread at any time with END-OSC-THREADS or all threads with END-ALL-OSC-THREADS.

 

On 3/14/2019 at 3:15 AM, Rangarajan said:

2) What does "osc-thread" really do? Does it not send the data given to it to the controller at the other end?

Yes, the OSC-THREAD send the data to the given controller at the other end. Each message has two values, example: (0.04198588 4). The first value is the controller value, the second value is the time (interval - second or ratio).

 

Best wishes,

Janusz

Link to comment
Share on other sites

I am sorry but I have still the same problem as Rangarajan.

 

The OSC-messages does not make it out from OM. I have tested the same messages from MAX, Kyma and Reaper. No problem.

Weird. Maybe Mojave is the problem. There is sometimes problems with the security thingies that Apple have put in there.

Let me know if I can assist in tracking down this.

 

/Lasse

Link to comment
Share on other sites

I am on Mojave and all works fine here.

You need to set the correct remote-host and remote-port for your Reaktor:

(defparameter reaktor '(127.0.0.1 10000))

 

Make sure the OSC is Active:

 

Screenshot 2019-03-15 at 20.50.01.png

 

 

Do you see the Control IDs and Targets in your Reaktor-Drive.ens file:

 

Screenshot 2019-03-15 at 20.57.39.png

 

Please drop this file into your '~/Opusmodus/Extensions' folder and restart OM, without it the OSC will not work.

OSC Remote Setup.opmo

 

This should fix the problem.

 

Best,

Janusz

Link to comment
Share on other sites

On 3/13/2019 at 3:00 PM, Rangarajan said:

1) Normally when we use OSC to send to a destination, we use an "address" like "/a/b/c". A device that has this destination "address" is expected to receive the message and act on it. How and where do we specify that address in "osc-thread" function.

 The ID is the address. The form like "/a" is made internally. All you need to do is to give the id (address) "a" only.

 

On 3/13/2019 at 3:00 PM, Rangarajan said:

2) There could be occasions where I want to ping the destination at regular intervals. How do I do that in OM?

The data has two values one for the controller and the second one is the time (interval). I have explained this in my previous post (see above).

Link to comment
Share on other sites

1 hour ago, lviklund said:

I have tested the same messages from MAX, Kyma and Reaper.

 

I did that by sending the same messages to the included .ens.

Works well in the ensemble.

 

Forget it. If you are on Mojave I will figure out the problem my self.

 

/Lasse

Link to comment
Share on other sites

Great! The example works now. Thanks for the help Janusz.

 

I am trying to understand the finer details of this.

1) The third argument to "osc-thread" is a list of lists with two elements <controller-value, time>. What is the time unit assumed here? For example if a list element is '(0.5 1/2), what does "1/2" in this indicate? Is it 1/2 second, or something else?

2) Suppose the third argument to this function has 5 elements like this: '((a b) (c d) (e f) (g h) (I j)), what happens to the thread after it sends the last pair to the controller device? Does it get destroyed by itself? 

3) Is there a way to check the status of any of these threads at any time after they have started?

4) Is there a way to destroy a thread and release its resource back to the runtime? Is that what (stop-osc-thread...) does?

5) Is it possible to re-start/re-use a thread?

 

 Regards,

Rangarajan

Link to comment
Share on other sites

  • 2 weeks later...

Janusz,

While I am waiting for your reply to my earlier queries, I want to ask one more doubt. The "osc-thread" function takes a finite list of data to be transmitted to the receiving controller. What if I want to send data continuously in a loop (like - forever)? 

 

Regards,

Rangarajan

Link to comment
Share on other sites

On 3/16/2019 at 8:52 AM, Rangarajan said:

1) The third argument to "osc-thread" is a list of lists with two elements <controller-value, time>. What is the time unit assumed here? For example if a list element is '(0.5 1/2), what does "1/2" in this indicate? Is it 1/2 second, or something else?

Yes, 1/2 equal 1/2 second.

 

On 3/16/2019 at 8:52 AM, Rangarajan said:

2) Suppose the third argument to this function has 5 elements like this: '((a b) (c d) (e f) (g h) (I j)), what happens to the thread after it sends the last pair to the controller device? Does it get destroyed by itself? 

Yes, after the last thread pair is send the thread will destroy by itself.

 

On 3/16/2019 at 8:52 AM, Rangarajan said:

3) Is there a way to check the status of any of these threads at any time after they have started?

Yes, this function will display all running threads: 

(bt:all-threads)

 

On 3/16/2019 at 8:52 AM, Rangarajan said:

4) Is there a way to destroy a thread and release its resource back to the runtime? Is that what (stop-osc-thread...) does?

 

The function:

 (stop-osc-threads a-thread)

will destroy the given OSC thread.

 

The function:

(stop-all-osc-threads)

 will destroy all OSC threads.

 

On 3/16/2019 at 8:52 AM, Rangarajan said:

5) Is it possible to re-start/re-use a thread?

No, In order to restart a thread again you need to evaluate the expression again, example: 

(sets thread1 (osc-thread reaktor "osc1" '((0.18450676 5/2)))

 

On 3/28/2019 at 4:59 AM, Rangarajan said:

What if I want to send data continuously in a loop (like - forever)? 

No, but you could create a loop with repeat function for a given count.

Best wishes,

Janusz

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy