Skip to content

Commit 7044d38

Browse files
authored
Add a basic offset-voltage generator script. It generates flat voltages, and does nothing else. (#382)
1 parent 3f7e7bd commit 7044d38

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed

software/contrib/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,16 @@ as faithfully as possible on the EuroPi hardware.
237237
<i>Author: [mjaskula](https://github.com/mjaskula)</i>
238238
<br><i>Labels: sequencer, random, triggers</i>
239239

240+
### Volts \[ [documentation](/software/contrib/volts.md) | [script](/software/contrib/volts.py) \]
241+
Generates static voltages on CV1-6. Useful for when you need a reliable, fixed voltage source as an input. Some useful applications include:
242+
- transposing a sequencer
243+
- shifting a bipolar LFO or VCO to be unipolar
244+
- sending a fixed voltage to a VCA to amplify a signal to a fixed level
245+
- calibrating other modules
246+
247+
<i>Author: [chrisib](http://github.com/chrisib)</i>
248+
<br><i>Labels: cv, voltages, non-interactive</i>
249+
240250
---
241251

242252
<details>

software/contrib/menu.py

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
["StrangeAttractor", "contrib.strange_attractor.StrangeAttractor"],
6060
["Traffic", "contrib.traffic.Traffic"],
6161
["Turing Machine", "contrib.turing_machine.EuroPiTuringMachine"],
62+
["Volts", "contrib.volts.OffsetVoltages"],
6263

6364
["_Calibrate", "calibrate.Calibrate"], # this one should always be second to last!
6465
["_BootloaderMode", "bootloader_mode.BootloaderMode"] # this one should always be last!

software/contrib/volts.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Volts
2+
3+
This script is non-interactive and simply generates 6 fixed voltages:
4+
5+
- `cv1`: 0.5V
6+
- `cv2`: 1.0V
7+
- `cv3`: 2.0V
8+
- `cv4`: 2.5V
9+
- `cv5`: 5.0V
10+
- `cv6`: 10.0V
11+
12+
These can be used to apply fixed offsets for e.g. transposing a sequencer up a number of octaves, shifting a bipolar
13+
LFO so it is positive, sending a contant voltage to a VCA to amplify a signal, or calibrating other modules.
14+
15+
## Changing the voltages
16+
17+
The offset voltages can be changed by creating/editing `config/OffsetVoltages.json`:
18+
```json
19+
{
20+
"CV1": 0.5,
21+
"CV2": 1.0,
22+
"CV3": 2.0,
23+
"CV4": 2.5,
24+
"CV5": 5.0,
25+
"CV6": 10.0,
26+
}
27+
```
28+
Simply set each cv to the desired voltage, save the file, and reset the module.

software/contrib/volts.py

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env python3
2+
"""Generates fixed voltages
3+
4+
Voltages can be configured via an optional JSON file
5+
"""
6+
7+
8+
from europi import *
9+
from europi_script import EuroPiScript
10+
11+
import configuration
12+
13+
14+
class OffsetVoltages(EuroPiScript):
15+
def __init__(self):
16+
super().__init__()
17+
18+
@classmethod
19+
def config_points(cls):
20+
"""Return the static configuration options for this class
21+
"""
22+
return [
23+
configuration.floatingPoint(name="CV1", minimum=0.0, maximum=europi_config.MAX_OUTPUT_VOLTAGE, default=0.5),
24+
configuration.floatingPoint(name="CV2", minimum=0.0, maximum=europi_config.MAX_OUTPUT_VOLTAGE, default=1.0),
25+
configuration.floatingPoint(name="CV3", minimum=0.0, maximum=europi_config.MAX_OUTPUT_VOLTAGE, default=2.0),
26+
configuration.floatingPoint(name="CV4", minimum=0.0, maximum=europi_config.MAX_OUTPUT_VOLTAGE, default=2.5),
27+
configuration.floatingPoint(name="CV5", minimum=0.0, maximum=europi_config.MAX_OUTPUT_VOLTAGE, default=5.0),
28+
configuration.floatingPoint(name="CV6", minimum=0.0, maximum=europi_config.MAX_OUTPUT_VOLTAGE, default=10.0),
29+
]
30+
31+
def main(self):
32+
oled.fill(0)
33+
oled.show()
34+
35+
cv1.voltage(self.config.CV1)
36+
cv2.voltage(self.config.CV2)
37+
cv3.voltage(self.config.CV3)
38+
cv4.voltage(self.config.CV4)
39+
cv5.voltage(self.config.CV5)
40+
cv6.voltage(self.config.CV6)
41+
42+
while True:
43+
pass

0 commit comments

Comments
 (0)