No I am not using the std namespace anywhere in my own code, as I mentioned above, BUT I just found that some library code indeed IS using the std namespace! But why was this not presenting a problem for so long up until now? Very strange, but...
Ok, I was able to compile by using uint8_t, but since my project uses the Keypad library, I had to also change Keypad to use uint8_t instead of byte too. Thanks for the tip, I'm very much not sure why this issue is happening now vs. before, but...
Here is a portion of the compiler output:
In file included from src/XRAsyncIO.cpp:1:
include/XRAsyncIO.h:62:9: error: reference to 'byte' is ambiguous
62 | byte buffer[ASYNC_IO_W_BUFFER_SIZE];
| ^~~~
In file included...
No, I'm not.
Yes, i'm including the Arduino header.
I'm kind of thinking it might be something with the way PlatformIO is caching or scanning for dependencies out of order or some sort of linker error after trying to compile the project from...
Hi, I have a project which was previously compiling just fine on my MacBook Pro, but my computer had to be wiped so I've had to reinstall everything.
I'm using VSCode, PlatformIO, a Teensy 4.1, and my MacBook Pro is running on macOS 13.5.1.
It...
Latest branch seems good so far for me. Just an FYI, I made my own fork here because I'm using PlatformIO and I had to modify ResamplingReader.h to use forward declarations in a ResamplingReader.cpp file for the resetStatus, getStatus, and...
Another question: I notice better playback timing for short one-shot samples (~100kb file size or less) when using a smaller sample size and buffer count (say, 512 samples @ 5 buffers). However, for longer samples (and larger file sizes) I tend...
Yeah some instrumentation would be good, I hope to get there eventually, still just in the "trying to keep all these jenga blocks from falling over" phase of development. I have a lot of tech debt already. I would add you as collaborator to my...
Thanks. Could it be feasible option to have the sample files’ open/close states programmatically set by the user? The sample files could remain open while a pattern is playing them, so that they only need to be opened once. Then, when a pattern...
Was thinking something like this, conceptually:
#define MAX_TRACKS 16
#define MAX_STEPS 64
void onStep()
{
// Iterate over all tracks
for (uint8_t t = 0; t < MAX_TRACKS; t++)
{
// Get the current step of the track...
So I tried out both configurations, I have some observations:
I'm using PlatformIO, so I'm not sure if it's that, but I was getting an error about play_failed() being undefined. It's declared but there's no definition as far as I can see? I...
Yes I was looking at your thread and have been tinkering around, thank you!
Sorry for derailing the thread a bit. I will try to use this soon and report back, very much appreciated.
Back on topic, I've done, tested and documented an update which doesn't require modifications to other libraries, and gives you a couple of options. You can find it on this branch. Note the markdown file for documentation.
Briefly, you can...
Thank you both. I should clarify that I am referring to displaying the static waveform of an entire audio sample file. I am not currently looking to draw an oscilloscope style realtime audio waveform.
My device has a line input for recording...
@h4yn0nnym0u5e I'm also interested in using sample data to display the sample waveform on my display. Is there currently a way I can read out the buffered sample data in a loop or something? I wasn't sure of a method on the playback object to...
Yes, I was (and am) currently doing that check before reading or writing. The issue at the time was with the buffered audio which was using EventResponder while the underlying SD library was calling yield(). The issue only seemed to occur when I...
> when you're reading from an audio file, what is the data rate required for smooth playback?
Maybe @h4yn0nnym0u5e can chime in here, but I have his SD audio buffering code right now configured at 7 buffers of 512 samples per playback object. My...
Hm, for my specific application, I'm honestly not sure it could be simplified that way.
Right now, my application only checks if I need to write every 1 second (Y=1). I don't automatically write every 1 second, I wait until there's a signal...
Sounds good, glad it's working OK for you. Yes, if you turn the above approach into a class then you should be able to instantiate multiple copies, each of which can be in a different state / stage of its progress. If it's worth the effort...
I ended up using a state machine approach, as well as queues. I think eventually it might make sense to parallelize the reads/writes, instead of doing them on a sequential queue basis, but for now it seems fast enough and doesn't cause too much...
Just a note, I'm hearing bits of glitches on the streamed samples sometimes now when the concurrent reading/writing starts, but it may be the buffer and chunk sizes I need to play with.
It works swimmingly now so far! Writes seems to do well at 4kb chunks so far. It took ~77ms to write ~360k data to a file.
Thank you yet again for all your help and diligence on this!
Hm I thought I should only keep the file open briefly to write one chunk at a time because the SD card can only have a single file open at a time, and I want the audio playback objects to not be stalled trying to open files.
Got it. I take it back though, I was able to get my project file _reads_ to happen concurrently with buffered SD playback using a non-blocking main loop approach, but as far as writes go, even in 512 byte sized chunks, it seems it pretty much...
I was discussing the topic of reading/writing project data structures from the SD card while at the same time playing audio files which are buffered from the SD card in this thread.
I am able to do non-blocking reads of other project data from...
Nevermind, I figured out that I just needed to implement non-blocking buffered SD reads/writes from the main loop. Before, I was just doing large blocking read/write calls, and then I was trying to do buffered read/writes from within a while loop...
Thanks for all your help! Would you prefer I start a new thread about the concurrent playback + SD card access? I’m trying to read/write my custom data structures in chunks to the SD card while the buffered audio is playing and I can’t seem to...
Never ever access the SD card from interrupt! It's the major cause of pretty much all previous issues with SD streaming...
I would expect SD accesses to work during playback, with the caveat that the audio updates are taking ~50% of the CPU, so...
Another question: I've noticed severe lag / program failure when trying to read/write from the SD card while these AudioPlaySdResmp are playing, which makes sense if the SD card is busy streaming audio files. Is there a simple way to set a flag...
Alright, I fixed the sketch. I was being sloppy before. Updated sketch here.
Very cool that this works! I will have to try and benchmark this approach for my project to see if offers better timing / value, because I could see myself coming back...
RESAMPLE_BUFFER_COUNT affects the number of buffers allocated to each playback object, so 2048, 7 gives you seven buffers of 2048 samples, thus 28kB of memory used to buffer about 325ms of audio. Once a buffer's data is consumed the...
@h4yn0nnym0u5e I have a few lingering questions as well:
1. What does adjusting the RESAMPLE_BUFFER_COUNT actually affect? I'm curious if I should be increasing this value since I'm opening lots of files concurrently given the multi-track sample...
Welp, here's the best I have so far, but I think either it just doesn't work or I'm doing it wrong somewhere. At best I sometimes hear flashes of sounds, so maybe there's a bug in my sketch...
@h4yn0nnym0u5e in regards to the slow playback start and the click sound -- on my end these are a million times better! I don't hear a click sound at all. I also took your advice and put my sample folder at the top level, and that plus your other...
I agree with your prioritization, and thank you so much for dedicating time to this!
I've switched from using SW SPI to HW SPI for talking to the OLED display, and it is way faster, and this basically eliminated the stuttering in the audio /...
Just reporting in... I think there are three issues for me to attack, probably in this order:
triggering playback from uClock or other interrupt code
slow playback start
your repeatable click
I've been struggling a bit today with getting...
This is repeatable. I hear this click at the end with a specific kick drum wav sample. https://gist.github.com/grayxr/3ca01ce5db5761a499ba554b4be84b0e (using the BD.WAV sample from the google drive link I shared above) demonstrates it. Careful, I...
Seems like if the buffered WAV file playback is going to be in my main loop, I have to figure out how to use the SSD1309 OLED with the u8g2 library in such a way that is non-blocking, because I think the SPI communication to the OLED is what is...
So I made a revision to the original sketch to try and use uClock. It works because I have a separate crude data structure tracking the trigger events, and then I'm scanning for them and firing them in the main loop. It works decently for this...
Yeah with having to sacrifice all of the PSRAM for caching samples freed up now, I can probably move all of my project files into PSRAM during a play session, rather than how I have it now which is to read/write project data to the SD card in...
Ok, that makes sense. But now that I know that the Teensy Variable Playback changes don't require the Teensy Audio library changes, I am wondering if the Teensy Variable Playback changes are/can be easily interrupt safe, specifically playing...