Marc Pilgaard
Marc Pilgaard

Reputation: 598

Portaudio: Importing sound example into my buffer

I am in need of your help once again.

Short version: Can you import sound clips into Portaudio? If not, where can I get 'realistic' sound examples, that is converted into discrete values which I can store into my sound buffers?

Long version: As a part of a mini-project, I have decided to implement HRTF. For this, I am using PortAudio (http://www.portaudio.com/) which is a C/C++ library for sound manipulation. As a part of that I am trying to simulate ITD (Inneraural Time Difference). For that purpose, PortAudio generates a sinus wave and stores it into a buffer, though the sinus wave is problematic to use for testing. Thats why I am in need of a 'realistic' sound example. The issue is, I can't seem to find any PortAudio function that allows me to import sound clips and store them into my buffer. As a second option I could look up a sound clip which is converted into discrete values and is stored into an array. Then I could copy that array into my own buffer, though I have no clue of where to look for such arrays, and I don't even know if they exist.

So the question is: Do PortAudio allow you to import your own sound clip, and if not, where can I find arrays in which sound clips are stored in discrete values.

If there are any questions regarding to my question, pleas ask. Best regards - Marc Pilgaard

Upvotes: 1

Views: 1742

Answers (1)

André Bergner
André Bergner

Reputation: 1439

PortAudio is just an audio playback/recording library. It neither manipulates sound, nor does it bring any facilities to load/store sounds. It just realizes buffer --> speaker and microphone --> buffer.

If I understand you right you are looking for a library that let's you load wav or mp3 files into a buffer that in turn can be played by portaudio. Since you are in the C world already the best step would be to use libsndfile which basically mimics the standard C file access interface for loading and writing pcm files, such as wav.

Upvotes: 3

Related Questions