[Csnd] Anyone using Haskell?
Date | 2009-03-22 21:46 |
From | Michael P Mossey |
Subject | [Csnd] Anyone using Haskell? |
I just discovered Haskell, and it seems like a great language for music-related work (for example, algorithmic composition or computer-assisted composition). It's a "functional language" which means that "pure" functions are at the heart of it. A pure function is one that has no side-effect (does not modify state). That might seem like a limitation at first, but it's a type of simplification that opens the door to a very expressive language, and promotes bug-free programs. It's the most astonishingly compact and elegant syntax I've ever seen. It combines strong typing with automatic type inference---which basically means you have all the benefits of a strongly typed language (including bug prevention and the ability to compile to fast code) with the ease of a scripting language. High-quality, highly-developed compilers and interpreters are available for Unix, Mac, and Windows. It has so many extension modules, I think it might actually be equal to Python and Perl and Java. It has a real-time midi module, for instance. I am planning to switch from Python to Haskell for nearly all my music-related coding. Well, I still need to learn more about Haskell before I can be confident that is the best choice, but it looks like it is. -Mike |
Date | 2009-03-22 22:18 |
From | David |
Subject | [Csnd] Re: Anyone using Haskell? |
I'm still learning Haskell, but I became interested in it for the same reason you did. You should pick up a copy of "The Haskell School of Expression" by Paul Hudak. It has several chapters on using Haskell to write musical applications. Although I've been programming for 30 years, it's not an easy language to learn, in my opinion. But I think the effort is worth it. It's a complicated but very powerful language. David. On Sun, Mar 22, 2009 at 4:46 PM, Michael P Mossey |
Date | 2009-03-22 23:13 |
From | victor |
Subject | [Csnd] Re: Anyone using Haskell? |
I'm not too convinced by all the talk on pure functional languages. My problem with Haskell is that the syntax is so foreign that it is hard to get going. The advantage I see in Python is that it is not that different to C; for me this is important because C is pretty much all I always used (plus some C++). So for scripting, it's quite useful not to have to learn everything from scratch. I realised I actually only needed two languages, a fast, compiled, one (C or C++) and something for scripting which was easy and not too different (Python). But then my programming uses are probably different from yours. I don't do algorithmic music stuff, but signal processing. I believe John Lato has done some work integrating Csound and Haskell. Regards Victor ----- Original Message ----- From: "Michael P Mossey" |
Date | 2009-03-22 23:29 |
From | Erik de Castro Lopo |
Subject | [Csnd] Re: Anyone using Haskell? |
Michael P Mossey wrote: > I just discovered Haskell, I've been using Ocaml (another strict statically typed functional language) for nearly 5 years and a couple of months ago picked up Haskell which I think is actually even better. Before picking up Ocaml I had used Python for a couple of years but I feel with Ocaml and Haskell I get similar levels of productivity to python, but with significantly improved performance and even more importantly, siginificantly fewer run time bugs. Nowadays I rarely use Python for anything longer than 100 lines of code. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/erikd/Blog/ |
Date | 2009-03-22 23:43 |
From | Erik de Castro Lopo |
Subject | [Csnd] Re: Re: Anyone using Haskell? |
victor wrote: > I'm not too convinced by all the talk on pure functional languages. Having used two such languages, I am convinced. For a large variety of tasks I can get fast, reliable, working code more quickly in languages like Haskell than in anything else. > My problem with Haskell is that the syntax is so foreign that it is hard > to get going. I personaly think the syntax of Haskell is much closer to Python than Python is to C. If you really want to see some horrible syntax, go and have a look at Ocaml :-). > The advantage I see in Python is that it is not that different > to C; I suspect what you see as the similarity between C and Python is actually the programming paradigm; imperative programming with mutable variables on the C/Python side while Haskell is more about functional/declarative programming with immutable values. > for me this is important because C is pretty much all I always used > (plus some C++). So for scripting, it's quite useful not to have to learn > everything from scratch. I realised I actually only needed two languages, > a fast, compiled, one (C or C++) and something for scripting which was > easy and not too different (Python). But then my programming uses are > probably different from yours. I don't do algorithmic music stuff, but > signal processing. For signal processing nothing portable can currently beat C (and/or a subset of C++). However, for a huge range of higher level tasks C and C++ are simply not a good fit as they require simultaneously dealing with high and low level concepts. This is where true high level langauges like Python, Ocaml and Haskell are useful. However, if you need a high level language and perfromance, Python is not as good a fit as compiled languages like Ocaml and Haskell. > I believe John Lato has done some work integrating Csound and Haskell. You probably mean this: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hCsound Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/erikd/Blog/ |
Date | 2009-03-23 00:50 |
From | Michael Mossey |
Subject | [Csnd] Re: Re: Anyone using Haskell? |
victor wrote: > I'm not too convinced by all the talk on pure functional languages. > My problem with Haskell is that the syntax is so foreign that it is hard > to get going. I can sympathize... I've just spent the last three days learning Haskell and I'm still having trouble doing the simplest things. It's quite different than C and Python, but my understanding is that once you get going, it is one of the fastest/easiest language to code in. One of my goals in life is to make music, but I also have the goal of continuously improving the way I do things. Haskell represents a huge improvement over Python for music applications (other than signal processing), plus I'm a computer scientist at heart, so I would rather learn something new than keep doing things the old way. Mike |
Date | 2009-03-23 01:13 |
From | Dave Seidel |
Subject | [Csnd] Re: Re: Re: Anyone using Haskell? |
Another alternative for a modern programming language is SuperCollider, which has features of both functional and object-oriented languages (SmallTalk was a major inspiration) and has the distinct advantage of being an integral part of an excellent music-making system. Very nice to work with. Though I'm not giving up on Csound + Python (which I use in the context of blue). - Dave Michael Mossey wrote: > > > victor wrote: >> I'm not too convinced by all the talk on pure functional languages. >> My problem with Haskell is that the syntax is so foreign that it is hard >> to get going. > > I can sympathize... I've just spent the last three days learning Haskell > and I'm still having trouble doing the simplest things. It's quite > different than C and Python, but my understanding is that once you get > going, it is one of the fastest/easiest language to code in. > > One of my goals in life is to make music, but I also have the goal of > continuously improving the way I do things. Haskell represents a huge > improvement over Python for music applications (other than signal > processing), plus I'm a computer scientist at heart, so I would rather > learn something new than keep doing things the old way. > > Mike |
Date | 2009-03-23 09:23 |
From | Victor.Lazzarini@nuim.ie |
Subject | [Csnd] Re: Re: Re: Anyone using Haskell? |
Attachments | None |
Date | 2009-03-23 12:17 |
From | jlato@mail.utexas.edu |
Subject | [Csnd] Re: Re: Re: Anyone using Haskell? |
Attachments | None |
Date | 2009-03-23 12:55 |
From | jlato@mail.utexas.edu |
Subject | [Csnd] Re: Re: Re: Anyone using Haskell? |
Attachments | None |
Date | 2009-03-23 15:13 |
From | "Anthony Palomba" |
Subject | [Csnd] Re: Re: Re: Re: Anyone using Haskell? |
I have recently taken up Common Music, a lisp based computer music language... http://commonmusic.sourceforge.net/#documentation I must say I like it a lot. It supports csound as well. I am still learning the details but it seems to have a good library for creating procedural structures. I like the idea of being able to prototype pieces with it. Having programmed for many years now, I am pretty familiar with C, C++, python, Java, blah, blah. I am really looking for a language that allows me to think about music at a structurally higher level. Giving me the ability to easily specify form and how that is projected on to tonal spaces, with out getting bogged down with syntactical details. Lisp is a very nice language in this regard. I am always looking for better ways to do things. I would be curious to know if anyone out there has had previous experiences with Common Music or Lisp and how this compares to other high level languages. This Haskel looks intriguing, is there any compelling argument why I should use it versus lisp? Anthony ----- Original Message ----- From: "Dave Seidel" |
Date | 2009-03-23 15:31 |
From | Victor.Lazzarini@nuim.ie |
Subject | [Csnd] Re: Re: Re: Re: Re: Anyone using Haskell? |
Attachments | None None |
Date | 2009-03-23 19:50 |
From | Stéphane Rollandin |
Subject | [Csnd] Re: Re: Re: Re: Re: Anyone using Haskell? |
Anthony Palomba a écrit : > I am always looking for better ways to do things. I would be curious to > know if anyone out there has had previous experiences with Common Music > or Lisp and how this compares to other high level languages. This Haskel > looks > intriguing, is there any compelling argument why I should use it versus > lisp? I'm working mainly in Lisp and Smalltalk. In my view these langages, along with Python, Haskell, Ruby and others I don't have in mind at the moment, are all very good candidates for algorithmic composition. Exactly as Mike Gogins pointed out before, as far as musical composition is concerned the langage should not become the object of study; this should be music. So I would say: choose a langage you like, that's enough. Lisp, Smalltalk, Haskell, Python styles are wildly different, so it's likely that one of them will please you more than the others. If you do like Lisp, I see no reason for you to switch to Haskell. Lisp comes in many flavors: you can leverage all Java libraries with Clojure, for music you have Common Music, CLM, Snd, Nyquist, you have Emacs Lisp "to bind them all" (+ Python, Haskell, Mathematica and virtually any other langage actually). My current setup is Emacs + Squeak (Smalltalk). I went to Squeak not because of Smalltalk (although it is an amazingly beautiful langage IMO) but because of Morphic, its graphical framework. I guess if I could do everything in Lisp, I would. my 2 cents... Stef |
Date | 2009-03-23 22:49 |
From | Martin Rodgers |
Subject | [Csnd] Re: Anyone using Haskell? |
Attachments | None |
Date | 2009-03-24 09:54 |
From | Dave Phillips |
Subject | [Csnd] Re: Re: Re: Re: Re: Anyone using Haskell? |
Anthony Palomba wrote: > I have recently taken up Common Music, a lisp based computer music > language... > > http://commonmusic.sourceforge.net/#documentation > > I must say I like it a lot. It supports csound as well. > I am still learning the details but it seems to have a good library > for creating procedural structures. I like the idea of being able > to prototype pieces with it. > ... > I am always looking for better ways to do things. I would be curious to > know if anyone out there has had previous experiences with Common Music > or Lisp and how this compares to other high level languages. Hi Anthony, I've been an on & off user of Common Music for some years. I'm not a programmer, so I don't have any useful advice re: the language itself, but I have done utility coding in C, x86 assembler, Lisp, and Tcl/Tk (sorry, no Python yet). CM can be considered a Lisp subset with a bunch of special operators and functions for creating musical material. Btw, my C coding was not DSP or other realtime stuff. Mostly I wrote simple interactive generators for Csound instruments and scores, command-line stuff only, no UI programming. Tk was useful for the few little things I wrote for myself that needed a GUI. These days I just leave it all to the pros. ;-) As a musician I prefer Common Music for music programming. It's the only language in which I've maintained any ability, excepting Csound of course. Best, dp |
Date | 2009-03-24 21:48 |
From | apalomba |
Subject | [Csnd] Re: Re: Re: Re: Re: Anyone using Haskell? |
I don't think this is done yet, I think it just calls the csound command line. Are there any other lisp environments that access the Csound5 API? Anthony Victor.Lazzarini wrote: > > In fact Rick Taube was working on a link to Csound5 at the > API level for Grace. Not sure he's released it yet. > -- View this message in context: http://www.nabble.com/Anyone-using-Haskell--tp22651085p22690578.html Sent from the Csound - General mailing list archive at Nabble.com. |
Date | 2009-03-24 22:09 |
From | Stéphane Rollandin |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: Anyone using Haskell? |
apalomba a écrit : > I don't think this is done yet, I think it just calls the csound command > line. Are there any other lisp environments that access the Csound5 API? Clojure can do this transparently by importing the API for Java. I just experimented this last week and it works like a charm. code snippets: (import '(csnd Csound CsoundPerformanceThread) ..... ..... (when (and (not @perf-thread) (= 0 (.Compile csound csd-file "-dodac"))) (dosync (ref-set perf-thread (CsoundPerformanceThread. csound))) (.Play @perf-thread) ..... this will be demonstrated in the next Surmulot pre-release Stef |
Date | 2009-03-24 22:45 |
From | victor |
Subject | [Csnd] Re: Re: Re: Re: Re: Re: Re: Anyone using Haskell? |
There also used to be a wrapper for CLisp, but I am not sure of its status. Victor ----- Original Message ----- From: "Stéphane Rollandin" |
Date | 2009-03-24 23:43 |
From | Brian Wong |
Subject | [Csnd] RE: Re: Re: Re: Re: Re: Re: Re: Anyone using Haskell? |
I have posted some of my work on http://www.myspace.com/boscotung . Three pieces done with Csound/blue are included. Communicate, update and plan on Windows Live Messenger. Get started today. |
Date | 2009-03-25 00:12 |
From | Brian Wong |
Subject | [Csnd] Songs Posted |
Sorry about forgetting to change the subject line, the songs don't use Haskell. Neither do I. From: brian.wong1@hotmail.com To: csound@lists.bath.ac.uk Date: Tue, 24 Mar 2009 20:43:52 -0300 Subject: [Csnd] RE: Re: Re: Re: Re: Re: Re: Re: Anyone using Haskell? I have posted some of my work on http://www.myspace.com/boscotung . Three pieces done with Csound/blue are included. Communicate, update and plan on Windows Live Messenger. Get started today. Messenger has tons of new features that make chatting more fun. Click here to learn more. |
Date | 2009-03-25 03:22 |
From | "Dr. Richard Boulanger" |
Subject | [Csnd] Re: Brian Wong's Blue/Csound Compositions |
Brian, Some nice things. Thanks for sharing them with us. Please consider posting one or two of them in the podcast at cSounds.com and possibly sharing your .csd files as well. -dr.B. Dr. Richard Boulanger Professor of Electronic Production and Design Music Technology Division Berklee College of Music 1140 Boylston Street Boston, MA 02135 617-747-2485 (office) On Mar 24, 2009, at 7:43 PM, Brian Wong wrote:
|
Date | 2009-03-26 18:50 |
From | PINOT François |
Subject | [Csnd] Re: Re: Anyone using Haskell? |
Erik de Castro Lopo a e'crit : > Michael P Mossey wrote: > > >> I just discovered Haskell, >> > > I've been using Ocaml (another strict statically typed functional > language) for nearly 5 years and a couple of months ago picked up > Haskell which I think is actually even better. > > Before picking up Ocaml I had used Python for a couple of years > but I feel with Ocaml and Haskell I get similar levels of productivity > to python, but with significantly improved performance and even > more importantly, siginificantly fewer run time bugs. Nowadays > I rarely use Python for anything longer than 100 lines of code. > > Erik > I've been playing with Ocaml during the last summer. I'd say that the learning curve is rather steep in the beginning, but once I've got through this first step, I rather liked it. If you're used to math expressions and if you have this way of thinking then it's worth learning Ocaml. Anyway I began to write a wrapper to use the csound API from Ocaml. It's not finished yet but it works. The following functions are already implemented : csoundCreate csoundPreCompile csoundDestroy csoundGetVersion csoundGetAPIVersion csoundGetEnv csoundSetGlobalEnv csoundCompile csoundPerform csoundPerformKsmps csoundPerformKsmpsAbsolute csoundPerformBuffer csoundStop csoundCleanup csoundReset csoundGetSr csoundGetKr csoundGetKsmps csoundGetNchnls csoundGet0dBFS csoundGetStrVarMaxLen csoundGetSampleFormat csoundGetSampleSize csoundGetInputBufferSize csoundGetOutputBufferSize csoundGetOutputFileName csoundSetHostImplementedAudioIO csoundGetScoreTime csoundIsScorePending csoundSetScorePending csoundGetScoreOffsetSeconds csoundSetScoreOffsetSeconds csoundRewindScore csoundGetMessageLevel csoundSetMessageLevel csoundInputMessage csoundKeyPress csoundScoreEvent csoundSetIsGraphable csoundGetDebug csoundSetDebug csoundTableLength csoundTableGet csoundTableSet and the class csoundPerformanceThread, implemented as an Ocaml class. I wrote the wrapper by hand because I don't like the way swig produces Ocaml bindings. I don't have much time at the moment to finish this work but I can write a little notice on my personnal web site and give some examples. Please let me know if people are interested. Francois Pinot |