Welcome to the documentation for FDSoundActivatedRecorder!
What is FDSoundActivatedRecorder?
FDSoundActivatedRecorder is a powerful audio recording library for iOS that allows you to record audio only when a specific sound level or frequency threshold is reached. It provides a hassle-free way to implement sound-activated recording functionality into your iOS applications.
Features
- Record audio only when a specific sound level or frequency threshold is reached.
- Efficient and lightweight library, designed for easy integration.
- Configurable sound level and frequency thresholds.
- Option to record continuously or in short clips based on sound activation.
- Customizable to meet specific project requirements.
Installation
To install FDSoundActivatedRecorder into your iOS project, follow these steps:
- Download the latest version of the library from the GitHub repository.
- Drag and drop the FDSoundActivatedRecorder.xcodeproj file into your Xcode project.
- In your Xcode project settings, select your main target, then go to the “General” tab, and add FDSoundActivatedRecorder under the “Frameworks, Libraries, and Embedded Content” section.
- In your target’s “Build Settings,” add “@import FDSoundActivatedRecorder” to the “Import Paths” setting.
- Congratulations! Now you’re ready to start using FDSoundActivatedRecorder.
Usage
Using FDSoundActivatedRecorder is straightforward. Follow these steps to get started:
- Create an instance of `FDSoundActivatedRecorder` in your view controller or desired class.
- Set the desired sound level or frequency threshold using the provided properties.
- Implement the delegate methods from `FDSoundActivatedRecorderDelegate` to handle various events such as sound activation and recording completion.
- Call the `startRecording()` method to begin recording when the sound threshold is reached.
- Optionally, call the `stopRecording()` method to manually stop the recording.
Examples
Here are a few examples to showcase how to use FDSoundActivatedRecorder:
import FDSoundActivatedRecorder
class ViewController: UIViewController, FDSoundActivatedRecorderDelegate {
var recorder: FDSoundActivatedRecorder?
override func viewDidLoad() {
super.viewDidLoad()
// Initialize the recorder
recorder = FDSoundActivatedRecorder()
// Set sound activation threshold
recorder?.soundActivationLevel = 0.5
// Set delegate
recorder?.delegate = self
}
// Delegate method called when sound activation threshold is reached
func soundActivatedRecorderDidStartRecording(_ recorder: FDSoundActivatedRecorder) {
// Perform desired actions on sound activation
}
// Delegate method called when recording is completed
func soundActivatedRecorderDidFinishRecording(_ recorder: FDSoundActivatedRecorder, with audioData: Data?) {
// Handle recorded audio data
}
// Start recording when a button is tapped
@IBAction func startRecordingButtonTapped(_ sender: UIButton) {
recorder?.startRecording()
}
// Stop recording when a button is tapped
@IBAction func stopRecordingButtonTapped(_ sender: UIButton) {
recorder?.stopRecording()
}
}
Documentation
For detailed usage instructions and API reference, please refer to the official GitHub repository.
Contributing
If you’d like to contribute to FDSoundActivatedRecorder, simply fork the repository, make your changes, and submit a pull request. Any contributions are welcome and greatly appreciated!
License
FDSoundActivatedRecorder is available under the MIT license. See the LICENSE file for more information.