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!

*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 and 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/
    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/ [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.
  • 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


Code: Select all

v0.0.4 - First public release

Code: Select all

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/ WAVFILE:/m
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/' resident: '1'
/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

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


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

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

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 :)