Play ANY kind of sound during boot

Hi!

I’m working with some Jetsons for my PhD project for visually impaired people. Right now, i’m using Jetson TX2 with orbitty carrier to run my system and my doubt lies in the following scenario:

Jetson TX2 on orbitty carrier takes from 60 to 90 seconds to complete its boot process and auto login. Is there any way to play/emit any kind of sound periodically (or in specific points) during whole boot process? I’m totally clueless of how to do it, since boot process is also responsible for loading sound modules etc. I have a USB headset which is used by my system, so it could be used to receive boot progress sounds.

Thank you so much.

I can only give a partial answer. Normally sound devices are associated with a login to the GUI. Upon login sound devices tend to be associated with that DISPLAY. Sometimes the audio going over HDMI is used, but it can also be a USB headset. Thus the standard mechanism requires a login. This does not have to be the case, but it would mean you might have to provide a configuration which takes control of an audio device not associated with a GUI login.

I’m not sure where you would start with that, but consider that if you are logged in to a GUI and can find ways to trigger the sounds on command line, then you can research the man pages for those command line items and discover if there is a way to name the sound device without inheriting from the environment of a logged in session.

Dourado,

Sorry that currently there is no support for such feature.

Could you also share more detail what you want? Do you want this to be implemented in bootloader or kernel?
I also wonder why is takes a tx2 device to take 60 ~90 second to boot up. Normally, you should only wait for 30 second until the desktop show up.

Hello!

One possible option to start playing a sound on boot would be to create a systemd service to start playing audio. Now this service will not start until the root file-system has been mounted but this should be less than 10 seconds.

For example, on my Jetson I have the following soundcards …

ubuntu@tegra-ubuntu:~$ cat /proc/asound/cards 
 0 [tegrahda       ]: tegra-hda - tegra-hda
                      tegra-hda at 0x70038000 irq 83
 1 [tegrasndt210ref]: tegra-snd-t210r - tegra-snd-t210ref-mobile-rt565x
                      tegra-snd-t210ref-mobile-rt565x
 2 [Device         ]: USB-Audio - USB Audio Device
                      C-Media Electronics Inc. USB Audio Device at usb-70090000.xusb-2.3, full speed

I have then created the following audio.service …

$ cat /etc/systemd/system/audio.service 
[Unit]
Description=Audio startup service

[Service]
Type=oneshot
ExecStart=/usr/bin/aplay -D hw:Device,0 /home/ubuntu/myaudio.wav

[Install]
WantedBy=multi-user.target

Note that ‘Device,0’ matches my USB soundcard name seen under /proc/asound/cards.

Finally I enable the service by …

$ sudo systemctl enable audio.service

Now on rebooting the system the service will be started on the next boot and start playing the file ‘/home/ubuntu/myaudio.wav’ (assuming it exists). You can change the above command to be whatever it is you want to play or even call a script which plays a WAV file periodically for a certain period of time.

Hope this helps.

Regards,
Jon

Hey Jon!

I managed to make it work with some changes in your service script. Since it’s an USB device, I pointed directly to it and ordered systemd to run the command only after this device was available.

Here is my script:

[Unit]
Description=Audio startup service
Requires=sys-devices-70090000.xusb-usb1-1\x2d2-1\x2d2.3-1\x2d2.3.3-1\x2d2.3.3:1.0-sound-card2.device
After=sys-devices-70090000.xusb-usb1-1\x2d2-1\x2d2.3-1\x2d2.3.3-1\x2d2.3.3:1.0-sound-card2.device

[Service]
Type=oneshot
ExecStart=/usr/bin/aplay -D plughw:2,0 /home/nvidia/hold.wav

[Install]
WantedBy=default.target

It’s not at the very beginning of boot procedure, but it’s played like 10 to 15 seconds after it.
Hope it can help anyone else too.

Cheers!

Hello!

Thanks for the feedback. Yes it is not at the very beginning indeed, but the easiest way to have something play as soon as the USB device is available.

Regards,
Jon

Jon and the others, I will extend my doubt with a more hardware guided stuff:

Is there a GPIO/USB/ANYTHING Buzzer (Just like PC Speakers) that I can attach to my board and it beeps once I turn the power on? Not in the middle of boot, but when energy passes by for the first time.

You could just build a circuit which measures any of the power rails which go up after boot starts and makes a short beep or other sound if there is a transition from zero to some voltage. Using external hardware greatly simplifies the task…using GPIO or USB or anything internal to the TX2 is far more complicated.