Click here to Skip to main content
15,885,216 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
raddevus16-Oct-18 2:13
mvaraddevus16-Oct-18 2:13 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
Rick York16-Oct-18 5:32
mveRick York16-Oct-18 5:32 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
raddevus16-Oct-18 8:35
mvaraddevus16-Oct-18 8:35 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
Rick York16-Oct-18 9:38
mveRick York16-Oct-18 9:38 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
Jan Holst Jensen218-Oct-18 1:14
Jan Holst Jensen218-Oct-18 1:14 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
StatementTerminator18-Oct-18 4:19
StatementTerminator18-Oct-18 4:19 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
raddevus18-Oct-18 12:47
mvaraddevus18-Oct-18 12:47 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
StatementTerminator19-Oct-18 5:07
StatementTerminator19-Oct-18 5:07 
raddevus wrote:
I know there basically is a solid way to say XXX frequency is a particular note

Not really, or at least only if you make certain assumptions. From the perspective of music theory that isn't correct at all.

Warning: below is a little clarification about technicalities and theory, but for the practical purposes of what you're doing you don't really need to take this into account for most cases. I think it's worth mentioning though while we're discussing notes and frequencies, because there are some misunderstandings here. And, yeah, I have a bit of a thing about this because it's a common misconception that bugs me.

You can easily find tables of frequencies matched to notes on the scale, but they are lies told for practical purposes and convenience. In reality, there is no defined frequency for any note, there are just arbitrary standards that can be--and often are--ignored by musicians in practice.

The A=440 thing is a relatively recent convention designed to make it easier for musicians to play together while being in tune with each other. It's just a convention, and it's far from universal. For the purposes of a MIDI pickup, though, it's safe to assume that A=440 unless the guitarist is into archaic or oddball tunings.

That's the easy part, though. The real problem is that the Western scale is based on ratio intervals between notes rather than any absolute pitches (frequencies), and the intervals change with each key, which can require the notes themselves to change frequency to be perfectly in tune for a particular key. That is, E-flat in one key may be a slightly different frequency than E-flat in another key, if you want perfect consonance with the other notes on the scale. You might think that's crazy, but it's true, and it's the reason for things like blue notes in jazz.

Microtonal instruments like voice, violin, trombone, etc. automatically adjust pitch for each key, because intonation is done by ear and your ear will tell you to adjust the intonation for each key, musicians do this automatically. But fretted and keyboard instruments are another story, they have discrete pitches that they can play with little wiggle room, and so the musician can't adjust on the fly and it's impossible to tune them so that they are in tune in every key.

This is why every piano in the world is out of tune, always, and if you don't believe me ask a piano tuner. The only way to make a piano truly in tune is to re-tune it every time you change the key being played in, but since that isn't practical pianos are normally tuned in such a way to spread the inaccuracies evenly over the whole range of the instrument to keep the problem minimal (this is called even temperament, and this is what those frequency-to-note tables are based on, and that's why those tables are lies).

So, no, there is no real mapping between frequencies and notes on the scale, not technically. But by convention and practicality much of this is hidden unless you have a good ear and/or an interest in music theory. The upshot, though, is that you should take those frequency/note tables with a grain of salt and not try to match the frequencies too exactly. However, using such a table should work just fine if you are using it with a guitar tuned to A=440 and even temperament. But it won't work for all cases, and anyway I think it's best to understand that notes aren't defined by frequencies if you're really going to get deep into this kind of thing.

modified 19-Oct-18 14:03pm.

GeneralRe: friend: frequency to MIDI should be easy right? Pin
raddevus19-Oct-18 8:35
mvaraddevus19-Oct-18 8:35 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
StatementTerminator19-Oct-18 8:38
StatementTerminator19-Oct-18 8:38 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
raddevus19-Oct-18 8:43
mvaraddevus19-Oct-18 8:43 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
englebart18-Oct-18 9:31
professionalenglebart18-Oct-18 9:31 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
raddevus18-Oct-18 12:49
mvaraddevus18-Oct-18 12:49 
RantHideous Colors in Git Bash Shell Pin
David A. Gray3-Sep-18 20:52
David A. Gray3-Sep-18 20:52 
GeneralRe: Hideous Colors in Git Bash Shell Pin
Jörgen Andersson3-Sep-18 21:17
professionalJörgen Andersson3-Sep-18 21:17 
GeneralRe: Hideous Colors in Git Bash Shell Pin
David A. Gray4-Sep-18 6:41
David A. Gray4-Sep-18 6:41 
GeneralRe: Hideous Colors in Git Bash Shell Pin
Mycroft Holmes3-Oct-18 21:07
professionalMycroft Holmes3-Oct-18 21:07 
GeneralRe: Hideous Colors in Git Bash Shell Pin
den2k883-Sep-18 21:28
professionalden2k883-Sep-18 21:28 
GeneralRe: Hideous Colors in Git Bash Shell Pin
raddevus4-Sep-18 3:10
mvaraddevus4-Sep-18 3:10 
GeneralRe: Hideous Colors in Git Bash Shell Pin
den2k884-Sep-18 3:13
professionalden2k884-Sep-18 3:13 
GeneralRe: Hideous Colors in Git Bash Shell Pin
David A. Gray4-Sep-18 6:40
David A. Gray4-Sep-18 6:40 
GeneralRe: Hideous Colors in Git Bash Shell Pin
David A. Gray4-Sep-18 15:54
David A. Gray4-Sep-18 15:54 
GeneralRe: Hideous Colors in Git Bash Shell Pin
kalberts5-Sep-18 22:55
kalberts5-Sep-18 22:55 
GeneralRe: Hideous Colors in Git Bash Shell Pin
MarkTJohnson6-Sep-18 4:08
professionalMarkTJohnson6-Sep-18 4:08 
GeneralRe: Hideous Colors in Git Bash Shell Pin
David A. Gray6-Sep-18 6:43
David A. Gray6-Sep-18 6:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.