1

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

4

1 回答 1

3

PortAudio 只是一个音频播放/录音库。它既不操纵声音,也不带来任何加载/存储声音的设施。它只是实现了缓冲区--> 扬声器和麦克风--> 缓冲区。

如果我理解正确,您正在寻找一个库,可以让您将 wav 或 mp3 文件加载到缓冲区中,而该缓冲区又可以由 portaudio 播放。由于您已经在 C 世界中,因此最好的方法是使用libsndfile,它基本上模仿标准 C 文件访问接口来加载和编写 pcm 文件,例如 wav。

于 2012-06-06T13:25:04.680 回答