DEV Community

moritalous | Kazuaki Morita
moritalous | Kazuaki Morita

Posted on

Building a Real-time Guitar Tuner Web App with Kiro

Introduction

I participated in the Code with Kiro Hackathon and developed a real-time guitar tuner web application. While there are already many tuner apps and websites available, I was curious about what it would be like to build one myself. I had attempted this before but gave up due to the complexity of handling microphone input and pitch detection algorithms. With Kiro's AI assistance, I hoped these technical challenges could be overcome.

Live Demo: https://moritalous.github.io/kiro-guitar-tuner/

I'd like to share my experience of how I was able to go from a simple idea to a production-ready web application using Kiro, AWS's AI-powered IDE.

About Kiro

Kiro is AWS's AI coding editor, described as "The AI IDE for prototype to production." What makes Kiro unique is its spec-driven development approach, where you create specifications first before any code is generated.

image

Kiro offers two modes:

  • Vibe: Chat first, then build. Explore ideas and iterate as you discover needs.
  • Spec: Plan first, then build. Create requirements and design before coding starts.

What I Built

Guitar Tuner Web App

  • Real-time pitch detection using microphone
  • Visual tuning meter
  • Dark mode/Light mode support
  • Responsive design
  • PWA support

Tech Stack: TypeScript, Vite, Web Audio API, MediaStream API

Development Experience with Kiro

1. Spec-Driven Development Process

I chose Spec mode and started with a simple request:

"I want to create a guitar tuner. As a web app. I want to tune using sound captured from PC or smartphone microphone."

Instead of immediately generating code, Kiro first created a requirements.md file to clarify the requirements. You can see the actual requirements document here: requirements.md

After the requirements were finalized, Kiro generated a design.md file containing the system architecture: design.md

When I suggested using React, Kiro recommended Vanilla JavaScript instead, explaining it would be better for DOM operations. This showed that Kiro doesn't just agree with suggestions but provides thoughtful technical guidance.

Finally, Kiro created a tasks.md file with implementation tasks: tasks.md

This isn't just regular Markdown - Kiro treats it specially, allowing you to execute each task directly from the interface.

Image

2. Complex Audio Processing Logic

Pitch detection using Web Audio API is complex, but when I explained the requirements to Kiro:

// Pitch detection using autocorrelation algorithm
export class PitchDetector {
  detectPitch(audioData: Float32Array, sampleRate: number): number | null {
    // High-precision pitch detection logic generated by Kiro
    const autocorrelation = this.autocorrelate(audioData, sampleRate);
    return this.findFundamentalFrequency(autocorrelation, sampleRate);
  }
}
Enter fullscreen mode Exit fullscreen mode

Even without specialized knowledge in audio processing, Kiro suggested and implemented appropriate algorithms.

3. Test-Driven Development

Kiro also automatically generates test code. Comprehensive testing was especially important for complex features like audio processing:

// Example test code generated by Kiro
describe('PitchDetector', () => {
  it('should detect guitar E2 frequency correctly', () => {
    const detector = new PitchDetector();
    const testFreq = 82.41; // E2
    const result = detector.detectPitch(generateSineWave(testFreq), 44100);
    expect(result).toBeCloseTo(testFreq, 1);
  });
});
Enter fullscreen mode Exit fullscreen mode

4. Accessibility and UX

Kiro doesn't just generate code; it also makes suggestions from accessibility and UX perspectives:

  • Proper ARIA attribute configuration
  • Keyboard navigation support
  • Color contrast optimization
  • Responsive design implementation

Impressive Aspects of Development

1. Natural Code Generation Through Conversation

Simply saying "I want to support standard guitar tuning" was enough for Kiro to accurately implement the frequencies for each string: E-A-D-G-B-E.

2. Incremental Feature Addition

Starting with simple pitch detection, I gradually added requests like "I want dark mode support" and "I want to make it a PWA." Kiro expanded functionality while maintaining consistency with existing code.

Results and Reflections

The final application worked exactly as expected. The pitch detection was accurate, and the visual interface was clean and functional. However, I did need to make additional adjustments for proper dark mode support, which I handled as a separate specification.

Key Takeaways

  1. Specification Granularity: Smaller, focused specs work better than large, complex ones
  2. Iterative Improvements: Features like dark mode, testing, and specific UI adjustments are best handled as separate specs
  3. AI Guidance: Kiro provides valuable technical recommendations rather than just following instructions

Conclusion

Kiro's Spec-Driven Development enabled efficient development from idea to production-ready web application. The generation of complex audio processing logic and comprehensive test code, which would typically be time-consuming in traditional development, was significantly accelerated with Kiro's support.

What impressed me most was how Kiro handled the technical challenges I had previously given up on - microphone access and pitch detection algorithms were implemented seamlessly through natural conversation.

The AI-collaborative development experience felt like more than just a "code generation tool" - it showed the potential of a true development partner that understands both technical requirements and best practices.


Project Repository: https://github.com/moritalous/kiro-guitar-tuner
Live Demo: https://moritalous.github.io/kiro-guitar-tuner/

https://youtu.be/5rI7A9TlbJY?feature=shared

Top comments (0)