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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:41:58+00:00 2026-05-26T01:41:58+00:00

I am making an iPhone app which includes tutorials on guitar scales. The goal

  • 0

I am making an iPhone app which includes tutorials on guitar scales. The goal is that I have many sounds that my function plays, until the scale is done.

Here is a random scale: F G A B C D E. I recorded sounds like C.mp3, D, E, F, G, A, B, C2, D2, E2… 2 being an higher note. Here is the code I use :

- (IBAction) playScale {

    NSLog(@"s: %i", s);
    NSLog(@"p: %i", pressed);
    [self.player prepareToPlay];

    components = [self.scale componentsSeparatedByString:@", "];
    ns_NoteToPlay = [components objectAtIndex:s];
    NSString *path = [[NSBundle mainBundle] pathForResource:ns_NoteToPlay ofType:@"m4a"];
    NSLog(@"Path : %@", path);
    self.player.delegate = self;
    self.player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    [self.player play];
    mChord.text = ns_NoteToPlay;

    NSLog(@"Nombre de notes ds Array : %i", components.count);

    if ( s == 0) { 
        int clean;
        clean = components.count + 1;
        [NSTimer scheduledTimerWithTimeInterval:clean target:self selector:@selector(cleanDots) userInfo:nil repeats:NO];
    }

    nsNowPlayingNote = ns_NoteToPlay;
    [self instrument];
    s = s+1;



    if ((s < components.count) && (pressed == 0)) {
        [self performSelector:@selector(playScale) withObject:nil afterDelay:0.8];    
    } 


}

This works. The function plays the scale, but I can’t find a way to tell when to call the higher note C2. In consequence, when it plays D then C, C should be C2, but still calls C, which is lower.

  • 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-26T01:41:59+00:00Added an answer on May 26, 2026 at 1:41 am

    You could keep around an array of NSStrings which contain the name of your files, something like:

    [NSArray arrayWithObjects:@"C", @"D"..., @"C2", @"D2", nil]
    

    And then you could keep an int variable around that you use to iterate through the array.

    As a side note, are you sure AVAudioPlayer is the right choice to play your sounds? You should at least have a look into AudioServicesPlaySystemSound(), which is more appropriate to play short sounds.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi similar to the facebook and iphone app, i have an @ function which
I am making an application (iPhone app) which gets information (jokes) from an RSS
I'm making an iPhone app that has information about different video games. How can
I am making a iPhone app that has two different targets. They use the
I'm currently making an iPhone app that has PDF viewing a crucial part of
Hey, so I'm making an iPhone app and in there is a common function
I am making an iPhone app which uses UIButton s with Placeholder text on
I am making an iPhone app which needs to send a couple of arrays
I am making an iPhone app in which on one of the UIWebView I
I am making an iPhone app which has ASCII art. I face a problem

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.