Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 11 of 11

Thread: [queued] Notes to Waves

  1. #1

    [queued] Notes to Waves

    Hello,

    Here is a fun project I would like to share with the community. It is a basic 3 oscillators synth plus an input follower stage. You can plug in a microphone and convert dynamics and notes of an acoustic instrument into frequency and envelope, and then trigger the synth oscillators and effects.
    This was made possible thanks to the noteFreq object developed by Duff. This object uses the YIN algorithm to guess the notes frequency (almost) in realtime. Dynamics are analysed with the rms object.
    Filtering the signal is important to get better frequency analysis, but also to limit the feedback when playing on stage.

    Limitation is latency. It is possible to reduce latency with high pitch instruments (thank you Duff for your guidance). I doubt we can get good results with low pitch instrument like cellos, double bass, tenor and baryton sax... But it works pretty well with "treble key" instruments like the flute, the violin, the trumpet...

    I am still trying to reduce latency. If someone has any suggestion, I would be very happy to exchange ideas.
    Here are a few pics and a video.

    Emmanuel (France)

    Click image for larger version. 

Name:	front.jpg 
Views:	18 
Size:	138.5 KB 
ID:	20056

    Click image for larger version. 

Name:	inside.jpg 
Views:	19 
Size:	173.9 KB 
ID:	20057

    https://youtu.be/N79Hcg-cOfI

  2. #2
    5 times faster .... That's good news. I am going to investigate this right now !

  3. #3
    Great project! Would you be willing to share your code?

    For faster guessing of frequencies have a look at my project here:
    https://forum.pjrc.com/threads/60796...th-FFT-and-Yin

    With FFT my tuner can estimate frequencies ~5x faster than with Yin.

    I use the lowest FFT freq found nearest to Yin freq if found, so if rate is so high that Yin doesn't find a freq FFT still does. Average in case both find a freq close to each other. You can find my code in the linked thread.

  4. #4
    Thanks for your suggestion.
    Yes I will share the code. I have to reformat it or you won't be able to understand it. Basically, i have adapted the examples coming with the audio library. Nothing new !

  5. #5
    Ok, I am just interested in some detail such as how often do you read notefreqs result, do you adjust gain permanently for a steady level, does EQ the input help reducing wrong estimates, what probability and threshold settings do you use, and is there anything else I can do...?

    I guess buffer size in notefreq.h is the most important setting: what size did you prefer for flute?

  6. #6
    I publish the main code here
    https://forum.pjrc.com/threads/60516...326#post240326

    I call notefreq1.available() and rms1.available() without any delay or timer. Peak object also works well.
    notefreq threshold : 0.3
    I use a pot adjust input level. No code, just a pot.

    important : edit AUDIO_GUITARTUNER_BLOCKS parameter in the analyze_notefreq.h file. Try lower values (4 or 6 or 8). This is the most efficient way to reduce latency (but you may have problem with low pitch instruments).
    Filtering is important. It reduces feedback when playing live. It also helps with freq detection. I use the builtin 5 bands eq of the SGTL 5000 audio shield.

    Emmanuel

  7. #7
    Many thanks, this helps a lot.

    When mentioning that FFT was faster than Yin I used default value for AUDIO_GUITARTUNER_BLOCKS. Did you try if adding FFT helps to improve speed?
    Last edited by jpk; 05-20-2020 at 03:17 PM.

  8. #8
    Yes I made some tests. FFT is faster, but it is not optimised for complex sounds. For instance, for the flute FFT is OK. But results are totally wrong for the trumpet. It is always about compromises...

  9. #9
    What does your code mean:
    Code:
          waveformMod1.frequency(freq * osc1_oct * transpose);
          waveformMod2.frequency(freq  * osc2_oct * detune);
          waveformMod3.frequency(freq  * osc3_oct);
    How does "transpose", "detune", "osc_oct" modify the result of notefreq?

  10. #10
    Absolutely.
    For instance, I have a pot that returns 0.25 ; 0.5 ; 1 ; 2 ; 4 ... This result is stored in osc1_oct variable. The multiplication fréquence * osc1_oct allows you to shift the frequency of +/- n octaves.
    "transpose" is used to shift the frequency within a range of a 5th.
    "detune" is used to shift the frequency within a range of 1 semitone.
    Have a look there : https://www.youtube.com/watch?v=UJcZxyB5rVc&t=6s
    There is on episode dealing with detune.

  11. #11
    Many thanks, I will try to improve my code with your suggestions!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •