Skip to content

Merge develop into main#54

Closed
davidirvine wants to merge 49 commits intomainfrom
develop
Closed

Merge develop into main#54
davidirvine wants to merge 49 commits intomainfrom
develop

Conversation

@davidirvine
Copy link
Copy Markdown
Owner

No description provided.

- Replace std::vector with std::array for oscillators storage
- Add MAX_OSCILLATORS constant to prevent unbounded allocation
- Eliminate dynamic memory allocation in audio processing path
- Add oscillator_count member to track active oscillators
- Update all oscillator iteration to use index-based loops

This improves real-time audio performance by avoiding heap allocation
during audio processing, which is critical for maintaining low latency.
- Add validation for sample rate, frequencies, and oscillator count
- Throw std::invalid_argument with descriptive messages for invalid parameters
- Validate non-negative frequencies and positive sample rates
- Check oscillator count bounds against MAX_OSCILLATORS
- Add validation for animation multiplier
- Include <stdexcept> for exception handling

This prevents undefined behavior from invalid parameters and provides
clear error messages to help developers identify configuration issues.
- Add noexcept to getter methods and simple setters that cannot throw
- Mark const methods with noexcept where appropriate
- Update Range class methods with noexcept specifications
- Improve exception safety guarantees for performance-critical operations

This helps the compiler optimize better and provides clearer contract
specifications for API consumers about which operations can throw.
- Create deepnote::constants namespace for configuration values
- Define DEFAULT_LFO_AMPLITUDE, DEFAULT_DETUNE_HZ, TARGET_FREQUENCY_TOLERANCE
- Replace hard-coded magic numbers with named constants
- Update init_voice function to use DEFAULT_DETUNE_HZ constant
- Update target frequency tolerance in process_voice function

This improves code maintainability by centralizing configuration
values and making their purpose explicit through naming.
…tions

- Extract calculate_shaped_frequency for LFO processing and scaling
- Extract update_voice_state for state transition logic
- Extract constrain_frequency for frequency bounds checking
- Simplify main process_voice function to focus on orchestration
- Improve code readability and testability by separation of concerns
- Use anonymous namespace for helper functions to limit scope

This makes the code more maintainable and easier to understand by
breaking complex logic into focused, single-responsibility functions.
- Add detailed class documentation for DeepnoteVoice with usage instructions
- Document BezierUnitShaper with mathematical formula and purpose
- Add comprehensive function documentation with parameter descriptions
- Document the detuning algorithm with clear explanation
- Add examples and usage patterns in docstrings
- Explain the state machine and animation system

This improves code maintainability and helps developers understand
the complex audio processing algorithms and their intended usage.
- Add comprehensive compiler warning flags (-Wall, -Wextra, -Wpedantic, -Werror)
- Enable AddressSanitizer and UndefinedBehaviorSanitizer in debug builds
- Add optimized release builds with -O3
- Create .clang-format configuration for consistent code formatting
- Enhance .gitignore with comprehensive build artifact exclusions
- Add static analysis script for clang-format, clang-tidy, and cppcheck
- Improve development workflow with automated code quality checks

This establishes better development practices and helps catch bugs early
through static analysis and runtime sanitizers.
…encies

- Remove -Werror and -Wpedantic to avoid failures from external code
- Add more warning exclusions for common issues in external dependencies
- Remove sanitizers from default debug build to reduce development friction
- Keep reasonable warnings (-Wall -Wextra) for our own code quality

This allows the project to build successfully while still maintaining
good code quality standards for the main codebase.
fix: tone down aggressive compiler flags to work with external depend…
The issue was in the update_voice_state helper function which was
re-reading the voice state instead of using the current state passed
from the main processing loop. This caused the voice to get stuck in
PENDING_TRANSIT_TO_TARGET state instead of properly transitioning
through IN_TRANSIT_TO_TARGET to AT_TARGET.

