GithubHelp home page GithubHelp logo

pulseaudio_glitch_demo's Introduction

Glitch in rtaudio + PulseAudio

Introduction

This project reproduces an audio glitch that occurs when using rtaudio to generate audio via PulseAudio on Linux.

I discovered this using VCV Rack 2.1.0+ and reported it on the VCV Rack forum. I subsequently determined the root cause to be a change in how rtaudio initializes PulseAudio. My proposed fix is in the patch file glitchfix.patch.

Andrew Belt suggested I report the issue and the proposed fix to Gary Scavone at his original rtaudio repo on GitHub.

This is my first step: a program that demonstrates there really is an issue in PulseAudio without my fix, and that the problem goes away when my fix is applied.

Reproducing the glitch

  1. Clone this repository on a Linux system that has PulseAudio installed.
  2. Clone the rtaudio repository.
  3. cd rtaudio
  4. git checkout c70f95e352b26e3bd486d6b2b23e3964f2b97a39
  5. cd ../pulseaudio_glitch_demo
  6. Edit the run script and verify that the line RTAUDIO_SOURCE=../rtaudio correctly points to the directory where you cloned rtaudio. Make adjustments to the path as needed.
  7. ./run

You will hear an 80 Hz stereo sine wave. To reproduce the glitch, allow the program to continue running while you switch to other windows, run other things, etc. You will hear clicks and pops every now and then. On my system, the glitches happen even if I do nothing, but they happen a lot more if I open Google Chrome and start switching tabs around. But pretty much any normal user activity will cause the glitches sooner or later.

When you are done with the demo program, press ENTER and it will stop generating audio and quit.

Validating the fix

Apply the patch glitchfix.patch to rtaudio, then repeat the steps above. The glitch will disappear.

Theory

My best understanding of the glitch is that it happened when this change was made.

VCV Rack 2.0.6 used a version of rtaudio before this change, and it never glitched on my system. VCV Rack 2.1.0 and above included a fork of rtaudio with this change, and it glitches. When I removed the code that set attr_ptr to a non-null value in RtApiPulse::probeDeviceOpen, the glitch goes away again.

This is how I build and run VCV Rack on my own system, so that the audio renders correctly.

pulseaudio_glitch_demo's People

Contributors

cosinekitty avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.