Pages

Tuesday, 23 December 2014

Sound to note converter

The reason for the app is to let me play a tune that I hear on my baby top piano. To convert a simple tune to midi note.

- I will need time spectrum to get the notes in a file. 

260115
- Get all peak. But only key press for intensity > 3. K
- manage to get accurate for 1,2 and 3 keys. But error when it goes more to an octave. 
- use nature of harmonic to determine correct freq. 
- publish on 270115. I feel a sense of achievement since my app can accurate determine multiple keys being played. Current existing app can only find one at a time. 

230115 restart fft to piano keyboard
- add keyboard using c4 to c5 as 7 white keys. K
- alight using middle C k
- remove low freq noise k
get peak freqs k
- get pitch class k
- get lowest freq for each class k
- check if ratio is greater equal to 2 to prevent higher harmonic
240115 the harmonic for F is changing. There are 5 harmonic. When key F is pressed, second harmonic is higher. I get first since it has ratio 2. But as time goes, first harmonic is gone, but second or last is still around. The keyboard goes to the wrong key. 
250115 use amp instead of db, the signal is much clearer without noise. 

210115 there are certain challenge in converting music to note accurately. It is a not yet solve problem that is a field for phD thesis. 
1. Fft gives freq. they may not be the right freq due to harmonic freq. you don't know which is the right freq to use. 
2. Using harmonic law, I can get the class but not the location. The peak is not the answer. 
3. The time to take fft is uncertain. Spectrogram gives freq vs time. 
4. The freq log can map to the piano key. The freq log can be map into the guitar too. 
5. The harmonic freq may intersect with the note freq.  

281214
- read books on fft. 
- test app on wave, fft and double fft
- test on mic -> PCM -> wave


261214 after working for 3 days, I manage to get a working app. But the accuracy is so bad. Note 61 and 60 are not differentiated. The required freq unit is 15 but android visualizer return 43. I could not change the sampling rate.

Maybe I should use PCM data from audio recorder. 

Freq = sampling rate / size of sample capture. This case is 44100 / 1024 = 43. 

241214 as I look at android midi app, I come across a mic to midi converter. I like the idea even more when it uses FFT. Thing that I learn in university. I want to play a tune but could not find its name. I imagine an app that would listen to the tune and tell me the notes so that I can play myself. 

Certain sound will wake baby. Police siren. Lorry go past. It is so cooling in Penang. 

1. Run wave sample 241214
2. Add in fft graph 241214
3. Add in recording to audiotrack 241214
4. Then play on wave and fft graph 241214
5. Test 1 note and get its fft max frequency and convert to note 251214
- I am getting unstable freq! 
- it is stable but it gives wrong freq. it is far off. 

F = k fs / n
- I get better result if I remove div by 2. And also to use the smallest k peak. But it is still inaccurate by 2,3 note. 

Different instrument gives different freq . 

30 36. 86, est 86
40 82. 215, est 215.
50 should 146. 387, est 135.
60 should be 261. 258
70 should 466. 861, est 430. 
80 should be 830. 775. Est 775. 
90 should be 1479. 1335. Est 1335. 


6. Test a stream of notes 261214 problem is that my freq unit is 43 while midi not frequency is about 15. Send 87 86 86. I get 86 84 84. 


7. Add noise filter 
8. Write to midi format 251214

No comments:

Post a Comment