# Ear Training Tool - Setup Guide ## Overview This guide will help you set up the Interactive Frequency Trainer in Obsidian with live Strudel code execution. ## Prerequisites ### Required Obsidian Plugins 1. **LiveCoding Plugin** (Recommended) - Install from Community Plugins - Specifically designed for live coding environments like Strudel - Supports real-time audio synthesis and pattern execution - Alternative: Execute Code Plugin (more basic JavaScript execution) 2. **MDX Integration (Optional)** - For enhanced markdown with embedded components - Alternative: Templater plugin for dynamic content ### Strudel Integration Options #### Option 1: CDN Integration (Recommended) Add this to your vault's CSS snippets or in the tool's markdown file: ```html <script src="https://unpkg.com/@strudel-cycles/core"></script> <script src="https://unpkg.com/@strudel-cycles/webaudio"></script> <script src="strudel-patterns.js"></script> ``` #### Option 2: Local Installation 1. Download Strudel files to your vault's assets folder 2. Reference them relatively in your markdown files ## Setup Steps ### Step 1: Enable LiveCoding Plugin In Obsidian Settings → Community Plugins → LiveCoding: - Enable the plugin - Configure Strudel as the default live coding environment - Set audio output preferences - Optional: Enable real-time pattern evaluation ### Step 2: Audio Permissions Ensure your browser/Obsidian allows: - Microphone access (not required, but helpful for comparison) - Audio playback - Web Audio API usage ### Step 3: Load Support Files Copy these files to your vault: - `strudel-patterns.js` - Core audio functions - `Interactive Frequency Trainer.md` - Main tool - `Setup Guide.md` - This file ### Step 4: Test Basic Functionality Run this test code in an Obsidian code block: ```javascript // Test basic audio setup (async () => { try { const context = new (window.AudioContext || window.webkitAudioContext)(); console.log('Audio context created successfully'); // Test tone generation const oscillator = context.createOscillator(); const gainNode = context.createGain(); oscillator.connect(gainNode); gainNode.connect(context.destination); oscillator.frequency.setValueAtTime(440, context.currentTime); gainNode.gain.setValueAtTime(0.1, context.currentTime); oscillator.start(); oscillator.stop(context.currentTime + 0.5); console.log('Test tone played successfully'); } catch (error) { console.error('Audio setup failed:', error); } })(); ``` ## Usage Instructions ### Basic Usage 1. Open `Interactive Frequency Trainer.md` 2. Click on any JavaScript code block 3. Press the "Run" button (if using Execute Code plugin) 4. Follow the console output for instructions ### Advanced Usage #### Create Custom Training Sessions ```javascript // Initialize trainer const trainer = new FrequencyTrainer(); // Generate a medium difficulty challenge const challenge = trainer.generateChallenge('medium'); // Play the challenge trainer.playChallenge(); // Check your guess (example: guessing 1000 Hz) const result = trainer.checkGuess(1000); console.log('Result:', result); ``` #### Create Frequency Sweeps ```javascript // Sweep from 100Hz to 2000Hz over 5 seconds const sweep = createSweep(100, 2000, 5); sweep.play(); ``` #### A/B Frequency Comparison ```javascript // Compare two close frequencies const abTest = createABPattern(440, 445, 'sine'); abTest.play(); ``` ## Troubleshooting ### Common Issues #### "AudioContext is not defined" - **Solution**: Ensure you're running the code in a browser context - Check that Obsidian's Execute Code plugin is properly installed #### "initStrudel is not a function" - **Solution**: Verify Strudel CDN links are loaded - Check browser console for loading errors #### No Audio Output - **Solution**: Check browser audio permissions - Verify audio isn't muted or volume too low - Try running the basic audio test code #### Code Block Not Executing - **Solution**: Ensure Execute Code plugin is enabled - Check that JavaScript execution is allowed in settings ### Performance Tips - Use headphones for accurate frequency perception - Close other audio applications to avoid conflicts - Take breaks every 15-20 minutes to prevent ear fatigue - Start with easier challenges and progress gradually ## Customization ### Modify Frequency Ranges Edit the `criticalBands` object in `strudel-patterns.js`: ```javascript const criticalBands = { yourCustomRange: { range: [500, 1000], description: 'Your description' }, // ... other ranges }; ``` ### Add New Waveforms Extend the waveform array: ```javascript const waveforms = ['sine', 'square', 'sawtooth', 'triangle', 'your_custom_wave']; ``` ### Create Custom Exercises Extend the `FrequencyTrainer` class with your own methods. ## Next Steps Once the basic setup is working: 1. **Experiment** with different frequency ranges 2. **Create** custom training routines 3. **Track** your progress over time 4. **Share** your improvements and patterns with the community ## Support For issues with: - **Obsidian integration**: Check the Execute Code plugin documentation - **Strudel syntax**: Refer to [Strudel documentation](https://strudel.tidalcycles.org/) - **Audio concepts**: Consult mixing/mastering resources in your vault --- *Happy ear training! 🎧*