# Dragan Djuric

Dragan Djuric's Clojure Blog, Artificial Intelligence, Deep Learning, Bayesian Data Analysis, CUDA, GPU, OpenCL, Functional Programming, Probabilistic Programming, Data Science.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Gemma 3 AI model in Clojure

DevFeed: [Gemma 3 AI model in Clojure](<https://devfeed.tech/articles/gemma-3-ai-model-in-clojure-20729.md>)

Original publisher: [Read original article](<http://dragan.rocks/articles/25/Gemma-3-AI-model-in-Clojure>)

Published: 2025-12-09T22:35:00Z

Content type: tutorial

Language: en

Sources: [Dragan Djuric](<https://devfeed.tech/sources/dragan-djuric.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [Inference](<https://devfeed.tech/topics/inference.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>), [onnx](<https://devfeed.tech/topics/onnx.md>), [gemma](<https://devfeed.tech/topics/gemma.md>)

Tags: [3](<https://devfeed.tech/tags/3.md>), [ai](<https://devfeed.tech/tags/ai.md>), [clojure](<https://devfeed.tech/tags/clojure.md>), [code](<https://devfeed.tech/tags/code.md>), [deep](<https://devfeed.tech/tags/deep.md>), [diamond](<https://devfeed.tech/tags/diamond.md>), [gemma](<https://devfeed.tech/tags/gemma.md>), [inference](<https://devfeed.tech/tags/inference.md>), [llms](<https://devfeed.tech/tags/llms.md>), [onnx](<https://devfeed.tech/tags/onnx.md>)

### AI overview

This tutorial demonstrates loading and running a one-step Gemma 3 inference in Clojure through the ONNX runtime integration in Deep Diamond. It configures a smaller one-billion-parameter model, uses main-memory tensors with the oneDNN engine, and explains that the demonstrated output is a next-token tensor rather than a complete generated response.

### Source excerpt

Recently I've been working on the ONNX runtime integration into Deep Diamond, backed by the grant sponsored by the Clojurists Together Foundation. In the past few articles, we've seen how ONNX models are integrated into Deep Diamond, using only a single function onnx, with almost no need for additional configuration (which is available). I used a simple MNIST model in the demonstration. But, can we now load and run the inference on the real deal models, such as the open LLMs from the Hugging Face, for example? Let's see! The Hugging Face model card has this to say about Gemma 3: "Gemma is a family of lightweight, state-of-the-art open models from Google, built from the same research and technology used to create the Gemini models." (etc., etc.) So, it seems to be something worth trying. I'll try to be brief, and skip the unnecessary talk. Let's just show the code, which I've just lifted up and adapted from the Diamond's midje tests. What we need for this? First, decide on the backend engine; this time we'll use tensors in main memory backed up by the oneDNN engine (DNNL). (def fact (dnnl-factory)) (def neand-fact (neanderthal-factory fact)) Next, load and configure a particular flavor of Gemma 3 (a smaller one, only 1 billion parameters). The onnx function creates a generalized blueprint, which can create the actual functions when evaluated with the specific input tensors. (def onnx-bp (onnx fact "data/gemma-3-1b-it-ONNX-GQA/onnx/model.onnx" {:options (-> (options) (override-dimension! "batch_size" 1) (override-dimension! "sequence_length" 1) (override-dimension! "past_sequence_length" 1) (override-dimension! "total_sequence_length" 1))}) Gemma 3 has 63 inputs and 61 outputs. We'll need to provide these, but even here we can automate some parts with Clojure, since past-key values are pretty uniform. We only need to provide inputs, while the engine can create the outputs for us. (def src-tz (tensor fact [1 1 28 28] :float :nchw)) (def input-ids (tensor neand-fact [1

## Plan for Clojure AI, ML, and high-performance Uncomplicate ecosystem in 2026

DevFeed: [Plan for Clojure AI, ML, and high-performance Uncomplicate ecosystem in 2026](<https://devfeed.tech/articles/plan-for-clojure-ai-ml-and-high-performance-uncomplicate-ecosystem-in-2026-20726.md>)

Original publisher: [Read original article](<http://dragan.rocks/articles/25/Clojure-AI-ML-high-performance-Uncomplicate>)

Published: 2025-11-29T00:41:00Z

Content type: opinion

Language: en

Sources: [Dragan Djuric](<https://devfeed.tech/sources/dragan-djuric.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [Machine learning](<https://devfeed.tech/topics/machine-learning.md>), [CUDA](<https://devfeed.tech/topics/cuda.md>), [OpenCL](<https://devfeed.tech/topics/opencl.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [NumPy](<https://devfeed.tech/topics/numpy.md>)

Tags: [2026](<https://devfeed.tech/tags/2026.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-ml](<https://devfeed.tech/tags/ai-ml.md>), [algebra](<https://devfeed.tech/tags/algebra.md>), [apple](<https://devfeed.tech/tags/apple.md>), [clojure](<https://devfeed.tech/tags/clojure.md>), [cuda](<https://devfeed.tech/tags/cuda.md>), [linear](<https://devfeed.tech/tags/linear.md>), [matrices](<https://devfeed.tech/tags/matrices.md>), [neanderthal](<https://devfeed.tech/tags/neanderthal.md>), [opencl](<https://devfeed.tech/tags/opencl.md>), [programming](<https://devfeed.tech/tags/programming.md>), [vectors](<https://devfeed.tech/tags/vectors.md>)

### AI overview

The article outlines a 2026 development and funding plan for the Uncomplicate ecosystem of Clojure libraries for AI, machine learning, and high-performance computing. It describes support for Nvidia GPUs, Apple Silicon, CPUs, CUDA, OpenCL, and several planned library improvements.

### Source excerpt

I've applied for Clojurists Together yearly funding in 2026. Here's my application. If you are a Clojurists Together member, and would like to see continued development in this area, your vote can help me keep working on this :) My goal with this funding in 2026 is to continuously develop Clojure AI, ML, and high-performance ecosystem of Uncomplicate libraries (Neanderhal and many more), on Nvidia GPUs, Apple Silicon, and traditional PC. In this year, I will also focus on writing tutorals on my blog and creating websites for the projects involved, which is something that I wanted for years, but didn't have time to do because I spent all time on programming. How that work will benefit the Clojure community This will highly benefit the Clojure community as this is THE AI ecosystem for Clojure, and supporting AI is arguably the main focus on probably all software platforms. Clojure has something to offer on that front, beyond just calling OpenAI API as a web service! Uncomplicate grew to quite a few libraries (of which some are quite big; just Neanderthal is 28,000 lines of highly-condensed, aggresively macroized, and reusable code): Diamond ONNX Runtime, Neanderthal, Deep Diamond, ClojureCUDA, ClojureCPP, Apple Presets, ClojureCL, Fluokitten, Bayadera, Clojure Sound, and Commons. Here's a word or two of how I hope to improve each of these libraries with Clojurists Together funding in 2026. Neanderthal (Clojure's alternative to NumPy, on steroids) In 2025, Neanderthal celebrated its 10th birthday. It started as a humble but fast matrix and vector library for Clojure, but after 10 years of relentless improvements, now it boasts a general matrix/vector/linear algebra API implemented by no less than 5(!) engines for CPUs, GPU (Nvidia CUDA), GPU (OpenCL: AMD, Intel, Nvidia), Apple Silicon (Accelerate), and general CPU (OpenBLAS). And this is not a superficial support for the sake of ticking a check box; each of these engines support much more operations on exotic structure

## Four ways to run ONNX models on a GPU with CUDA in Clojure

DevFeed: [Four ways to run ONNX models on a GPU with CUDA in Clojure](<https://devfeed.tech/articles/not-one-not-two-not-even-three-but-four-ways-to-run-an-onnx-ai-model-on-gpu-with-cuda-20728.md>)

Original publisher: [Read original article](<http://dragan.rocks/articles/25/Four-Ways-to-ONNX-on-GPU-in-Clojure-and-CUDA>)

Published: 2025-11-09T17:49:00Z

Content type: tutorial

Language: en

Sources: [Dragan Djuric](<https://devfeed.tech/sources/dragan-djuric.md>)

Topics: [CUDA](<https://devfeed.tech/topics/cuda.md>), [GPU](<https://devfeed.tech/topics/gpu.md>), [onnx](<https://devfeed.tech/topics/onnx.md>), [Clojure](<https://devfeed.tech/topics/clojure.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [Deep neural networks](<https://devfeed.tech/topics/deep-neural-networks.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [clojure](<https://devfeed.tech/tags/clojure.md>), [code](<https://devfeed.tech/tags/code.md>), [cuda](<https://devfeed.tech/tags/cuda.md>), [deep](<https://devfeed.tech/tags/deep.md>), [diamond](<https://devfeed.tech/tags/diamond.md>), [examples](<https://devfeed.tech/tags/examples.md>), [gpu](<https://devfeed.tech/tags/gpu.md>), [image-recognition](<https://devfeed.tech/tags/image-recognition.md>), [model](<https://devfeed.tech/tags/model.md>), [neural-networks](<https://devfeed.tech/tags/neural-networks.md>), [onnx](<https://devfeed.tech/tags/onnx.md>), [tensors](<https://devfeed.tech/tags/tensors.md>)

### AI overview

A tutorial presents four ways to run ONNX models on a GPU with CUDA using Clojure libraries including Diamond ONNX RT, Deep Diamond, and ClojureCUDA. It covers GPU tensor backends and a configuration that keeps input and output tensors in main memory while executing the model on the GPU.

### Source excerpt

Two weeks ago, I announced a new Clojure ML library, Diamond ONNX RT, which integrates ONNX Runtime into Deep Diamond. In that post, we explored the classic Hello World example of Neural Networks, MNIST handwritten image recognition, step-by-step. We run that example on the CPU, from main memory. The next logical step is to execute this stuff on the GPU. You'll see that with a little help of ClojureCUDA and Deep Diamond built-in CUDA machinery, this is both easy and simple, requiring almost no effort from a curious Clojure programmer. But don't just trust me; let's fire up your REPL, and we can continue together. Here's how you can evaluate this directly in your REPL (you can use the Hello World that is provided in the ./examples sub-folder of Diamond ONNX RT as a springboard). Require Diamond's namespaces First things first, we refer functions that we're going to use. (require '[uncomplicate.commons.core :refer [with-release]] '[uncomplicate.neanderthal.core :refer [transfer! iamax native]] '[uncomplicate.diamond [tensor :refer [tensor with-diamond]] [dnn :refer [network]] [onnxrt :refer [onnx]]] '[uncomplicate.diamond.internal.dnnl.factory :refer [dnnl-factory]] '[uncomplicate.diamond.internal.cudnn.factory :refer [cudnn-factory]] '[hello-world.native :refer [input-desc input-tz mnist-onnx]]) None of the following ways to run CUDA models has preference, you use the one that best suits your needs. Way one One of the ways to run ONNX models on your GPU is to simply use Deep Diamond's cuDNN factory as the backend for your tensors. Then, the machinery recognizes what you need and proceeds doing everything on the GPU, using the right stream for tensors, Deep Diamond operations, and ONNX Runtime operations. This looks exactly the same as any other Deep Diamond example from this blog or the DLFP book. (with-diamond cudnn-factory [] (with-release [cuda-input-tz (tensor input-desc) mnist (network cuda-input-tz [mnist-onnx]) classify! (mnist cuda-input-tz)] (transfer! input

## Get Ready for Clojure, GPU, and AI in 2026 with CUDA 13.0

DevFeed: [Get Ready for Clojure, GPU, and AI in 2026 with CUDA 13.0](<https://devfeed.tech/articles/get-ready-for-clojure-gpu-and-ai-in-2026-with-cuda-13-0-20730.md>)

Original publisher: [Read original article](<http://dragan.rocks/articles/25/Get-Ready-Clojure-GPU-AI-2026-CUDA-13>)

Published: 2025-10-30T16:37:00Z

Content type: tutorial

Language: en

Sources: [Dragan Djuric](<https://devfeed.tech/sources/dragan-djuric.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [CUDA](<https://devfeed.tech/topics/cuda.md>), [GPU](<https://devfeed.tech/topics/gpu.md>), [OpenCL](<https://devfeed.tech/topics/opencl.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [clojure](<https://devfeed.tech/tags/clojure.md>), [coding](<https://devfeed.tech/tags/coding.md>), [cuda](<https://devfeed.tech/tags/cuda.md>), [deep](<https://devfeed.tech/tags/deep.md>), [diamond](<https://devfeed.tech/tags/diamond.md>), [gpu](<https://devfeed.tech/tags/gpu.md>), [opencl](<https://devfeed.tech/tags/opencl.md>), [tensors](<https://devfeed.tech/tags/tensors.md>)

### AI overview

The article introduces ClojureCUDA 0.25.0, which supports CUDA 13.0.2, and encourages Clojure developers to try GPU programming interactively through the Clojure REPL. It explains that GPU acceleration is most useful for large vectors and sufficiently complex workloads because data transfer costs can outweigh computation gains.

### Source excerpt

A little anniversary Did you know that CUDA has been available in Clojure for the last 9 years through ClojureCUDA, and GPU programming through OpenCL for more than 10? I almost forgot about these anniversaries. Ten years ago most people liked it a lot, starred it on Github, patted me on the back, but then concluded that they don't have an Nvidia card available on their laptops, or, if they had GPUs, that they won't have time to learn to think in massive parallel algorithms, or if they have time and will, that there are no GPUs in the servers, so what would they do with their applications, even if they created them in Clojure, and so on, and so off :) But, ClojureCUDA and ClojureCL continued living on for these 10 years, I used them in creating Neanderthal, Deep Diamond, and Diamond ML, and they proved themselves as simple and reliable tools. I still had trouble convincing Clojure programmers that they can write GPU programs that run as fast as they'd wrote them in C++, but interactively in the Cloujre REPL, without C++ hell. But I'm not easy to shake off! If it's necessary, I'll continue for 10 more years, for I'm convinced there'd be a moment when Clojure programmers are going to say "hmmm, this is something that we can use and be good at!". CUDA 13 is here! I've recently released ClojureCUDA 0.25.0, with support for the latest CUDA 13.0.2! Why not celebrate that by opening the REPL, and coding your first Hello World application on the GPU? I promise, it won't be a usual GPU carpet of text; this is ClojureCUDA, it follows the Clojure philosophy by being simple and interactive! There's not much sense in wielding a GPU to print out "Hello World". Note that it is also not very useful to work with scalar numbers and call a GPU function to add or multiply two numbers. No. Unless you have many, many, numbers to crunch, stay by your trusty CPU. For our purposes, many, many, numbers would be two vectors of dimension 3 (hey, it's hello world; imagine it's 3 billion). Also,

## Clojure API for Running ONNX Models with ONNX Runtime

DevFeed: [Clojure API for Running ONNX Models with ONNX Runtime](<https://devfeed.tech/articles/clojure-runs-onnx-ai-models-now-join-the-ai-fun-20727.md>)

Original publisher: [Read original article](<http://dragan.rocks/articles/25/Clojure-Runs-ONNX-AI-Models-Now>)

Published: 2025-10-26T15:56:00Z

Content type: tutorial

Language: en

Sources: [Dragan Djuric](<https://devfeed.tech/sources/dragan-djuric.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [onnx](<https://devfeed.tech/topics/onnx.md>), [AI Models](<https://devfeed.tech/topics/ai-models.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [clojure](<https://devfeed.tech/tags/clojure.md>), [deep](<https://devfeed.tech/tags/deep.md>), [diamond](<https://devfeed.tech/tags/diamond.md>), [onnx](<https://devfeed.tech/tags/onnx.md>), [tensors](<https://devfeed.tech/tags/tensors.md>)

### AI overview

The author describes work on a Clojure API for using pre-trained models exported in ONNX format through ONNX Runtime. The approach uses ONNX Runtime's underlying C library rather than Python interoperability.

### Source excerpt

Hello, Clojurians! I haven't written here in a long time. Was I tired? Is anybody reading blogs anymore? Who knows. But that was not the main reason. I've been working on several Clojure projects sponsored by the Clojurists Together Foundation. I did a ton of things, but after all this programming, I was kinda tired, and kept slugging when it comes to telling people about the work done! That's not very smart, but you know how it goes... :) But, then, if we don't tell people about awesome software that we have, nobody is going to use it, so finally I had to stop kicking this down the road, sit, and write the first post. It's been long overdue, so expect more posts soon! ONNX Runtime in one line of Clojure The most recent thing I'm currently working on started its life as Clojure ML (again, superthanks to Clojurists Together for sponsoring this). I proposed to create a human-friendly Clojure API for AI/DL/ML models, and back it by the first implementation, in this case based on ONNX Runtime. Of course, it should all be integrated into existing Clojure libraries, and follow the Clojure way of doing stuff as much as possible! The idea is to get an existing, pre-trained ML model previously exported to the ONNX format from whatever technology the authors chose (which in today's world is typically Python and PyTorch), and put it into production in Clojure and JVM. It should be seamless and in-process, without any clunky interoperability, copy, translation, etc. Of course, our Clojure numerical libraries fully support GPU computing, so it goes without saying that we want that, too! Just to be clear, we do not use nor need any Python or Python interop for this, we use the ONNX Runtime's underlying C library. Nice idea, but what parts of this well intended story can we evaluate in our REPLs right now? At least some promising demo? Are we on the trail? To access that AI goodness, we surely have to do a sophisticated dance? Are the steps hard to learn? Do we need to watch careful

## Recurrent Networks Hello World in Clojure with new Deep Diamond RNN support on CPU and GPU

DevFeed: [Recurrent Networks Hello World in Clojure with new Deep Diamond RNN support on CPU and GPU](<https://devfeed.tech/articles/recurrent-networks-hello-world-in-clojure-with-new-deep-diamond-rnn-support-on-cpu-and-gpu-20724.md>)

Original publisher: [Read original article](<http://dragan.rocks/articles/22/Recurrent-networks-hello-world-sequence-prediction-in-Clojure-with-new-Deep-Diamond>)

Published: 2022-08-26T14:25:00Z

Content type: tutorial

Language: en

Sources: [Dragan Djuric](<https://devfeed.tech/sources/dragan-djuric.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [Deep learning](<https://devfeed.tech/topics/deep-learning.md>), [Time Series](<https://devfeed.tech/topics/time-series.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [clojure](<https://devfeed.tech/tags/clojure.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [deep](<https://devfeed.tech/tags/deep.md>), [deep-learning](<https://devfeed.tech/tags/deep-learning.md>), [diamond](<https://devfeed.tech/tags/diamond.md>), [gpu](<https://devfeed.tech/tags/gpu.md>), [learning](<https://devfeed.tech/tags/learning.md>), [networks](<https://devfeed.tech/tags/networks.md>), [neural](<https://devfeed.tech/tags/neural.md>), [programming](<https://devfeed.tech/tags/programming.md>), [recurrent](<https://devfeed.tech/tags/recurrent.md>), [rnn](<https://devfeed.tech/tags/rnn.md>), [time-series](<https://devfeed.tech/tags/time-series.md>)

### AI overview

A beginner-friendly Clojure tutorial demonstrates recurrent neural networks in Deep Diamond by training a model to predict the next value in a simple numerical sequence. It introduces time-series prediction and notes that the example can run on CPU and GPU.

### Source excerpt

I've been busy in the last period working on new major features in Deep Diamond, one of which is the support for Recurrent Neural Networks (RNN). It's not been an easy ride, but I can finally show you some results! Big thanks for everyone that's helping me with this by buying my books (or subscribing to the upcoming editions), and Clojurists Together, who generously funded me in the past year to work on this. I know that most of you probably don't have much more than passing familiarity with deep learning, let alone recurrent neural networks, and that's why I'll try to show a very simple example on the level of Hello World that anyone interested in machine learning and programming can understand and try. So, enough talk, let's get down to business. What are we doing We are demonstrating a hammer: recurrent neural networks. Just kidding; we would like to create a (software) device that can learn to predict the next data point in a series. Depending on the data, this can be done in a number of ways (even by convolutional neural networks (CNN) that Deep Diamond already supported), one of which is RNN. So, we are creating a recurrent network, and training it with a set of data for this task. An example of data that fits this task would be temperature at some place, stock prices, and any other (possibly infinite) sequence of numbers in one of more dimensions that have an ordinal relation, that is, has an abstract notion of time attached to it. Then, we are trying to forecast one or more values that are happening in the future (temperature the next day, or the closing price of a stock, etc.). Since Hello World has to be dead simple, a real example would have too many opaque numbers, so we'll solve an artificially trivial task of teaching our network to predict the next number in the series for obvious series such as 1, 2, 3, 4, 5. Of course, in real life we rarely need to solve that exact task with such a bazooka as RNN, but if this is your first contact with time series

## Clojure Sound - 5 - Double Click with Foot Control

DevFeed: [Clojure Sound - 5 - Double Click with Foot Control](<https://devfeed.tech/articles/clojure-sound-5-double-click-with-foot-control-20723.md>)

Original publisher: [Read original article](<http://dragan.rocks/articles/22/Clojure-Sound-5-Double-Click-with-Foot-Control>)

Published: 2022-07-30T15:45:00Z

Content type: tutorial

Language: en

Sources: [Dragan Djuric](<https://devfeed.tech/sources/dragan-djuric.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [MIDI](<https://devfeed.tech/topics/midi.md>), [Playback](<https://devfeed.tech/topics/playback.md>), [ui](<https://devfeed.tech/topics/ui.md>)

Tags: [audio](<https://devfeed.tech/tags/audio.md>), [clojure](<https://devfeed.tech/tags/clojure.md>), [desktop](<https://devfeed.tech/tags/desktop.md>), [interface](<https://devfeed.tech/tags/interface.md>), [music](<https://devfeed.tech/tags/music.md>), [playback](<https://devfeed.tech/tags/playback.md>), [sound](<https://devfeed.tech/tags/sound.md>), [user-interface](<https://devfeed.tech/tags/user-interface.md>)

### AI overview

This article discusses designing foot-controller gestures for a Clojure audio player. It examines button press, release, and double-click signals, and describes how those signals could control clip playback and address the need to rewind tracks.

### Source excerpt

In the last article we created a receiver function that listened to signals from our foot controller and started or stopped playback on consecutive clicks. The trouble with our player it that it only works until the end of the track. The start! function does not automatically rewind the playback. Neither stop! does that. Our program is responsible for detecting that the track should be rewound, perhaps by detecting that we reached the end of track (but even that is not fool proof, since audio infrastructure is not that precise). Now we have to think about a foot user interface that is useful and simple at the same time - there's not many different precise actions that a foot can do. My idea at this time is the following: distinguish three gestures: Button (un)pressed (value 0) Button pressed (value 127) Button pressed twice in a short time span (doubleclick). This can have two varieties: First pressed (value 127), then (un)pressed (value 0) (Un)pressed (value 0), then pressed (value 127). The values 0 and 127 always interchange, there's no way to send the same value twice in a row (with the MIDI controller I have). This gives us 4 different signals from one button that we can work with, which doesn't seem that much, but on the other hand, we can't assume that the feet of our user that is doing all this stomping is able or eager for much more complicated stuff. So, if I assume that the particular button is dedicated to a particular clip playback, I see the following actions: If the button is (un)pressed (value 0), the clip should stop, regardless of the previous state. If the clip has not been playing, nothing changes. If the button is pressed (value 127), the clip should start, regardless of the previous state. If the clip has been playing, it just keeps playing. If the button is clicked twice in a row, the things might get complicated! It's not exactly rocket science level complicated, but we still need to think what to do. In our desktop user interface toolkits, w

## Clojure Sound - 4 - Ctrl-Left-Pedal

DevFeed: [Clojure Sound - 4 - Ctrl-Left-Pedal](<https://devfeed.tech/articles/clojure-sound-4-ctrl-left-pedal-20722.md>)

Original publisher: [Read original article](<http://dragan.rocks/articles/22/Clojure-Sound-4-Ctrl-Left-Pedal>)

Published: 2022-07-13T18:45:00Z

Content type: tutorial

Language: en

Sources: [Dragan Djuric](<https://devfeed.tech/sources/dragan-djuric.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [MIDI](<https://devfeed.tech/topics/midi.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [audio](<https://devfeed.tech/tags/audio.md>), [clojure](<https://devfeed.tech/tags/clojure.md>), [debug](<https://devfeed.tech/tags/debug.md>), [devices](<https://devfeed.tech/tags/devices.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [music](<https://devfeed.tech/tags/music.md>), [play](<https://devfeed.tech/tags/play.md>), [sound](<https://devfeed.tech/tags/sound.md>), [usb](<https://devfeed.tech/tags/usb.md>)

### AI overview

This article explores using Clojure to build a basic audio player controlled by MIDI input. It describes playing selected segments of a WAV recording with arbitrary repetitions and connecting both a USB MIDI controller and a MIDI-connected foot pedal.

### Source excerpt

In the last article we managed to connect a MIDI controller and receive updates whenever something happens to its knobs and buttons. So what? As it is, nothing. Printing out messages is not of much use, beyond perhaps getting informed about how these messages look like, and what kind of data they typically contain. On another thought, exactly that is often valuable, because how else can we debug what's happening and learn how to use these devices. They typically don't come with terrific manuals. Luckily, basic use revolves around receiving one of a few kind of standard messages, that typically contain only a handful of bytes, more or less conforming to the MIDI standard, so it's up to us to assign the meaning according to our use case. If we care to read the standard, we could try to pick the closest meaning in our application, but if that's not possible, or practical, well... you live only once. Let's celebrate creativity and be silly. What I would like Cool, so, at first, I have an audio recording of a few chords interposed with some talk and noise, just a single wav file. I'd like to discover how to play only selected segments (i.e. the chords I'm interested in guessing), with arbitrary repetitions. The purpose of this is not to create a perfect looper or learning device, at least not yet. At first, I'm just interested in creating the crudest audio player, and discovering how to connect the player to react to the input from the MIDI controller that we connected last week. After that, it would be nice to see whether the foot pedal works in the same way, or it needs more poking. As we discovered last week, the more modern Faderfox MX12 connects through USB and is listed as one of the connected MIDI devices. The Roland FC-300 foot pedal, does not support USB, so I connect it via a 5-pin MIDI cable to my USB sound card. It will probably be displayed as a MIDI in/out of that sound card (more on that later). MIDI Controller (hands) The usual imports: (ns my-midi) (requir

## Clojure Sound 3 - Hello MIDI Controller

DevFeed: [Clojure Sound 3 - Hello MIDI Controller](<https://devfeed.tech/articles/clojure-sound-3-hello-midi-controller-20721.md>)

Original publisher: [Read original article](<http://dragan.rocks/articles/22/Clojure-Sound-3-Hello-MIDI-Controller>)

Published: 2022-06-30T21:59:00Z

Content type: tutorial

Language: en

Sources: [Dragan Djuric](<https://devfeed.tech/sources/dragan-djuric.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [MIDI](<https://devfeed.tech/topics/midi.md>), [Arch Linux](<https://devfeed.tech/topics/archlinux.md>), [Linux](<https://devfeed.tech/topics/linux.md>)

Tags: [clojure](<https://devfeed.tech/tags/clojure.md>), [connectivity](<https://devfeed.tech/tags/connectivity.md>), [core](<https://devfeed.tech/tags/core.md>), [music](<https://devfeed.tech/tags/music.md>), [sound](<https://devfeed.tech/tags/sound.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>), [usb](<https://devfeed.tech/tags/usb.md>)

### AI overview

A Clojure Sound tutorial that introduces MIDI controller input and explains how to use it to control software on a computer. It discusses MIDI device connectivity, Clojure Sound, and example hardware such as the Faderfox MX12.

### Source excerpt

You may not know that music instrument were connected devices even in the Stone Age, that is, many decades ago. In the 80's that even resulted in the standard that facilitated connectivity of heterogeneous devices. Typically, you'd have a keyboard, a synthesizer, some external knobs, maybe effect boxes, and many of them could be connected by cable and talk to each other, even though that synth might be 27 years old, and the keyboard 2 years old. That's the power of standard. MIDI might not be technically impressive. Especially for 2022, its transfer rate is unbelievably slow. On the other hand, a random device that you'd pick up at the store, on a yard sale, e-bay, or even at the dumpster, is almost guaranteed to have a MIDI connector. So, even though you'd have a hard time connecting your iPhone with your Linux laptop, my guitar can talk with my Arch Linux desktop just fine (I'm not kidding, it really does!). Making that guitar send a meaningful data to my computer is another pair of shoes. MIDI is very basic, and it's up to the user program to make sense of the data it receives. It is likely that you'll want to use a random exotic device in a very specific way; after all, music and art are all about originality. But, to walk on the Moon, we first have to get up from our bed. That's today's objective: taking input from a MIDI device, and controlling something on our computer by twisting knobs. The software As for the software, we need nothing more than Clojure Sound(), of course! You can read how to prepare a fairly basic Clojure project in the first article in Clojure Sound tutorial series. (require '[uncomplicate.commons.core :refer [close! info]] '[uncomplicate.clojure-sound [core :refer :all] [midi :refer :all] [sampled :refer :all]]) The hardware It is unlikely that you'll have the same controller that I do, but so what? Any MIDI device that has a button or a knob on it will do! At this moment, I'm using Faderfox MX12, not because it's a great device (which it