Commit graph

838 commits

Author SHA1 Message Date
UnknownSuperficialNight
af210a67cc Fix agc_disable benchmark 2024-10-02 04:57:05 +13:00
UnknownSuperficialNight
ef602860ba Trigger CI checks 2024-10-02 04:49:44 +13:00
UnknownSuperficialNight
e2ee86e4b9 Fix unused arc import 2024-10-02 04:46:21 +13:00
UnknownSuperficialNight
fd94703dc7 Merge branch 'master' into feature/automatic-gain-control 2024-10-02 04:42:23 +13:00
UnknownSuperficialNight
3ce64ef53f Add experimental flag to enabled dynamic controls 2024-10-02 04:31:16 +13:00
UnknownSuperficialNight
db0bfb09d3 Add better documentation for AutomaticGainControl's Implementations 2024-10-02 00:53:22 +13:00
UnknownSuperficialNight
cb85bce7ae Enforce RMS_WINDOW_SIZE is a power of two at compile time 2024-10-01 22:35:23 +13:00
David Kleingeld
1d95a5ca45
Merge pull request #602 from iluvcapra/synth-waveforms
Synthesizer Waveforms
2024-10-01 10:37:10 +02:00
UnknownSuperficialNight
3e4bf8b12b Implement thread-safe parameter control for AGC using AtomicF32
- Replace static parameters with AtomicF32 for thread-safe access
- Add methods to get Arc<AtomicF32> for release_coeff, attack_coeff, absolute_max_gain, and target_level
- Enable real-time modification of AGC parameters during playback
- Use Ordering::Relaxed for optimal low-latency performance
- Remove set_* methods in favor of direct atomic access
- Update internal methods to use atomic loads consistently

This change allows for dynamic adjustment of AGC parameters
without interrupting audio playback, improving real-time control
and responsiveness of the Automatic Gain Control system.
2024-10-01 20:29:22 +13:00
Jamie Hardt
135024650e rustfmt 2024-09-30 22:02:46 -07:00
Jamie Hardt
322bdd5f5f Rustfmt and a doc comment 2024-09-30 21:59:44 -07:00
Jamie Hardt
a1fa144f57 Adding renamed signal_generator.rs 2024-09-30 21:50:30 -07:00
Jamie Hardt
8899e6709f Renamed TestWaveform to SignalGenerator 2024-09-30 21:45:30 -07:00
UnknownSuperficialNight
86cb156e47 Refactor CircularBuffer to use heap allocation to avoid large stack usage
- Updated CircularBuffer implementation to allocate on the heap instead of the stack to prevent excessive stack usage (32KB) which can lead to stack overflow issues.
- Optimized index wrapping logic using bitwise operations, leveraging the fact that RMS_WINDOW_SIZE is a power of two for improved efficiency.
2024-10-01 13:56:28 +13:00
David Kleingeld
15cca73388
Add dependency notice (libalsa on linux) to readme 2024-10-01 02:35:16 +02:00
UnknownSuperficialNight
42fe8320aa Enhance automatic_gain_control documentation
- Add references to get_agc_control method in automatic_gain_control docs
- Include a quick start example demonstrating usage of get_agc_control
2024-10-01 02:28:13 +13:00
UnknownSuperficialNight
b59533e382 Add new benchmark for disabled_agc 2024-10-01 00:50:45 +13:00
UnknownSuperficialNight
2442aa09e8 Add real-time toggle for AGC processing
Implement get_agc_control() to allow dynamic enabling/disabling of AGC
during audio playback.
2024-10-01 00:45:48 +13:00
UnknownSuperficialNight
68e1bd21c0 Pass min_attack_coeff directly 2024-09-30 20:09:05 +13:00
UnknownSuperficialNight
a8a443ba51 Enhance AGC stability and flexibility
- Increase RMS_WINDOW_SIZE for more stable measurements of very low frequencies
- Replace MIN_ATTACK_COEFF with release_coeff for improved customizability

