I can't play wav files in my app which starts automatically on reboot

**• Hardware Platform : Nano
**• DeepStream Version : 6.0.1
**• JetPack Version : 4.6.1

I can play the wav file just fine by creating a function like this:

-------------------- myapp -------------------

void play_sound()
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;

pipeline = gst_parse_launch( “playbin uri=file:///home/aaa/app/sound/test.wav”, NULL );

//Start playing
gst_element_set_state(pipeline, GST_STATE_PLAYING);

//Wait until error or EOS
bus = gst_element_get_bus(pipeline);
msg =
gst_bus_timed_pop_filtered(bus, GST_CLOCK_TIME_NONE,

//Free resources
if (msg != NULL)

gst_element_set_state(pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);


void play_sound_2()
system(“aplay ./sound/test2.wav &”);

Then, I created myapp_run.sh as follows, registered it in crontab, and made it run automatically when Nano starts.

[ myapp_run.sh ]
cd /home/aaa/app/
sleep 15s
exit 0

[Change Permissions]
$chmod 777 myapp_run.sh
$chmod 777 myapp

--------------------- crontab -----------------
$sudo crontab -e

[crontab contents]
@reboot /home/aaa/app/myapp_run.sh

If you run $myapp_run.sh directly from the shell, myapp plays the test.wav file well.
The problem is that if I register myapp_run_sh in crontab as above so that Nano can run automatically when booting up and reboot Nano, myapp runs, but there is no sound when playing the wav file in the play_sound() and play_sound_2() function inside myapp.
Haven’t been able to solve this problem for several days.

How you set crontab for myapp_run.sh?

To set myapp_run.sh in crontab I did:

$sudo crontab -e

The following is the contents of crontab .

To set myapp_run.sh in crontab I did:

$sudo crontab -e

The following is the contents of crontab .

@reboot /home/aaa/app/myapp_run.sh

How about add one delay to run your app after boot, like
@reboot sleep 120 && /home/aaa/app/myapp_run.sh

I’m closing this topic due to there is no update from you for a period, assuming this issue was resolved.
If still need the support, please open a new topic. Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.