Changes:
- Modified update_voice_state to accept current_state parameter
- Fixed enum references to use DeepnoteVoice::STATE instead of voice.STATE
- All tests now pass (10 passed, 0 failed)
Fix voice state machine bug in refactored helper functions
- Implement CI/CD workflow in .github/workflows/ci.yml for automated testing and deployment
- Enhance .gitignore to exclude generated documentation files
- Create detailed improvement suggestions in IMPROVEMENT_SUGGESTIONS.md
- Add Doxygen configuration in docs/doxygen/Doxyfile for API documentation
- Develop mainpage.md for Doxygen documentation overview
- Provide a basic usage example in docs/examples/basic_usage.cpp
- Introduce performance guide in docs/performance_guide.md for optimization strategies
…ements

feat: add CI/CD pipeline and documentation improvements
- Moved FrequencyTableIndex and VoiceIndex definitions to the nt namespace in frequencytable.hpp.
- Updated FrequencyTable to use a 2D array of frequency functions, improving encapsulation and readability.
- Simplified the get method in FrequencyTable to handle out-of-bounds indices with wrapping.
- Cleaned up oscfrequency.hpp by removing unnecessary namespace brackets.
- Adjusted test cases in freqtable.cpp for improved formatting and readability.
- Made minor formatting adjustments across various test files for consistency.
- Ensured proper inclusion of headers in voice.cpp and main.cpp.
- Updated GitHub Actions workflow to support feature branches
- Fixed Doxygen configuration and documentation paths
- Reformatted all source files to meet clang-format requirements
- Improved CI error handling and cross-platform compatibility
- Updated .gitignore to exclude generated documentation
davidirvine and others added 19 commits July 21, 2025 14:49
fix: update CI configuration to include fixing-* branch and enhance s…
fix: restore conditions for coverage and documentation jobs, update G…
spelling fix and added link to doxygen docs
* Use native github code coverage

Replace Codecov with:

lcov-reporter-action for PR comments
Custom badge generation for README coverage badges
Artifact upload to store the badge

* codeql workflow
* feat: Add comprehensive performance and real-time validation tests

- Implement real-time processing validation
  * Single voice processing speed verification (sub-100ms for 1s audio)
  * Multiple voice scaling tests (1-16 voices with CPU usage monitoring)
  * Real-time constraint validation for different voice counts

- Add memory allocation stability tests
  * Long-duration processing without dynamic allocation
  * Consistent memory usage across multiple transitions
  * Amplitude and frequency bounds verification during extended processing

- Implement stress testing
  * Rapid parameter changes with fast animation speeds
  * Extreme oscillator count testing (up to 16 oscillators)
  * High-complexity scenarios with detuning and rapid transitions

- Add performance regression detection
  * Baseline performance measurement with detailed timing statistics
  * Per-sample processing time analysis (average, median, 95th percentile, max)
  * Performance consistency across different voice states

- Fix duplicate symbol issue with inline specifier for init_voice function
- Update CMakeLists.txt to include performance_tests.cpp
- All tests pass with 606,406 assertions validating performance characteristics
- Tests maintain C++14 compatibility and realistic performance expectations

* re-formatted
* feat: Add comprehensive performance and real-time validation tests

- Implement real-time processing validation
  * Single voice processing speed verification (sub-100ms for 1s audio)
  * Multiple voice scaling tests (1-16 voices with CPU usage monitoring)
  * Real-time constraint validation for different voice counts

- Add memory allocation stability tests
  * Long-duration processing without dynamic allocation
  * Consistent memory usage across multiple transitions
  * Amplitude and frequency bounds verification during extended processing

- Implement stress testing
  * Rapid parameter changes with fast animation speeds
  * Extreme oscillator count testing (up to 16 oscillators)
  * High-complexity scenarios with detuning and rapid transitions

- Add performance regression detection
  * Baseline performance measurement with detailed timing statistics
  * Per-sample processing time analysis (average, median, 95th percentile, max)
  * Performance consistency across different voice states

- Fix duplicate symbol issue with inline specifier for init_voice function
- Update CMakeLists.txt to include performance_tests.cpp
- All tests pass with 606,406 assertions validating performance characteristics
- Tests maintain C++14 compatibility and realistic performance expectations

* feat: Add comprehensive property-based and edge case validation tests

