Jump to content
Sign in to follow this  

Convert OMN to OSC Data (to SuperCollider)

Recommended Posts

Hi everyone,

For the past two days I've been messing around with SuperCollider and OM.
I want to be able to write my score in OMN format and send it via OSC to SuperCollider.
So far I have this in OM:

(defparameter to-sc '( 57120))
(setf thd1 (create-osc-thread "thread1" to-sc))
(send-osc-data thd1 '( 
                      (12 1/2) (2 1/2) (0 1/2) (3 1/2)
                      (14 1/2) (2 1/2) (0 1/2) (3 1/2)
                      (8 1/2) (2 1/2) (0 1/2) (3 1/2)
                      (7 1/2) (2 1/2) (0 1/2) (3 1/2)

And this in SuperCollider

		arg msg, time, addr, port;
		[msg, time, addr, port].postln;
		Synth(\synth1, [pitch:msg[1]+60]);
SynthDef('synth1', {
    arg pitch=60, amp=0.2, ffreq=15000;
	var linen, env, sig1, sig2;
    linen = Env.linen(0.01, sustainTime:0, releaseTime:1);
    env = EnvGen.kr(linen, doneAction:2);
	sig1 = Mix(VarSaw.ar([pitch.midicps], 0, 0.5));
	sig2 = LPF.ar(sig1, ffreq);
    Out.ar(0, sig2* env * amp);

And this works great! However I would like to write my OM script in regular OMN format and then convert it to integers, which SuperCollider understands.

I've tried to do this like so:

(setf convert-test '(
                       (q a3 e4 c4 f4)
                       (q e3 b4 a3 c4)))

(setf data (gen-osc-data 16
                         (pitch-to-midi (omn :pitch convert-test))
                         :time (flatten (omn :length convert-test))
                         :min 0
                         :max 127))

However, it seems like "gen-osc-data" really wants to use floating values, adding the Min and Max does seem to convert these values in the range 0-127 but still I end up having the wrong notes:

(setf data (gen-osc-data 16
                         (pitch-to-midi (omn :pitch convert-test))
                         :time '(1/2 1/4 1/12 1/12 1/12)
                         :min 0
                         :max 127))

>> (((0 91 127) 1/2) ((27 127 0) 1/4) ((0 106 127) 1/12) ((0 127 64) 1/12) ((0 91 127) 1/12) ((27 127 0) 1/2) ((0 106 127) 1/4) ((0 127 118) 1/12) ((0 127 118) 1/12) ((0 127 118) 1/12)....


Any ideas on a straightforward method to deal with this? I hope my question is understandable, this is by far the most challenging project I've tried in OM, any help would be very appreciated!

NOTE: I know that I can just send MIDI notes to SC however I would like to control my Synth Parameters via OSC and I'm a big fan of consistency, therefor it would be great if the Pitch and Length information also could be converted and send via OSC messages.

Thanks very much in advance!

- Jor

Share this post

Link to post
Share on other sites

Yes but for this project I would love to use native SC language, and not write everything in Lisp. CL-Collider only uses the server side (synths & FX)of SC but not the language side, which has a lot of good stuff as well.
Following up on my previous question:
Is there a way to send multiple messages to one Thread? In SC it's great to be able to filter out messages like so [1], [2]. Wich will get the first and the second message send to a specific thread. Is this possible with the current OSC implementation? I tried sending multiple messages with send-osc-data but I can't figure out how to format the messages in that case.

Share this post

Link to post
Share on other sites

Join the conversation

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

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.

Sign in to follow this  

  • Similar Topics

    • By hujairi
      I am trying to find different ways of importing partials/frames data into Opusmodus. I am currently trying to use spectral analysis to analyzes certain music/audio phenomena I haven't really seen analyzed before to adapt into my own composition process. The sounds are generally archival or things I have synthesized on the computer through software myself (in .wav format), and are usually between 1 - 5 seconds in length. Is this a good length of time to analyze the spectral data of sounds? 
      I just wanted to understand the following information about spectral tools within Opusmodus. I really would appreciate it if anyone could help me out.
      1. Is it only Spear that we can use for spectral analysis? Is something like Audiosculpt also useable?
      2. Looking at Spear, when we explore the data, which of the following export formats do we use: 1. Text - Resampled Frames, 2. Text - Partials, 3. SDIF 1 TRC - Resampled Frames, 4. SDIF 1 TRC - Exact Interpolated, or 5. SDIF RBEP?
      3. Once I have the data in the correct format, I think I want to create a library of the datasets I important so that I can reinterpret them in the future. If I want to use the "get-tuning" function, for example, and then mapping it across certain instruments within my planned orchestration. What would be an effective way of doing this?
      One of my main challenges is finding a way to keep all my data organized every time I want to use Opusmodus for a new project. I still find myself using Opusmodus in little blocks as I compose, and I hope to eventually get to the point in which I can compose entire pieces using only Opusmodus. 
      I really appreciate your help.
    • By Andy
      I have converted many of my scores made in Notion to music xml in order to display them in the Assistant..which is very nice indeed.
      I'm wondering if I can convert those xml scores to an Opusmodus score direct or do I have to re-import them as midi? I see I can go the other way..xml to Notion, but cannot find how to go this way or if it's possible.
    • By hujairi
      I am working on a sound installation for two voices (using Soniccouture's Geosonics VST plugin and a vibraphone VST plugin running through a computer). The source of the data is taken live from the internet and is actually API weather data from a city in South Korea. The piece will play for 2 hours every night between early December and early March. 
      The trouble I am having is how to transform the different fragments of weather data into data I could use within Opusmodus. Here's the type of data that I get according to each parameter (the options are either floating points, integers, or T/F). All of this is on my computer as OSC signals.
      1. wind direction: floating points, between 0 and 360.0
      2. wind speed: floating points
      3. sky code (i.e., clear, cloudy, rain, snow): integers
      4. precipitation type: integers (codes for each type of precipitation) 
      5. temperature (celcius): floating points
      6. temperature minimum: floating points
      7. temperature maximum: floating points
      8. humidity: floating points (representing percentage, example 31.1% = 31.1)
      9. pressure: float points (time of writing this, pressure of the place I was looking at was 1008.9 while here in Seoul, the pressure is 922.8)
      10. lightning: True or False option
      My questions are: 
      - How can I receive OSC signals within Opusmodus? Is there a function that allows me to do this?
      - I've never used the Live Coding function in Opusmodus although I've got a basic knowledge of live coding within other environments such as SuperCollider, Sonic Pi, and Max/MSP. I would like to have the data control the live coding functions modulate the music as it plays live. 
      I would really, really appreciate any advice I may get on this. I don't mean to have the community here 'do everything' for me, but I'd appreciate any direction I may get in successfully accomplishing this project.  
      Thanks very much and sorry for any trouble,
  • Create New...