Show HN: Inflammation – Intelligent Voice to Code for Cursor and VSCode

3 months ago 17

Inflammation Icon

Inflammation lets you dictate code inside VSCode/Cursor. It's context aware and let's you convert speech like

export function foo take in string bar and string car return string

into

export function foo(bar: string, car: string): string {}

You can see a demo video here.

It's named inflammation because it's gotten hard for me to type on some days due to inflammation and I needed something I can dictate to on a line-per-line basis.

This extension is simple enough for my needs. Please help improve it by submitting a PR.

After installing, hit cmd + shift + z to start listening. Release when you're done talking.

And that's it.

You can change the hotkey by going into your keyboard shortcut prefs: Preferences :Open Keyboard Shortcuts. from the command pallete.

https://marketplace.visualstudio.com/items?itemName=moughxyz.inflammation

You can find the .vsix files in the vsix dir on GitHub:

1. Audio Recording Software

The extension requires audio recording software to be installed on your system:

  • macOS: Install SoX

  • Windows: Install SoX

  • Linux: Install arecord (usually pre-installed)

    sudo apt-get install alsa-utils

You'll need an OpenAI API key with access to:

  • Whisper API (for transcription)
  • GPT-4 or GPT-3.5 (for text processing)

Get your API key from: https://platform.openai.com/api-keys

https://marketplace.visualstudio.com/items?itemName=moughxyz.inflammation

From Source (Development)

  1. Clone this repository
  2. Install dependencies:
  3. Compile the extension:
  4. Open in VSCode and press F5 to run the extension in a new window

To create a .vsix package:

  1. Install vsce globally:
  2. Package the extension:
  3. Install the generated .vsix file in VSCode/Cursor
  1. Open any text file in VSCode/Cursor
  2. Press Cmd+Alt+Z (the extension will prompt for your OpenAI API key)
  3. Enter your API key (it will be stored securely)
  1. Place your cursor where you want to insert text
  2. Press Cmd+Alt+Z to start recording (you'll see "Recording..." in the status bar)
  3. Speak your code or text
  4. Press Cmd+Alt+Z again to stop recording and process

The extension will:

  1. Transcribe your audio using Whisper
  2. Process the transcription with GPT-4 using your file's context
  3. Insert the result at your cursor position

You can configure the extension in VSCode settings:

  • inflammation.openaiModel: Choose the GPT model (default: gpt-4-turbo-preview)
  • inflammation.whisperModel: Choose the Whisper model (default: whisper-1)

To change your API key:

  1. Open Command Palette (Cmd+Shift+P)
  2. Run "Inflammation: Configure API Key"

"Failed to start recording"

  • Ensure you have the required audio recording software installed
  • Check microphone permissions in your system settings
  • Try running the audio recording command manually to test
  • Check your microphone is working
  • Speak louder or closer to the microphone
  • Ensure no other application is using the microphone
  • Verify your API key is valid
  • Check your OpenAI account has sufficient credits
  • Ensure you have access to the selected models

Pull requests are welcome! Please ensure your code follows the existing style and includes appropriate tests.

MIT

For issues and feature requests, please use the GitHub issue tracker.

Read Entire Article