ios - 如何录制钢琴?

标签 ios streaming audio-streaming icecast piano

我有一个基于触摸音调的钢琴应用程序,现在我想在其中添加录音功能。谁能指导我做到这一点。但是我需要记录下来并发送到流。

-(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
    for (int i = 0; i < [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];

    for (NSNumber* keyIndex in keys) {
        if ([audio count] > [keyIndex intValue]) {
            SystemSoundID soundID = [audio[[keyIndex intValue]] unsignedLongValue];
            AudioServicesPlaySystemSound(soundID);
        }
    } }

最佳答案

只是提供一个想法,您如何保存关键音符并记录计时器以延迟本地db。之后,使用AVAsset组合热门音频和静音音频以保存或重放。可以帮忙吗

关于ios - 如何录制钢琴?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18328044/

相关文章:

ios - UICollectionViewCell 中的自动布局宽度常量效果不佳

ios - 类型 'PlaySoundsViewController' 的值没有成员 'recordedAudio'

apache-spark - Kinesis Spark Streaming Receiver的检查点如何工作

iOS:在实时流式传输 (HLS) 中是否可以进行缓冲

audio-streaming - Icecast 和 Darkice 的高音频延迟

azure - 使用Azure媒体服务进行实时音频编码

iphone - 使用 CoreText 对齐段落

ios - 为什么我不能直接设置一些类属性?

.net - 如何将 System.Data.Linq.Binary 转换为流?

android - 在单独的 Android 设备上同步播放音频