Search results

  1. T

    Filter acceleration signal

    There is a library for filtering on Cortex-M processors: https://arm-software.github.io/CMSIS-DSP/main/group__groupFilters.html Conceive your filter in Python, the coefficients will be the same. You have to be very careful with precision, depending on your filter, you might be in a situation...
  2. T

    Unreliable recording delay

    Yes it is me again and I am here due to a delay issue (again). This time, I am concentrating on playing and recording sound with one Teensy (I am using a Teensy 4.1 with the SPH0645 I2S microphone and the MAX98357A I2S amp). I wrote a simple code to do this: digitalWrite(0,LOW)...
  3. T

    Synchronizing teensies (again)

    Schematic for better understanding: I am measuring gej(t) and gjr(t) (32 of each). Code for recording: while(digitalRead(0) == HIGH); Q_in_L.begin(); Q_in_L.clear(); for (i = 0; i < nfor; i++) { while(Q_in_L.available() < 1); sp_L = Q_in_L.readBuffer()...
  4. T

    Synchronizing teensies (again)

    The 32 Teensies also have 32 speakers to do it the other way. Also, later code is basically a partitioned convolution filter made with the Green's functions. It is really heavy, so it can't run on a single Teensy. Also, we decided that each Teensy should be independent (it's a metasurface)...
  5. T

    Synchronizing teensies (again)

    The microphones are SPH0645, it is i2s mems, so... Also I have the PCB made... I can only trigger with pin 0.
  6. T

    Synchronizing teensies (again)

    Pin 0 is HIGH by default. To trigger, it is set to LOW.
  7. T

    Synchronizing teensies (again)

    I am not completely sure either, but the delay is really there! I think it's because all the Teensies do not start at the same time, so there is some jitter... It could also be the queuing in the audio library introducing that... I have been able to correct that for one Teensy (it's slowly...
  8. T

    Synchronizing teensies (again)

    Hello everyone, I have a project where I need to record the Green's functions in two rooms. For those who don't know what it is, it’s basically what you hear if you play a brief impulse like an explosion. To do this, I just have an I2S amplifier and an I2S microphone on two separate Teensies...
  9. T

    Two queues on i2s input not working

    The code I used is : #include <Audio.h> #include <arm_const_structs.h> #include <utility/imxrt_hw.h> #include <SD.h> #include <SPI.h> File dataFile; const int chipSelect = BUILTIN_SDCARD; extern "C" uint32_t set_arm_clock(uint32_t...
  10. T

    Two queues on i2s input not working

    I actually tested it with a bunch of values, and it only works if the number of blocks is odd. I think it comes from the fact that the input is stereo while the output is mono, so it is not possible for the input queues to allocate everything, leaving a spare buffer for the output queue...
  11. T

    Two queues on i2s input not working

    You're right... the mono code uses 9 blocks while the stereo one uses 10 (maximum). So I increased the audio memory to 11, and it works! Then, I started to become crazy because increasing the audio memory is the first thing I tried. So, I did a test with 12, and it does not work! It seems that...
  12. T

    Two queues on i2s input not working

    Here is the mnimal code (using the original i2s objects) reproducing the problem: #include <Audio.h> #include <arm_const_structs.h> #include <utility/imxrt_hw.h> #include <SD.h> #include <SPI.h> File dataFile; const int chipSelect = BUILTIN_SDCARD...
  13. T

    Two queues on i2s input not working

    I corrected the test code, which still works. #include <Audio.h> #include <Wire.h> #include <SPI.h> #include <SD.h> #include <SerialFlash.h> int16_t *sp; float float_buffer[128]; // GUItool: begin automatically generated code AudioInputI2S i2s1; //xy=204,228...
  14. T

    Two queues on i2s input not working

    I have a code for Teensy 4.1 that is working well with one SPH0645 microphone (mono). But now, I need to make it stereo, which is why I am here... The strangest part is that even the output queue stops working (seems to struggle at "sp_L = Q_out_L.getBuffer();"). #include <Audio.h> #include...
  15. T

    Low-latency two-level partitioned convolution for the T4

    I know this thread is a little bit old... I tried to use your code, but it seems that it makes my Teensy 4.1 crash after a few seconds : #include <Audio.h> #include <arm_const_structs.h> #include <utility/imxrt_hw.h> #include "filter_twolev_partition.h" const int nc = 1280; float32_t...
  16. T

    Triggered I2S

    This time, I think it is good enough! To do this, I a added a delay of 1/4 of buffer : delay(100); digitalWrite(1,LOW); i2s_in.begin(); i2s_out.begin(); delay(100); digitalWrite(1,HIGH); while(digitalRead(0) == HIGH); delayMicroseconds(partitionsize/4/SAMPLE_RATE*1e6); i2s_in.begin()...
  17. T

    Triggered I2S

    I found something! I modified the I2S audio classes by removing the call to begin() in the lines: AudioInputI2S(void) : AudioStream(0, NULL) { begin(); } AudioOutputputI2S(void) : AudioStream(0, NULL) { begin(); } And called begin only after triggered with: digitalWrite(1,LOW)...
  18. T

    Triggered I2S

    Also, is it possible to stop i2s/dma and restart it when needed, so everything start at the same time? I tried to manipulate I2S1_RCSR and I2S1_TCSR but it seems to break everything. Actually, my problem is a little bit like trying to measure the speed of sound very precisely.
  19. T

    Triggered I2S

    I understand that you mentioned it's impossible to trigger I2S due to sigma-delta modulation, but I'm unsure if I really understood what I want: I'm not aiming to trigger I2S for every sample; rather, I only want the initiation of data transmission to be triggered. To clarify, I want the Teensy...
  20. T

    Triggered I2S

    I just tested something, and it's very strange: if I place "Serial.println(input_buffer[buffer_ind]);" before the line "I2S1_TDR0 = (uint32_t)output_buffer[buffer_ind]*0xffff;", the data are correct. However, if I place it after, I obtain the sawtooth pattern again. This doesn't make any sense...
  21. T

    Triggered I2S

    Yes, I know... but this seems to be the only way it even works... At least the values obtained with Serial.print() in the ISR seem correct (I tested it by emitting a sine wave with another speaker). Also, I didn't mention this earlier, but the values returned by getData represent a sawtooth...
  22. T

    Triggered I2S

    Alright, I've implemented the triggering parts, but I'm getting some very strange results... The values I'm seeing in the isr function are different from the values I obtain from the getData function! New code: #include "I2Sone_input.h" volatile uint32_t buffer_ind; volatile uint32_t...
  23. T

    Triggered I2S

    It works very well now! But... I still have a doubt: I don't fully understand how stereo works in the I2S audio library. To clarify, I don't see where the two channels are represented in the I2S registers (I2S1_RDR0 and I2S1_TDR0). Since I only want mono, I'm uncertain if the data is truly...
  24. T

    Triggered I2S

    I corrected the mistake with volatile. (I also forgot to activate the interrupt...). However, I'm still obtaining 0: #include "I2Sone_input.h" volatile uint16_t data_input; void Triggeredi2s::begin(void) { config_i2s(true); CORE_PIN8_CONFIG = 3; //1:RX_DATA0...
  25. T

    Triggered I2S

    Depending of the method I use, I obtain 0 or 65535 (=2^16-1) as result... I clearly don't really know what I am doing, however, I verified with my oscilloscope that the the i2s communication is active! Header file : #include <Arduino.h> #include <imxrt.h> #define IMXRT_CACHE_ENABLED 2 //...
  26. T

    Triggered I2S

    Sorry for the beginner question, but I'm having trouble understanding how to retrieve data from I2S. I noticed in the file i2s_input.cpp that data retrieval is accomplished with the line: dma.TCD->SADDR = (void *)((uint32_t)&I2S1_RDR0 + 2); While I understand that this sets the origin of the...
  27. T

    Triggered I2S

    For the context, the best way is to see my old thread : https://forum.pjrc.com/index.php?threads/triggering-problem.74361/ By "continuous recording sample by sample and transfer them to some buffer when triggered", I mean copying data from i2s register to buffer only when a pin is set to HGH...
  28. T

    Triggered I2S

    So, the only way is to do continuous recording sample by sample and transfer them to some buffer when triggered? Or do i need to use analog stuff?
  29. T

    Triggered I2S

    Hi everyone, Unfortunately, I require a very precise and repeatable method to initiate sound emission and reception on several Teensy 4.1 boards equipped with SPH0645 and MAX98357A I2S microphones and amplifiers. Currently, using the existing audio library, I encounter approximately 3ms of...
  30. T

    Triggering problem

    I think maximum 1/10 of period at 10kHz, so 10us... worst case...
  31. T

    Triggering problem

    Actually, in reality, I have 12 teensy for emission, so I really need the delay to be constant every time and everywhere... Also, my microphones and amplifiers are I2S. For the time reversal stuff: 1-The teensy (only one at a time) play a chirp, which is recorded and logged into a PC. 2-The PC...
  32. T

    Triggering problem

    What is the best way to do it actually? Is that even possible with teensy?
  33. T

    Triggering problem

    So, perhaps a class which pass it's input to it's output only when triggered (and placed between the output queue and I2S) could work ?
  34. T

    Triggering problem

    I need this precision because any variation of phase completely messes the multi-elements time reversal technique I want to use (if you don't know what it is: https://en.wikipedia.org/wiki/Time_reversal_signal_processing).
  35. T

    Triggering problem

    Is there a way to make this delay being always the same without rewriting the audio module code ?
  36. T

    Triggering problem

    I am trying to do a synchronized emission and reception between two teensy 4.1 (I use the SPH0645 as the microphone and the MAX98357A as an amplifier for the speakers). Here is my code for recording : digitalWrite(1,LOW); Q_in_L.clear(); for (i = 0; i < nfor; i++) {...
  37. T

    unexpected delay

    I am trying to do a synchronized emission en reception with 2 teensy 4.1. The first code, for the "master", which put it's pin 1 to LOW (to trigger the second teensy) and play a signal (chirp[12800], here some dummy sine at 500Hz) stored in memory. digitalWrite(1,LOW); for (i = 0; i...
  38. T

    Transfering float data between PC and Teensy

    I made the code simpler : const int nb = 2; byte buffer[4*nb] DMAMEM; Serial.readBytes((char *)&buffer, 4*nb); Serial.write(buffer,4*nb); And I am sending the data with : data = np.array([1,0.5]).astype(np.float32) arduino.write(bytes(data)) The data from the teensy can be read with...
  39. T

    Transfering float data between PC and Teensy

    I am trying to transfert float data between a PC (python) and a teensy 4.1, but my attempt with serial is a little bit... ugly. python code : # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import serial import time import scipy.signal as signal Fs = 44100 arduinos...
  40. T

    recording filtered signals

    Actually, I took it from an example (in audio) dedicated to the testing of this microphone : audio/hardwaretesting/microphones/SPH0645, and it works. The only thing I change is fft1024, which I replaced by queue_in. If i remove the filter, it is working...
  41. T

    recording filtered signals

    I am trying to record (on the teensy 4.1 SD card) a filtered signal from the I2S microphone adafruit SPH0645. I thought it was simple but... #include <Audio.h> #include <arm_const_structs.h> #include <utility/imxrt_hw.h> #include...
Back
Top