MIT License

项目介绍

fulldecent/FDSoundActivatedRecorder 是一个托管在 GitHub 上的开源项目,主要使用 Swift 编写,采用 MIT License 许可证,目前获得 299 个 Star、62 次 Fork。

仓库全名
fulldecent/FDSoundActivatedRecorder
开源许可证
MIT License
Star 数
299
Fork 数
62

README 摘要

FDSoundActivatedRecorder Example Clone the repo and open Example/Example.xcodeproj. Run the Example scheme on a recent iPhone simulator. Installation Add this package with Swift Package Manager. In Xcode that is File > Add Package Dependencies... Development Run the package tests on an iPhone simulator. Package.swift requires iOS 16 and the library records through AVFoundation, so the destination is a simulator…

完整内容见 GitHub 原始 README 或本页 。

常见问题

FDSoundActivatedRecorder 用什么语言开发?

主要使用 Swift 编写,采用 MIT License 许可证,目前有 299 个 Star。

FDSoundActivatedRecorder 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 FDSoundActivatedRecorder 的源码?

可以直接克隆仓库:git clone https://github.com/fulldecent/FDSoundActivatedRecorder.git,默认分支为 main;安装与运行步骤见仓库 README。

FDSoundActivatedRecorder 最近还在维护吗?

仓库最近一次更新为 3 周前,当前没有未关闭的 Issue;Star 数为 299,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Start recording when the user speaks

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
437
价值分
199
活跃状态
活跃

语言占比

Swift

Release

README

FDSoundActivatedRecorder

Test Lint

 * V
 * O                 /-----------\
 * L                /             \
 * U          Rise /               \ Fall
 * M              /                 \
 * E  -----------/                   \-----------
 *
 *       Quiet   |   Recorded file   |   Quiet

Example

Clone the repo and open Example/Example.xcodeproj. Run the Example scheme on a recent iPhone simulator.

Installation

Add this package with Swift Package Manager. In Xcode that is File > Add Package Dependencies…

Development

Run the package tests on an iPhone simulator. Package.swift requires iOS 16 and the library records through AVFoundation, so the destination is a simulator. This is the same command .github/workflows/ci.yml runs, with the simulator chosen from the ones installed on this Mac:

UDID=$(xcrun simctl list devices available | awk -F '[()]' '/iPhone/ { print $2; exit }')
xcodebuild -scheme FDSoundActivatedRecorder -destination "id=$UDID" test

Maintenance and dependency updates

Do this every quarter, and send a pull request when an update is safe. The list is the one in Swift 6 Module Template, applied to the files this repository actually has:

  1. Review the external Actions in .github/workflows/ci.yml and the xcode-27 runner image. GitHub-supported Actions (the actions/ organization) need a short review.
  2. Re-read Swift 6 Module Template at the release in References. When a newer release is published, adopt it and update that citation in the same change.

License

FDSoundActivatedRecorder is available under the MIT license. See the LICENSE file for more information.

Features

  • You can start recording when sound is detected
  • Sound stops recording when the user is done talking
  • Works with ARC and iOS 16+

Usage

Import the project with:

import FDSoundActivatedRecorder

Then begin listening with:

self.recorder = FDSoundActivatedRecorder()
self.recorder.delegate = self
self.recorder.startListening()

A full implementation example is provided in this project.

Regular recorder

If you want to use it as a regular recorder, without trimming the audio, you can tweak the Configuration to achieve that.

Full API

The full API, from FDSoundActivatedRecorder.swift is copied below:

// FIXME: PASTE HERE

Technical discussion

This library is tuned for human speech detection using Apple retail iOS devices in a quiet or noisy environement. You are welcome to tune the audio detection constants of this program for any special needs you may have. Following is a technical description of how the algorithm works from FDSoundActivatedRecorder.swift.

 * V
 * O                 /-----------\
 * L                /             \
 * U          Rise /               \ Fall
 * M              /                 \
 * E  -----------/                   \-----------
 *
 *       Quiet   |   Recorded file   |   Quiet
  • We listen and save audio levels every INTERVAL
  • When several levels exceed the recent moving average by a threshold, we record
  • (The exceeding levels are not included in the moving average)
  • When several levels deceed the recent moving average by a threshold, we stop recording
  • (The deceeding levels are not included in the moving average)

References

  1. The Example app is one application target, package tests use Swift Testing, and the Example, Installation, Development, and maintenance sections follow Swift 6 Module Template release 16.5.0 (2026-10-09), commit 558b339.
  2. From that release, .github/workflows/ci.yml runs on the GitHub-hosted xcode-27 image and checks out with actions/checkout@v7. The template’s macOS job is .github/workflows/swiftlang-workflows.yml. macos-26 stops at Xcode 26. The test command stays xcodebuild against an iPhone simulator, because this package imports AVFoundation and declares .iOS(.v16).
  3. Deltas from that release, kept because this library records on iOS:
    • Package.swift stays swift-tools-version: 6.0 and .iOS(.v16). The library does not enable ApproachableConcurrency. The Example app stays on iOS 16.6. The template package is swift-tools-version: 6.4 with that upcoming feature, and it has no platform restriction.
    • .github/workflows/build-test.yml builds a release-mode Linux library and .github/workflows/release.yml publishes it with Release Please. This repository keeps the changelog and the release steps in CONTRIBUTING.md. Swift Package Manager installs this library from the git tag.
    • The template also builds Linux, Windows, Wasm, and Embedded Swift. Those jobs do not build this package. Soundness in that workflow expects a Swift 6.4 image. This repository does not run it.
    • .gitignore already inlines Swift.gitignore, which is the ignore file that release vendors.
    • lint.yml, .editorconfig, .markdownlint.json, .markdownlintignore, and .prettierignore follow swift6-module-template release 16.6.0. Prettier checks files that are not Markdown. markdownlint checks Markdown. The commands are in that template’s Development section.

评论

暂无评论