Coder Social home page Coder Social logo

munshkr / superdirtmod Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 26 KB

SuperDirt extension for parameter modulation of currently running synth nodes

License: GNU General Public License v3.0

SuperCollider 100.00%
supercollider-quark superdirt tidalcycles livecoding live-coding

superdirtmod's Introduction

SuperDirtMod

Experimental: SuperCollider Quark that extends SuperDirt for parameter modulation of currently running synth nodes.

This will allow you to modulate some parameter of a SuperDirt SynthDef while it is sounding.

Motivation

In TidalCycles, if you play a long sample or synth, you won't be able to apply effects and modulate them while the sample is playing:

d1 $ n "[0, 2, 5, 9]/2" # s "superhammond" # octave 6
   # pF "vibrato" (range 0 2 $ slow 2 saw)

This wlll play a single chord for 2 cycles, but the vibrato parameter will be fixed to 0 the entire time. By using the mod1 helper function, you can modulate the vibrato parameter for all synths on d1.

d1 $ n "[0, 2, 5, 9]/2" # s "superhammond" # octave 6

mod1 $ segment 32
     $ pF "vibrato" (range 0 2 $ slow 2 saw)

The segment is there to discretize the saw function into 32 steps.

A more complete example:

d1 $ n "[0, 2, 5, 9]/2" # s "superhammond" # octave 6

mod1 $ segment 32
     $ pF "vibrato" (range 0 2 $ slow 2 saw)
     # pF "vrate" (range 0 16 $ slow 2 tri)
     # pF "voice" (range 0 4 $ perlin)

Install

Open a new document on your SuperCollider IDE and type:

Quarks.install("https://github.com/munshkr/SuperDirtMod");

After a few seconds, if everything went OK, you should see something like this in your Post window:

Installing SuperDirtMod
SuperDirtMod installed
-> Quark: SuperDirtMod[0.1.0]

Finally recompile your class library. Go to Language menu, Recompile class library, or hit Ctrl+Shift+L.

TidalCycles

Open your boot script file and add the following at the end of the file, but before :set prompt "tidal> ":

--
-- == SuperDirtMod BEGIN ==
--

-- Define mod target
modTarget = OSCTarget {oName = "SuperDirtMod", oAddress = "127.0.0.1", oPort = 57130, oPath = "/set", oShape = Nothing, oLatency = 0.02, oPreamble = [], oTimestamp = BundleStamp}

-- Define mod stream
-- Total latency = oLatency + cFrameTimespan
mod <- startTidal modTarget (defaultConfig {cCtrlListen = False, cFrameTimespan = 1/20})

-- Define pmod stream replacer and orbit helper functions
pmod = streamReplace mod
mod1 = pmod "mod1" . (|< orbit 0)
mod2 = pmod "mod2" . (|< orbit 1)
mod3 = pmod "mod3" . (|< orbit 2)
mod4 = pmod "mod4" . (|< orbit 3)
mod5 = pmod "mod5" . (|< orbit 4)
mod6 = pmod "mod6" . (|< orbit 5)
mod7 = pmod "mod7" . (|< orbit 6)
mod8 = pmod "mod8" . (|< orbit 7)
mod9 = pmod "mod9" . (|< orbit 8)
mod10 = pmod "mod10" . (|< orbit 9)
mod11 = pmod "mod11" . (|< orbit 10)
mod12 = pmod "mod12" . (|< orbit 11)

-- Reset functions
reset = pI "reset" 1
modResetAll = streamOnce mod reset

putStrLn "SuperDirtMod enabled"

--
-- == SuperDirtMod END ==
--

This creates a new OSC Stream for SuperDirtMod and defines the pmod function to replace streams, which works similarly to p. There are also some predefined modN functions that accompany the dN functions and with their respective orbits.

Usage

Simply execute SuperDirtMod.start after starting SuperDirt.

By default, it tries to use ~dirt as the default SuperDirt instance. You can also pass it with via parameter:

var mySuperDirt = SuperDirt(2, s);
mySuperDirt.loadSoundFiles;
mySuperDirt.start;

SuperDirtMod.start(superDirt: mySuperDirt)

If you silence a modulation stream, you will notice that parameters will not go to default values, but instead keep using the last value when the stream was silenced.

To reset all modulation parameters back to default values, you can use modResetAll.

Known limitations

  • You can't modulate the parameters of specific synths. All running synths playing on some orbit are affected by the parameter modulation.

  • If you silence a pmod stream, the last values will not be reset. For now, you can call modResetAll on TidalCycles or SuperDirtMod.reset on SC to reset the state.

Contributing

Bug reports and pull requests are welcome on GitHub at the issues page. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

This project is licensed under GPL 3+. Refer to LICENSE.txt

superdirtmod's People

Contributors

munshkr avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

mynkit

superdirtmod's Issues

Update osc instructions for tidal 1.5>

What worked for me was to set it this way:

let modTarget = superdirtTarget {oName = "SuperDirtMod", oAddress = "127.0.0.1", oPort = 57130 }
    oscSet = OSC "/set" $  Named {required = []}
    modMap = [(modTarget, [oscSet])]
    mod <- startStream defaultConfig modMap

Does State Values work?

I tried the following patterns.

setF "tremolo" 1

d1
  $ s "superhammond/2"
  # n "[5,7,10]"
  # gain 0.5

mod1
  $ segment 32
  $ pF "tremolorate" (cF 0 "tremolo")
  # pF "tremolodepth" (0.1)

I want to control the "tremolorate" effect by state values "tremolo". I want to control the "tremolorate" effect by state values "tremolo" because I want to manipulate the effect externally in OSC.
Is there any way to support state values?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.