Discussion:
[Audiere-users] more spectrum analasys stuff
Dave
2005-02-23 18:48:32 UTC
Permalink
Hi!
I posted a while ago about interest in Audiere and also with a question about spectrograms. I am happy to say that since I posted I decided to go ahead with implementing the API regardless and have not been disapointed once with its performance! Awesome job guys! It slipped right in seamlessly to my project and hasn't caused any fuss at all.

I went and did some research on what I would need to do to create a spectrum analiser for a graphical display. I now understand the concept and implementation and am all but ready to write it :)
I need to get at the sample buffer and read in 64 samples to perform a FFT calculation which I can then use to generate my sound spectrum array. I'm cool with all of that apart from actually getting the sample data x_X
Its probably because im bitfik (lol) but I have never got on with automatically generated documentation because I often find it hard how everything fits together in the actual code. All I generally know is x function exists in the class somewhere and theres a way to use it with blah stream etc XD

I've found read() on a couple of things, its perfect. Have not once managed to successfully implement it XD Heres my question:
What would be OPTIMAL is if someone could tell me how I can read in samples for the final sound being mixed in the sound card so I can generate a spectrum for all currently playing sounds. If thats possiable. If its not, then I guess my question is how can I read() the sample data when I have opened a stream like:
stream = OpenSound(AudDevice.get(), "f:\\nya.mp3", true);

Its all I need.. I can do the rest of the calculations myself and implement the FTT. If anyone can help so I can get right on with it you would make me a very happy man :) Also, if anyone is interested, if I ever get a graphic spectrum displaying properly I would be more than happy to share the source! ^_^

Looking forward to your response
-Dave
Brian Robb
2005-02-23 19:53:43 UTC
Permalink
Post by Dave
Hi!
I posted a while ago about interest in Audiere and also with a question
about spectrograms.
I am happy to say that since I posted I decided to go ahead with
implementing the API regardless
and have not been disapointed once with its performance! Awesome job guys!
It slipped right in seamlessly to my project and hasn't caused any fuss at
all.
I went and did some research on what I would need to do to create a
spectrum analiser for a
graphical display. I now understand the concept and implementation and am
all but ready to
write it :)
I need to get at the sample buffer and read in 64 samples to perform a FFT
calculation which I
can then use to generate my sound spectrum array. I'm cool with all of
that apart from actually
getting the sample data x_X
Its probably because im bitfik (lol) but I have never got on with
automatically generated
documentation because I often find it hard how everything fits together in
the actual code. All I
generally know is x function exists in the class somewhere and theres a way
to use it with blah
stream etc XD
I've found read() on a couple of things, its perfect. Have not once
managed to successfully
What would be OPTIMAL is if someone could tell me how I can read in samples
for the final sound
being mixed in the sound card so I can generate a spectrum for all
currently playing sounds. If
thats possiable. If its not, then I guess my question is how can I read()
stream = OpenSound(AudDevice.get(), "f:\\nya.mp3", true);
Its all I need.. I can do the rest of the calculations myself and implement
the FTT. If anyone can
help so I can get right on with it you would make me a very happy man :)
Also, if anyone is
interested, if I ever get a graphic spectrum displaying properly I would be
more than happy to
share the source! ^_^
Looking forward to your response
-Dave
I'm guessing here, so you'll probably want to wait till chad replies, but...

But the closest thing I see to what you might want is SampleSource::read

Actually, that's probably not what you want since that'll be when the data
is read, and you'll likely want when the data is played... So perhaps one of
the device mixers?
Like MixerStream::read ?
Dave
2005-02-24 16:29:55 UTC
Permalink
Hey Brian,
Thanks for your response :)

Well I have done a little bit of playing and have had no luck yet. I took a
look at mixerdevice and saw a protected method for read - it looks good.
Havnt been able to implement it yet XD
Brian Robb
1970-01-01 00:00:00 UTC
Permalink
I think I need some way or the other to grab a pointer to whatever mixer
device is created when I do a simple stream = OpenSound(AudDevice.get(),
"f:\\nya.mp3", true); or maybe its when I init the audio device in the first
place? I dont know.

