Click here to Skip to main content
15,887,746 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
Marc Clifton16-Oct-18 1:24
mvaMarc Clifton16-Oct-18 1:24 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
raddevus16-Oct-18 2:12
mvaraddevus16-Oct-18 2:12 
GeneralRe: friend: frequency to MIDI should be easy right? Pin
Storm-blade16-Oct-18 1:30
professionalStorm-blade16-Oct-18 1:30 
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 
Exactly.

The code shown will give a readout of the DC (static) input voltage, it will not tell you anything about the tone signal.

To sample the input at a decent frequency, forget about using analogRead(). It can't sample faster than about 9000 Hz. You will need to set the ADC in free-running mode and after the necessary code changes to support that, you then need to see how much RAM you have availble for sampling, and how fine-grained an FFT you can do on that given the limited processing power you have.

Let's assume that you can get a fine-grained FFT. If you play a single string on the guitar it will be fairly simple to determine the base frequency and convert that to MIDI. Now strike a chord. Now you have six different strings that all produce base frequencies and overtones and you need to deconvolute them.

To produce correct MIDI you have to do all this in real-time. The delay from string-played to MIDI-produced has to be below 10 ms if you want to use the MIDI signal to trigger a guitar synth or another instrument without noticeable delay. If you "only" want to record and can live with a fixed larger latency, fine, but you still have to be able to process all input in real-time.

One of my friends has a home studio and he uses a piece of software that can analyze all kinds of instruments and e.g. split a guitar voice into the respective strings and display what is played as finger settings. Really awesome, but of course, it costs Smile | :) .

You can buy dedicated hardware to plug into your guitar that outputs MIDI for around $100. Just saying Smile | :) ...
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 
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 

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.