【问题标题】:audio synthesis with MoMu STK使用 MoMu STK 进行音频合成
【发布时间】:2011-11-10 08:27:45
【问题描述】:

有人在 iOS 上使用 MoMu STK 成功实现了 Instrument 吗?我对 Instrument 的流的初始化有点困惑。 我正在使用教程代码,看起来缺少一些东西

RtAudio DAC; // 计算 StkFloat 中有多少字节并设置 RtAudio 流。 RtAudio::StreamParameters 参数; 参数.deviceId = dac.getDefaultOutputDevice(); 参数.nChannels = 1; RtAudioFormat 格式 = ( sizeof(StkFloat) == 8 ) ? RTAUDIO_FLOAT64:RTAUDIO_FLOAT32; 无符号整数 bufferFrames = RT_BUFFER_SIZE; dac.openStream( & 参数, NULL, 格式, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data );

错误描述说输出设备的输出参数无效,但是当我跳过分配设备ID时,它就不能正常工作。 任何想法都会很棒。

【问题讨论】:

    标签: c++ ios core-audio


    【解决方案1】:

    RtAudio 仅适用于桌面应用,在 iOS 上实现时无需打开流。

    示例:

    头文件:

    #import "Simple.h"
    
    // make struct to hold 
    
    struct TickData {
    
        Simple *synth;    
    
    };
    
    // Make instance of the struct in @interface= 
    TickData data;
    

    实现文件:

    // init the synth:
    data.synth = new Simple();
    data.synth->keyOff();
    
    // to trigger note on/off:
    data.synth->noteOn(frequency, velocity);
    data.synth->noteOff(velocity);
    
    // audio callback method:
    for (int i=0; i < FRAMESIZE; i++) {
        buffer[i] = data.synth -> tick();
    }
    

    【讨论】:

      【解决方案2】:

      是的,我在商店中有几个运行 STK 类的应用程序。请记住,在 iOS 上运行 STK 所需的设置与在桌面上运行它所需的设置不同。

      这里有一个关于如何在 iOS 应用中使用 STK 类的教程: https://arielelkin.github.io/articles/mandolin

      【讨论】:

      • 此链接似乎已过期
      猜你喜欢
      • 2012-02-01
      • 2020-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-20
      • 1970-01-01
      • 2016-02-05
      • 2011-03-08
      相关资源
      最近更新 更多