Retrieving decoded 16-bit PCM data?

View: New views
4 Messages — Rating Filter:   Alert me  

Retrieving decoded 16-bit PCM data?

by Peter Mosedal Laursen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone,

I have recently discovered this library and am quite satisfied with it so far.

I am wondering how I can do the following using Audiere. I should very much like to use this library instead of FMOD - the API of this library seems simpler and easier to understand.

I basically want to use this library as a decoder of audio files. My question, therefore is this:

Is it possible to:

1) Read in a file in chunks?

2) Let Audiere decode the frames just read in?

3) Get the decoded PCM data for saving or other processing?

I have searched the mailing lists and looked on Google, but have not yet found any hints as to solving the problems.

Using MS VC 7.0 on a Windows XP SP2 Pro.

Any reply is very much appreciated.

Peter.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audiere-users mailing list
Audiere-users@...
https://lists.sourceforge.net/lists/listinfo/audiere-users

Re: Retrieving decoded 16-bit PCM data?

by Matt Campbell-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Peter:

Since you didn't say otherwise, I'm ssuming you're using the C++ API and
not one of the other language bindings.

Instead of calling OpenSound, call OpenSampleSource to open your sound
file.  This returns a SampleSource object; you can use the read method
on that object to decode data from the file into memory.

I hope that helps.

--
Matt Campbell
Lead Programmer
Serotek Corporation
www.freedombox.info
"The Accessibility Anywhere People"


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audiere-users mailing list
Audiere-users@...
https://lists.sourceforge.net/lists/listinfo/audiere-users

Re: Retrieving decoded 16-bit PCM data?

by Peter Mosedal Laursen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Matt,
 
Thank you very much for your answer. Could you provide me with a few lines of sample code that would accomplish it?I am a bit confused about the structure of the API, so if you could point me in the right direction (either with a few lines of sample code or to the documentation), I would be most grateful.
 
Thanks in advance,
 
Peter.
 

________________________________

From: audiere-users-bounces@... on behalf of Matt Campbell
Sent: Mon 19/03/2007 02:03
To: audiere-users@...
Subject: Re: [Audiere-users] Retrieving decoded 16-bit PCM data?



Hello Peter:

Since you didn't say otherwise, I'm ssuming you're using the C++ API and
not one of the other language bindings.

Instead of calling OpenSound, call OpenSampleSource to open your sound
file.  This returns a SampleSource object; you can use the read method
on that object to decode data from the file into memory.

I hope that helps.

--

Matt Campbell
Lead Programmer
Serotek Corporation
www.freedombox.info
"The Accessibility Anywhere People"


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audiere-users mailing list
Audiere-users@...
https://lists.sourceforge.net/lists/listinfo/audiere-users




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audiere-users mailing list
Audiere-users@...
https://lists.sourceforge.net/lists/listinfo/audiere-users

winmail.dat (6K) Download Attachment

Re: Retrieving decoded 16-bit PCM data?

by Matt Campbell-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Peter:

OK, here's a sample program which decodes a file and writes the PCM data
to standard output:

#include <stdio.h>
#include <audiere.h>
using namespace audiere;

int main()
{
  SampleSourcePtr source = OpenSampleSource("song.ogg");
  int channel_count, sample_rate;
  SampleFormat sample_format;
  source->getFormat(channel_count, sample_rate, sample_format);
  int frame_size = GetSampleSize(sample_format) * channel_count;
  char buf[4096];

  while (true)
  {
    int rv = source->read(sizeof(buf) / frame_size, buf);
    if (rv <= 0)
      break;
    fwrite(buf, frame_size, rv, stdout);
  }
}

--
Matt Campbell
Lead Programmer
Serotek Corporation
www.freedombox.info
"The Accessibility Anywhere People"


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audiere-users mailing list
Audiere-users@...
https://lists.sourceforge.net/lists/listinfo/audiere-users