Page 1 of 1

[App] libPlaySound D/E/F/H

Posted: Wed May 25, 2016 9:42 pm
by zoelechat
Useless? Maybe, but funny so indispensable :)
libPlaySound... plays sounds!

Usage:
*For D series (arm), replace every instance of /mnt below by /mtd_rwcommon/widgets/user/SamyGO/SamyGO
  • First install latest samyGOso as usual, if needed.
  • Extract attached archives and copy libPlaySound.so and libTada.so to /mnt/opt/privateer/usr/libso (create folder if needed).
  • You noticed two libs are there, you first have to inject libTada resident (only once a boot of course), it installs necessary payloads other (non-resident) lib will use afterwards.

    Code: Select all

    samyGOso -T -B -r -l /mnt/opt/privateer/usr/libso/libTada.so
    At this point you should hear nothing yet.
  • Then you can play with sounds at will using other lib:

    Code: Select all

    samyGOso -T -B -l /mnt/opt/privateer/usr/libso/libPlaySound.so [arg1...argN]
  • Used without args, it will play a well-known "tada.wav". Usable args are:
    • WAVFILE:/full/path/to/yoursound.wav - Wave file to play. Default (unspecified) is built-in tada.wav
    • VOLUME:1-100 - Relative (to current) volume of wave to play. Default is VOLUME:100
    • STOP - Stops current playback in case you launched a (too) long wave file and you're bored. To be used as single arg.
Autostart:
  • Copy 99_94_Tada.init to /mnt/etc/init.d
  • Set permissions

    Code: Select all

    chmod +x /mnt/etc/init.d/99_94_Tada.init
  • Script injects only libTada, then it's up to you to use libPlaySound anywhere you want (e.g. Oscam started -> Tada! :p)
Wave file has to be standard PCM 16 bits (44 bytes header), mono or stereo, with sample rate of 22050Hz-48000Hz. I insist on "standard" since much waves found on the web don't respect it. Use any converter if needed (if it obviously doesn't sound as expected!)

You should be able to play waves *almost* as long as you want, but there's some theoretical limit due to sizeof(int) I didn't calculate. About more than half an hour I think...
Anyway, the point is primarily to play short "alerts" (ding dong pwêt). Please do not ask for MP3 nor playlist support and don't expect libJukebox :P

*Changelog:

Code: Select all

* libPlaySound.so
25/5/2016
v0.0.4 - First public release

Code: Select all

* libTada.so
25/5/2016
v0.0.9 - First public release

Re: [App] libPlaySound D/E/F/H

Posted: Wed May 25, 2016 10:22 pm
by notengo13
Good job. :idea: . it works on my TV.

Now i can tell some things to my wife, through the tv. :lol:

Re: [App] libPlaySound D/E/F/H

Posted: Tue Feb 07, 2017 11:23 pm
by klepacky
Hello can anybody help me?

If i execute in putty:
/mnt # samyGOso -T -B -l /mnt/opt/privateer/usr/libso/libPlaySound.so WAVFILE:/m
nt/opt/privateer/usr/sound/1.wav
it plays sound on tv immediately.

and if execute in putty - it write not found:
/mnt # /mnt/etc/init.d/03_02_Tada.init start
/mnt/etc/init.d/03_02_Tada.init: line 1: #!/bin/sh: not found
checking /dtv/usb/sda
samyGOso v1.2.4 (c) bugficks 2013, sectroyer 2014
Injecting '/mnt/opt/privateer/usr/libso/libTada.so' resident: '1'
Succeeded.
/mnt/etc/init.d/03_02_Tada.init: line 33: WAVFILE:/mnt/opt/privateer/usr/sound/1.wav: not found

How to setup play sound on TV stratup?

03_02_Tada.init content:

Code: Select all

#!/bin/sh
#
# © Copyright 1996-2016, zoelechat@SamyGO
#
#
. /dtv/SGO.env

SODIR=$SYSROOT/opt/privateer/usr/libso

stop_bootloop()
{
	for USB in /dtv/usb/sd* ; do
		echo "checking $USB"
		[ -e $USB/STOP ] && echo "STOP found. Script exit..." && exit 1
	done
}

case $1 in 
	start)
	stop_bootloop
	[ "$LIBSO_DIR" ] && SODIR=$LIBSO_DIR
	samyGOso -T -B -r -l $SODIR/libTada.so
WAVFILE:/mnt/opt/privateer/usr/sound/1.wav ;;
	stop)
	;;
	status)
	[ -f /dtv/Tada.log ] && cat /dtv/Tada.log || echo "Not started"
	;;
	*)
	echo "Usage: $0 {start|stop|status}" 1>&2
	exit 0
	;;
esac

Re: [App] libPlaySound D/E/F/H

Posted: Tue Feb 07, 2017 11:26 pm
by zoelechat
Typical error of Windows bad text editor. Use Notepad++ to edit scripts and set linefeeds to Unix format :)