Search results

  1. F

    Compiler crashes teensy because of memory overflow

    I wrote this class that keeps track of the maximum value in a sliding window of incoming samples in realtime and I've been using it without issue. However I recently decided to use header files only because the compiler can optimise the code more by inlining etc. and the OPTIMISE_FASTEST_LTO...
  2. F

    Need help with reducing overhead in my program to make it run faster

    I'm running out of processing power on my Teensy 4 with my electronic drum project and need to implement some more stuff. I'm wondering if a particular part of the code can be improved to be faster as it is run inside the loop many times. It's my filter class which has a bunch of filters inside...
  3. F

    Help me optimise this code

    I wrote a class that does some calculations. It compares a 1d signal with a template of a peak and calculates the absolute difference after normalisation. I have a function that triggers based on a threshold but I want to only trigger signals of a certain shape and this class does this. I'm...
  4. F

    Filter library for the teensy.

    Hello! I've been trying to install this library into my project for 2 days without luck. I'm not very familiar with installing c++ libraries and it seems like a nightmare. Can anyone tell me if this would even work for Arduino and how do I use it in my project? I've tried importing the .h and...
  5. F

    How many teensy 4 can be connected together?

    Hello! I’m doing an electronic drum project where I have a teensy 4 inside a drum doing all the sensor processing and MIDI triggering. It sends out midi through a usb cable to a pc that triggers all sounds. I’m wondering if it’s possible to have multiple of these drums connected in series with...
  6. F

    ElapsedMicros/millis, how to avoid overflowing

    Hello! In stead of me trying to solve this on my own doing something unnecessary and inefficient, I figured I’d ask here first because I’m sure it’s a common problem. I’m starting a counter of elapsedMicros when an event occurs and I really only need to count up to maybe 3ms to know how long...
  7. F

    General C++ coding program structure guidance

    I learned some programming in C++ and I've started working on a project. I have difficulties getting started with the coding because of some problems with structuring the program. I have 10 sensors that I need to read and do some filtering and whatnot. How do I avoid having to add a number to...
  8. F

    Suitable op amp for driving the teensy4 ADC

    Hello! I just saw this document: https://www.eetimes.com/using-op-amps-with-data-converters-part-1/# Part 2: https://www.eetimes.com/using-op-amps-with-data-converters-part-2/ Part 3: https://www.eetimes.com/using-op-amps-with-data-converters-part-3/ There are multiple parts in this series...
  9. F

    Clean up power supply noise Teensy 4

    Hello! I’m wondering what I can do to clean up the power supply noise/ripple. I’m using some piezo sensors with a virtual ground circuit. I buffer the sensors and virtual ground with op amps and I’m getting pretty clean signals after digital filtering but I’m wondering what I can do to clean...
  10. F

    Electrical question.

    Is it OK to plug the 3.3V to the ground pin with only about 250 ohms of resistance. Is that bad for some reason? Thanks.
  11. F

    How to keep track of biggest value in sliding window

    Hello! I need guidance on making a function for this: I need to keep track of the biggest sample in the last ~5ms or so. It needs to update for every new sample that comes in. I'm sampling sensors at 50kHz. Surely there must be a clever way of doing this other than going through the whole...
  12. F

    Is there any filter libraries for teensies out there?

    I’m looking for a good filter library. Is there a library with bessel, chebyshev, butterworth etc. filters? I need them to filter some sensor data. I found this on github which seems to be what I need: https://github.com/vinniefalco/DSPFilters.git However it’s not an arduino library and...
  13. F

    uniform initialisation, object oriented programming etc.

    Hello! I'm learning C++ and I've just started the chapter on OOP, classes, constructors etc. There is something called "member initialisation list" where you can use direct or uniform initialisation to initialise an object with constexpr members. Constexpr variables are tricky because you can't...
  14. F

    Peak tracking problem.

    Hello! I'm working on a project where I'm tracking peaks in amplitude and timing and I'm wondering if there is a good way to more accurately track the time occurrence of a peak. I have filtered out the signal as much as I can and I can track the peaks pretty accurately when they are low to...
  15. F

    Strange behaviour on certain analog reads

    Hello. I'm getting some kind of "stepping" problems on certain pins as though the average signal goes up one step and stays there and sometimes it's a step lower. I'm averaging the signal and it seems the behaviour is different depending on how I shift it. If I add say a value of 0.5 to the...
  16. F

    How to add a delay to an analog read?

    Hello, I'm reading analog sensors and want to make delayed versions of it in a set number of milliseconds or samples. I'm thinking something like this: out = delayBuffer[i]; delayBuffer[i++] = in; if(i >= delaySetting) i = 0; However, how do I make that for multiple sensors...
  17. F

    Store values for a period of time.

    I need help with a solution to a problem. I want to store some calculations of sensor values (peaks etc.) for a period of time say 2 milliseconds and when that peak "expires" I want to store it in another variable that saves the value for another 5ms or so. I need to compare values that...
  18. F

    Teensy 4 send multiple MIDI notes at once through USB.

    Hello! I'm wondering if it's possible to send multiple MIDI notes at once through USB midi. As far as I understand MIDI works sequencially sending one message at a time but I'm wondering if it's possible to send multiple notes and have them played at the same time without any delay between...
  19. F

    Function to find index in 2D array based on sensor values

    Hello! I need to write a program that can find the right indexes in a 2D array based off of sensor values and have no clue how to best solve this in an effecient way. Basically I have two variables that I calculate from sensor values. They range from -1200 to 1200. I need the variables to...
  20. F

    How many elapsedMicros can you use on the teensy 4?

    I'm new at programming, I'm still half way through a book on C programming and I'm learning so bare with me. Is there a limit on how many timers you can run simultaneously with the teensy 4? I'm measuring the width of peaks on a AC signals so I check when the value crosses above zero and when...
  21. F

    Teensy 4: Global vs local variables speed of execution

    I'm a novice in programming and I'm using mostly global variables in my code to make it more readable. It's hard enough as it is to wrap my mind around what my code is doing so keeping the variables up top helps at the moment and I need them to keep their values in scope of the main loop. I'm...
  22. F

    Program "curves" for realtime use.

    Hello! I'm working on an electronic drum brain and I'm wondering what the best way is to implement curves for use as moving thresholds, velocity calculations and whatnot. For example, after a drum is struck, the signal will take maybe 30 milliseconds to decay below the threshold. I can't wait...
  23. F

    Teensy 4, how to store ADC readings in buffers

    Noob here. I'm planning to do an electronic drum project and I'm thinking about the best way to get fast ACD readings from multiple piezos. Is there a way to do readings as fast as possible cycling through the different piezos and store the last reading from each piezo into buffers? I could...
  24. F

    piezo cable

    I'm trying to use this piezo cable to detect a knock but I'm getting some weird results. Basically it responds very poorly to impacts, I have to whack it really hard for it to detect a spike. I'm an electronics total noob and I'm sure I'm using it wrong. I've wired it like a regular piezo with a...
Back
Top