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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:00:02+00:00 2026-06-05T01:00:02+00:00

Looking to do pretty much what Shazam is doing as far as recording audio

  • 0

Looking to do pretty much what Shazam is doing as far as recording audio while another app is playing audio.

1) Recording audio fine, no problem here

2) When app starts and starts recording, the music from another app stops (itunes, etc).

3) I have played with all of the incantations of the AV Audio settings with no luck in having the audio continue / resume.

4) When Shazam starts, the audio stop for a bit, and then resumes. I assume that Shazam is doing something to restart the audio with the music player? I searched and could not find if there is a way to do this.

So if anyone has the proper settings to get this to work, it would be appreciated.

Also, Saying, please read the AV docs, is not an answer, I have looked these over with no luck.

I have tried found here

http://developer.apple.com/library/ios/#documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategories/AudioSessionCategories.html

Have tried both the AV and K type of settings. I do see a difference in the settings as far as how exactly the MIC works, but in all cases when my app gets the mic, it stops the audio from the other app.

If I have to sacrifice a chicken standing in the direction of Apple, this is fine, just let me know what type of chicken 🙂

  • 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-05T01:00:05+00:00Added an answer on June 5, 2026 at 1:00 am

    After some back and forth, it looks like using the MixWithOthers is the key. You have to also make sure that the audio route is set to the last / current audio route…

    FYI This is with the AudioQueue interface

    So we …

    / Start Music with iPod
    / Start our app with

    • AudioQueueNewInput
    • AudioQueueAddPropertyListener
    • AudioQueueAllocateBuffer(s)
    • AudioQueueEnqueueBuffer(s)
    • setupCat
    • setupDuck
    • setupAudioRoute
    • setupMixing
    • AudioSessionSetActive (true)
    • AudioQueueStart

    typedef union 
    {
        OSStatus propertyResult;
        char a[4];
    } unionstatus;
    
    unionstatus u2;
    
    typedef union 
    {
        UInt32 UI32sessionCat;
        char a[4];
    } unionuint32;
    
    unionuint32 usc2;
    
    bool setAudioUInt32 ( UInt32 property, UInt32 value )
    {
        bool result = true;
    
        UInt32 UI32 = value;
        UInt32 UI32size = sizeof(UI32);
    
        u2.propertyResult = AudioSessionSetProperty (property, UI32size , &UI32 );
    
        if ( u2.propertyResult )
        {
            printf("Error Set %ld %lx %c%c%c%c\n",u2.propertyResult,u2.propertyResult,u2.a[3],u2.a[2],u2.a[1],u2.a[0]);
            result = false;
        }
        return result;
    }
    
    UInt32 getAudioSettingInt ( UInt32 value )
    {
        UInt32  I32;
        UInt32  I32size = sizeof(I32);
    
        u2.propertyResult = AudioSessionGetProperty ( value , &I32size, &I32 );
    
        if ( u2.propertyResult )
            printf("Error Get %ld %lx %c%c%c%c\n",u2.propertyResult,u2.propertyResult,u2.a[3],u2.a[2],u2.a[1],u2.a[0]);
    
        return (I32);
    }
    

    /// checking taken out
    
    bool otherPlaying = getAudioSettingInt ( kAudioSessionProperty_OtherAudioIsPlaying );
    if ( otherPlaying )
    {
        setAudioUInt32 (kAudioSessionProperty_OtherMixableAudioShouldDuck, false);
        // this returns a string, arg, have to look for string values, etc.
        UInt32 audioRoute = getAudioSettingInt ( kAudioSessionProperty_AudioRoute );
    
        CFStringRef ar = (CFStringRef) audioRoute;
        CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
        const char *car = CFStringGetCStringPtr(ar,encodingMethod);
        CFRange range = CFStringFind(ar,CFSTR("Headphones"),kCFCompareCaseInsensitive);
    
        if ( range.length == 0 ) // we have speakers
            result = setAudioUInt32 (kAudioSessionProperty_OverrideAudioRoute, kAudioSessionOverrideAudioRoute_Speaker);
        else // we have headphones
            {}
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty much stuck here. I'm looking at this module and i'm looking at
The question pretty much says it all, I've been looking around for an answer
I'm looking for some good Java AWT tutorials on the Internet. Pretty much everything
I was looking at MEF as an extensibility framework, and I'm pretty much sold,
The title pretty much says what I'm looking to do, but to elaborate a
Title pretty much says it i'm looking to add a line to a script
Title pretty much says it all... ;) I'm looking for a way to allow
Question pretty much says it all. You can read entity association here , but
I'm pretty much just looking for the code they used that is very similar
I think the title pretty much says it all... I'm looking to implement an

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.