- Implement frequency transition properties validation
  * Random parameter testing with 50 test cases across musical frequency range
  * Monotonicity property verification for ascending frequency transitions
  * Adaptive timeouts based on animation speed for reliable completion

- Add extreme parameter value testing
  * Very low frequencies (20-40Hz sub-bass range) stability validation
  * Very high frequencies (8-18kHz treble range) without aliasing issues
  * Extreme frequency ratio testing (32x increases/decreases across 5+ octaves)
  * Error tolerance validation within 10% for extreme transitions

- Implement Bezier curve parameter edge cases
  * Boundary value testing for control points (0.0-1.0 range)
  * Extreme control point combinations (linear, reverse, near-extremes)
  * Animation multiplier testing (0.5x to 10x speed variations)
  * Graceful handling of edge curve configurations

- Add detuning edge case validation
  * Extreme detune values (0Hz to ±100Hz) stability testing
  * Negative detuning support verification
  * Detuning behavior during frequency transitions with amplitude variation
  * Beat pattern validation with reasonable amplitude bounds

- Implement sample rate variation testing
  * Multi-rate support (8kHz to 192kHz) stability validation
  * Sample rate and frequency relationship verification
  * Proportional timing behavior across different sample rates

- Update CMakeLists.txt to include property_edge_tests.cpp
- All tests pass with 1,958,075 assertions validating comprehensive edge coverage
- Property-based testing with random parameter generation for robust validation
- Realistic bounds and tolerances for practical audio applications

* re-formatted
* feat: add state machine lifecycle tests for deepnote voice

* fix: improve static analysis script and enhance performance tests with additional metrics
#49)

* feat: add bezier animation tests to validate curve properties and animation accuracy

* Update test/bezier_animation_tests.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
#50)

* feat: add error robustness tests to validate system behavior under edge cases

* Fix robustness tests and improve performance guidance

- Fixed detuning boundary tests by using more reasonable extreme values (±200Hz instead of ±500Hz)
- Reduced oscillator count for extreme detuning tests to prevent excessive amplitudes
- Separated normal and extreme detuning tests for better reliability
- Updated performance guide with detuning amplitude considerations
- Added amplitude management section to performance guide
- All 34 test cases now pass with 2,197,690 total assertions

Changes ensure robustness tests are reliable in CI environments while still validating system behavior under stress conditions.

* feat: enhance boundary condition tests for detuning values and improve robustness checks

* Fix build issues in test files

- Add missing <chrono> header include to error_robustness_tests.cpp
- Suppress unused variable warnings in performance_tests.cpp with (void)output statements
- Apply clang-format styling corrections
- Fixes compilation errors that were preventing CI builds from succeeding

* fix: enable coverage job for pull requests targeting develop

- Update coverage job condition to run on develop branch pushes AND pull requests targeting develop
- This ensures coverage reports are generated during PR review process
- Coverage report comments will now appear on PRs as intended
- Badge generation remains restricted to develop branch only

* fix: update deprecated actions/upload-artifact from v3 to v4

- Replace actions/upload-artifact@v3 with @v4 to resolve CI deprecation warning
- Fixes: 'This request has been automatically failed because it uses a deprecated version of actions/upload-artifact: v3'
- Coverage badge upload will now use the supported artifact action version

* fix: update lcov-reporter-action and add pull-requests permission

- Update romeovs/lcov-reporter-action from v0.3.1 to v0.4.0 to resolve 403 permission errors
- Add pull-requests: write permission to workflow to allow coverage comments on PRs
- Fixes: 'Resource not accessible by integration' error in coverage reporting
- Ensures coverage reports can be posted as PR comments successfully
* fix: exclude test files from code coverage analysis

