I am creating one sound based application where I need to generate different oscillations for sound wave. One part that I need to achieve in this is the discontinuous or paused beep. I am trying to do this using I'm doing variations in the sine wave using Core Audio, but I'm not getting the desired output.
Basically I need to generate variable sound oscillation patterns like Dog Whistler app.
Can anyone help me in proper direction for this
have a look at my other answer how to loop background music. You can create an audio file with 0.5 sec beep and 1 sec silence and loop that file infinitely via AVAudioPlayer. As well as pausing the beep sequence via [player pause];
This will work if you have some predefined beep intervals/oscillations but not if you need 100% user customization. You can also look for sound effects to adjust the pitch and frequency.
Related
aurio_touch sample is taking input from mic,but i want to take show frequency waves while playing sound files.
Is it possible through audio_touch,if yes then how?
please reply...
The scenario is that I start the recording at in my iphone app maybe by using AVAudioRecoder and when i have some input sound above certain threshold then i will do some thing. Is it possible to process the input audio while recoding??
Is there any way to know the input loudness in iPhone. Like what is the level of the loudness in numbers or if there is any other measure for that.
Look at AVFoundation, AVAudioRecorder and enable the property meteringEnabled to get threshold change callbacks.
I am having a problem finding resources on playing an attack (start of sound) / sustain (looping sound) / decay (ending of sound) sequence with no transition breaks. Are there any good libraries for handling this, or should I roll my own with AVAudioPlayer? Is AudioQueue a better place to look? I used to use SoundEngine.cpp, but that's been long gone for a while. Is CAF still the best format to use for it?
Thanks!
From your description, it sounds as if you're trying to write a software synthesizer. The only way that you could use AVAudioPlayer for something like this would be to compose the entire duration of a note as a single WAV file and then play the whole thing with AVAudioPlayer.
To create a note sound of arbitrary duration, one that begins playing in response to a user action (like tapping a button) and then continues playing until a second user action (like tapping a "stop" button or lifting the finger off the first button) begins the process of ramping the looped region's volume down to zero (the "release" part), you will need to use AudioQueue (AVAudioPlayer can be used to play audio constructed entirely in memory, but the entire playback has to be constructed before play begins, meaning that you cannot change what is being played in response to user actions [other than to stop playback]).
Here's another question/answer that shows simply how to use AudioQueue. AudioQueue calls a callback method whenever it needs to load up more data to play - you would have to implement all the code that loops and envelope-wraps the original WAV file data.
creating your own envelope generator is very simple. the tough part will be updating your program to use lower level audio services in order to alter the signal directly.
to do this, you will need:
the audio file's samples
set up an AudioQueue (that's one approach, but i am going with it because it was mentioned in the OP, and it is relatively high level API for a user provided sample buffer)
provide a signal to the queue
determine if your program is best in realtime or pre-rendered
Realtime
Allows live variations
manage your loop points
manage your render position
be able to determine the amplitude to apply based on the sample position range you are reading
or
Prerendered
May require more memory
Requires less CPU
apply the envelope to your copy of the sample buffer
manage your render position
I also assume that you need only slow/simple transitions. If you want some crazy/fast LFO, without aliasing, you will have a lot more work to do. This approach should not produce audible aliasing unless your changes are too abrupt:
Writing a simple envelope generator (EG) is easy; check out Apple's SinSynth for a very basic EG if you need a push in that direction.
I'm recording audio using AVAudioRecorder and after recording I want to draw a wave form of the recorded audio. I've found a nice article about wave form drawing, but it first I need the frequencies at a certain sample rate as floats, right?
Do I need to do FFT on the audio and how do I do this? Is *AVAudioRecorder** even the API for this purpose? Or do I need to use some lower API to record the audio?
Hope someone can help me.
AVAudioRecorder doesn't look like it's much use for this (although it may be possible). You need to look at recording with AudioQueue.
The 'waveform' of the audio isn't the frequencies. The waveform is the value of the samples that make up the audio (you can get these when recording with an AudioQueue). FFT converts the audio samples from the time domain to the frequency domain - if you draw the output of the FFT you will have a Spectrograph instead of a waveform.
Consider aurioTouch sample application provided by Apple. I wanted to simulate a lengthy processing of the recorded audio and modified the sample by introducing a delay of 0.1 second in the render callback method: PerformThru. This leads to a distorted audio and static noise being played through iPhone's speaker or headphones. The noise is heard even when the mute button in the application is on which essentially outputs silence into AudioUnit output bus.
Can anybody give a detailed explanation what happens on the low level when the host's callback function (in our sample it is PerformThru) does not return in a timely fashion?
Why a callback function that performs poorly makes iPhone playback the noise?
I understand that the code in the callback function must be highly optimized. Still I would like to know if it is possible to prevent the noise from happening.
Is it possible to modify aurioTouch sample to make AudioUnit do just the recording and switch the playback off completely?
If you want to introduce a delay then you need to do this via buffering, not by simply delaying the callback. E.g. for 0.1 s and a 44.1 kHz sample rate you would need to buffer an additional 4410 samples. Initially you would pass 4410 0s and then start passing your buffered (delayed) samples.