Giter Site home page Giter Site logo

Comments (3)

garyscavone avatar garyscavone commented on June 13, 2024

Hi James,

I suggest using the programs in the “tests” directory to test things. That would at least rule out problems with the code.

—gary

On Sep 24, 2014, at 2:54 AM, James Heliker [email protected] wrote:

Hello -

I am currently testing RtAudio in hopes to use it on a project, and am getting unexpected results!

Given my code below (hooked up to a known-good ASIO device), I would expect my output to be essentially a copy of my input; that said it is very distorted and only somewhat recognizable with all the static / noise. Using Audacity or other known-good software I can run the same test on my hardware with no audible problems.

My setup is very simple:

audioDriver->openStream(&parameters, &parameters, RTAUDIO_SINT16, sampleRate, &bufferFrames, &input, NULL, &options);
audioDriver->startStream();

And my callback is very simple too:

int input(void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
double streamTime, RtAudioStreamStatus status, void *userData)
{

if (status)
std::cout << "input: " << status << std::endl;
memcpy(outputBuffer, inputBuffer, nBufferFrames);
return 0;
}

Any insight you could offer would be so appreciated!! Sorry if this is the wrong place to post a question / issue of this nature.

Kind Regards,

• James Heliker

Reply to this email directly or view it on GitHub.

{"@context":"http://schema.org","@type":"EmailMessage","description":"View this Issue on GitHub","action":{"@type":"ViewAction","url":"https://github.com/thestk/rtaudio/issues/24","name":"View Issue"}}

from rtaudio.

radarsat1 avatar radarsat1 commented on June 13, 2024

memcpy(outputBuffer, inputBuffer, nBufferFrames);

If you look at, e.g., record.cpp, you'll see a line like,

bufferBytes = frames * iData->channels * sizeof( MY_TYPE );

In other words, memcpy should take the number of bytes as the 3rd parameter, but you are passing it the number of frames. Since you are using type RTAUDIO_SINT16, then outputBuffer and inputBuffer point to signed short, and your line should be,

memcpy(outputBuffer, inputBuffer, nBufferFrames * sizeof(short));

Without this, the second half of every buffer would be random values, and therefore the audio would sound crunchy and weird. Don't forget to also consider the number of channels.

from rtaudio.

radarsat1 avatar radarsat1 commented on June 13, 2024

Closing because no response in several months.

from rtaudio.

Related Issues (20)

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.