Good morning.
Even at the risk of being a matter of little interest given the time that has elapsed since the last contribution, perhaps someone may be interested in my sound card version.
Hardware:
- ESP32 with DAC output. (I don't remember exactly, but I bought 5 for 20-30€ at AZ-Delivery).
- PAM8403 amplifier (on Amazon 10 for €8.49).
- 8 omhs, 3 w speaker (on Amazon 4 for €11.99).
Software
- xt-dac-audio library.
- Audacity and HxD to produce the WAV "files".
- Sketch ESP32.
Resources
-
www.xtronical.com (although today I found it impossible to access). This was quite a valuable resource. There's a mirror of the bookstore on Github:
https://github.com/WeekendWarrior1/XTro ... dio_Mirror.
Functionality
- The typical chuff-chuff.
- Whistle.
- Bells.
- Brake.
The sound files are arrays in the sketch so that access is at the speed of access to the internal memory of the program and, consequently, the boundaries in their manipulation lie in the imagination of the programmer, his needs and, of course, the memory available to the program.
Of course, it is feasible to place WAVs in flash memory or other external storage. In that case, you have to deal with file upload latencies.
In my case, the chuff chuff is implemented with chuff and silence alternations whose duration is determined by the PWM signal sent to the engine. The bells ring automatically when starting or changing direction, i.e. when PWM=0. The brake when sending a stop command. And, all, when the user decides to do so, by pressing the corresponding button on the user interface.
It goes without saying that the overall quality is determined by the sound used, so I beg for mercy for my implementation.
An example of use.
Sorry: robotic english.