Skip to content

Instantly share code, notes, and snippets.

View hlolli's full-sized avatar
:shipit:

Hlöðver Sigurðsson hlolli

:shipit:
View GitHub Profile
@hlolli
hlolli / README.md
Last active July 18, 2026 11:06
Locks, Clocks, and Sound Blocks: a developer field guide to Csound7 realtime concurrency

Locks, Clocks, and Sound Blocks

A developer field guide to concurrency in Csound7

Csound turns Orchestra code into sound one control block at a time. In ordinary rendering, much of the engine can move in a straight line: read an event, initialize an instrument, perform it, and eventually turn it off. Realtime use adds other workers. MIDI, API calls, dynamic compilation, asynchronous file access, and diskin2 can all be active while the audio thread is trying to meet its next deadline.

This guide explains how Csound coordinates that work. It starts with the relevant C concepts, then follows the locks through event insertion, instrument lifetime, disk streaming, and cleanup.

Note

Source used by this guide: snapshot 473e86135. These are engine internals, not a promise that every identifier will become public API.

@hlolli
hlolli / README.md
Last active July 13, 2026 17:42
Csound recursive struct lifetime benchmarks and charts

Csound recursive struct lifetime benchmarks

This bundle contains the benchmark runner, chart generator, raw measurements, and rendered charts used for the recursive struct-array lifetime pull request.

Contents

  • benchmark.py: interleaved process runner and 25 ms CPU/RSS sampler.
  • plot.py: generates the three Grafana-style charts from the CSV files.
  • summary.csv: per-process wall time, CPU time, return code, and peak RSS.
@hlolli
hlolli / Custom.cmake
Last active April 8, 2023 21:27
custom csound development config using nix
set(CMAKE_OSX_ARCHITECTURES "arm64")
set(CMAKE_APPLE_SILICON_PROCESSOR "arm64")
execute_process(
COMMAND bash "-c"
"nix-build -E 'let pkgs = import <nixpkgs> {}; in pkgs.libsndfile.out' --no-out-link | awk '{print $1\"/lib/libsndfile.dylib\"}'"
OUTPUT_VARIABLE LIBSNDFILE_LIBRARY
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND bash "-c"
Verify Github on Galaxy. gid:gNZwNnsuqvuQSuKoGmSaqM

Keybase proof

I hereby claim:

  • I am hlolli on github.
  • I am hlolli (https://keybase.io/hlolli) on keybase.
  • I have a public key ASAIxfZAh5SzLGA4wSk1s-WF0BH4FVtDiUlVm2BN-fc9vwo

To claim this, I am signing this object:

[
"Abkasía",
"Afganistan",
"Albanía",
"Alsír",
"Alþýðulýðveldið Kína",
"Andorra",
"Angóla",
"Angvilla",
"Antígva og Barbúda",
@hlolli
hlolli / csound.zig
Created September 25, 2020 04:27
translate-c on csound, for lolz
pub const __u_char = u8;
pub const __u_short = c_ushort;
pub const __u_int = c_uint;
pub const __u_long = c_ulong;
pub const __int8_t = i8;
pub const __uint8_t = u8;
pub const __int16_t = c_short;
pub const __uint16_t = c_ushort;
pub const __int32_t = c_int;
pub const __uint32_t = c_uint;
This file has been truncated, but you can view the full file.
Directory: C:\Users\User\Documents\csound
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/10/2019 8:41 AM build
-- The C compiler identification is MSVC 19.13.26129.0
-- The CXX compiler identification is MSVC 19.13.26129.0
brew install \
pkg-config \
aften \
libsamplerate \
libsndfile \
opus \
readline \
doxygen \
wget
@hlolli
hlolli / blockcheck.cljs
Created August 31, 2018 19:21
detect thread block in nodejs
(defn detectBlock []
(let [interval 500
blockDelta 5]
(js/setInterval
(fn []
(let [last (.hrtime js/process)]
(js/setImmediate
(fn []
(let [delta (* 1e-6 (aget (.hrtime js/process last) 1))]