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 8456483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:33:36+00:00 2026-06-10T12:33:36+00:00

In QT I can define an Audio input as: m_audioInput = new QAudioInput(m_Inputdevice, m_format,

  • 0

In QT I can define an Audio input as:

m_audioInput = new QAudioInput(m_Inputdevice, m_format, this);
m_input = m_audioInput->start();

In my application I would like to use a mic and read from audio card.

Now if I want to see how many bytes are ready to read from Audio buffer I use:

qint64 len = m_audioInput->bytesReady();

It looks like the len is a function of sampling rate and number of bits per sample.
My question is that is there a way to control len, without changing the sampling rate? In other words I would like to control the audio card such that it reads data in shorter blocks and emits the ready signal.

  • 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-10T12:33:36+00:00Added an answer on June 10, 2026 at 12:33 pm

    You can control the audio card by setting up proper format parameters e.g., frequency, sample size. For this you need to use QAudioFormat class.

    Other than this, there is no other way to control audio card from Qt.

    Class Reference.

    Example from the reference:

    QFile outputFile;   // class member.
    QAudioInput* audio; // class member.
    
    outputFile.setFileName("/tmp/test.raw");
    outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate );
    
    QAudioFormat format;
    
    // set up the format you want, eg.
    format.setFrequency(8000);
    format.setChannels(1);
    format.setSampleSize(8);
    format.setCodec("audio/pcm");
    format.setByteOrder(QAudioFormat::LittleEndian);
    format.setSampleType(QAudioFormat::UnSignedInt);
    
    QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice();
    if (!info.isFormatSupported(format)) {
        qWarning()<<"default format not supported try to use nearest";
        format = info.nearestFormat(format);
    }
    
    audio = new QAudioInput(format, this);
    QTimer::singleShot(3000, this, SLOT(stopRecording()));
    audio->start(&outputFile);
    // Records audio for 3000ms
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can define icon for a jquery ui button in code like this; $(
In HTML you can define in a form an input-field for uploading files. This
I can define a delegate and write the query like this. Func<string, bool> filter
I can define default value in domain by this way : class ProcessingPriority {
I know I can define new structs in ruby by doing Person = Struct.new(:first_name,
As I know I can define a new Enum DataFormat at the my project
How can define a custom block like @for in Razor view? I read about
I have a macro that looks like this: #define coutError if (VERBOSITY_SETTING >= VERBOSITY_ERROR)
Assume I have a controller method like this: [Audit] public JsonNetResult List(int start, int
I would like to define a schema for a document like: ... <car> <make>ford</make>

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.