Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>- (void)modifySpeedOf:(CFURLRef)inputURL byFactor:(float)factor andWriteTo:(CFURLRef)outputURL { ExtAudioFileRef inputFile = NULL; ExtAudioFileRef outputFile = NULL; AudioStreamBasicDescription destFormat; destFormat.mFormatID = kAudioFormatLinearPCM; destFormat.mFormatFlags = kAudioFormatFlagsCanonical; destFormat.mSampleRate = 44100 * factor; destFormat.mBytesPerPacket = 2; destFormat.mFramesPerPacket = 1; destFormat.mBytesPerFrame = 2; destFormat.mChannelsPerFrame = 1; destFormat.mBitsPerChannel = 16; destFormat.mReserved = 0; ExtAudioFileCreateWithURL(outputURL, kAudioFileCAFType, &amp;destFormat, NULL, kAudioFileFlags_EraseFile, &amp;outputFile); ExtAudioFileOpenURL(inputURL, &amp;inputFile); //find out how many frames is this file long SInt64 length = 0; UInt32 dataSize2 = (UInt32)sizeof(length); ExtAudioFileGetProperty(inputFile, kExtAudioFileProperty_FileLengthFrames, &amp;dataSize2, &amp;length); SInt16 *buffer = (SInt16*)malloc(kBufferSize * sizeof(SInt16)); UInt32 totalFramecount = 0; AudioBufferList bufferList; bufferList.mNumberBuffers = 1; bufferList.mBuffers[0].mNumberChannels = 1; bufferList.mBuffers[0].mData = buffer; // pointer to buffer of audio data bufferList.mBuffers[0].mDataByteSize = kBufferSize * sizeof(SInt16); // number of bytes in the buffer while(true) { UInt32 frameCount = kBufferSize * sizeof(SInt16) / 2; // Read a chunk of input ExtAudioFileRead(inputFile, &amp;frameCount, &amp;bufferList); totalFramecount += frameCount; if (!frameCount || totalFramecount &gt;= length) { //termination condition break; } ExtAudioFileWrite(outputFile, frameCount, &amp;bufferList); } free(buffer); ExtAudioFileDispose(inputFile); ExtAudioFileDispose(outputFile); } </code></pre> <p>it will change pitch based on factor</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload