Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# run this with personal-access-token (repo scope) as argument
# cf. https://stackoverflow.com/questions/53452910/how-to-remove-a-github-environment
env=github-pages
token=$1
repo=Mellite
user=Sciss
if [ $# -eq 0 ]
then
val mainSq = (userHome / "Downloads" / "rb").children(f => f.extL == "pdf" && f.base.startsWith("p-")).sorted(File.NameOrdering)
mainSq.foreach(f => println(f.base))
def runMain(): Unit = {
val out = userHome / "Downloads" / "rb" / "main.pdf"
require (!out.exists())
import scala.sys.process._
val cmd = Seq("pdftk") ++ mainSq.map(_.path) ++ Seq("cat", "output", out.path)
val code: Int = cmd.!
require (code == 0)
val mainSq = (userHome / "Downloads" / "rb").children(f => f.extL == "pdf" && f.base.startsWith("p-")).sorted(File.NameOrdering)
mainSq.foreach(f => println(f.base))
def runMain(): Unit = {
val out = userHome / "Downloads" / "rb" / "main.pdf"
require (!out.exists())
import scala.sys.process._
val cmd = Seq("pdftk") ++ mainSq.map(_.path) ++ Seq("cat", "output", out.path)
val code: Int = cmd.!
require (code == 0)
val inSq = (userHome / "Downloads" / "rb").children(_.extL == "jpg")
def run(): Unit =
inSq.foreach { in =>
val out = in.replaceExt("pdf")
require (!out.exists())
import scala.sys.process._
val code: Int = Seq("convert", in.path, out.path).!
require (code == 0)
}
def snd = AudioFileIn("in")
val dur = 60.0
//val pch = Seq(0.5, 1, 1.5, 2, 4)
val pch1 = Seq(0.6, 0.8, 1.0, 1.2, 1.4)
val pch2 = Seq(0.8, 0.9, 1.0, 1.1, 1.2)
val pch = pch1 zip pch2
val freq0 = 200.0 // 100
val freq1 = 5000.0
val gain0 = 128.0
def snd = AudioFileIn("in")
val dur = 60.0
//val pch = Seq(0.5, 1, 1.5, 2, 4)
val pch = Seq(0.8, 1.0, 1.2, 1.4, 1.6)
val freq0 = 200.0 // 100
val freq1 = 5000.0
val gain0 = 128.0
val gain1 = 1.0
val frag0 = 0.2 // 1.0
def snd = AudioFileIn("in")
val dur = 60.0
val sr = snd.sampleRate
val framesIn = snd.numFrames
val framesOut = (dur * sr).toInt
def mkPosBs(el: Double = 0.0, posSq: Seq[Double] = Nil, bsSq: Seq[Double] = Nil): (GE, GE) =
if (el >= dur) (ValueDoubleSeq(posSq: _*), ValueDoubleSeq(bsSq: _*))
else {
val pos = el / dur
val in = AudioFileIn("in")
//val in1 = in * Seq[GE](0.0.dbAmp, 4.5.dbAmp)
val in1 = in * Seq[GE](1.0, 1.75)
val rms = (in1.squared.sum / in.numFrames).sqrt
rms.out(0).ampDb.poll("RMS [dB] [0]")
rms.out(1).ampDb.poll("RMS [dB] [1]")
val loud0 = Loudness(in1, sampleRate = in.sampleRate,
size = 2048)
val loud = (loud0.sum / (in.numFrames / 2048))
loud.out(0).poll("Avg. loudness [phon] [0]")
import java.awt.Desktop
Desktop.isDesktopSupported // true
val d = Desktop.getDesktop
d.isSupported(Desktop.Action.APP_ABOUT) // false
d.isSupported(Desktop.Action.BROWSE_FILE_DIR) // false
d.browseFileDirectory(
new java.io.File("/home/hhrutz/Pictures/lucre/IMG_7565.JPG"))
d.isSupported(Desktop.Action.OPEN) // true
import scala.language.{higherKinds, implicitConversions}
trait NewExActMapBlueprint {
trait Ex[+A] {
def value: A
}
trait Act {
def execute(): Unit
}