Synthesizing music from sample wav files

edited May 2013

Hi, I want to synthesize music with some given wav files on iOS.
The wav files don't cover all the notes so I figure pitch shifting is required to get them to the right pitch.
I think for pitch shifting I can try to use an Audio Unit?

I made one using something like this:

AEAudioUnitFilter *pitch = [[AEAudioUnitFilter alloc] initWithComponentDescription:AEAudioComponentDescriptionMake(kAudioUnitManufacturer_Apple, kAudioUnitType_FormatConverter,kAudioUnitSubType_NewTimePitch) audioController:_audioController error:&error];

AudioUnitSetParameter(pitch.audioUnit, kAudioUnitScope_Global, 0, kNewTimePitchParam_Pitch, 800, 0);

[self.audioController addChannels:@[_audioFilePlayer]];
[_audioController addFilter:pitch toChannel:_audioFilePlayer];

but for some reason the wav file plays once and then again with the audio unit applied to it. I think. I'm not sure what's happening but that's what it sounds like. I don't know what parameters I can pass into the kNewTimePitchParam_Pitch as well.

the other issue is the time. The wav file is only a fraction of a second long, how would I extend it to be longer or shorter?

Comments

  • Have a look at the AUSampler (kAudioUnitSubType_Sampler), which does what you want. You can also load it from a SoundFont file or an .aupreset file with the relevant sample files and zones.

  • AudioUnitSetParameter(pitch.audioUnit,kNewTimePitchParam_Pitch, kAudioUnitScope_Global, 0, 800, 0);
Sign In or Register to comment.