gpt4 book ai didi

ios - CoreAudio : Ausampler Unit polyphony

转载 作者:可可西里 更新时间:2023-11-01 06:20:55 24 4
gpt4 key购买 nike

我目前正在尝试有效地使用 Ausampler Unit。我使用了苹果示例中的代码:https://developer.apple.com/library/ios/#samplecode/LoadPresetDemo/Introduction/Intro.html#//apple_ref/doc/uid/DTS40011214-Intro-DontLinkElementID_2

缺点似乎是如果相同的音符再次出现,它会立即停止音符/采样。所以如果我发送例如加载了长号预设的 midi note 60。然后拿着这个,我再次发送 note 60。它切断了第一个音符事件。有谁知道是否/如何保持每个音符直到(该特定音符的)音符关闭事件出现?

其他问题:发送后如何更改音符的音量?例如。我以 100 的力度发送了 midi note 60 和 70。虽然音符 60 仍在播放,但我想降低音量但保持音符 70。这将称为 midi 触后。

希望你能帮上忙:)

最佳答案

AUSampler (kAudioUnitSubType_Sampler) 是单音色的(referencehere )所以为了同时演奏两个相同音高的音符,你需要两个“乐器”——即实例AUSampler 的。在我的项目中,我发现这不会增加太多内存开销,因为声音资源是共享的。

至于触后 - 我还没有探索过,但看起来你想要的属性是 kAUGroupParameterID_KeyPressure_FirstKey(引用 here,也许还有 here)。

Supporting the kAUGroupParameterID_KeyPressure parameter indicates to 
hosts that your audio unit supports polyphonic "aftertouch" key pressure.

Each of the 128 MIDI key numbers can have its own value for polyphonic
aftertouch. To respond to aftertouch for a particular key, your audio
unit needs to support an additional parameter specifically for that key.
The aftertouch parameter ID for a given MIDI key is equal to the MIDI
key number plus 256. For example, the aftertouch parameter ID for MIDI
key #60 (middle C) is:

60 + kAUGroupParameterID_KeyPressure_FirstKey = 316

如果触后工作正常,请发回一些示例代码。

关于ios - CoreAudio : Ausampler Unit polyphony,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15670554/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com