tirandagan
Member
Folks,
I have accumulated several questions about the audio card and audio library which I am consolidating into a single thread. I have noticed that the questions I have reflect issues others have asked in other threads (which were left unanswered) so feel comfortable this is not duplicative.
I am building a sub simulator for my 9 year old:
https://developer.ibm.com/recipes/tu...ine-simulator/
I am attaching an "architectural design" document so you can see where I am so far with the build (and connections to the teensy)
View attachment 13494
Here are a few problems I am having:
1. Intermittent audio glitches playing a Wav 2 from SD:
After the main setup, I start playing out a 3 minute WAV file from the SD card (using the audio controller SD or the Teensy SD do not fix my issue). I loop this file (re-reading it or reading another sound file after it finishes). However every 30s - 2 minutes I get a "glitch", the entire code seems to halt/pause and then continue. I am attaching a audio recording of this artifact:
View attachment Distortion.zip
My SD card is SDHC and when I ran the SD test , the worst SDblock time was 5.08ms (when reading 4 files at once) at 175.23% of audio frame time. I switched to SD_t3 but unfortunately this breaks the SdCardTest app so I only have the values from the traditional SD library. I am running my app, however, with TD_t3 by uncommenting the #define USE_TEENSY3_OPTIMIZED_CODE in line 35 of SD.h
I have the following libraries invoked by my code:
I also added memory usage code and am seeing an average of 30-38% except when this hiccup occurs. At that point the max mem usage jumps from 101% to 180%. I tried setting AudioMemory(50) with not effect.
Before I add more source code - any initial thoughts what could be causing this? I suspect some interrupt conflicts but after adding lots of debug lines I see this happens in random points in the code and random points in the music tracks.
Finally, here's the audio configuration I am running:
2. Once I figure out the problem above, I would like to accomplish a few more things:
a. Load an SD Wave file into memory and then...playmem - so I can loop in memory without noise when repeating
b. Control the pitch of the wav sound file (make it sound higher/lower in pitch)
I have accumulated several questions about the audio card and audio library which I am consolidating into a single thread. I have noticed that the questions I have reflect issues others have asked in other threads (which were left unanswered) so feel comfortable this is not duplicative.
I am building a sub simulator for my 9 year old:
https://developer.ibm.com/recipes/tu...ine-simulator/
I am attaching an "architectural design" document so you can see where I am so far with the build (and connections to the teensy)
View attachment 13494
Here are a few problems I am having:
1. Intermittent audio glitches playing a Wav 2 from SD:
After the main setup, I start playing out a 3 minute WAV file from the SD card (using the audio controller SD or the Teensy SD do not fix my issue). I loop this file (re-reading it or reading another sound file after it finishes). However every 30s - 2 minutes I get a "glitch", the entire code seems to halt/pause and then continue. I am attaching a audio recording of this artifact:
View attachment Distortion.zip
My SD card is SDHC and when I ran the SD test , the worst SDblock time was 5.08ms (when reading 4 files at once) at 175.23% of audio frame time. I switched to SD_t3 but unfortunately this breaks the SdCardTest app so I only have the values from the traditional SD library. I am running my app, however, with TD_t3 by uncommenting the #define USE_TEENSY3_OPTIMIZED_CODE in line 35 of SD.h
I have the following libraries invoked by my code:
Code:
#include <SD.h>
#include <Adafruit_SSD1306.h>
#include <Led7Segment.h>
#include <Grove_LED_Bar.h>
#include <SparkFunSX1509.h> // Include SX1509 library
#include <Audio.h>
I also added memory usage code and am seeing an average of 30-38% except when this hiccup occurs. At that point the max mem usage jumps from 101% to 180%. I tried setting AudioMemory(50) with not effect.
Before I add more source code - any initial thoughts what could be causing this? I suspect some interrupt conflicts but after adding lots of debug lines I see this happens in random points in the code and random points in the music tracks.
Finally, here's the audio configuration I am running:
Code:
// GUItool: begin automatically generated code
AudioPlaySdWav musicTrack; //xy=87,134
AudioPlaySdWav effect1; //xy=89,236
AudioMixer4 mixerL; //xy=317,118
AudioMixer4 mixerR; //xy=321,251
AudioOutputI2S audioOutput; //xy=512,219.7142791748047
AudioConnection patchCord1(musicTrack, 0, mixerL, 0);
AudioConnection patchCord2(musicTrack, 1, mixerR, 0);
AudioConnection patchCord3(effect1, 0, mixerL, 1);
AudioConnection patchCord4(effect1, 1, mixerR, 1);
AudioConnection patchCord5(mixerL, 0, audioOutput, 0);
AudioConnection patchCord6(mixerR, 0, audioOutput, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=180,507
// GUItool: end automatically generated code
2. Once I figure out the problem above, I would like to accomplish a few more things:
a. Load an SD Wave file into memory and then...playmem - so I can loop in memory without noise when repeating
b. Control the pitch of the wav sound file (make it sound higher/lower in pitch)
Last edited: