robertsonics / Tsunami-Arduino-Serial-Library

Arduino Serial Control Library for Arduino
11 stars 9 forks source link

Stop ALL Tracks on a specific Output OR Allow Query #9

Open djrobby opened 2 years ago

djrobby commented 2 years ago

I have 560 mono tracks that are played/stopped via a REST API communicating with an application specific NodeJS implementation of this serial protocol. Everything works as expected but I believe that the routine I have for stopping whatever TRACK is playing on a specific OUTPUT is very inefficient. I say this because I am sending 560x STOP commands (1 per track) to any given OUTPUT that I want to stop from playing whatever track(s) it is currently playing. As it stands, the serial protocol only allows you to either Stop ALL Tracks on ALL Outputs or Stop One (1) Track on One (1) specific Output. I did try to maintain a state of which tracks might be playing on a specific output but, due to edge cases, it kept going out of sync with what was actually playing on Tsunami.

With that in mind, are you able to implement the ability to either:

Thank you in advance 🙏

robertsonics commented 2 years ago

This is certainly a reasonable request. I can implement a command to stop all tracks on a specified output, but it will necessitate a firmware update as well. Are you using the original Tsunami or the new Tsunami Qwiic version?

djrobby commented 2 years ago

Thank you for your prompt response. I'm using Tsunami original for development/testing but was planning on ordering additional units for deployment. I'm assuming the original version has been phased out?

robertsonics commented 2 years ago

Yes - the AKM codec went end-of-life, necessitating a new version. You should also be aware that even the new version is becoming harder and harder for Sparkfun to keep in stock due to numerous parts being affected by the global supply chain issues. They've been building small batches when they can, but these sell out quickly.

I'm actually working on a new 10-channel output player that should be easier to manufacture and keep in stock that I may sell directly from my website, but that's at least a few months off.

Give me a few days to see about implementing this new command, and I'll post back here.

djrobby commented 2 years ago

I understand. Supply chain is a big mess right now! I won't need production units until fall this year (Sept-Oct). As for quantities, my current forecast is 40-60pcs.

My application uses all 8-channels so this board has always been on my radar. In the past, we wrote a custom ASIO driver using BASSASIO audio library to drive these channels on a regular PC equipped with 4x physical audio outputs capable of 7.1 playback. However, as PCs become smaller in form factor, manufacturers have started phasing out the additional audio jacks for a single headphone output along with optical. Also, with this setup, I was limited to the Windows platform only. So, I finally decided to move off Windows and over to a browser based solution using your board. So far, it's been rock solid!

Thank you again! 🙏

robertsonics commented 2 years ago

If I may ask, have you had any problem with the unbalanced outputs and noise? I know that a small number of users have had issues with certain combinations of power supplies and external amplifiers. I've been considering balanced outputs on the new design but this would add significant cost and size.

djrobby commented 2 years ago

No, I have not. Attached is my current setup going 16P out from your board to 16P I/O block to a 4CH amp (production setup will use 2x amps). My application does not require high-fidelity audio as it's only driving mono tones via siren speakers. I'll be on the lookout if I hear anything and report back to you.

Tsunami Original Setup

djrobby commented 2 years ago

So, I have an interesting issue after letting the 4x mono tracks playback (in loop mode) on 4 independent outputs (1 track per output) for more than 3-4mins. The playback turns into a clicking noise. I have a video documenting this issue here: https://youtu.be/FoR8l_J6mVw. Any ideas what could be causing this?

robertsonics commented 2 years ago

The first step is to determine if the processor on the Tsunami is still running or has gone off the rails - which is what it sounds like. Once it's in this state, does it respond to any serial communications? Can you send the stop commands and observe the LED going back to the flashing heartbeat? If not, that's evidence that the processor has crashed and the sound you're hearing is simply the audio buffer being played but not being updated.

I am rather confident after all this time and all the units out there that there are no firmware bugs that cause the processor to crash - I routinely leave a Tsunami looping for days - so the only thing left is hardware. This could be anything from a power supply issue, static discharge or a defective Tsunami. For example, a bad solder connection on the microSD socket can cause something like this, and I've seen units come from SparkFun with loose pins.

How are you powering the unit?

djrobby commented 2 years ago

I'm driving the Tsunami board and a 4-channel x 65W/channel amplifier using a MeanWell 12VDC 350W power supply. I just tested now and the processor does respond to the STOP and STOP-ALL commands. It even accepts the play command but after the issue starts, it continues to play the clicking noise until RESET. The solder joints look fine to me...I've upload some pix here for your reference: https://imgur.com/a/gt6ddnd. Please let me know and I post more pictures as needed. Thanks!

robertsonics commented 2 years ago

When you send the STOP-ALL, does the LED go out and resume the heartbeat flashing? Does the LED go on solid again when you issue another play command? If so, it could be a hardware issue between the CPU and the audio codec, something that's causing the codec to either reset or lose sync with the TDM protocol. If it were me here, I'd examine all the solder connections on the CPU and the codec under a microscope.

The next step would be to remove the Tsunami from your setup, use a standard 5V USB-C power supply and headphones, so that the only things connected to Tsunami are the USB power supply and the headphones, and program a trigger to play a looping sound. If it fails during this test, then it's definitely a defective unit.

The next step would be to try another Tsunami. If you only have one Tsunami, then you may have to contact SparkFun to see about a replacement.