- Add lcov --remove patterns to exclude test directory from coverage
- Remove test/*.cpp files and doctest framework files from coverage reports
- Ensure coverage only measures production code in src/ directory
- Coverage reports will now correctly show only source code coverage, not test code

* fix: handle unused lcov exclude patterns gracefully

- Add --ignore-errors unused flag to lcov --remove command
- Combine multiple remove operations into single command for efficiency
- Fixes exit code 25 error when exclude patterns don't match any files
- Coverage job will now complete successfully even when some patterns are unused
…#53)

- Add comprehensive file header comments to all source files in src/
- Include brief description of each file's purpose and functionality
- Add complete MIT license text to ensure proper attribution
- Format all files using clang-format to maintain consistency
- Headers follow Doxygen documentation style for better tool integration

Files updated:
- src/voice/deepnotevoice.hpp: Core voice implementation
- src/voice/frequencytable.hpp: Frequency table management
- src/voice/oscfrequency.hpp: Oscillator frequency utilities
- src/ranges/range.hpp: Range constraint utilities
- src/ranges/scaler.hpp: Value scaling and mapping
- src/unitshapers/bezier.hpp: Bezier curve shaping
- src/unitshapers/linear.hpp: Linear unit shaping
- src/util/namedtype.hpp: Type-safe wrapper utilities
Copilot AI review requested due to automatic review settings July 25, 2025 21:30
Comment thread test/bezier_animation_tests.cpp Dismissed
Comment thread test/bezier_animation_tests.cpp Dismissed
Comment thread test/bezier_animation_tests.cpp Dismissed
Comment thread test/bezier_animation_tests.cpp Dismissed
Comment thread test/bezier_animation_tests.cpp Dismissed
Comment thread test/property_edge_tests.cpp Dismissed
Comment thread test/statemachine_lifecycle_tests.cpp Dismissed
Comment thread test/statemachine_lifecycle_tests.cpp Dismissed
Comment thread test/statemachine_lifecycle_tests.cpp Dismissed
Comment thread test/statemachine_lifecycle_tests.cpp Dismissed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces comprehensive testing improvements and development infrastructure enhancements to the deepnote synthesizer voice library. The changes focus on expanding test coverage, improving code quality, and providing better developer experience through documentation and examples.

  • Adds five new comprehensive test files covering voice lifecycle, performance, edge cases, error handling, and Bezier animation validation
  • Introduces development infrastructure including CI/CD pipeline, documentation generation, and static analysis tools
  • Provides usage examples and performance optimization guide for developers

Reviewed Changes

Copilot reviewed 27 out of 32 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/statemachine_lifecycle_tests.cpp State transition and lifecycle validation tests
test/property_edge_tests.cpp Property-based testing and edge case validation
test/performance_tests.cpp Real-time performance and memory allocation tests
test/error_robustness_tests.cpp Error handling and boundary condition tests
test/bezier_animation_tests.cpp Bezier curve and animation validation tests
test/voice.cpp Code formatting improvements
test/freqtable.cpp Code formatting improvements
test/CMakeLists.txt Enhanced build configuration with compiler-specific warnings
src/voice/deepnotevoice.hpp Code documentation and header improvements
src/voice/frequencytable.hpp Documentation header addition
src/voice/oscfrequency.hpp Documentation header addition
src/util/namedtype.hpp Documentation header addition
src/unitshapers/bezier.hpp Documentation and formatting improvements
src/unitshapers/linear.hpp Documentation header addition
src/ranges/range.hpp Documentation and formatting improvements
src/ranges/scaler.hpp Documentation and formatting improvements
.github/workflows/codeql.yml CodeQL security analysis workflow
docs/performance_guide.md Performance optimization guide
docs/examples/basic_usage.cpp Complete usage example
docs/doxygen/Doxyfile API documentation configuration
docs/doxygen/mainpage.md Main documentation page
scripts/static_analysis.sh Static analysis script
README.md Documentation link and typo fix
IMPROVEMENT_SUGGESTIONS.md Additional improvement recommendations
Comments suppressed due to low confidence (1)

test/CMakeLists.txt:64

  • [nitpick] Consider re-enabling sanitizers for debug builds as they are valuable for catching memory errors and undefined behavior, even if they add development friction.
# Removed sanitizer linking for now to avoid development friction

Comment thread test/statemachine_lifecycle_tests.cpp
Comment thread test/error_robustness_tests.cpp
Comment thread test/performance_tests.cpp
Comment thread src/voice/deepnotevoice.hpp
Comment thread docs/examples/basic_usage.cpp
@davidirvine davidirvine changed the title Test Merge develop into main Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants