Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8797991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:58:30+00:00 2026-06-13T23:58:30+00:00

I use Rtaudio library and I would like to implement an audio program where

  • 0

I use Rtaudio library and I would like to implement an audio program where I can control the panning (e.g. shifting the sound from the left channel to the right channel).

In my specific case, I use a duplex mode (you can find an example here: duplex mode). It means that I link the microphone input to the speaker output.

Should I apply a filter on the output buffer? What kind of filter?
Can anyone help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:58:32+00:00Added an answer on June 13, 2026 at 11:58 pm

    To reduce the signal on the left, simply multiply every sample on the left by a number less than or equal to 1, let’s call it l. Similarly for the right, we’ll call that number r. Generally speaking you don’t want to multiply by a number greater than 1, or you might cause the signal to distort.

    l and r are both functions of the “pan position”. How you get from pan position to your numbers is a matter of some discussion. If this is for something simple, you can just ramp the values down linearly, using these values at the extremes:

    Hard Left:
    l=1; r=0
    Center:
    l=1; r=1
    Hard Right:
    l=0; r=1;
    

    If this is something fancier, you should google for “pan law”. Here’s an example that looks like a good start:

    http://www.kvraudio.com/forum/viewtopic.php?p=4264576

    UPDATE:
    I’ve never used RT audio (I usually use PortAudio, which is similar), but I think code to pan would look something like this, with l and r as defined above (assuming a type int32_t – signed 32 bit integer):

    int inout( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
               double streamTime, RtAudioStreamStatus status, void *data )
    {
      if ( status ) std::cout << "Stream over/underflow detected." << std::endl;
    
      int32_t *ob = (int32_t *)outputBuffer;
      int32_t *in = (int32_t *)inputBuffer;
    
      unsigned long *bytes = (unsigned long *) data;
      int i =0;
      while( i < bytes / 4 ) {
         ob[i] = (int32_t) ( ib[i] * l + .5 );
         ++i;
         ob[i] = (int32_t) ( ib[i] * r + .5 );
         ++i;
      }
      return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Use Eclipse Classic with ADT plugin. Tried to make project from existing example of
use Control::CLI; $cli = new Control::CLI('SSH'); $cli->connect(Host=>'10.10.10.10',Username=>'user',Password=>'pwd'); $cli->waitfor('>'); $cli->print('Show XXXXXXXXXXXXXXXXXXXX| grep Active'); @f=$cli->waitfor('>'); print
use qcvalues_test go select [finalConc] ,[rowid] from qvalues where rowid in (select rowid from
Use to work with a MySQL + + (library for C + +) The
I am trying to write a C++ program which plays real-time processed audio. I
Use trap to capture signals like this: i=-1;while((++i<33)); do trap echo $i >> log.txt
Use OPENXML to get dt element in MSSQL 2005. How can I get xmlns:dt
use level1\level2\level3; Can someone explain with a simple demo ?
USE AdventureWorks; GO BEGIN TRANSACTION; GO DELETE FROM HumanResources.JobCandidate WHERE JobCandidateID = 10; DELETE
USE AdventureWorks2008R2; GO INSERT INTO myTestSkipField SELECT * FROM OPENROWSET(BULK 'C:\myTestSkipField-c.dat', FORMATFILE='C:\myTestSkipField.fmt' ) AS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.