robertsonics commented 2 years ago

Also, it's probably obvious, but have you tried a different microSD card? Also, is the card formatted with 32k allocation size?

djrobby commented 2 years ago

I just tried with 4x completely different files that I had been originally testing with and so far it's been running for 30mins just fine. I was initially testing tracks 1-4 routed to outputs 1-4 (respectively) and from what I tell, one of those tracks seems to be throwing the processor into some kind of limbo. I have uploaded METADATA from one of the tracks here: https://imgur.com/a/ifTSZhH. What should I be looking for in terms of adherence to the codec?

robertsonics commented 2 years ago

Ideally, you could isolate a single file that causes the problem. What happens when you loop each of the "bad" 4 individually? If any one file does it, I'd love to get that file and see if I can duplicate the issue.

Are you making sure to save your wave files without any metadata?

djrobby commented 2 years ago

Yes, I will most definitely send you the file(s) tomorrow once I’ve isolated the issue. As for metadata, yes. I used SoundForge to downsample 48kHz/24-bit stereo wav files to 44.1kHz/16-bit mono and stripped away any fatty metadata such as title, author, genre etc. I believe the metadata I sent you the screenshots of is the inherent filetype info that goes along with every wav file. I will also double-check that fact tomorrow to be 200% certain.

qniens commented 2 years ago

We have been using the Tsunami a lot in our projects. In our experience clicking sounds/bad playback can be caused by a SD-Card that gets corrupted/damaged. The SD-Card will still work on your PC but in the Tsunami they will produce unusable audio.

The 'destruction' of the SD-card happens usually after a endurance test of +- 24 hours. Solution was to which to Industrial grade SD-cards or the 'Endurance max' series of Sandisk.

djrobby commented 2 years ago

@robertsonics I apologize for the delay in my response but something weird happened (on my end) the day after I reported the issue and I wanted to investigate it further prior to responding. So, it looks like after I let the completely different tracks play for a day or so, the problematic tracks (track 1-4) started working just fine. Since then, I have not been able to replicate the issue. This is knowing that no audio files changed and nor did my code base they drives them (via serial). I could have something to so with the SD card itself as @qniens mentioned. I'm using SanDisk Ultra 32GB A1 microSDHC formatted with FAT32 filesystem having a 32KB Allocation Unit Size. As per @qniens, SanDisk Max Endurance 32GB V30 microSDHC might be a better option. Please let me know your thoughts.

Also, do you know which MCU you plan on moving to for the 10-channel option and how many layers the PCB will be? The reason I ask is becuase I might have to have our engineer re-design the layout to fit inside a metal enclosure that provides industrial Phoenix Connectors as field termination points for our application (along with a physical serialport which might end up being in the form of a thru-hole RJ45 connector).

robertsonics commented 2 years ago

There are so many microSD cards available and they are changing all the time, so there's no way I can make a statement about any cards I haven't personally tried. That said, more demanding customers who have used industrial grade cards generally report that they perform well.

A new player will likely be based on the STM32H750. Not completely sure of your intentions, but just keep in mind that the firmware is not open source and the downloadable files on my website will not run on custom hardware. I don't want anyone to go to the trouble of designing their own board and then discover my firmware won't run on it.

djrobby commented 2 years ago

My intent is NOT to customize any part of the firmware or schematic design. Due to the requirements of my application, instead of soldering components onto the Tsunami board after the fact, I figured it would be easier to do a custom layout and place actual IO components onto the PCB for easy of use and fitting inside the metal enclosure (rendering attached). I hope that's OK?

SS_20220719_12

robertsonics commented 2 years ago

I just sent you an email.

djrobby commented 1 year ago

Hi Robert, happy new year! I hope you're well. Is there any update on if and when the Tsunami WAV Trigger inventories will be replenished? If not, are there any plans to produce a similar board with a different/more readily available MCU? Please let me know. Thank you 🙏

robertsonics commented 1 year ago

There are several components that are causing supply problems for Tsunami right now, and SparkFun is actively working on the issue. I'm told there may be a run of either the original or the new "25-voice" version (the CPU has less memory but is more available) in the next few weeks, but both processors remain elusive, so I don't know how many they'll be able to build before running out again.

I couldn't get sufficient (any) quantity of the STM32H750 for my own board design, so I pivoted and have a new player based on the Daisy Seed - see the "Daisy Rogue WAV" on my website. It will be more capable than Tsunami, but will be a different form factor - smaller footprint but much taller to accommodate the Seed.

djrobby commented 1 year ago

Thank you Robert. Any ideas about when Daisy Rogue WAV module will be ready for purchase? Also, similar to Tsunami WAV Trigger, will it support control via RS232?

robertsonics commented 1 year ago

Maybe a month? I'm currently working on a board support packege for the Electro-Smith libDaisy codebase so that the Daisy community can use the board to write their own software. As soon as that's done, I'll probably start offering the board as just a multichannel Daisy compatible board, but without firmware. I can only start selling the Robertsonics Player version (board with my firmware) when I feel the firmware is ready. Perhaps 2 months?

And yes, it will support a similar serial control interface. The init file concept (and the Configurator app) has been replaced with csv "preset" files that can be created/edit with Excel or Google Sheets. This is because of the vastly increased MIDI capabilities.