0

I am using QNX neutrino RTOS, I am new to QNX. I have setup my first project with some IPC messaging between two threads.

What I want to do is have one thread as a microphone "driver" that samples input from the microphone and stores / sends it as PCM packets to another thread which plays it out of the speaker.

So, are there any audio support libraries?, what is the best way to achieve recording microphone input and speaker output?

code_fodder
  • 15,263
  • 17
  • 90
  • 167

1 Answers1

1

Yes, QNX comes with an audio library.

The audio library is documented starting at this location (6.5 SP1 version): http://www.qnx.com/developers/docs/6.5.0_sp1/index.jsp?topic=%2Fcom.qnx.doc.neutrino_audio%2Fabout.html&cp=13_1

Your qnx system includes a utility (command) called "wave" for playing back a .wav file and "waverec" for recording audio from the microphone and saving it to a .wav file.

You can use the "use wave" and "use waverec" commands for getting information about the supported command line options.

The documentation includes the complete source of the wave and waverec utilities:

wave.c: http://www.qnx.com/developers/docs/6.5.0_sp1/index.jsp?topic=%2Fcom.qnx.doc.neutrino_audio%2Fwavec.html

waverec.c: http://www.qnx.com/developers/docs/6.5.0_sp1/index.jsp?topic=%2Fcom.qnx.doc.neutrino_audio%2Fwaverec.html

The recommended way to start with audio recording and playback is to first have the wave and waverec binaries shipped with the system working. After that build the supplied source, have it working again, then understand it and embed in your application, possibly after stripping it down. (Because the sample is generic and perhaps you want to hard-code certain features that are dynamically configured in the sample).

You need to link against the libasound.so library in order to build the samples. A minimal command-line example (tested) to build wave.c for armlev7 and x86:

ntoarmv7-gcc wave.c -o wave -l asound
ntox86-gcc wave.c -o wave -l asound

If you are building via the IDE then you need to add the library in the appropriate setting.

You are welcome to post here any questions you may have while working with the samples.

maverick
  • 436
  • 2
  • 10
  • Thanks very much Maverick (sorry about the late reply, I was away over the W/E). I just got these files and will start to play with them. I started to think that I needed to get the audio DDK, but I was struggling to install that (some java issue) when I finished on Friday... this looks much simpler I hope :), I may take you up on the offer to post questions too! – code_fodder Feb 24 '14 at 08:06
  • "Maverick, I have QNX 6.4.0 (working on upgrading to 6.5.0 sp1), so I found a the waverec.c for that version. I made it into a QNX c project but it does not build. It seems to fail on all of the asoundlib.h functions. The header file is there, but after reading some of the documentation it appears that the actual library may not be shipped with QNX (some LGPL issue). I searched around the web but can't see how to resolve this... any ideas? – code_fodder Feb 24 '14 at 09:34
  • The audio functions are defined in libasound so you need to link against that; I updated the post with command line examples to do that. As for the audio DDK, you would need that if you wanted to develop an audio driver. The audio driver is normally part of your BSP and you don't need to worry about that. – maverick Feb 24 '14 at 13:09
  • Thanks for that, I think I got side-tracked with this LGPL license, I had convinced myself that asoundlib was not there, but it is! I added this library in my linker settings and now the project compiles fine : ) ... But now I can't get any sound on my x86 installation of the QNX RTOS. I have made a QNX box (out of an unused windows PC, with a built-in sound card). I have been messing around trying to get io-audio to detect my card, it seems its not supported, so I went a bought a cheap sound card, and installed it... this also is not supported it seems, so I am now stuck here! – code_fodder Feb 24 '14 at 14:00