Clojure Signal Processing
Hey all, I've been thinking about and wanting to do some music transcription projects recently (inferring musical notes from audio) and what the best way to write systems like this is clojure would be. There are java libraries and things like fftw that can handle the *hard* parts like computing fourier transformations. These libraries are not necessarily easy to use idiomatically from clojure or easily composable though. I'm also having a hard time seeing the best way to wire up different components so that a stream of audio can flow between them. What I think I want is a toolkit for creating signal processing graphs in idiomatic clojure. It seems like the main abstractions that I'd want would be similar to what storm uses for data processing; stream sources, bolts and topologies to show how they connect. That way one could code up some pieces, use common built in bolts to get things like frequency information, declare how the pieces fit together and then run the system in a variety of different ways. I'd also like the library to be built on a set of protocols so the processing graphs can be run in a variety of settings. In process in an async manner (something similar to the way lamina works), paralyzed across many machines with storm or even in the web browser leveraging the new html5 audio data apis. I plan to build this library and what I'm looking for is some feedback and guidance before I begin. I'd especially love to hear from anyone that is working on these kinds of systems in clojure. A Couple of the main questions I have before I can begin are these. 1) Are streams, bolts and topologies the right level of abstraction for building systems like this? They will need to be a little more complicated than the way storm does things I think. Different bolts will need to operate on different length intervals of the signal. (an fft bolt will need one bin size but then later down stream a pitch tracking bolt will need different interval sizes) I guess giving bolts a buffer size would be necessary and every time that buffer is filled the analysis function would be called. 2) What is the best way to implement asynchronous streaming binary data in clojure? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Partitioning a list when the result of a predicate becomes a certain value.
I think you'd just have to do it manually with a reduce Something like this should work. (defn foldfn [i n] (let [result (first i) current (second i)] (if (re-matches #"^(\w)\1.*" n) (if (= [] current) [result [n]] [(conj result current) [n]]) [result (conj current n)]))) (defn partition-lst [lst] (let [reduced (reduce foldfn [[][]] lst) result (first reduced) current (second reduced)] (if (= current []) result (conj result current -- Stephen Olsen Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Thursday, May 10, 2012 at 4:11 PM, Ant wrote: > Hi all, > > I am battering my head against the following problem which I'm sure is > straightforward if only I knew how. I want to partition the following > list: > > '("aa123" "x" "y" "z" "bb123" "ccq23" "3" "yg") > > into the following: > > (("aa123" "x" "y" "z") ("bb123") ("ccq23" "3" "yg")) > > The predicate is: > > #(re-matches #"^(\w)\1.*" %) > > partition-by doesn't work, since it splits the sequence when the > result of applying the predicate changes. I want to partition when the > predicate becomes a particular value. > > Any clues on how to accomplish this would be gratefully received! > > Thanks, > > Anthony. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > (mailto:clojure@googlegroups.com) > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > (mailto:clojure+unsubscr...@googlegroups.com) > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en