emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to play sound from string correctly?


From: Pavel Janík
Subject: How to play sound from string correctly?
Date: Fri, 04 Jan 2002 23:14:08 +0100
User-agent: Gnus/5.090005 (Oort Gnus v0.05) Emacs/21.1.50 (i386-suse-linux-gnu)

Hi,

I have spent some time on fixing LDAP/EUDC for GNU Emacs and realized,
that LDAP can also distribute images and sounds. Images now work for me,
but I still have some problems with sound.

The situation is as follows:

I have a file somewhere which can be played with system play command. Even

(play-sound-file "filename")

works. I already have it read in Emacs in variable value:

            (save-excursion
              (set-buffer bufval)
              (erase-buffer)
              (set-buffer-multibyte nil)
              (insert-file-contents-literally value)
              (delete-file value)
              (setq value (buffer-string)))

First question: Is this correct way to read the contents of the binary
file?

I can not play that data with

     (play-sound (list 'sound :data value))

it will result in Invalid sound specification. Why?

On the other hand, when I save this value to the file and play it again
with:

             (save-excursion
               (set-buffer (get-buffer-create "*sdkjhfskjd*"))
               (set-buffer-multibyte nil)
               (insert value)
               (setq my-temp-file (make-temp-file "XXX"))
               (write-region (point-min) (point-max) my-temp-file)
               (play-sound (list 'sound :file my-temp-file)))

it is played without any problem. I suppose there is bug wrt
multibyte/encoding somewhere. Am I right? Where?

How can I made it without temporary files? It is not elegant solution...

P.S. Screenshot of Emacs with working LDAP is at
http://www.janik.cz/tmp/emacs-21.1.50-ldap-images.png
-- 
Pavel Janík

It's known to be very buggy (it comes directly from the hardware
manufacturer).
                  -- Hubert Mantel about some driver for eth. card



reply via email to

[Prev in Thread] Current Thread [Next in Thread]