2

I'm fairly new to signal processing and I'm building a beat game using frequency, RMS and hopefully onset detection alongside numerous other functions.

However the problem is I don't want to use an FFT - multiple reasons for this, for example I'd want to write my own which I imagine would take far too long and also I like the challenge of not using an FFT in my entire project

So I ask - can this be done?

lennon310
  • 3,590
  • 19
  • 24
  • 27
  • 1
    yes, but it's a "stupid" self-constraint. you're also not writing your own operating system to run your game on, or designing your own microcontroller. – Marcus Müller Aug 18 '22 at 15:20
  • 3
    FYI, "writing your own" doesn't take that long, there are LOTS of resources and open source FFT implementations out there. If you want the challenge, there are many time-domain based onset detection methods, which you can find online! google "time-domain onset detection" for example :) – Jdip Aug 18 '22 at 15:21
  • actually @MarcusMüller I can think of some very good reasons to stay outa the frequency domain. especially if this is meant to be running real time. – robert bristow-johnson Aug 18 '22 at 15:35
  • Ok not sure why my "cheers in advance" was edited out - i was merely trying to be friendly but anyway

    First thankyou Jdip that does help and amazed there are indeed LOTS of resources - again thankyou :)

    Secondly MarcusMüller is it ok if you explain how it's possible? - even if it is a limiting self constraint it's something i find interest in challenging myself to do. Also do you mind me asking why writing my own OS or designing my own circuitboard matters in this context? also as robertbristow-johnson said this is important for perfomance reasons aswell - as it is running in real time.

    – Bobbymcbobface Aug 18 '22 at 15:48
  • this one is not my doing, but sometimes i've been accused of being a form or style nazi. but i wouldn't have deleted that. lately i've been editing posts about discrete signals changing $x(n)$ to $x[n]$. – robert bristow-johnson Aug 19 '22 at 06:27

1 Answers1

2

So I ask - can this be done?

Sure. Why the heck would you need an FFT for this in the first place ? Most onset detectors are RMS meters with different time constant and a threshold detector. Frequency sensitivity of the the detector can be implemented with a simple IIR filter.

Hilmar
  • 44,604
  • 1
  • 32
  • 63
  • 1
    There might be some need for a bank of resonant filters spaced apart by one semitone. An FFT is an efficient way to implement this, but 9 years ago when I was working on this, we decided to just implement 37 parallel BPF filters tuned to each semitone in a 3 octave range. The output of each of those BPFs then you do a37 RMS or peak-level meters and LPF those 37 mono-polar signals just a little. Then look for "novelty" (vector difference). I can't remember the paper, but that's what they called it. – robert bristow-johnson Aug 18 '22 at 15:51
  • 1
    Also, check out the two references in this answer of mine from 2014 when the topic was much more fresh in my mind. – robert bristow-johnson Aug 18 '22 at 15:54
  • I'm not in full understanding of what both these answers mean so will need some time to understand this (sorry i'm very new to the subject as a whole) - but as i understand it @robertbristow-johnson your saying by using changes in pitch i can detect onsets? i do have 2 questions for this method - if 2 pitches of the same note were played sequentially would this "trip up" the algorithm? and would a riser (https://www.youtube.com/watch?v=bcJINU0s05I) cause issues? – Bobbymcbobface Aug 18 '22 at 16:05
  • 1
    The video doesn't seem to help me understand your question. Perhaps identify a specific time in the video? "2 pitches of the same note" is a curiosity to me. I understand "two notes of the same pitch" and "two notes of different pitches". Do you mean separated by an octave? – robert bristow-johnson Aug 18 '22 at 16:20
  • 1
    Now consider detecting new notes from some singer who is humming a tune with legato? How can you tell there is a new note? – robert bristow-johnson Aug 18 '22 at 16:22
  • ah sorry so from 0:00 to 0:10 the riser effect is played - the frequency increases over 10 seconds - it's usually used in music to create a buildup to a beat - but if using this in onset detection using pitch detection wouldn't this be problematic as every few milleseconds the pitch would change - resulting in a detection of multiple onsets? - and sorry i meant 2 notes of the same pitch - however i've just realised this would be solved by a gap between the 2 notes regardless - so something like 0hz, 100hz, 0hz, 100hz, 0hz would be equivalent to 2 onsets – Bobbymcbobface Aug 18 '22 at 16:35
  • as for the consideration of legato as you say the only way of knowing is pitch so in this respect onset detection using pitch detection seems like the best option to me - but of course this raises the question of my above concern involving "risers" – Bobbymcbobface Aug 18 '22 at 16:39
  • Aha! i think i finally understood what Hilmar said now which has helped me massively in getting towards my goal - i still need to understand things such as resonant filters and how to go about immplementing (and understanding) features of the 2 papers robert has linked - but it's a step in the right direction - accepted the answer (and i did upvote 2 days ago but im new to the forum so it won't show (and i'd upvote comments if i could)) Thankyou everyone! :) – Bobbymcbobface Aug 19 '22 at 13:52