Skip to content

Commit fc8b711

Browse files
author
Byron Chris
authored
docs/bugs: v1 (#17)
* free only
1 parent 66d3327 commit fc8b711

File tree

9 files changed

+964
-1157
lines changed

9 files changed

+964
-1157
lines changed

.deepsource.toml

Lines changed: 0 additions & 8 deletions
This file was deleted.

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
<img src="https://user-images.githubusercontent.com/22690219/130872109-150ac61f-ad69-4bfb-8f10-3337abcb6551.png" alt="drawing" width="350"/> <img src="https://i.imgur.com/pJbgSUh.png" alt="drawing" width="350"/>
22

3+
[![Go Reference](https://pkg.go.dev/badge/github.com/bh90210/models.svg)](https://pkg.go.dev/github.com/bh90210/models)
4+
35
# elektron:models
46

5-
A Go package to programmatically interact with [elektron](https://www.elektron.se/)'s **model:cycles** & **model:samples** via midi.
7+
Go package to programmatically control [Elektron's](https://www.elektron.se/) **model:cycles** & **model:samples** via midi.
68

79
## Prerequisites
810

911
### Go
1012

11-
Install Go https://golang.org/doc/install
13+
Install Go https://golang.org/doc/install.
1214

1315
### RtMidi
1416

@@ -30,14 +32,32 @@ For more information see the [formulae page](https://formulae.brew.sh/formula/rt
3032

3133
`Help needed.`
3234

33-
## Usage
35+
## Quick Use
3436

35-
_complete examples can be found in the [examples](https://github.com/bh90210/elektronmodels/tree/master/examples/) folder_
37+
_complete examples can be found in the [examples](https://github.com/bh90210/elektronmodels/tree/master/examples/) folder._
3638

37-
The relevant cycles/samples manuals' part for this library is the `APPENDIX A: MIDI SPECIFICATIONS`.
39+
_The relevant cycles/samples manuals' part for this library is the `APPENDIX A: MIDI SPECIFICATIONS`._
3840

3941
<img src="https://i.imgur.com/Yrs6YS3.png" alt="drawing" width="350"/> <img src="https://i.imgur.com/cmil9NG.png" alt="drawing" width="350"/>
4042

41-
### Free
4243

43-
### Sequencer
44+
Code to get a single kick drum hit at C4 key, with velocity set at `120` and length at 200 milliseconds:
45+
```go
46+
package main
47+
48+
import (
49+
"time"
50+
51+
m "github.com/bh90210/models"
52+
)
53+
54+
func main() {
55+
p, _ := m.NewProject(em.CYCLES)
56+
defer p.Close()
57+
58+
p.Free.Note(m.T1, m.C4, 120, 200, m.PT1())
59+
time.Sleep(200 * time.Millisecond)
60+
}
61+
62+
```
63+
There are four Free methods to use, `Preset` to set preset on the fly, `Note` to fire a note on/off for given duration, `CC` to send a single control change message && `PC` for program changes.

presets.go renamed to defaultpresets.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package elektronmodels
1+
package models
22

33
//
44
// default presets

example/main.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package main
2+
3+
import (
4+
"time"
5+
6+
m "github.com/bh90210/models"
7+
)
8+
9+
func main() {
10+
p, err := m.NewProject(m.CYCLES)
11+
if err != nil {
12+
panic(err)
13+
}
14+
defer p.Close()
15+
16+
// reproduce helloSound example using Free API
17+
var noteLength int = 250
18+
19+
defaultPresetT1 := m.PT1()
20+
p.Free.Preset(m.T1, defaultPresetT1)
21+
p.Free.Note(m.T1, m.C4, 120, float64(noteLength))
22+
time.Sleep(time.Duration(noteLength) * time.Millisecond)
23+
24+
p.Free.Note(m.T2, m.C4, 120, float64(noteLength), m.PT2())
25+
time.Sleep(time.Duration(noteLength) * time.Millisecond)
26+
27+
p.Free.Preset(m.T3, m.PT3())
28+
p.Free.CC(m.T3, m.DELAY, 0)
29+
p.Free.Note(m.T3, m.C4, 120, float64(noteLength))
30+
time.Sleep(time.Duration(noteLength) * time.Millisecond)
31+
32+
preset4 := m.PT4()
33+
p.Free.Preset(m.T4, preset4)
34+
preset4 = make(map[m.Parameter]int8)
35+
preset4[m.DELAY] = 0
36+
p.Free.Preset(m.T4, preset4)
37+
p.Free.Note(m.T4, m.C4, 120, float64(noteLength))
38+
time.Sleep(time.Duration(noteLength) * time.Millisecond)
39+
40+
p.Free.Note(m.T5, m.C4, 120, float64(noteLength), m.PT5())
41+
time.Sleep(time.Duration(noteLength) * time.Millisecond)
42+
43+
p.Free.Note(m.T6, m.C4, 120, float64(noteLength), m.PT6())
44+
time.Sleep(time.Duration(noteLength) * time.Millisecond)
45+
}

examples/helloSound/main.go

Lines changed: 0 additions & 158 deletions
This file was deleted.

go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
module github.com/athenez/models
1+
module github.com/bh90210/models
22

3-
go 1.16
3+
go 1.17
44

55
require (
66
gitlab.com/gomidi/midi v1.23.3
77
gitlab.com/gomidi/rtmididrv v0.11.0
88
)
9+
10+
require gitlab.com/gomidi/rtmididrv/imported/rtmidi v0.0.0-20191025100939-514fe0ed97a6 // indirect

0 commit comments

Comments
 (0)