I require a DLL that listens to incoming audio (e.g. from the microphone or line-in) for single-note sounds and detects the PITCH of the notes, and whenever a note is detected, send a windows message to a specified handle. See the "Deliverable" section for details.
The job of the DLL is to monitor the audio-in and detect the frequency. It should use a separate thread or other non-blocking method. The Pitch-Recognition DLL should have these methods: procedure PR_Start(CALLBACK_HANDLE: HWND) This method tells the DLL to start its "listening" activity. The supplied handle must be used to send messages back to the calling application. (Details below) If the DLL is already listening when this command is issued, it will simply start using the new handle for the messages. NB: In spite of the listening activity being very CPU-intensive, the DLL should avoid using 100% of the CPU. For example, it should include some millisecond-long "sleep" pauses during processing, to leave a reasonable share of the CPU cycles to the other processes. procedure PR_Stop The DLL stops looping and goes idle. function PR_GetFreq: float The DLL returns the frequency being detected at that moment. If no clear frequency is detected, return -1. If the DLL is not looping (stopped), return 0 PR_SetPitch(A440: float) The application can specify a frequency different from 440 Hz to be used as the diapason by the DLL for calculating what notes are played. If this method is not called, it will use A4 = 440. MESSAGES: While listening, the DLL must translate the current frequency into the MIDI equivalent of the corresponding musical note. PostMessage(CALLBACK_HANDLE, 1031, 121, MIDI_EQUIV) NB: In MIDI the 440 Hz A note is note number 69. The C below it is therefore note number 60, and so on. So the DLL should translate each frequency to the nearest note, and whenever that note changes (or stops) send the message above to the callback handle. NB: The application may change the value of note 69. For example, the application can use: PR_SetPitch(442) and the DLL should use this new value when calculating the note corresponding to the detected frequencies. * If a note fades/stops playing, send a message with MIDI_EQUIV = 0 * If a note is repeated (played again before fading) send a new message * And of course whenever a new note is played send a message IMPORTANT POINTS: SPEED: The recognition of a new frequency should be as fast as possible, half a second or less. RELIABILITY: Because audio input will never be perfect, the DLL should be able to recognize pitches correctly in spite of some background noises. RANGE: The DLL should respond correctly within the notes range of the piano (eg 25 to 3000 Hz) OTHER PARAMETERS If the DLL needs other user-adjustable parameters to function and fine-tune itself, they should be readable and writable by the calling application. Perhaps a "noise threshold" ot some other such parameters. The coder should kindly advise me on these matters. Payment will be effected immediately upon receipt of these deliverables: 1) Compiled DLL (complete and fully functional as per specs) 2) Complete source code (C or Delphi) 3) Copyrights to work purchased. Coder will receive a substantial bonus if the DLL is particularly fast and reliable. Questions and comments are welcome. I will assist the coder to the best of my capacity.
Windows 32 bit (9X, NT, W2K, XP)