POV-Ray : Newsgroups : povray.off-topic : DFT and FFT Server Time
9 Oct 2024 17:42:59 EDT (-0400)
  DFT and FFT (Message 36 to 45 of 55)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Mike Raiford
Subject: Re: DFT and FFT
Date: 20 Jan 2009 10:04:32
Message: <4975e800$1@news.povray.org>
Invisible wrote:
> 
> Sounds pretty interesting.
> 
> Personally I'd love to implement something like that myself - but I 
> don't have access to anything that can talk to the sound hardware. :-(
> 
> (Haskell has a binding for libSDL - but it doesn't work on Windoze.)

I know this is probably painful, but ... under the windows platform does 
Haskell have access to COM libraries? DirectX uses COM, you may be able 
to use DirectSound (or is it DirectShow, now?) via its COM interfaces..

Either than or write a simple C Dll, and import the functions from that 
DLL into the Haskell application.

You'll of course need to download the DirectX SDK for that to work.

-- 
~Mike


Post a reply to this message

From: Invisible
Subject: Re: DFT and FFT
Date: 20 Jan 2009 10:11:21
Message: <4975e999$1@news.povray.org>
Mike Raiford wrote:

>> (Haskell has a binding for libSDL - but it doesn't work on Windoze.)
> 
> I know this is probably painful, but ... under the windows platform does 
> Haskell have access to COM libraries?

It has access to most of the Win32 API. If I can figure out what calls 
to execute, it should be doable.

> DirectX uses COM, you may be able 
> to use DirectSound (or is it DirectShow, now?) via its COM interfaces..

Seems plausible.

> Either than or write a simple C Dll, and import the functions from that 
> DLL into the Haskell application.

Heh. As if I could *ever* do that... I don't even know how DLLs work!

> You'll of course need to download the DirectX SDK for that to work.

That's the easy part. ;-)


Post a reply to this message

From: scott
Subject: Re: DFT and FFT
Date: 20 Jan 2009 10:24:07
Message: <4975ec97$1@news.povray.org>
> Personally I'd love to implement something like that myself - but I don't 
> have access to anything that can talk to the sound hardware. :-(

You could always just output a raw .wav file and then send it somewhere to 
play it (eg mediaplayer or winamp, surely also a smaller command line player 
somewhere out there).


Post a reply to this message

From: Mike Raiford
Subject: Re: DFT and FFT
Date: 20 Jan 2009 10:24:30
Message: <4975ecae$1@news.povray.org>
Invisible wrote:

> 
> Heh. As if I could *ever* do that... I don't even know how DLLs work!
> 

Oh, now. DLLs aren't big scary things. They're just libraries. Creating 
a DLL project in Visual C is a snap. Then you just create the functions 
you want to export using the extern "C" __declspec( dllexport ) 
decoration on the function.

>> You'll of course need to download the DirectX SDK for that to work.
> 
> That's the easy part. ;-)

Depends ... ;) if you're impatient like me it's excruciating.
-- 
~Mike


Post a reply to this message

From: scott
Subject: Re: DFT and FFT
Date: 20 Jan 2009 10:34:44
Message: <4975ef14@news.povray.org>
>> I know this is probably painful, but ... under the windows platform does 
>> Haskell have access to COM libraries?
>
> It has access to most of the Win32 API. If I can figure out what calls to 
> execute, it should be doable.

http://msdn.microsoft.com/en-us/library/ms712879.aspx

You could first start off by checking that it plays a pre-existing WAV file, 
then write the WAV file and play it immediately afterwards, then try out the 
SND_MEMORY flag to play it directly from memory...


Post a reply to this message

From: Invisible
Subject: Re: DFT and FFT
Date: 20 Jan 2009 10:38:24
Message: <4975eff0@news.povray.org>
scott wrote:
>> Personally I'd love to implement something like that myself - but I 
>> don't have access to anything that can talk to the sound hardware. :-(
> 
> You could always just output a raw .wav file and then send it somewhere 
> to play it (eg mediaplayer or winamp, surely also a smaller command line 
> player somewhere out there).

Have you seen the format spec for the .WAV file format??

It's actually RIFF - a multilation of the Amiga IFF format with all the 
4-byte values incorrectly written backwards. (Hence "R" for "reverse".)

You can't just say "hey, here's some data". You have to include a header 
that describes - in the most retarded way imaginable - exactly what the 
layout of the payload is. (E.g., mono or stereo, 8-bit or 16-bit, signed 
or unsigned, etc.)

It's no mean feat to set all this up...



What I guess I *could* do is write a small Java application that accepts 
raw audio data over TCP and then writes it to the sound hardware. 
(Although talking to the sound hardware in Java isn't exactly easy 
either - it's a 12-step process of getting a factory factory factory 
that possibly yields a factory factory that can then be queried for the 
kinds of factories it knows how to produce... you get the picture.)


Post a reply to this message

From: Warp
Subject: Re: DFT and FFT
Date: 20 Jan 2009 10:46:24
Message: <4975f1d0@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> It's actually RIFF - a multilation of the Amiga IFF format with all the 
> 4-byte values incorrectly written backwards. (Hence "R" for "reverse".)

  I think the R stands for Resource.

-- 
                                                          - Warp


Post a reply to this message

From: Mike Raiford
Subject: Re: DFT and FFT
Date: 20 Jan 2009 10:55:08
Message: <4975f3dc@news.povray.org>
Invisible wrote:
> scott wrote:
>>> Personally I'd love to implement something like that myself - but I 
>>> don't have access to anything that can talk to the sound hardware. :-(
>>
>> You could always just output a raw .wav file and then send it 
>> somewhere to play it (eg mediaplayer or winamp, surely also a smaller 
>> command line player somewhere out there).
> 
> Have you seen the format spec for the .WAV file format??
> 
> It's actually RIFF - a multilation of the Amiga IFF format with all the 
> 4-byte values incorrectly written backwards. (Hence "R" for "reverse".)
> 
> You can't just say "hey, here's some data". You have to include a header 
> that describes - in the most retarded way imaginable - exactly what the 
> layout of the payload is. (E.g., mono or stereo, 8-bit or 16-bit, signed 
> or unsigned, etc.)
> 
> It's no mean feat to set all this up...
> 
> 
> 
> What I guess I *could* do is write a small Java application that accepts 
> raw audio data over TCP and then writes it to the sound hardware. 
> (Although talking to the sound hardware in Java isn't exactly easy 
> either - it's a 12-step process of getting a factory factory factory 
> that possibly yields a factory factory that can then be queried for the 
> kinds of factories it knows how to produce... you get the picture.)

IIRC the data in the wav file isn't too, too bad to format correctly, 
but the header needs to be right.

I remember a conversation with a friend while I was screwing around with 
linux.

I can't remember the exact syntax .. but something like this.

cat mysound.wav | /dev/snd

"You can't cat a wav file!"

"Yeah, I can. Watch"

I hit enter and ... after a short burst of static, it plays the file, 
albeit at the wrong sampling rate.

"Huh, I didn't know you could do that ..."



-- 
~Mike


Post a reply to this message

From: scott
Subject: Re: DFT and FFT
Date: 20 Jan 2009 10:59:27
Message: <4975f4df$1@news.povray.org>
> Have you seen the format spec for the .WAV file format??

You mean this:

http://ccrma.stanford.edu/courses/422/projects/WaveFormat/

Looks very simple to me, about the same level of difficulty as writing a 
windows bmp file, ie very easy.


Post a reply to this message

From: Warp
Subject: Re: DFT and FFT
Date: 20 Jan 2009 11:19:40
Message: <4975f99b@news.povray.org>
Mike Raiford <"m[raiford]!at"@gmail.com> wrote:
> cat mysound.wav | /dev/snd

> "You can't cat a wav file!"

  The amount of things wrong in everything of the above is mind-boggling. ;)

  (For one, you are trying to run /dev/snd as if it was a program. Of course
that's not the only problem.)

-- 
                                                          - Warp


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.