portaudio | Unofficial Git mirror of PortAudio

 by   EddieRingle C Version: Current License: Non-SPDX

kandi X-RAY | portaudio Summary

kandi X-RAY | portaudio Summary

portaudio is a C library. portaudio has no bugs, it has no vulnerabilities and it has low support. However portaudio has a Non-SPDX License. You can download it from GitHub.

PortAudio is a portable audio I/O library designed for cross-platform support of audio. It uses either a callback mechanism to request audio processing, or blocking read/write calls to buffer data between the native audio subsystem and the client. Audio can be processed in various formats, including 32 bit floating point, and will be converted to the native format internally. Documentation: Documentation is available in "/doc/html/index.html" Also see "src/common/portaudio.h" for API spec. Also see And see the "test/" directory for many examples of usage (we suggest "test/patest_saw.c" for an example).
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              portaudio has a low active ecosystem.
              It has 59 star(s) with 51 fork(s). There are 8 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 3 open issues and 1 have been closed. On average issues are closed in 38 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of portaudio is current.

            kandi-Quality Quality

              portaudio has 0 bugs and 0 code smells.

            kandi-Security Security

              portaudio has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              portaudio code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              portaudio has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              portaudio releases are not available. You will need to build from source code and install.
              It has 906 lines of code, 65 functions and 11 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of portaudio
            Get all kandi verified functions for this library.

            portaudio Key Features

            No Key Features are available at this moment for portaudio.

            portaudio Examples and Code Snippets

            No Code Snippets are available at this moment for portaudio.

            Community Discussions

            QUESTION

            Portaudio - Unable to play audio file
            Asked 2022-Apr-10 at 07:21

            I'm trying to implement a very simple API for audio playback using portaudio. I have minimal amount of code needed to play the audio file but I am not getting any errors and/or audio output.

            Here is the code,

            ...

            ANSWER

            Answered 2022-Apr-07 at 23:24

            You've got two flaws that I can see.

            One is using what looks like a class method as the callback to PulseAudio. Since PA is a C API, it expects a C function pointer here. It won't call that function with the this pointer set, so you can't have a class method here. But maybe AudioStream::Callback is static? That will work.

            Two is that you need to consider that the callback is called in another thread. The compiler does not take that into account when it optimizes the code. As far as it knows, there is nothing in your empty while loop that could possibly change the value of file->count.

            Once you call the debug function, it brings in enough code, some probably in libraries that are already compiled, that the compiler can't be sure nothing has modified file->count. Maybe SH_LOG_DEBUG() calls prinf() and then printf() calls AudioStream::Load()? Of course it doesn't, but if the compiler doesn't see the code of printf() because it's already in a library, and your AudioStream object is global, then it's possible. So it actually works like you want.

            But even when it works, it's really bad. Because the thread is sitting there busy waiting for the count to stop, hogging the/a CPU. It should block and sleep, then get notified when the playback finishes.

            If you want to pass information between threads in a way that works, and also block instead of busy waiting too, look into the C++ concurrency support library. The C++20 std::latch and std::barrier would work well here. Or use a C++11 std::condition_variable.

            Source https://stackoverflow.com/questions/71785813

            QUESTION

            How to patch portaudio for low-latency iOS usage?
            Asked 2022-Mar-17 at 19:09

            I am currently working on a patch that should make portaudio work for iOS. For now I successfully applied portaudio member Hans Petter's patch for iOS usage

            https://www.dropbox.com/s/6hf9bjqpa6b6uv3/0001-Add-basic-support-for-iOS-to-portaudio.patch?dl=0

            and at least I call tell that the audio process does work, however, it is currently stuck at 1024 samples. When I try decreasing it to lower values the callback function terminates immediately. When using 48 kHz it terminates without any warning or error message but when using 44.1 kHz it crashes with t the following error:

            Assertion failed: (*streamCallbackResult == paContinue || *streamCallbackResult == paComplete || *streamCallbackResult == paAbort), function PaUtil_EndBufferProcessing, file pa_process.c, line 1499. dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_IMAGE_SUFFIX=_debug DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

            referring to line 1497 in pa_process.c -->

            assert( *streamCallbackResult == paContinue || *streamCallbackResult == paComplete || streamCallbackResult == paAbort ); / don't forget to pass in a valid callback result value */

            I'd like to get as low as possible in terms of buffer size (ideally 128 or even 64), however, since I am not familiar with audio on iOS am now seeking for first inspirational comments. On OSX, Win or Linux this problem does not exist. Maybe iOS expects special low-latency flags ?

            ...

            ANSWER

            Answered 2022-Mar-16 at 20:37

            Meantime I figured that iOS is able to handle audio frame sizes < 1024 (down to 128 and possibly less) and that the portaudio patch requires additional modifications and calls in order to make it work. Once completed I will provide the patch and further details here.

            Source https://stackoverflow.com/questions/71481460

            QUESTION

            I am not able to install pyaudio library on windows 11
            Asked 2022-Feb-21 at 09:43
              C:\Users\mudit\AppData\Local\Programs\Python\Python310\include\pyconfig.h(117): warning C4005: 'MS_WIN64': macro redefinition
              src/_portaudiomodule.c: note: see previous definition of 'MS_WIN64'
              src/_portaudiomodule.c(29): fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory
              error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
              ----------------------------------------
              ERROR: Failed building wheel for pyaudio
            
            ...

            ANSWER

            Answered 2022-Feb-21 at 09:43

            Actually pyaudio cant be installed now as python has ended its support but if you need py audio donwload from hereenter link description here

            choose the correct version of pyaudio or simply watch this video on youtube enter link description here

            Source https://stackoverflow.com/questions/71204070

            QUESTION

            How do you dynamically allocate a buffer for PortAudio Pa_WriteStream in C++?
            Asked 2022-Feb-15 at 20:26

            When I declare buffer as float buffer[FRAMES_PER_BUFFER][2], I get a nice sound out of PortAudio's Pa_WriteStream. When I declare buffer as a float ** and then dynamically allocate (and zero out) a block of memory for it, I get no sound or popping (be careful if you try this on your computer).

            As far as I can tell the structure of block pointed to by buffer in each case is identical, but the memory location is different (stack vs heap). This can be seen by the output of the cout statements at the end of the attached example.

            How can I dynamically allocate buffer? My application will not know FRAMES_BER_BUFFER or the constant 2 (could be 3 or 4) at compile time.

            I'm running this code on Mac with PortAudio 19.5.0 and compiling with gnu (tried various versions).

            ...

            ANSWER

            Answered 2022-Feb-15 at 20:26

            How do you dynamically allocate a buffer for PortAudio Pa_WriteStream in C++?

            float buffer[FRAMES_PER_BUFFER][2]

            Just:

            Source https://stackoverflow.com/questions/71131999

            QUESTION

            pyaudio not working in linux in pycharm but work file in windows(dual boot)
            Asked 2022-Feb-02 at 18:22

            i am new to linux and i am setting up my code (in code i trying to take audio input from user and changing it to text). ran into problem while installing pyaudio .when i try to install pyaudio(by pipwin install pyaudio) following showed

            ...

            ANSWER

            Answered 2022-Feb-02 at 18:22

            Like it says, you need the portaudio library installed. Assuming you are running Ubuntu, something like this should work:

            Source https://stackoverflow.com/questions/70960668

            QUESTION

            How to make sound read by PsychoPy
            Asked 2021-Dec-17 at 12:11

            I'm trying to figuring the problem out I'm facing with PsychoPy. When I try to upload this file

            that actually is a .svp file I get this error:

            ...

            ANSWER

            Answered 2021-Dec-17 at 12:11

            From the error message I believe the sound file you've used here has a sampling rate of 32000 Hz, but you have another sound in your project sampled at 48000 Hz. Switching between sample rates is called resampling but resampling takes time. PsychoPy is designed to provide low-latency playback of sounds but to do this it will not perform any resampling for you. As a result, you should convert all your sounds to use the same sampling rate before the study runs using some audio software

            Source https://stackoverflow.com/questions/70290639

            QUESTION

            How to build and use an external library with CMake
            Asked 2021-Nov-13 at 18:13

            I am trying to build a portable sound synthesiser using the cross-platform library portaudio. The library has it's own CMake file to be built with. I think I have managed to build it as part of my project (build finishes with exit code 0) but I can't figure how to actually use it's imports. Any #include I try to use results in cannot open source file.

            This is my project's CMake file:

            ...

            ANSWER

            Answered 2021-Nov-13 at 18:13

            I had to also link the executable with the library with target_link_libraries(sound-synth PortAudio). Then on windows I had the problem that the .dll was placed in a separate folder from the .exe. So I just added a copy file command and that fixed it.

            Source https://stackoverflow.com/questions/69950551

            QUESTION

            Audio recording in Python with Pyaudio, error ||PaMacCore (AUHAL)|| ... msg=Audio Unit: cannot do in current context
            Asked 2021-Nov-09 at 04:30

            I am using pyaudio to record sounds on my Mac BigSur 11.6 (20G165). Specifically, I'm redirecting sound from an application to the input using BlackHole, which works fine.

            It usually works fine but, sometimes, I get this error in the Terminal:

            ||PaMacCore (AUHAL)|| Error on line 2500: err='-10863', msg=Audio Unit: cannot do in current context

            Any idea why or how I could prevent it from happening (like, waiting until PaMacCore is ready to record again or something)?

            I already tried reinstalling but it doesn't help

            ...

            ANSWER

            Answered 2021-Nov-03 at 16:29

            Apparently the problem were mismatched bitrates in BlackHole's aggregated output device. I was aggregating Blackhole's output (44,1kHz) and the Mac Speakers (48kHz). This did not cause any consistent bad behaviour but sometimes led to these errors.

            Source https://stackoverflow.com/questions/69571374

            QUESTION

            Sound not properly played, buzzing sound instead of recorded sound - Portaudio
            Asked 2021-Oct-15 at 13:46

            I'm trying to record and play some sound with Portaudio, the objective is to create a simple voip app, so i'm trying to transfer recorded data from the first client to a second client. The problem is when it comes to play the recorded sound, i either have no sound played, of a very buzzy sound, let me explain :

            here are my record and play callback functions :

            ...

            ANSWER

            Answered 2021-Oct-15 at 13:46

            I can't seem to find what's wrong, but I messed up something, ended up cutting the example again and it worked.

            Source https://stackoverflow.com/questions/69498549

            QUESTION

            Encoded Sound loses data when encoding Opus
            Asked 2021-Oct-14 at 11:30

            I'm trying to encode with Opus some data recorded via PortAudio, so whenever I try to encode data, the written data is lost because the unsigned char vector ends up being empty for every iteration of the vector, the original data is recorded from PortAudio

            here are my structures :

            ...

            ANSWER

            Answered 2021-Oct-14 at 11:30

            It looks like the problem is that you're keeping two sizes. You're mixing C and C++ style, which probably explains the std::vector *. But more importantly, std::vector stores its own size, yet you also store a seprate size. And it looks like they don't agree.

            The fix is easy. Don't store that .size in AudioEnc and AudioData. Instead, call .resize on the vectors to remember the size returned from Opus. This will discard the unused entries.

            Source https://stackoverflow.com/questions/69568397

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install portaudio

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/EddieRingle/portaudio.git

          • CLI

            gh repo clone EddieRingle/portaudio

          • sshUrl

            git@github.com:EddieRingle/portaudio.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link