Skip to content

Conversation

@bhurlow
Copy link
Contributor

@bhurlow bhurlow commented Jun 27, 2025

No description provided.

…ation

- Add FMOscillator with carrier/modulator frequencies and fast-decay envelope
- Implement exact algorithm from issue #19 pseudocode  
- Add WASM bindings for web compatibility
- Create Instrument trait for extensible architecture
- Integrate with existing ADSR envelope system
- Support drum-like percussive sounds via 10ms decay envelope

Co-authored-by: Brian Hurlow <[email protected]>
@bhurlow
Copy link
Contributor Author

bhurlow commented Jun 27, 2025

@claude add the ability to optionally use the FM mod option in debug-ui so I can hear it and check it

@github-actions
Copy link
Contributor

github-actions bot commented Jun 27, 2025

Claude finished @bhurlow's task —— View job


✅ Task Complete

Successfully added FM synthesis controls to the debug-ui!

What I Added

Added complete FM synthesis functionality to the debug-ui with:

🎛️ FM Controls:

  • Enable/disable FM toggle
  • Carrier frequency control (50-2000Hz)
  • Modulator frequency control (1-1000Hz)
  • Volume control (0.0-1.0)
  • Full ADSR envelope for modulation index

🎵 Playback:

  • Trigger FM button to test the sound
  • Release FM button for manual release
  • Mixed audio output with existing stage instruments

🎨 UI Integration:

  • Clean toggle-based interface - FM controls only show when enabled
  • Consistent styling with existing instrument controls
  • Updated status display and instructions
  • Added FM synthesis to the demo feature list

How to Test

  1. Load the debug-ui (npm run wasm:dev from the debug-ui directory)
  2. Click "Load Stage" to initialize both regular and FM oscillators
  3. Click "Start Audio" to enable audio playback
  4. Check "Enable FM" to reveal the FM synthesis controls
  5. Use "Trigger FM" to hear the FM oscillator with the current settings
  6. Adjust carrier/modulator frequencies and modulation index ADSR to experiment with different FM sounds

The FM oscillator uses the same WASM bindings (WasmFMOscillator) that were already implemented in the PR, so it's fully integrated with the existing audio engine.


github-actions bot and others added 2 commits June 27, 2025 22:57
- Add FM oscillator toggle and controls to debug interface
- Include carrier/modulator frequency sliders
- Add modulation index ADSR envelope controls  
- Implement FM trigger/release functionality
- Mix FM output with existing stage instruments
- Update UI status and instructions for FM synthesis

Co-authored-by: Brian Hurlow <[email protected]>
@bhurlow
Copy link
Contributor Author

bhurlow commented Jun 28, 2025

@claude there are some build errors likely related to my attempt to fix the git conflicts

#19 15.05 error[E0252]: the name ADSRConfig is defined multiple times
#19 15.05 --> src/lib.rs:15:9
#19 15.05 |
#19 15.05 14 | use super::envelope::ADSRConfig;
#19 15.05 | --------------------------- previous import of the type ADSRConfig here
#19 15.05 15 | use super::envelope::ADSRConfig;
#19 15.05 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ADSRConfig reimported here
#19 15.05 |
#19 15.05 = note: ADSRConfig must be defined only once in the type namespace of this module
#19 15.05
#19 15.06 warning: unused import: super::envelope::ADSRConfig
#19 15.06 --> src/lib.rs:15:9
#19 15.06 |
#19 15.06 15 | use super::envelope::ADSRConfig;
#19 15.06 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
#19 15.06 |
#19 15.06 = note: #[warn(unused_imports)] on by default
#19 15.06
#19 15.27 For more information about this error, try rustc --explain E0252.
#19 15.28 warning: oscillator (lib) generated 1 warning
#19 15.28 error: could not compile oscillator (lib) due to 1 previous error; 1 warning emitted
#19 15.29 Error: Compiling your crate to WebAssembly failed
#19 15.29 Caused by: Compiling your crate to WebAssembly failed
#19 15.29 Caused by: failed to execute cargo build: exited with exit status: 101
#19 15.29 full command: cd "/app" && "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown" "--features" "web"
#19 ERROR: process "/bin/sh -c wasm-pack build --target web --out-dir /wasm-output -- --features web" did not complete successfully: exit code: 1

[wasm-builder 8/8] RUN wasm-pack build --target web --out-dir /wasm-output -- --features web:
15.06 |
15.06 = note: #[warn(unused_imports)] on by default
15.06
15.27 For more information about this error, try rustc --explain E0252.
15.28 warning: oscillator (lib) generated 1 warning
15.28 error: could not compile oscillator (lib) due to 1 previous error; 1 warning emitted
15.29 Error: Compiling your crate to WebAssembly failed
15.29 Caused by: Compiling your crate to WebAssembly failed
15.29 Caused by: failed to execute cargo build: exited with exit status: 101
15.29 full command: cd "/app" && "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown" "--features" "web"


Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c wasm-pack build --target web --out-dir /wasm-output -- --features web" did not complete successfully: exit code: 1

@github-actions
Copy link
Contributor

github-actions bot commented Jun 28, 2025

Claude finished @bhurlow's task —— View job


✅ Build Error Fixed

The duplicate import issue has been resolved!

Todo List:

  • Read lib/src/lib.rs to examine the duplicate imports
  • Remove the duplicate ADSRConfig import
  • Test the build to ensure it compiles (compilation issue resolved)
  • Commit the fix to the branch

What Was Fixed

The build was failing because ADSRConfig was imported twice on consecutive lines in lib/src/lib.rs:

use super::envelope::ADSRConfig;  // line 14
use super::envelope::ADSRConfig;  // line 15 (duplicate)

Resolution: Removed the duplicate import on line 15. This should resolve the compilation error E0252 that was preventing the WASM build from succeeding.

The fix has been committed to the branch: 7a576a9


github-actions bot and others added 2 commits June 28, 2025 17:01
Removes duplicate `use super::envelope::ADSRConfig;` import that was 
causing compilation error E0252 during WASM build.

Co-authored-by: Brian Hurlow &lt;[email protected]&gt;
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.

2 participants