-
Notifications
You must be signed in to change notification settings - Fork 34
32 bit I2S output, F32 FFT256 #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
It's about twice as slow as the I16 version but produces cleaner output
output is garbled but it's not crashing
The reference manual suggests that the I2S needs to be disabled and clock-gated when changing the clock params
Over on my Tympan_Library (which was shared with this OpenAudio library until I had to focus more on Tympan), I redid the input and output I2S classes to be compatible with both Teensy 3.6 and Teensy 4.x. When I did this a few months ago, I used the then-current version of the Teensy Audio input_i2s and output_i2s as my model. I added in the adjustable sample rate and the adjustable block size. I then repeated for input_i2s_quad and output_i2s_quad. It all seems to be working for Teensy 4.x and Teensy 3.6. I don't think that it does 32-bit I2S transfers, but maybe it does? If so, it might be easy and desirable to pull that code back over here to OpenAudio? Does anyone wanna take a look? It's in the branch "feature_Teensy4_SD" because it both upgrades compatibility to include Teensy4 and it upgrades the SD functionality to work with the latest Greiman-based SdFat included with Teensyduino 1.54 Beta5. Tympan OutputI2S: https://github.com/Tympan/Tympan_Library/blob/feature_Teensy4_SD/src/output_i2s_f32.cpp Chip |
Chip, this is timely. I have been working on the input and output for
F32, even today. I will take this on to get the input and output F32
classes going again for: 1-changing data rates, 2-variable block size,
3-master or slave clocking. But as of now, I am not equipped to test
more than 16-bits. Most 16+ bit converters don't have that kind of
noise level, and I would need to get a test setup. So, I would defer 24
or 32 bits until I get the rest up to speed. Thanks for doing it for
Tympan. The open audio names for these will have "_OA_" in the files
and classes to stop collisions.
BTW, everyone needs to be aware that the F32 inputs and outputs use 4
AudioMemory (non-F32). Even if every object Audio Object is F32 they
must be there. The input and output can, of course, share the same 4
blocks.
Bob
…On 1/5/21 1:12 PM, Chip Audette wrote:
Does anyone wanna take a look?
|
I looked at the code and it appears to be running the I2S interface in 32 bit mode but the output DMA only writes to the top 16 bits so the bottom 16 bits are always 0, and the input DMA only copies the top 16 bits. This is the same as the base audio library. The changes in my commits from "dma 32 bits at at time to i2s" to "convert directly from f32 to i32" will make the output full 32 bit resolution. I think porting the Tympan code here would be nice as it's one less divergence with the base audio library. |
Chip, I looked at your links for Tympan In/Out F32. You have been busy! They look good. I tried these with some other Open Audio pieces using 16-bit I2S, T3.6 and T4.0 and saw no problems, consistent with what you are seeing. I ran into no name conflicts and would agree with @jcj83429 to use your Tympan classes with Open Audio. I believe the AudioInputI2S_F32 / AudioOutputI2S_F32 names can be used without OA. We will need to sync the 2 libraries, but that should make sense since the goals are the same. How is that best done? Pull requests on Tympan, maybe? My comment on needing I16 audio memory is out of date and wrong. Your implementation uses only F32 memory blocks which is smart. Right now there are no OA I/O except with clobbered names, so I will proceed to get F32 I/O restored with limitations noted in the .h and readme.md. Incidentally, your get_isOutOfMemory() & flag_out_of_memory are something that I sure could have used at times. It is probably the most important part of an error manager. How do you envision this being used, in general, i.e., outside the Input routine. Bob |
…end all available precision. Basically, I re-did jcj83429's pull request, which got outdated, to current code: chipaudette#8
I changed the output_i2s_f32 to set the I2S output to run in 32 bit mode (teensy audio library already does this) and convert F32 directly to I32, avoiding the conversion to I16. This is useful for doing digital volume control with a 24 bit DAC.
I also deleted control_tlv320aic3206, which conflicts with the one already in teensy audio library, and ported the FFT256 to F32. The F32 version of FFT256 is twice as slow as the I16 version, but has better dynamic range.
I tested the I2S output and FFT256 on a teensy 3.6.
This change probably breaks the I2S input. The fix may be as simple as changing dma.TCD->SADDR to (void *)((uint32_t)&I2S0_RDR0 + 2) but I don't have an I2S ADC so I can't test it.