Search results

  1. M

    Porting moog ladder filters to audio objects?

    Wow, I had forgotten about this discussion. Have a newborn so I’ve been absent from teensy for the last 6 months or so, I’m happy to see it get incorporated into the library. I will dust off my 4.0 I bought and try and give it a play in the next week. Nice work, Paul! Strangely I didn’t get...
  2. M

    Porting moog ladder filters to audio objects?

    The lookup table is generated using the standard tanh() function; //fill a float [4097] array +/- 1.0 tanh function uint32_t arrayCount = 0; for (int32_t i = -32768; i <= 32768; i += 16) { float Val_1 = (float)i / 32768.00; tanhArrayF[arrayCount] = tanh(Val_1); arrayCount++...
  3. M

    Array handling in the audio tool.

    There's nothing inherently different dealing with arrays inside vs outside audio library from my experience. I find it's easier to declare and initialize the array in the .cpp file of your audio object, and reference it outside with extern. i.e inside audio object .cpp; float variable1[16]...
  4. M

    Vector Math

    I will take that advice. In the meantime I'm converting all my single variables into array groups, that should make it easier to integrate any possible vector math down the road conceptually. Thanks for your input.
  5. M

    Vector Math

    This is good advice, though just given the ambitiousness of the audio project I'm undertaking, i think I'm going to have to use every trick in the book to get the most out of a T3.6... either that or start offloading some things onto external hardware chips, which is not a bad idea Vs...
  6. M

    Vector Math

    Ok, that makes more sense. So if you were building an 8 channel mono mixer that did 8 multiplications, this could be done using the vector multiply? pSrcA could be an array of 8 values representing one sample of incoming audio, pSrcB could be multiplication values for each sample & pDst would be...
  7. M

    Vector Math

    In reference to; https://arm-software.github.io/CMSIS_5/DSP/html/group__groupMath.html I'm trying to understand where vector math has usage given that it expects constants for the A/B array? Consider the vector float multiply; void arm_mult_f32 ( const float32_t * pSrcA, const float32_t *...
  8. M

    What Timer is used to derive the 44.1khz clock the audio library runs at?

    Thanks, Paul. I assume using inbuilt DAC/ADC means it's deriving the clock from the programmable delay block. I'll read up on that in the reference manual.
  9. M

    What Timer is used to derive the 44.1khz clock the audio library runs at?

    Curious to know how the audio rate clock is derived. Is it a flextimer?
  10. M

    Porting moog ladder filters to audio objects?

    Played around with an interpolated tanh table (4096 samples) Vs the real computational function. Interestingly there are some interesting rounding errors that deviate the results slightly every pass, maybe that would give it some character? I'm curious how this function would react in the...
  11. M

    Porting moog ladder filters to audio objects?

    I know the tanh() in these filters is at 64-bit precision, but the audio feeding them is 16-bit. This experiment is a waste of RAM space, but i setup an array[65535] and stored tanh +/- 1.0 in int16_t format. I wanted to see how fast a read of -32768 -> 32767 was done first using a lookup table...
  12. M

    Porting moog ladder filters to audio objects?

    ah. Maybe with a 32bit float you could do fixed point integer conversion (int32_t) to speed it up, but 64-bit...
  13. M

    Porting moog ladder filters to audio objects?

    Perhaps this is an area where a lookup table could be helpful? Linear interpolation is pretty fast, maybe coupled with a 12-bit tanh table (4kb). I’ve been learning the audio library since I first posted this am I feel I’m at a stage where I can help contribute.
  14. M

    Coding Tricks - Reducing SRAM & CPU cycles

    Yes, Absolutely. My suggestion is to try things out and see what results you get. Since i'm working a lot with the audio library i'm constantly benchmarking using AudioProcessorUsage(); I guess my idea for this post was more to create a large collection of tips that readers could look through...
  15. M

    Coding Tricks - Reducing SRAM & CPU cycles

    Following on from this; A boolean variable is a byte, despite only having two possible variables. If memory is a concern, and you have many boolean variables, consider wrapping them all inside a single integer variable; uint8_t has 8 possible boolean variables. uint16_t has 16 possible...
  16. M

    Coding Tricks - Reducing SRAM & CPU cycles

    I had an idea that an ongoing forum post containing little optimization tricks might be a benefit to the community, and just an interesting read overall. Certainly there are blogs you can search on Google and harvest a trick or two, but having everything in one place (plus ones not generally...
  17. M

    Tutorial on digital I/O, ATMega PIN/PORT/DDR D/B registers vs. ARM GPIO_PDIR / _PDOR

    Bullseye! I plugged that in before i read the datalines and BINGO. It adds about 0.8% more CPU overhead (vs without delay), but allows me to compile using Fastest With LTO. Is this more efficient than using a timer? Thanks for your help, 3 days ive been struggling with this issue.
  18. M

    Tutorial on digital I/O, ATMega PIN/PORT/DDR D/B registers vs. ARM GPIO_PDIR / _PDOR

    I suspect you’re right. I think maybe the code is “too fast” in some situations for the memory I’m controlling. I’m going to try and program in some delay (without using the delay()) and see if that helps. The memory wants specific timing once an address line is written before it’s ready to...
  19. M

    Tutorial on digital I/O, ATMega PIN/PORT/DDR D/B registers vs. ARM GPIO_PDIR / _PDOR

    Think my issue could be related to setting optimize to "Fastest with LTO" in arduino IDE. When i switch it to "Faster with LTO", the corruption goes away... I did a test, recompiling both ways. Either it's problematic with GPIO port commands, or just the way I'm coding it has to be phrased a...
  20. M

    Tutorial on digital I/O, ATMega PIN/PORT/DDR D/B registers vs. ARM GPIO_PDIR / _PDOR

    I switched over to PDOR and haven’t experienced the same issues. I will revisit this again, but given that I can write and clear bits in one operation with PDOR, it turns out to be more efficient vs PSOR + PCOR. For most of my ports, the global setting of pins shouldn’t be an issue, but one...
  21. M

    Tutorial on digital I/O, ATMega PIN/PORT/DDR D/B registers vs. ARM GPIO_PDIR / _PDOR

    Actually still confused. I thought a value of "0" had no effect on bits for PSOR? I've been clearing the bitmasks at the beginning of the loop with PCOR...
  22. M

    Tutorial on digital I/O, ATMega PIN/PORT/DDR D/B registers vs. ARM GPIO_PDIR / _PDOR

    *where i = uint32_t I've been doing some code optimization using GPIO ports on the T.36, for some reason I'm having troubles with GPIOB that I'm not seeing on other ports. Why doesn't this second equation work equally to the first (which does work)? example 1 works. GPIOB_PSOR = ((i & 0x40)...
  23. M

    Porting moog ladder filters to audio objects?

    #define WAVE_AMP 32000 should this instead be (see below)? I didn't understand at first, but now i understand the ampl scaling. If full scale in teensy library is +/- 32767 (signed integer), we'd want to divide by this amount to get +/-1.0 in the moog models, right? #define WAVE_AMP 32767...
  24. M

    Porting moog ladder filters to audio objects?

    last comment as its 3am here. I was able to swap in the Stilsonmodel.h vs RKS and the former works fine, so i think there is an issue with the code provided for the RKS model.
  25. M

    Porting moog ladder filters to audio objects?

    Ah I think i figured out why this wasn't working, funny its obvious now. virtual void SetResonance(float r) override { resonance = r * (t2 + 6.0 * t1) / (t2 - 6.0 * t1); } virtual void SetCutoff(float c) override { cutoff = 2.0 * c / sampleRate; p = cutoff * (1.8 - 0.8 * cutoff)...
  26. M

    Porting moog ladder filters to audio objects?

    The hum might be a sign of the cutoff being too low. The cutoff value is in Hz so 1000 = 4-pole filter with a 24db rolloff beginning at 1000hz. Better to set the cutoff higher for better clarity initially; // Default is 0 (no resonance) mDSPm.SetResonance(0.0); // Default is 10,000hz...
  27. M

    Porting moog ladder filters to audio objects?

    Is there a trick to getting RKSimulationModel to work. Simply commenting out //#define MDSPM leaves me with no audio? I want to hear if these "clicks" are in other filter models.
  28. M

    Porting moog ladder filters to audio objects?

    If i comment out SetResonance(resonance);in MusicDSPModel.h, i can control the cutoff, but i feel that might be there for a reason. I'm also hearing little "clicks" in the audio, which doesn't seem to change when giving audio library more memory or increasing the buffer in the asio driver...
  29. M

    Porting moog ladder filters to audio objects?

    I've had a chance to test it out. To evaluate i quickly assigned midi controllers to the cutoff and resonance value. Realtime resonance adjustment via midi works (and sounds good), but when i attempt to change the cutoff it kills the audio (requiring reboot). If i change the value in void...
  30. M

    Porting moog ladder filters to audio objects?

    Awesome! excited to try it out on the T3.6!
  31. M

    Guide/tips for writing custom audio effects for Teensy Audio Library

    Is it possible to call a function from your main sketch in an audio object? Or would you move the function into the .cpp?
  32. M

    Porting moog ladder filters to audio objects?

    I imagine this wouldn't be too hard, but my understanding of audio library isn't strong enough yet. Is anyone interested in giving it a try? Most of these have very friendly licenses. https://github.com/ddiakopoulos/MoogLadders
  33. M

    using the eeprom for audio sample memory + Audio Library (playQueue Vs audio object)

    I figured it out, i was able to learn from the code posted here https://gitlab.cs.washington.edu/kgoel/481/blob/808591d031a684e5cbe0675c7bdde2c1dabde5d4/SoundBrainTeensy/SoundBrainTeensy.ino I ended up loading a 4096byte 8bit clap sample (stored on SD) into the eeprom using the code below...
  34. M

    using the eeprom for audio sample memory + Audio Library (playQueue Vs audio object)

    I'm very new to the audio library, to help me get familiar i wanted to give myself a basic project. I wrote a small program that writes a 8-bit random number (0-255) to the onboard 4kb eeprom on startup. the audio is sent through the playQueue object to a mixer in the audio library then out the...
  35. M

    Read SD card file values (char string) into an Int array?

    No worries, luckily it wasn't a major change. serially printing each value I've noticed is the main bottleneck, and skews the results accordingly. That being said, using your algorithm i was able to parse and serial.print 128k variables in 1.1seconds. I see this being very useful as an...
  36. M

    Read SD card file values (char string) into an Int array?

    I've been spending today porting over everything i did using SD.h to sdfat beta, so glad I have. I was able to test the code below with my same 132kb file and speed has been dramatically improved...going from around 2.5sec to 74ms. "Parsing 495127 characters into 131195 numbers took 74...
  37. M

    Read SD card file values (char string) into an Int array?

    Actually, it all works with the settings below. FsFile is for Fat32. I opened the txt on my computer, i can see all the data is there, i had to read through your code and i see you limit the number of printouts.
  38. M

    Read SD card file values (char string) into an Int array?

    Even with sdfat beta, I can't get exFat to work...so I'm trying to get this code working in Fat32 mode. I changed; SdExFat sd; ExFile asciiFile; to SdFs sd; FsFile asciiFile; ....which is the only way i can get it to write. FsFile is for fat16, however, as File32 doesn't seem to work. With...
  39. M

    Read SD card file values (char string) into an Int array?

    Nice work! I'm excited to try. I read that when you read a SD file, it automatically loads a 512-byte block and subsequent reads are actually done from memory (until the next 512-byte block is pulled). Maybe that explains the magic number (512 for your buffer)
  40. M

    Read SD card file values (char string) into an Int array?

    Thanks! I will duplicate the function and experiment with modifications like this. I implement something like this when doing the serial transfer, group packets into a single word, it does speed things up vs sending character by character., I'll post my results.
  41. M

    Read SD card file values (char string) into an Int array?

    Cleaned up and refined a bit. Used "isDigit" function instead of searching for specific character. If you're just dealing with numbers, you can filter everything else besides numbers being saved to the character array using "isDigit". void parseFile(){ myFileIn = SD.open("whatever.txt"); if...
  42. M

    Read SD card file values (char string) into an Int array?

    I agree with all your points. I also tend to code in a way "that just works" first and then spritz it the more you look at it and realize you can do things more efficiently. The same data file that took 2seconds to read take 25 seconds to transmit over serial. There is always room for improvement .
  43. M

    Read SD card file values (char string) into an Int array?

    1. Wouldn’t 999. = 4bytes? Bytes would always equal one more than the number of digits, no? 2. Luckily no negative numbers. 3. The function runs pretty fast, it parses 130k variables (though most 8-bit data (3digits)) in 2 seconds on my T3.6
  44. M

    Read SD card file values (char string) into an Int array?

    I've got it all working. Attaching my function if it may be of help to others. Consider a .txt file with the following character sequence; <9876543.1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20> The code will skip '<' '>' & '.' and write everything else to a small char buffer (7)...
  45. M

    Read SD card file values (char string) into an Int array?

    yeah, the idea is to keep the SD datafiles intact, i.e <1.2.3.4.5.6.7.8.9.100.200.400.800.1600.32000.<128.128.128.128.128.128.128.128.> ... ... and convert these character arrays to integers and stored in memory only when the file is loaded. I setup a data file like <9876543.1.2.3.4.5.6.7.8.9...
  46. M

    Read SD card file values (char string) into an Int array?

    Getting closer. I'm now counting the "." as the end of a variable, so i can count number of variables in a file. I've thought this through, the largest number i need to represent is 7 characters long ( i.e 9999999). So maybe in the code below, i read each character into an array (i.e char...
  47. M

    Read SD card file values (char string) into an Int array?

    I've looked through a lot of forums last 24hrs but can't find a solution. Suppose you have a .txt file (on SD), and in that file you have values stored like; <1.2.3.4.5.6.7.8.9.100.200.400.800.1600.32000.<128.128.128.128.128.128.128.128.> quick question(s); If you wanted to read ascii from...
  48. M

    painfully slow SD file copy code / any suggestions?

    Right now i think it's "good enough" to move forward. The largest files i'll be dealing with are probably 1mb max, so speed isn't crucial for any internal file managment. Anything going over serial will be sent via character arrays and the raw data streamed straight into a SD card file with code...
  49. M

    painfully slow SD file copy code / any suggestions?

    It works! It's aliveeeeeeee! just corrected; readBytes(fileBuffer, len) to myFileIn.readBytes(fileBuffer, len); speed is light years better! Thanks for your help!
  50. M

    painfully slow SD file copy code / any suggestions?

    forgive my ignorance, could you alter the example code to demonstrate this? Posting a useable sketch is difficult, i've got everything in tabs in arduinoIDE.
Back
Top