# 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