Skip to content

Commit

Permalink
input works up to 16 channels
Browse files Browse the repository at this point in the history
  • Loading branch information
tmhglnd committed Oct 31, 2023
1 parent 9e82ce5 commit 590ab34
Show file tree
Hide file tree
Showing 4 changed files with 443 additions and 60 deletions.
23 changes: 21 additions & 2 deletions docs/02-instrument.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# All Instruments

The following methods apply to all the types of instruments: `synth`, `sample`, `polySynth`, `loop` and `midi`.
The following methods apply to all the types of instruments: `synth`, `sample`, `polySynth`, `loop`, `midi` and `input`.

For instrument specific functions see below:

- [Synth / polySynth](#synth-and-polysynth-only)
- [Sample / Loop](#sample-and-loop-only)
- [Midi](#midi)
- [Modulator](#modulator) *Mercury for Max8 Only!*
- [Input](#input) *Mercury for Max8 only!*
- [Modulator](#modulator) *Mercury for Max8 only!*
<!-- - text to speech -->

## name
Expand Down Expand Up @@ -539,6 +540,24 @@ new voice Alex speak("Hello world!") time(2)
new voice Samantha speak("Hi Alex!") time(2 1)
``` -->

# Input

Use the input from the soundcard (ADC) as the source for an instrument. The sound can be modified by all the various `fx()`. The volume can be adjusted with `gain()`. An envelope can also be applied on the sound with `shape()` and this envelope can be triggered with `time()` just as with the regular instruments `sample`, `synth`, etc. Use the words `in1`, `in2`, ..., `inx` to choose the input source.

**arguments**
- {Name} -> `default` or the input channel number as a string `inX`

```java
// use the default input, in most cases channel 1
new input default gain(1)

// use a specific channel
new input in3 gain(0.9)

// add functions like shape, time and fx
new input in4 gain(0.9) time(1/16) shape(1 100) fx(reverb) fx(distort)
```

# Modulator

The modulator allows you to send a modulation signal as an argument to parameters from functions of other instruments. These parameters are continuously modulated at a specific rate with a specific waveform. The modulation rate is independent from the instruments `time()` (in comparison when using a list as an argument). It is also possible to send the modulation signal directly out to the connected soundcard on a specific channel. This can for example be used for cv modulations.
Expand Down
53 changes: 47 additions & 6 deletions mercury_ide/patchers/_mercury_main.maxpat
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
,
"classnamespace" : "box",
"rect" : [ 72.0, 154.0, 368.0, 416.0 ],
"rect" : [ 67.0, 136.0, 368.0, 416.0 ],
"bglocked" : 0,
"openinpresentation" : 1,
"default_fontsize" : 12.0,
Expand Down Expand Up @@ -39,12 +39,46 @@
"subpatcher_template" : "",
"assistshowspatchername" : 0,
"boxes" : [ {
"box" : {
"id" : "obj-380",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 1860.0, 1695.0, 110.0, 22.0 ],
"text" : "mc.send~ directIns"
}

}
, {
"box" : {
"id" : "obj-226",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 1860.0, 1643.0, 177.0, 20.0 ],
"text" : "// 8 direct inputs from the adc~"
}

}
, {
"box" : {
"id" : "obj-197",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "multichannelsignal" ],
"patching_rect" : [ 1860.0, 1665.0, 260.0, 22.0 ],
"text" : "mc.adc~ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16"
}

}
, {
"box" : {
"id" : "obj-200",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 2025.0, 1575.0, 170.0, 20.0 ],
"patching_rect" : [ 1860.0, 1553.0, 170.0, 20.0 ],
"text" : "// 16 direct outputs to the dac~"
}

Expand Down Expand Up @@ -19316,7 +19350,7 @@
}
,
"classnamespace" : "box",
"rect" : [ 34.0, 79.0, 652.0, 783.0 ],
"rect" : [ 34.0, 96.0, 652.0, 783.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 12.0,
Expand Down Expand Up @@ -51675,6 +51709,8 @@
"saved_object_attributes" : {
"autostart" : 1,
"defer" : 0,
"node_bin_path" : "",
"npm_bin_path" : "",
"watch" : 1
}
,
Expand Down Expand Up @@ -55002,7 +55038,7 @@
, {
"box" : {
"id" : "obj-284",
"items" : [ "AU DLS Synth 1", ",", "IAC Driver Bus 1", ",", "from Max 1", ",", "from Max 2" ],
"items" : [ "AU DLS Synth 1", ",", "IAC Driver Bus 1", ",", "M4", ",", "from Max 1", ",", "from Max 2" ],
"maxclass" : "umenu",
"numinlets" : 1,
"numoutlets" : 3,
Expand Down Expand Up @@ -58807,8 +58843,6 @@
"saved_object_attributes" : {
"autostart" : 0,
"defer" : 1,
"node_bin_path" : "",
"npm_bin_path" : "",
"watch" : 1
}
,
Expand Down Expand Up @@ -73924,6 +73958,13 @@
"source" : [ "obj-195", 0 ]
}

}
, {
"patchline" : {
"destination" : [ "obj-380", 0 ],
"source" : [ "obj-197", 0 ]
}

}
, {
"patchline" : {
Expand Down
42 changes: 27 additions & 15 deletions mercury_ide/patchers/soundObject.maxpat
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 909.0, 392.0, 79.0, 22.0 ],
"patching_rect" : [ 909.0, 392.0, 86.0, 22.0 ],
"text" : "r #0_name"
}

Expand All @@ -196,7 +196,7 @@
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 356.5, 150.0, 81.0, 22.0 ],
"patching_rect" : [ 356.5, 150.0, 88.0, 22.0 ],
"text" : "s #0_name"
}

Expand Down Expand Up @@ -899,6 +899,7 @@
"boxes" : [ {
"box" : {
"id" : "obj-1",
"linecount" : 2,
"maxclass" : "newobj",
"numinlets" : 0,
"numoutlets" : 1,
Expand Down Expand Up @@ -1837,8 +1838,7 @@
}

}
],
"autosave" : 0
]
}
,
"patching_rect" : [ 45.0, 105.0, 99.0, 22.0 ],
Expand Down Expand Up @@ -2783,8 +2783,7 @@
}

}
],
"autosave" : 0
]
}
,
"patching_rect" : [ 1006.75, 452.0, 78.0, 22.0 ],
Expand Down Expand Up @@ -4130,8 +4129,7 @@
}

}
],
"autosave" : 0
]
}
,
"patching_rect" : [ 343.0, 707.0, 109.0, 22.0 ],
Expand Down Expand Up @@ -8545,6 +8543,7 @@
, {
"box" : {
"id" : "obj-15",
"linecount" : 2,
"maxclass" : "newobj",
"numinlets" : 0,
"numoutlets" : 1,
Expand All @@ -8557,6 +8556,7 @@
, {
"box" : {
"id" : "obj-14",
"linecount" : 2,
"maxclass" : "newobj",
"numinlets" : 0,
"numoutlets" : 1,
Expand Down Expand Up @@ -19491,6 +19491,7 @@
, {
"box" : {
"id" : "obj-15",
"linecount" : 2,
"maxclass" : "newobj",
"numinlets" : 0,
"numoutlets" : 1,
Expand All @@ -19503,6 +19504,7 @@
, {
"box" : {
"id" : "obj-14",
"linecount" : 2,
"maxclass" : "newobj",
"numinlets" : 0,
"numoutlets" : 1,
Expand Down Expand Up @@ -21563,7 +21565,7 @@
, {
"box" : {
"id" : "obj-37",
"linecount" : 2,
"linecount" : 3,
"maxclass" : "newobj",
"numinlets" : 0,
"numoutlets" : 1,
Expand Down Expand Up @@ -21691,7 +21693,7 @@
, {
"box" : {
"id" : "obj-8",
"linecount" : 2,
"linecount" : 3,
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 1,
Expand Down Expand Up @@ -23072,7 +23074,7 @@
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "8482_", "" ],
"outlettype" : [ "17521_", "" ],
"patching_rect" : [ 237.499985000000038, 480.0, 71.0, 22.0 ],
"text" : "t #0_ l"
}
Expand Down Expand Up @@ -26755,8 +26757,7 @@
}

}
],
"autosave" : 0
]
}
,
"patching_rect" : [ 50.0, 405.0, 95.0, 22.0 ],
Expand Down Expand Up @@ -26974,8 +26975,7 @@
}

}
],
"autosave" : 0
]
}
,
"patching_rect" : [ 126.0, 305.0, 91.0, 22.0 ],
Expand Down Expand Up @@ -30427,6 +30427,10 @@
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 240.0, 1380.0, 44.0, 22.0 ],
"saved_object_attributes" : {
"attr_comment" : ""
}
,
"text" : "out~ 2"
}

Expand All @@ -30438,6 +30442,10 @@
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 189.0, 1380.0, 44.0, 22.0 ],
"saved_object_attributes" : {
"attr_comment" : ""
}
,
"text" : "out~ 1"
}

Expand All @@ -30450,6 +30458,10 @@
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 169.666672000000005, 30.0, 30.0, 22.0 ],
"saved_object_attributes" : {
"attr_comment" : ""
}
,
"text" : "in 1"
}

Expand Down
Loading

0 comments on commit 590ab34

Please sign in to comment.