ios - 如何使用 Superpowered 从麦克风进行实时音高转换?
<p><div>
<aside class="s-notice s-notice__info post-notice js-post-notice mb16"role="status">
<div class="d-flex fd-column fw-nowrap">
<div class="d-flex fw-nowrap">
<div class="flex--item wmn0 fl1 lh-lg">
<div class="flex--item fl1 lh-lg">
<b>这个问题在这里已经有了答案</b>:
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我做了以下事情:</p>
<pre><code>static bool audioProcessing(void *clientdata,
float **buffers,
unsigned int inputChannels,
unsigned int outputChannels,
unsigned int numberOfSamples,
unsigned int samplerate,
uint64_t hostTime) {
__unsafe_unretained Superpowered *self = (__bridge Superpowered *)clientdata;
SuperpoweredAudiobufferlistElement inputBuffer;
inputBuffer.startSample = 0;
inputBuffer.samplesUsed = 0;
inputBuffer.endSample = numberOfSamples;
inputBuffer.buffers = SuperpoweredAudiobufferPool::getBuffer((unsigned int) (numberOfSamples * 8 + 64));
inputBuffer.buffers = inputBuffer.buffers = inputBuffer.buffers = NULL;
SuperpoweredInterleave(buffers, buffers, (float *)inputBuffer.buffers, numberOfSamples);
self->timeStretcher->process(&inputBuffer, self->outputBuffers);
// Do we have some output?
if (self->outputBuffers->makeSlice(0, self->outputBuffers->sampleLength)) {
while (true) { // Iterate on every output slice.
// Get pointer to the output samples.
int numSamples = 0;
float *timeStretchedAudio = (float *)self->outputBuffers->nextSliceItem(&numSamples);
if (!timeStretchedAudio || *timeStretchedAudio == 0) {
break;
}
SuperpoweredDeInterleave(timeStretchedAudio, buffers, buffers, numSamples);
}
// Clear the output buffer list.
self->outputBuffers->clear();
}
return true;
}
</code></pre>
<p>这在改变速度时也可能无法正常工作,但我只想要实时音高变换。人们应该能够自己说得慢或快。</p></p>
<p style="font-size: 20px;">关于ios - 如何使用 Superpowered 从麦克风进行实时音高转换?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/47222165/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/47222165/
</a>
</p>
页:
[1]