Having just read another topic on the long compilation times for ESP32(family) it popped into my mind that having sound notifications for 'done' compiling could be really helpful.
Compile times can be really long even on a fast processor, and if the time waiting could be spent more efficiently, more time would be left. Basically the Human should start multi-threading, but a sound notification can draw it back to the screen. It seems that it might not be to hard to add, but of course i don't know how much work this would be.
Hi @Deva_Rishi. If you want to implement the feature yourself now, you can use the recipe.hooks.objcopy.postobjcopy.NUMBER.pattern post-build hook to invoke a command that produces a sound:
In this case where you want to run the command regardless of which board is being compiled for, and it isn't in any way platform-specific, you can define it in the global platform.txt file, placed in the hardware subfolder of your sketchbook folder:
I use a Python script as a tea timer. I didn't find an easy way to just produce a simple tone via my computer's audio output (yes I had all sorts of fun using BASIC to make interesting noises on the PC speaker of XT and 286 computers as a kid, but I need it to come through my headphones) so I instead play an audio file using this Python package:
For my application, I needed more than an audible notification alone, so this is why I used a Python script for the purpose. For your application, you might be better off to just use a simple command line tool that will play the audio, but I thought I'd mention the specific solution I found just in case it might be useful to you.
Never really got around to that. Do remember a friend of mine came up with a floppy that had a song on it though. My ZX81 never had sound although the interface board should have been able to provide that as an option, but i only got that working just over 10 years ago.
I got Sennheiser BT headphones, and the BT only works on 1 side by now, so those i don't use.
Yeah probably. Thanks for all that. Don't have time to implement it yet, but as i thought the solution is simple enough.
Hmm just to get back on this. I found some time trying to implement it.
First of all on how to play a simple notification from the command line, and after some digging i found
I tried adding it to the platform.txt of the installed core (in sketchbook) in particular (ESP32 2.0.11) because that file was modified from it's original already (i had to change the name to distinguish it in the IDE from it's newer version)
But then i got a closing " missing error on compilation.
I'm looking forward to you getting this fixed. I don't need a sound but a timestamp would be really useful and I could use the same mechanism. Often, I am disturbed while developing and don't then know, from the log output, how fresh the latest verify/upload is and all we get is something like this:
Linking everything together...
"C:\\Users\\6v6gt\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F/oled_SSD1306_Test_V0_04.ino.elf" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F\\sketch\\oled_SSD1306_Test_V0_04.ino.cpp.o" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F\\libraries\\SPI\\SPI.cpp.o" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F\\libraries\\RF24\\RF24.cpp.o" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F\\libraries\\Wire\\Wire.cpp.o" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F\\libraries\\Wire\\utility\\twi.c.o" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F\\libraries\\Adafruit_GFX_Library\\Adafruit_GFX.cpp.o" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F\\libraries\\Adafruit_GFX_Library\\Adafruit_GrayOLED.cpp.o" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F\\libraries\\Adafruit_GFX_Library\\Adafruit_SPITFT.cpp.o" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F\\libraries\\Adafruit_GFX_Library\\glcdfont.c.o" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F\\libraries\\Adafruit_BusIO\\Adafruit_BusIO_Register.cpp.o" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F\\libraries\\Adafruit_BusIO\\Adafruit_I2CDevice.cpp.o" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F\\libraries\\Adafruit_BusIO\\Adafruit_SPIDevice.cpp.o" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F\\libraries\\Adafruit_SSD1306\\Adafruit_SSD1306.cpp.o" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F/..\\..\\cores\\arduino_avr_uno_83d732ec6bf56f7addb5051f4143e2d1\\core.a" "-LC:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F" -lm
"C:\\Users\\6v6gt\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F/oled_SSD1306_Test_V0_04.ino.elf" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F/oled_SSD1306_Test_V0_04.ino.eep"
"C:\\Users\\6v6gt\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F/oled_SSD1306_Test_V0_04.ino.elf" "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F/oled_SSD1306_Test_V0_04.ino.hex"
Using library SPI at version 1.0 in folder: C:\Users\6v6gt\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\SPI
Using library RF24 at version 1.4.2 in folder: C:\Users\6v6gt\Documents\Arduino\libraries\RF24
Using library Wire at version 1.0 in folder: C:\Users\6v6gt\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire
Using library Adafruit GFX Library at version 1.12.1 in folder: C:\Users\6v6gt\Documents\Arduino\libraries\Adafruit_GFX_Library
Using library Adafruit BusIO at version 1.16.1 in folder: C:\Users\6v6gt\Documents\Arduino\libraries\Adafruit_BusIO
Using library Adafruit SSD1306 at version 2.5.15 in folder: C:\Users\6v6gt\Documents\Arduino\libraries\Adafruit_SSD1306
"C:\\Users\\6v6gt\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\6v6gt\\AppData\\Local\\arduino\\sketches\\3B7983AD63F5DC5770F3A618103FF08F/oled_SSD1306_Test_V0_04.ino.elf"
Sketch uses 19982 bytes (61%) of program storage space. Maximum is 32256 bytes.
Global variables use 881 bytes (43%) of dynamic memory, leaving 1167 bytes for local variables. Maximum is 2048 bytes.
I'll provide instructions you can follow to do that:
Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open.
Take note of the path shown in the "Sketchbook location" field of the dialog.
Click the "CANCEL" button.
The "Preferences" dialog will close.
Use your file manager (e.g., Windows "File Explorer") to create a folder named hardware under the folder at the path you saw in the "Sketchbook location" field of the "Preferences" dialog.
Start any text editor.
Create a new text file.
Add the following content to the text file:
# An arbitrary high index number is used to ensure the hook won't override one defined in the platform.
recipe.hooks.objcopy.postobjcopy.99.pattern=date -Iseconds
# The Windows `date` command only provides the date, so the Windows-specific `time` command is used if running on a
# Windows machine.
recipe.hooks.objcopy.postobjcopy.99.pattern.windows=cmd /C "time /t"
Save the text file with the filename platform.txt inside the hardware folder you created at step 4.
Select Tools > Reload Board Data from the Arduino IDE menus.
Wait until you see a notification appear at the bottom right corner of the Arduino IDE window:
Board data reloaded.
Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open.
Check the box next to "Show verbose output during: ☐ compile" in the "Preferences" dialog.
Click the "OK" button.
The "Preferences" dialog will close.
You will now see a timestamp printed in the Output panel at the end of the compilation process when you have the verbose compilation output preference enabled.