Hello forum,
I need your help choosing the appropriate hardware and software for my project.
I want to make an electronic tuner for low-pitched range music instruments (ca.70-280Hz).
(It doesn´t need to work superfast or instantly. A output value every 0,5sec or 1sec should be enough.)
Accuracy: 1Hz
What I´m not sure… there is written:
“…will allow you to detect with fairly good accuracy the fundamental frequencies from electric guitars and basses.”
Does this mean that it will not work properly with other instruments such a tuba for example?
To get a clean signal I could insert a RC filter or a software filter from Arduinos libraries (lowpass filter: 0-300HZ pass).
Than I would use a sample rate of 600Hz…
FFT size: 256 (It`s possible to choose also a bigger one with Arduino?)
(600/2 )/ (256/2) =2,34Hz accuracy only.
What do you recommend?:
The for me a little bit familiar Arduino or the powerful new Teensy?
What is better for my application FFT or YIN?
A $7 experiment would seem worthwhile. Or try it out in the store even. The one I have tells you the note being played, even when it is not one of the open strings.
I have already an old chromatic tuner (maybe from 90´s) from Yamaha at home. Let’s says that in 90% of cases it works fine and it finds the first harmonic. In the remaining 10% the indicated tones jump around and it´s not possible to recognize the tone.
What do you think, what kind of algorithm did they used at that time? FFT or autocorrelation?
Which algorithm is used in modern chromatic tuners?
I´m not happy with the display of commercial tuners. Therefore I want do make one with my own design and I opened this topic.
The YIN algorithm is very powerful, able to find the fundamental even when the harmonics are much stronger.
AdaZus:
… It could also work for other instruments?? Are there maybe some experiments?
It should work for other instruments.
If you'd like to do an experiment, I will help. Can you record a good quality sample of your tuba? If you'll post the sound clip and you're willing to allow it to be freely distributed, I'll put it into the list of sample for the NoteFrequency example. Only short sounds will fit, so please keep the sound to only 2 seconds if 44.1 kHz or only 4 seconds if 22.1 kHz sample rare.
Of course, I'll run the NoteFrequency code and post a copy of whatever it prints to the serial monitor while analyzing your sound.
Regarding Arduino I must repeat my question:
Is 256 the biggest FFT-size which an Arduino can do?
For most Arduino boards, the small memory size limits how large your FFT can be.
Teensy Audio has 1024 point FFT. But even 1024 is not usually enough resolution. YIN algorithm is much better than FFT for this purpose.
Hello Paul,
Many thanks for your offer!
What an honor to collaborate with the developer of teensy.
Yes let’s make that experiment together.
Below now five different notes of the same tuba:
Question:
If Yin algorithm works fine with these examples, will it work also for other tubas?
I`m not sure because each tuba sounds a little bit different. Some sounds purer, and others have a lot of bad harmonics in their spectrum.
I think I understood now the different in FFT size...
Here the analysis of BBb_Tuba_01 with 256FFTsize, 1024FFTsize and 65536FFTsize:
With 256 it`s impossible to detect the tone with the biggest amplitude.
And the second problem with FFT:
Other tones in the signal can be louder than the firs harmonic and then you can`t anymore search for the bin with the biggest amplitude.
Hi I tried to upload “NoteFrequency” to Teensy, but it returns the error that the sketch uses to much space:
Arduino: 1.6.5 (Windows 7), TD: 1.29, Board: "Teensy 3.2 / 3.1, Serial, 48 MHz optimized, German"
Sketch uses 262,228 bytes (100%) of program storage space. Maximum is 262,144 bytes.
Global variables use 21,416 bytes (32%) of dynamic memory, leaving 44,120 bytes for local variables. Maximum is 65,536 bytes. …..
Why that? Do I have maybe to change something in proprieties?
After that my next step will be to figure out, how to connect this microphone
and how to change the “NoteFrequency”-sketch in order to record from an analog input...
Update to the lastest audio library. It fixes this problem. You update, you can grab the latest code from github, or install Teensyduino 1.30-beta4 which has the updated code.
Hi I update to 1.30 beta. It works well now. Thank you for support.
I recognize also that you put my tuba recordings to the examples.
Wow, that’s very cool!
I'm curious to hear how it works for your other sounds.
This note frequency detection question comes up occasionally on this forum, and rarely is the really good answer, so if you can let everyone know how this works, might help others in the future....
Hi,
no problem! As soon as I have some results I will post them.
I started with some research this evening but for me it`s not clear if I need 16bit audio bit depth for “NoteFrequency”-YIN algorithm or if 10bit of Teensy analog input are enough?
Have you read the workshop/tutorial manual, or watched the 48 minute video?
When you understand how to use the design tool, hopefully you'll see it has a ADC object you use to get the signal into the audio library.
Please, do yourself a favor and watch the video to learn how to use the design tool. I put a lot of work into that tool to make this so much simpler and easier for you and everyone who uses this audio library.
Hi I did a first test (without connecting the microphone, only with “wav2sketch”) with one of my other tuba recordings:
First test = positive. 110Hz as expected: