Comments (10)
I'll close this for now as I don't think it makes sense to add OSC functionality to the MIDI code.
from superdirt.
Yes that seems right.
I'm finding a way through with the Haskell OSC side now, thanks.
For posterity, here's the thing working: https://github.com/Intelligent-Instruments-Lab/iil-python-tools/tree/ja-dev/examples/mrp/tidalcycles
from superdirt.
This seems like a midiesque OSC protocol rather than MIDI over OSC. Why not just send the OSC from Tidal?
from superdirt.
Yeah that's right, but what I am struggling with is how would I get the NoteOff messages scheduled automatically like SuperDirt MIDI does?
https://github.com/musikinformatik/SuperDirt/blob/develop/classes/DirtEventTypes.sc#L126-L128
from superdirt.
How about something like this:
import Data.Maybe (fromJust)
eventHasOffset :: Event a -> Bool
eventHasOffset e | isAnalog e = False
| otherwise = stop (fromJust $ whole e) == stop (part e)
offsets :: Pattern a -> Pattern a
offsets pat = withEvent f $ filterEvents eventHasOffset pat
where f (e@(Event _ Nothing _ _)) = e -- ignore analog events
f (Event c (Just (Arc b e)) _ v) = Event c (Just a) a v
where a = Arc e (e + (e - b))
cmd = pS "cmd"
noteonoff pat = stack [pat # cmd "Channel16NoteOn", offsets pat # cmd "Channel16NoteOff"]
noteonoff (note "a b" # velocity 50)
giving:
(0>½)|cmd: "Channel16NoteOn", note: 9.0n (a5), velocity: 50.0f
(½>1)|cmd: "Channel16NoteOn", note: 11.0n (b5), velocity: 50.0f
(½>1)|cmd: "Channel16NoteOff", note: 9.0n (a5), velocity: 50.0f
(1>1½)|cmd: "Channel16NoteOff", note: 11.0n (b5), velocity: 50.0f
Getting the OSC shape right from this would hopefully be straightforward, as long as the MRP accepts (and ignores) the velocity parameter on a note off message.
from superdirt.
Btw. there is already a midi event type in SuperDirt's DirtEventTypes
. For tests, you could even tweak it while running.
(
DirtEventTypes.midiEvent[\play] = {
<.... the long function ....>
}
)
from superdirt.
The tidal solution for sending noteoffs does have some drawbacks, e.g. if you silence the pattern then the noteoff won't get sent. I think it's better to modify the receiving end to accept a duration parameter to the noteon. Tidal will fill this in to a parameter called 'delta'.
from superdirt.
Thank you for the suggestions.
A Haskell-only OSCTarget version sounds great...
@yaxu: if you silence the pattern then the noteoff won't get sent
There is an /mrp/allnotesoff
command in the spec, so I could get around this with e.g. hushmrp = once $ s "mrp" $ mrp_msg "allnotesoff
and equivalents for silence
. I'm going to try this out with your example code...
@yaxu: I think it's better to modify the receiving end to accept a duration parameter to the noteon.
Unfortunately the receiving end is a 10+ year old C++ codebase (albeit a marvel in its own right!) that I can't build myself in XCode as of yet. That's why I was wondering about using our SuperCollider MRP client class and creating a custom DirtEventType
to have more control over the messaging/scheduling.
@telephon: there is already a midi event type in SuperDirt's DirtEventTypes
Yes this is what I was originally referring to. As I mentioned, I found this quite difficult to comprehend, as I'm a novice SC user, but also there's few code comments and no .schelp
for this class. I assume I would need the overall structure/logic of the midiEvent
type to be able to schedule the NoteOff messages (ref https://github.com/musikinformatik/SuperDirt/blob/develop/classes/DirtEventTypes.sc#L107-L131), but to send out OSC messages instead of MIDI messages?
A thought: since our MRP class has its own MIDIdef
s as inputs, could this somehow be added as a "MIDI device" in the regular SuperDirt MIDI fashion?
from superdirt.
I had a quick go at the Haskell-only version. There's two head-scratchers:
The first is that the keyword-value OSC message style of Tidal means I can't send a message that complies with the keyword-less spec of the MRP (i.e. /mrp/midi Channel16NoteOn NoteNumber NoteVelocity
is sent as /mrp/midi 145 48 127
). If there's no simple way around this in Haskell, then I would need to parse out the keywords, probably in SC which wouldn't necessarily be a bad thing... however...
The second is that the MRP app cannot currently schedule incoming messages such as...
(0>½)|cmd: "Channel16NoteOn", note: 9.0n (a5), velocity: 50.0f
(½>1)|cmd: "Channel16NoteOn", note: 11.0n (b5), velocity: 50.0f
(½>1)|cmd: "Channel16NoteOff", note: 9.0n (a5), velocity: 50.0f
(1>1½)|cmd: "Channel16NoteOff", note: 11.0n (b5), velocity: 50.0f
Hopefully I will be able to build the MRP app someday, however in this case I would be less sure about designing a C++ Tidal event scheduler for it, over using what SuperDirt already has implemented.
This maybe leads back to the idea of a SuperDirt DirtEventType. Unless ~dirt.addMidi
can somehow send MIDI out to the MRP SC class directly using its MIDIdef
s? I guess it could simply use a virtual MIDI device as the go-between.
from superdirt.
Use 'arglist' to send a list of values rather than name-value pairs http://tidalcycles.org/docs/configuration/MIDIOSC/osc/#defining-osc-message-structure
However it seems the only difference between a note on and note off is the lack of a velocity parameter in the latter. So you'll need to do some hackery to get around that.
I'd forget about MIDI and superdirt. It'd be easier to make an OSC server for converting between tidal deltas and the MRP protocol.
from superdirt.
Related Issues (20)
- NRPN fails to send value 0 for CC 38
- Q: How do default arguments in the SynthDefs SuperDirt use work? HOT 3
- delay stops working sometimes HOT 4
- amp parameter scaling HOT 3
- playing samples in tune using pitch metadata HOT 2
- unit "s" unexpected behavior HOT 1
- Supercollider 3.13.0-rc1 / SuperDirt 1.7.3 - High Cpu Usage At Idle - macOS HOT 17
- SuperDirt does not recognize SynthDef variants HOT 2
- superchip is way out of tune HOT 2
- cut groups break on simultaneous events HOT 29
- Should we send RPN Null after NRPN? HOT 4
- d3 onwards not sounding HOT 1
- Lazy Sample Loading doesn't find any samples (Windows 11/SuperCollider 3.12.1) HOT 3
- Effect "dj-filter" should be inactive when value is 0.5 HOT 7
- Time stretching + Reverb can break an orbit's global effects HOT 2
- Add a simple way to add modules after another specific module HOT 2
- dirt_rms ambiguity. should it be running to not? HOT 11
- Tuning name parameters HOT 5
- New Release? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superdirt.