May 08, 2007
e7 Release

joanne and i at the houdini house in laurel canyon
JoAnne and I at the Houdini House

A public release of Eric Tiedemann's e7 Lisp dialect is now available. A concise description of e7 for Common Lispers can be found in the e7 Progress Report.

e7 looks a little like a mixture of Python and Lisp. Some interesting features include real-time garbage collection, extended syntax (postfix attribute access, square bracket-style indexing and slicing, triple-quoted strings), a Python bridge, and a focus on ease of extension with C++.

Here's an e7 script to normalize a stereo sound file:

#!/usr/bin/env e7

"""
sndfile-normalize <infile> <outfile>

Normalize (scale so the maximum absolute value is 1.0) a stereo sound file.
"""

(import sndfile sound)

(defopt bufsiz (* 64 1024))


(def (main infile outfile)
  (with-open in-sf (sndfile.open infile)

    (def extrema (sndfile.extrema infile))
    (def maxabs (max (abs (min extrema[0][0] extrema[1][0]))
             (abs (max extrema[0][1] extrema[1][1]))))

    (write (format "%r max dB = %r" infile (sound.val->db maxabs)))

    (def gain (/ 1.0 maxabs))

    (with-open out-sf (sndfile.open outfile 'write
               in-sf.format in-sf.sample-rate in-sf.channels)
      (def buf0 (fvector sys.opts.bufsiz))
      (def buf1 (fvector sys.opts.bufsiz))
      (def buf0a (fvector sys.opts.bufsiz))
      (def buf1a (fvector sys.opts.bufsiz))

      (def frame 0)

      (while (< frame in-sf.frames)
        (def n (min (- in-sf.frames frame) sys.opts.bufsiz))
        (sndfile.read2 in-sf buf0 buf1 n frame)
        (sndfile.write2 out-sf (* gain buf0a) (* gain buf1a) n)
        (incf frame n)))))
Posted by jjwiseman at May 08, 2007 01:47 PM
Comments

There's some discussion on reddit:

http://programming.reddit.com/info/1ovjd/comments

Posted by: est on May 10, 2007 07:18 PM
Post a comment
Name:


Email Address:


URL:




Unless you answer this question, your comment will be classified as spam and will not be posted.
(I'll give you a hint: the answer is “lisp”.)

Comments:


Remember info?