I would be very greatful if chad could reply and shed some light on this
subject for me :)

-Dave

----- Original Message -----
From: "Brian Robb" <***@hotmail.com>
To: <audiere-***@lists.sourceforge.net>
Sent: Wednesday, February 23, 2005 9:51 PM
Subject: RE: [Audiere-users] more spectrum analasys stuff
Post by Brian Robb
Post by Dave
Hi!
I posted a while ago about interest in Audiere and also with a question
about spectrograms.
I am happy to say that since I posted I decided to go ahead with
implementing the API regardless
and have not been disapointed once with its performance! Awesome job
guys!
Post by Brian Robb
Post by Dave
It slipped right in seamlessly to my project and hasn't caused any fuss
at
Post by Brian Robb
Post by Dave
all.
I went and did some research on what I would need to do to create a
spectrum analiser for a
graphical display. I now understand the concept and implementation and
am
Post by Brian Robb
Post by Dave
all but ready to
write it :)
I need to get at the sample buffer and read in 64 samples to perform a
FFT
Post by Brian Robb
Post by Dave
calculation which I
can then use to generate my sound spectrum array. I'm cool with all of
that apart from actually
getting the sample data x_X
Its probably because im bitfik (lol) but I have never got on with
automatically generated
documentation because I often find it hard how everything fits together
in
Post by Brian Robb
Post by Dave
the actual code. All I
generally know is x function exists in the class somewhere and theres a
way
Post by Brian Robb
Post by Dave
to use it with blah
stream etc XD
I've found read() on a couple of things, its perfect. Have not once
managed to successfully
What would be OPTIMAL is if someone could tell me how I can read in
samples
Post by Brian Robb
Post by Dave
for the final sound
being mixed in the sound card so I can generate a spectrum for all
currently playing sounds. If
thats possiable. If its not, then I guess my question is how can I
read()
Post by Brian Robb
Post by Dave
stream = OpenSound(AudDevice.get(), "f:\\nya.mp3", true);
Its all I need.. I can do the rest of the calculations myself and
implement
Post by Brian Robb
Post by Dave
the FTT. If anyone can
help so I can get right on with it you would make me a very happy man :)
Also, if anyone is
interested, if I ever get a graphic spectrum displaying properly I would
be
Post by Brian Robb
Post by Dave
more than happy to
share the source! ^_^
Looking forward to your response
-Dave
I'm guessing here, so you'll probably want to wait till chad replies,
but...
Post by Brian Robb
But the closest thing I see to what you might want is SampleSource::read
Actually, that's probably not what you want since that'll be when the data
is read, and you'll likely want when the data is played... So perhaps one
of
Post by Brian Robb
the device mixers?
Like MixerStream::read ?
Brian Robb
2005-02-25 14:03:54 UTC
Permalink
Post by Dave
Well I have done a little bit of playing and have had no luck yet. I took
a
look at mixerdevice and saw a protected method for read - it looks good.
Havnt been able to implement it yet XD
There's more than one mixer,
so you'll want to first find out which is being used when you do:
stream = OpenSound(AudDevice.get), "f:\\nya.mp3", true);

Maybe just printf statements in each read method, like:

printf ("ds_mixer::read()\n");

Then run your application with the newer audiere like:

player.exe > c:\audiere.log

Then see which print statement is shown in audiere.log

I think there's a mixer for each output type, one for direct sound, one for
winms, maybe more...
(I don't have audiere here at the moment so I can't check really.)

Once you know which mixer is being used...
You'd then want to change audiere's api to allow stream's to get at the
mixer data?

