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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:16:46+00:00 2026-05-29T20:16:46+00:00

I have an array of audio samples in C which I run algorithms on

  • 0

I have an array of audio samples in C which I run algorithms on such as low-pass filters. I was thinking of converting my array to Objective-C before working on it. This is mainly because I am more comfortable with that language and it’s conveniences (especially being able to get the length of the array easily and not having to deal with pointers).

I was wondering if there is any reason why this may be a bad idea. Or if there are any disadvantages to doing this that I’m not aware of. Like maybe speed in processing such a large amount of samples (?).

  • 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-05-29T20:16:48+00:00Added an answer on May 29, 2026 at 8:16 pm

    Standard practice is to use a c style array for manipulating an array of audio. This is because if you have to use an Objective-c container object with obj-c messaging to access each element, the performance will be bad, and as you note, the number of samples with audio can be quite large.

    This is especially true for real time processing such as processing audio samples that live in the system audio io callback, which have to do the job within a certain number of milliseconds or the sound will cut out.

    What you could do is define a struct (or even an objective c class) that has the audio buffer array as well as info elements like size, number of channels, etc, to wrap it together for you in one location. That way when you access the buffer, you don’t need to get into obj-c efficiency issues, and you still have the buffer specification info available.

    Here’s an example:

    typedef struct filter_buffer {
       uint16_t* buffer;
       int   channels;
       int   num_frames;
    } filter_buffer;
    

    You then just need a call that initializes it.

    You could do something with objective-c like:

    @interface FilterBuffer : NSObject
    {
      uint16_t* buffer;
      int   channels;
      int   num_frames;   
    }
    
    -initWithBuffer:(unit16_t*)buf channels:(int)c numFrames:(int)n;
    ...//accessors etc
    @end
    
    @implementation FilterBuffer
    -initWithBuffer:(unit16_t*)buf channels:(int)c numFrames:(int)n
    {
       if ((self = [super init)) {
          buffer = buf;
          channels = c;
          num_frames = n;
       }
       return self;
    }
    ...
    @end
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello kind people of the audio computing world, I have an array of samples
I have a byte array with audio samples. I want to play it, so
I have to send the audio data in byte array obtain by recording from
I have an array of bytes which comes on the regular interval on the
I have an array of int samples ranging from 32766 to -32767. In part
I have two arrays of samples of two different audio clips. If I just
I have pcm audio stored in a byte array. It is 16 bits per
I have a Stream of audio data coming from my mic for which I
I have some audio data (raw AAC) inside a byte array for playback. During
I have a 4 mic array connected to an iMac via an external audio

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.