[racket] mp3 or ogg play in scheme?

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Oct 3 14:07:23 EDT 2010

Two hours ago, synx wrote:
> On 10/03/2010 06:35 AM, 김태윤 wrote:
> > since wav file is too big, is there any way I can play ogg or mp3
> > file in scheme?
> 
> That shouldn't be too much trouble. There are many sound playing
> libraries and programs that can handle both Vorbis and MP3. I would
> recommend you do something like this:
> 
> (module file-player racket/base
>   (require racket/system)
>   (define player (find-executable-path "xmms"))
>   (define (play file)
>     (system* player (if (path? file) (path->string file) file)))
>   (provide play))
> 
> Adjust it for your particular ogg and mp3 player of course.

You'll want to use some command-line player, and also run it in a
thread so you don't block until it's done.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.