These changes provide better handling of low-frequency content and allow
developers more control over AGC behavior, particularly in attack/release
time adjustments.
2024-09-30 19:46:46 +13:00
Jamie Hardt
44cb217d48 Code review changes 2024-09-29 16:45:29 -07:00
UnknownSuperficialNight
9bf97acfa6 Update benchmark to new default values 2024-09-30 12:44:55 +13:00
Jamie Hardt
9d20ea21f1 One more tweak for rustfmt 2024-09-29 16:23:52 -07:00
Jamie Hardt
371bbda49e Some cosmetic changes for rustfmt 2024-09-29 16:18:42 -07:00
Jamie Hardt
5fa0188cc3 Added signal_generator.rs example 2024-09-29 16:15:41 -07:00
Jamie Hardt
b373f5253a Moved "noise" feature documentation
...into the previous "Optional Features" block
2024-09-29 16:02:07 -07:00
Jamie Hardt
09c5f31435 Merge branch 'master' of https://github.com/RustAudio/rodio into synth-waveforms 2024-09-29 15:44:13 -07:00
Jamie Hardt
56fcce74f3 Fixed a typo from @UnknownSuperficialNight 2024-09-29 15:40:36 -07:00
UnknownSuperficialNight
beeacf6e4a Added agc to CHANGELOG.md 2024-09-29 19:07:30 +13:00
UnknownSuperficialNight
1d2a6fdc94 Removed bullet point from docs 2024-09-29 15:52:33 +13:00
UnknownSuperficialNight
f4bb729235 Added benchmark for agc and inlines 2024-09-29 15:03:58 +13:00
UnknownSuperficialNight
d4a09f3f0b Merge branch 'master' into feature/automatic-gain-control 2024-09-29 13:40:12 +13:00
UnknownSuperficialNight
28b3c4b80c Removed MAX_PEAK_LEVEL now uses target_level as intended and styled documentation 2024-09-29 13:36:55 +13:00
github-actions[bot]
2e5fc2e312
fmt 2024-09-29 02:00:59 +02:00
github-actions[bot]
97befac520
Adds benchmarks for effects and type conversions
Benchmarks use the music.wav file, we use *divan* as benchmark harnass.
The time needed to load the wav file is excluded from the benchmark
by preparing the data into a special test Source. That source also
enables converting between formats.

In the future *divan* will add support for structured (json) output.
Then we could integrate with the bencher service to generate benchmark
reports for all PR's and keep a timeseries of performance.
2024-09-29 01:58:31 +02:00
github-actions[bot]
a4e12d09b3
add section on features, decribe tracing feature 2024-09-28 13:59:15 +02:00
UnknownSuperficialNight
ce3d7e0bd2 Optimize AGC with CircularBuffer and enhance functionality
- Replace Vec-based RMS calculation with efficient CircularBuffer
- Add separate release_time for asymmetric gain control
- Implement MAX_PEAK_LEVEL constant to prevent clipping
- Revise gain calculation logic:
  • Separate RMS and peak gain calculations
  • Use RMS for general adjustments, peak for limiting
  • Implement smoother transitions between gain levels
  • Improve handling of edge cases (e.g., zero RMS)
- Improve code organization and documentation
2024-09-28 23:47:34 +12:00
UnknownSuperficialNight
d9f7967fd2 Better document comments for docs.rs 2024-09-28 17:19:13 +12:00
UnknownSuperficialNight
1b27bcd335 Add debug logging for AGC current gain value 2024-09-28 13:52:42 +12:00
UnknownSuperficialNight
9497f5c9c2 Merge branch 'master' into feature/automatic-gain-control 2024-09-28 13:23:52 +12:00
github-actions[bot]
95a466e03a
use tracing (if enabled) for stream error + sink fmt 2024-09-28 02:44:58 +02:00
github-actions[bot]
1a7b8e5e8f
adds optional tracing 2024-09-28 02:41:44 +02:00
UnknownSuperficialNight
97636d163e Add author credit to AGC implementation 2024-09-28 11:15:46 +12:00
UnknownSuperficialNight
611055c62d Enhance AGC with asymmetric attack/release and safety limits
- Implement asymmetric attack/release
- Introduce MIN_ATTACK_TIME limit to prevent AGC instability
- Clamp attack_time to prevent instability
- Faster decrease, slower increase for smoother sound
- Safeguard against extreme gain fluctuations
2024-09-27 15:27:35 +12:00
UnknownSuperficialNight
6b62544cde Added simple flag to enable the debug temporarily during development 2024-09-27 13:04:48 +12:00
UnknownSuperficialNight
625d0f27b5 Updated comments, refactored logic & added more member functions for simplicity 2024-09-27 10:35:44 +12:00
UnknownSuperficialNight
85bfcbd40c Init commit for automatic_gain_control 2024-09-27 06:41:08 +12:00
github-actions[bot]
58b61f66ff
Doc/Api note that a returning None means the end of the sound 2024-09-24 23:35:06 +02:00
github-actions[bot]
e116660568
docs: add missing + fix docs in wrong place 2024-09-17 00:06:23 +02:00
github-actions[bot]
22d90e71d8
Docs: Added where missing corrected where wrong
Specifically the documentation for
 - UniformSourceIterator was incomplete it did not mention that it can
   change the sample type
2024-09-16 18:52:19 +02:00