ios - How to record Piano? -
i have piano app touch based tones , want put recording feature in it. can guide me this. need record , send stream.
-(void) viewdidload { [super viewdidload]; [keyboardview setvisiblekeyrange: nsmakerange(48, 5)]; if (audio == nil) { [self setaudio:[nsmutablearray arraywithcapacity:0]]; } [drawingview setshowoutsideledger:yes]; nsstring* plistpath = [[nsbundle mainbundle] pathforresource:@"keyboardlayout" oftype:@"plist"]; nsarray* names = [nsarray arraywithcontentsoffile:plistpath]; // load audio (int = 0; < [names count]; i++) { systemsoundid soundid; audioservicescreatesystemsoundid((__bridge cfurlref)[nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:names[i] oftype:@"aif"]], &soundid); nsnumber* audioid = @(soundid); [audio addobject:audioid]; } [[self keyboardview] setdelegate:self]; [[self octaveselectionview] setdelegate:self]; } - (void) keyspressed:(nsset *)keys { nslog(@"keyspressed=%d", [keys count]); [drawingview addnotes:keys]; (nsnumber* keyindex in keys) { if ([audio count] > [keyindex intvalue]) { systemsoundid soundid = [audio[[keyindex intvalue]] unsignedlongvalue]; audioservicesplaysystemsound(soundid); } } }
just give idea how save key hit note , record timer delay on local db. after using avasset combine hit audio , mute audio save or replay back. may help
Comments
Post a Comment