If you had access to the sample data and some info about it (like sample
rate)
would that then be enough to do your spectrum analysis?
Chad Austin
2005-02-27 07:44:56 UTC
Permalink
Post by Dave
Hi!
I posted a while ago about interest in Audiere and also with a question
about spectrograms. I am happy to say that since I posted I decided to
go ahead with implementing the API regardless and have not been
disapointed once with its performance! Awesome job guys! It slipped
right in seamlessly to my project and hasn't caused any fuss at all.
Great news!
Post by Dave
I went and did some research on what I would need to do to create a
spectrum analiser for a graphical display. I now understand the concept
and implementation and am all but ready to write it :)
I need to get at the sample buffer and read in 64 samples to perform a
FFT calculation which I can then use to generate my sound spectrum
array. I'm cool with all of that apart from actually getting the sample
data x_X
How much latency are you looking for? The problem is with some of the devices
that do "hardware mixing", like OpenAL, DirectSound, and potentially AudioWorks.
You can't always get the mixed data back before it's sent to the sound card.
So the way I see it, there needs to be a capabilities bitset on the device, with
things like "supports reading postmix samples". And you could specify your
desired capabilities when creating a device, and it would return the best one
that fits the requirements.
Post by Dave
Its probably because im bitfik (lol) but I have never got on with
automatically generated documentation because I often find it hard how
everything fits together in the actual code. All I generally know is x
function exists in the class somewhere and theres a way to use it with
blah stream etc XD
Yeah, you're right. Automatically generated documentation is no excuse. I've
at least separated the developer documentation (all of the internal headers and
sources) from the user documentation (audiere.h) in CVS.
Post by Dave
I've found read() on a couple of things, its perfect. Have not once
What would be OPTIMAL is if someone could tell me how I can read in
samples for the final sound being mixed in the sound card so I can
generate a spectrum for all currently playing sounds. If thats
possiable. If its not, then I guess my question is how can I read() the
stream = OpenSound(AudDevice.get(), "f:\\nya.mp3", true);
stream->read(64, buffer);
Dave
2005-02-27 15:50:54 UTC
Permalink
Hi Chad, thankyou for replying :)

you said stream->read();
I wish it was that easy, it was the first thing I tried when I started this
XD
But according to the docs there is no Read(); in the OutputStream class and
sure enough compiling your code returns error C2039: 'read' : is not a
member of 'OutputStream'. Is there something else I should of defined
stream as which supports the read method and OpenSound() calls?
Or is my version of Audiere old and not supporting that method when it
should do? I'm sure I have the latest CVS snapshot which I compiled myself
:/

Looking forward to your reply :) Feels like i'm close ^^
-Dave
Post by Chad Austin
Post by Dave
I've found read() on a couple of things, its perfect. Have not once
What would be OPTIMAL is if someone could tell me how I can read in
samples for the final sound being mixed in the sound card so I can
generate a spectrum for all currently playing sounds. If thats
possiable. If its not, then I guess my question is how can I read() the
stream = OpenSound(AudDevice.get(), "f:\\nya.mp3", true);
stream->read(64, buffer);
Chad Austin
2005-02-27 19:49:56 UTC
Permalink
Post by Dave
Hi Chad, thankyou for replying :)
you said stream->read();
I forgot to mention that stream would have to be an instance of the SampleSource
interface, not OutputStream. You can't read from an OutputStream.
Post by Dave
I wish it was that easy, it was the first thing I tried when I started this
XD
But according to the docs there is no Read(); in the OutputStream class and
sure enough compiling your code returns error C2039: 'read' : is not a
member of 'OutputStream'. Is there something else I should of defined
stream as which supports the read method and OpenSound() calls?
Or is my version of Audiere old and not supporting that method when it
should do? I'm sure I have the latest CVS snapshot which I compiled myself
:/
Looking forward to your reply :) Feels like i'm close ^^
-Dave
Post by Chad Austin
Post by Dave
I've found read() on a couple of things, its perfect. Have not once
What would be OPTIMAL is if someone could tell me how I can read in
samples for the final sound being mixed in the sound card so I can
generate a spectrum for all currently playing sounds. If thats
possiable. If its not, then I guess my question is how can I read() the
stream = OpenSound(AudDevice.get(), "f:\\nya.mp3", true);
stream->read(64, buffer);
Loading...