Skip to content

Commit

Permalink
Euclidean rhythm and doc tweaks
Browse files Browse the repository at this point in the history
Signed-off-by: James Hamlin <[email protected]>
  • Loading branch information
jfhamlin committed Apr 28, 2024
1 parent 41937b0 commit 5b6e8f0
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/package.json.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c44a339d910658f51f3335fc3acef6bf
320e1f1ff03eab1e1f33df45866c8ecf
2 changes: 2 additions & 0 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ function App() {
{/* <HydraView /> */}
<Toolbar />
<Editor />
{/* horizontal line */}
<div className="border-t border-gray-300" />
<Docs />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Docs/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default () => {

return (
// outer div has fixed height, inner divs scroll
<div className="p-4 h-full overflow-hidden">
<div className="pb-4 mx-2 h-full overflow-hidden mb-2">
<h1 className="text-2xl">Documentation</h1>
<div className="flex overflow-hidden h-full">
{/* each child scrolls separately */}
Expand Down
30 changes: 30 additions & 0 deletions pkg/mrat/script.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mrat

import (
"encoding/json"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -55,6 +56,35 @@ type (
}
)

// MarshalJSON implements the json.Marshaler interface for the Symbol type.
func (s Symbol) MarshalJSON() ([]byte, error) {
m := map[string]any{
"name": s.Name,
"group": s.Group,
"doc": s.Doc,
}
if len(s.Arglists) > 0 {
arglists := make([]string, len(s.Arglists))
for i, a := range s.Arglists {
arglists[i] = fmt.Sprint(a)
}
m["arglists"] = arglists
}
if len(s.UGenArgs) > 0 {
ugenargs := make([]map[string]any, len(s.UGenArgs))
for i, a := range s.UGenArgs {
ugenargs[i] = map[string]any{
"name": a.Name,
"default": fmt.Sprint(a.Default),
"doc": a.Doc,
}
}
m["ugenargs"] = ugenargs
}

return json.Marshal(m)
}

func (cw *consoleWriter) Write(p []byte) (n int, err error) {
// write each line to the console
for _, char := range p {
Expand Down
14 changes: 10 additions & 4 deletions pkg/stdlib/mrat/core.glj
Original file line number Diff line number Diff line change
Expand Up @@ -734,12 +734,12 @@
(def envelope env)

(defn env-asr
[gate [a s r]]
(env gate [0 s 0] [a r] :release-node 1))
[gate [a s r] & {:keys [curve]}]
(env gate [0 s 0] [a r] :release-node 1 :curve (or curve :lin)))

(defn env-adsr
[gate [a d s r]]
(env gate [0 1 s 0] [a d r] :release-node 2))
[gate [a d s r] & {:keys [curve]}]
(env gate [0 1 s 0] [a d r] :release-node 2 :curve (or curve :lin)))

(defn env-perc
[gate [a d] & {:keys [curve]}]
Expand Down Expand Up @@ -1268,6 +1268,12 @@
(mapv #(if (> %1 %2) 1 0)
tbl (rest tbl)))))))

(defugen impulse-pattern
[impulse 1 "The impulse signal to trigger the pattern."
^:noexpand pattern (euclid 3 8) "The pattern to trigger on the impulse signal."]
(let [pat-seq (step impulse pattern)]
(* impulse pat-seq)))

(docgroup "Patterns")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Expand Down

0 comments on commit 5b6e8f0

Please sign in to comment.