Lisp HUG Maillist Archive

Audio playback

What are the ways to output audio from inside Lisp?


(Lisp-HUG) Re: Audio playback

At 07:22 AM 6/27/2010, Yuri wrote:

>What are the ways to output audio from inside Lisp?


Yuri - Take a look at Capi:Play-Sound...

I use that and it works well for *.wav audio files under Windows.

Best that I can tell, the documentation does not specify what other, 
if any, audio formats that Capi:Play-Sound supports.

Regards,

Jack Harper
Secure Outcomes Inc.
Evergreen, Colorado USA



Re: (Lisp-HUG) Re: Audio playback

On Sun, 27 Jun 2010 14:54:35 +0100, Jack Harper <jharper@frobenius.com>  
wrote:


> Yuri - Take a look at Capi:Play-Sound...

I was thinking about that too, yet it turns out that it operates on  
elements of (unsigned-byte 8) as far as the documentation is concerned  
while one would want at least 16 bit output available, let alone 24 and 32.

SDL-MIXER appears to be limited to playback of audio files, one does not  
seem to be able to generate an array of fixnums, or int32s or whatever, do  
whatever DSP on it and then feed it to the audio outputs, or at least it  
is not too straight-forward judging from its documentation.


RE: Audio playback

Hi Yuri,

I use bindings for PortAudio (cross-platform C library for audio) in my project (more info on PortAudio - http://www.portaudio.com). I wrote my own, but there are some out there 'in the wild'... I could send you my code, if you like.

Cheers,
Chris

> To: lisp-hug@lispworks.com
> Date: Sun, 27 Jun 2010 14:22:27 +0100
> Subject: Audio playback
> From: yury.davidouski2@mail.dcu.ie
>
>
> What are the ways to output audio from inside Lisp?
>


Get a new e-mail account with Hotmail - Free. Sign-up now.

Re: (Lisp-HUG) Re: Audio playback

Unable to parse email body. Email id is 10375

Re: (Lisp-HUG) Re: Audio playback

On Mon, 28 Jun 2010 17:03:09 +0100, Martin Simmons <martin@lispworks.com>  
wrote:

> The array is just the contents of a file, so (unsigned-byte 8) doesn't
> contrain the output size.  The bytes are interpreted by the OS  
> functions, so
> the format can be whatever they can deal with (probably on WAV on  
> Windows).

I am not sure how that works, to be honest, if one just passes an array,  
the OS would not know its samplerate while it may figure the resolution by  
the element type, in case of (unsigned-byte 8) it would be 8 bit, so if  
one passed an (unsigned-byte 16) array that could be interpreted as 16 bit  
resolution and so on.

Yet, I tried to generate an array with the :element-type of (unsigned-byte  
8) and convert it to a sound object using (load-sound) which worked, but  
the object would not play back and nil would be returned. An array read  
 from a WAV file would convert and play back nicely.


Re: (Lisp-HUG) Re: Audio playback

On Mon, 28 Jun 2010 17:41:55 +0100, Tim Bradshaw <tfb@cley.com> wrote:

> I guess the point is that the array is just exactly what was in the  
> file, considered as a sequence of bytes, and, for instance, WAV files  
> encode their data rate and so on in metadata which is in the file (and  
> hence in the array).

All right, I see, this all makes sense now.


Updated at: 2020-12-10 08:39 UTC