Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

p5.sound's midiToFreq() allows microtonality (decimal MIDI notes)

Open
#92 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
38/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
javascript
Domain
documentation

Research direction

Start at the p5.sound midiToFreq() reference page linked in the issue and review how its General MIDI description presents accepted values. Done means adding a note that decimal MIDI values produce microtonal frequencies without rounding; no specific source file or test is named in the issue.

Written by the indexing model from the issue text.

Description

bug
Most appropriate sub-area of p5.js?
  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)
p5.js version

1.11.1

Web browser and version

Firefox 133.0.3

Operating system

Windows 11

Steps to reproduce this
Steps:
  1. Decimal numbers in midiToFreq() return microtonal values, because they're not rounded first.
  2. This is actually a pretty cool feature, and allows some creative possibilites (microtonal music!), but it might be unexpected for some because the reference implies the value should be an integer MIDI note number:

General MIDI treats notes as integers where middle C is 60, C# is 61, D is 62 etc. Useful for generating musical frequencies with oscillators.

Rather than 'fix' this, adding a note to the reference description along the lines of 'Decimal values return microtonal frequencies.' Might clarify that those values won't be rounded to equal temperament tuning, but keep a pretty cool, if unexpected, feature?

Snippet:

  console.log(midiToFreq(60)); // returns 261.6255653005986 (Hz) = C4
  console.log(midiToFreq(60.5)); // returns 269.2917795270241 = C4 quarter-sharp!
  console.log(midiToFreq(61)); // returns 277.1826309768721 = C#4

I'd be happy to add this note to the reference if it's accepted.

Dominant language
JavaScript
Stars
60
Forks
26
Avg merge
2d 3h
Merged PRs (30d)
7

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from processing/p5.sound.js

All issues in processing/p5.sound.js

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.