In the past years I used my own audio engine written using the WaveOutOpen API. Now I would like to port it to Linux / MacOS. I thought about using OpenAL.
What would be an efficient way to port this to Linux without changing too much code?
I'm mixing the audio data from WAV files and apply effects, such as 3D position, looping, frequency change, and echo.
From what I've seen OpenAL seems similar, but I don't have a very broad view on audio API's.
Would there be someone with audio programming experience who could point me in the right direction?
Related
I've been stuck on this problem for weeks now and Google is no help, so hopefully some here can help me.
I am programming a software sound mixer in C++, getting audio packets from the network and Windows microphones, mixing them together as PCM, and then sending them back out over the network and to speakers/USB headsets. This works. I have a working setup using the PortAudio library to handle the interface with Windows. However, my supervisors think the latency could be reduced between this software and our system, so in an attempt to lower latency (and better handle USB headset disconnects) I'm now rewriting the Windows interface layer to directly use WASAPI. I can eliminate some buffers and callbacks doing this, and theoretically use the super low latency interface if that's still not fast enough for the higher ups.
I have it only partially working now, and the partially part is what is killing me here. Our system has the speaker and headphones as three separate mono audio streams. The speaker is mono, and the headset is combined from two streams to be stereo. I'm outputting this to windows as two streams, one for a device of the user's choice for speaker, and one of another device of the user's choice for headset. For testing, they're both outputting to the default general stereo mix on my system.
I can hear the speaker perfectly fine, but I cannot hear the headset, no matter what I try. They both use the same code path, they both go through a WMF resampler to convert to 2 channel audio at the sample rate Windows wants. But I can hear the speaker, but never the headset stream.
It's not an exclusive mode problem: I'm using shared mode on all streams, and I've even specifically tried cutting down the streams to only the headset, in case one was stomping the other or something, and still the headset has no audio output.
It's not a mixer problem upstream, as I haven't modified any code from when it worked with PortAudio streams. I can see the audio passing through the mixer and to the output via my debug visualizers.
I can see the data going into the buffer I get from the system, when the system calls back to ask for audio. I should be hearing something, static even, but I'm getting nothing. (At one point, I bypassed the ring buffer entirely and put random numbers directly into the buffer in the callback and I still got no sound.)
What am I doing wrong here? It seems like Windows itself is the problem or something, but I don't have the expertise on Windows APIs to know what, and I'm apparently the most expert for this stuff in my company. I haven't even looked yet as to why the microphone input isn't working, and I've been stuck on this for weeks now. If anyone has any suggestions, it'd be much appreciated.
Check the re-sampled streams: output the stereo stream to the speaker, and output the mono stream to the handset.
Use IAudioClient::IsFormatSupported to check supported formats for the handset.
Verify your code using an mp3 file. Use two media players to play different files with different devices simultaneously.
Currently I am trying to use the libspotify lib to write a Windows Spotify Player. I'm new to audio streaming but not to video streaming.
I have the basics working for most of the user data and track info but the problem I'm having is that I can't figure out how to render the Raw PCM data on Windows.
I've been looking at the Jukebox example but it doesn't compile on Windows and I would like to keep this app as a native Windows app. This example is using OpenAL to render the stream and just wondering if that the best solution (vs something like Windows Audio Session API).
Seems like playing back a track should be straightforward. Am I missing something? It's turning out to be quite difficult.
I did see this post which is a little discouraging.
Getting the examples in libspotify to work under Windows 7
Any help or direction on this topic would be very much appreciated! Working samples even better. :)
I'm looking into coding a very simple LAN based home monitoring system using python 2.7 on Windows. I have a number of computers around the house each with a usb webcam attached. The cameras have built in microphones. I'm looking for the best way to capture and stream the audio and video over the network, then recieve and view/listen to it. I'm guessing I'd have to use PyAudio to get the audio from the microphone and CV2 to get the video, past that, I'm not sure how I'd stream that data to another computer, recieve it and then view/listen to it.
Not realy a question here, but still I guess I have a solution for you
(but there a millions of ways to solve this.)
My way is ROS (Robot Operating System), which is basically a TCP/IP Service Wrapper. Anyway you can simple broadcast and receive streams via your network.
ROS can be implemented in C++ or Python.
ROS usually applies OpenCV as CV-library, so it should suite your wishes.
Straight forward examples for video are (i.e.) here:
mjpeg_server
web_video_server
Audio streaming is introduced here:
audio_common (there might be solutions via PyAudio. Not sure if other solutions might come more easy and still suitable.)
I have an SDL app, that works under Linux, Mac and Windows. It's something like a media player, and can play audio just fine. I'd like to add audio recording feature to it, but I'd like to encode it in real time to MP3. Can anyone point me to an example how can I use LibLame, LibSoX, or possibly some other library to achieve this?
-- OR --
I'm also willing to rewrite the whole thing into something easier to manage than C++. I've looked at Kivy and Love2d which uses Lua, but audio recording it's still an issue there. If you know ANY toolkit that:
is cross platform
helps you build GUI using your own graphics
can play AND record mp3 files
ideally can operate under framebuffer (no X Window server under Linux)
Please let me know. I'm looking at Python + Pygame + Pyaudio, it can do graphics and output sound, but still can't record MP3's, only WAV's. Any way to integrate LAME into this to make it work?
FMOD can play practically anything, and handle audio input as well, although I don't know if integrating an entire audio engine is a bit overkill for your project.
It's free for non-commercial usage.
As for encoding, LAME is definitely the de-facto choice for MP3.
There's a very simple library called lame_enc.dll which wraps LAME's capabilities in a simple API. It's Windows only, but you could look at it's source for a good reference on how to use LAME.
I'm trying to get mpg123 audio decoder to work with QT on windows. How do i play the decoded audio data at the right speed with Qmultimedia module in push mode. Currently i'm using simple timer to get it to play audio but it's not very efficient way to do it, if I do anything else at the same time audio get all distorted. Is there any better way to send the decoded data to audio output? It would be nice if anyone could point me to any nice examples using Qmultimedia module and Qaudiooutput class. I've tried to figure out QT example project "audiooutput" but it seems that it's also using timer to send audio to output in push mode.. Hope that I'm not too confusing.
I also had to figure that out and I would also suggest using the Phonon framework to do this.
It uses Windows Media Player as host on Windows, QuickTime on Mac and some KDE stuff on Linux.
So it's pretty platform independent.
If you need more low-level functionality, you should take a look into an open-source project called portaudio. It's very easy to use and you can manipulate or even fill buffers from code.
I used it to build an oscillator.
Hope that helps!
Best,
guitarflow