05-09-2020, 03:39 PM | #31 | |
Guru
Posts: 831
Karma: 2525050
Join Date: Jun 2010
Device: K3W, PW4
|
Quote:
Dave |
|
05-09-2020, 04:08 PM | #32 |
Addict
Posts: 315
Karma: 26
Join Date: Jul 2012
Device: Kindle Paperwhite 4 (2018)
|
Any plan of building an ability to resume an mp3 audiobook so I wouldn’t have to listen in one session ?
|
Advert | |
|
05-09-2020, 04:33 PM | #33 | |
Guru
Posts: 831
Karma: 2525050
Join Date: Jun 2010
Device: K3W, PW4
|
Quote:
I assume you are stopping playback with the KUAL menu entry. If I can see a way for sox to support it, I guess I would need a separate "bookmark" menu entry and possibly a "resume" menu entry as well. Dave |
|
05-09-2020, 04:48 PM | #34 | |
curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
Posts: 3,002
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
|
Quote:
: Code:
[root@kindle sox]# cp sox play [root@kindle sox]# ls README.txt menu.json playurl.sh config.xml play sox killgst.sh playall.sh soxi killsox.sh playfile.sh library playinternetradio.sh [root@kindle sox]# LD_LIBRARY_PATH=./library ./play /mnt/us/music/Multitudes.mp3 ./play FAIL sox: Sorry, there is no default audio device configured [root@kindle sox]# LD_LIBRARY_PATH=./library ./play -V3 /mnt/us/music/Multitudes .mp3 ./play FAIL sox: Sorry, there is no default audio device configured [root@kindle sox]# aplay --version aplay: version 1.0.22 by Jaroslav Kysela <perex@perex.cz> [root@kindle sox]# |
|
05-09-2020, 05:01 PM | #35 |
Guru
Posts: 831
Karma: 2525050
Join Date: Jun 2010
Device: K3W, PW4
|
Try adding "-t alsa" to the end of that ./play command line after the file name and see if that works.
Dave PS: if that doesn't work see if you can get aplay to play the file. If so I might be able to use it instead. Last edited by dhdurgee; 05-09-2020 at 05:11 PM. Reason: add PS |
Advert | |
|
05-09-2020, 07:54 PM | #36 | |
curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
Posts: 3,002
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
|
Quote:
|
|
05-09-2020, 09:34 PM | #37 |
Guru
Posts: 831
Karma: 2525050
Join Date: Jun 2010
Device: K3W, PW4
|
Ok. Try this one:
LD_LIBRARY_PATH=./library ./sox /mnt/us/music/Multitudes.mp3 -t wav - -- | aplay Dave |
05-10-2020, 06:04 AM | #38 |
curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
Posts: 3,002
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
|
Plays as a charm.
Code:
[root@kindle root]# cd /mnt/us/extensions/sox
[root@kindle sox]# LD_LIBRARY_PATH=./library ./sox /mnt/us/music/Multitudes.mp3
-t wav - -- | aplay
Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
[root@kindle sox]#
Spoiler:
|
05-10-2020, 09:24 AM | #39 |
Guru
Posts: 831
Karma: 2525050
Join Date: Jun 2010
Device: K3W, PW4
|
Great! I will work up a revised script for you to test and post it here. If I code this properly the new script will support both Kindles with gstreamer sound and alsa sound.
Dave |
05-10-2020, 05:11 PM | #40 |
Guru
Posts: 831
Karma: 2525050
Join Date: Jun 2010
Device: K3W, PW4
|
Try this out, it works on my pw4.
Dave |
05-10-2020, 08:12 PM | #41 |
curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
Posts: 3,002
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
|
With this small change works fine on the PW3:
Code:
#!/bin/sh
# script to play a local file on pw4
# add required library
export LD_LIBRARY_PATH=/mnt/us/extensions/sox/library:$LD_LIBRARY_PATH
# get soxi data from file to be played
/mnt/us/extensions/sox/soxi "$1" >/var/tmp/soxidata.txt
# now to parse necessary information
Chan=$(awk -F: '/Channels/ {gsub(" ","");print $2}' /var/tmp/soxidata.txt)
Wide=$(awk -F: '/Precision/ {gsub(" ","");gsub("-bit","");print $2}' /var/tmp/soxidata.txt)
Rate=$(awk -F: '/Sample Rate/ {gsub(" ","");print $2}' /var/tmp/soxidata.txt)
rm /var/tmp/soxidata.txt
# now determine how to play it
driver="unknown"
which aplay>/dev/null && driver="alsa"
which gst-launch>/dev/null && driver="gst"
# now start playing
case "$driver" in
alsa)
/mnt/us/extensions/sox/sox "$1" -t wav - -- | aplay
;;
gst)
/mnt/us/extensions/sox/sox "$1" -t raw - -- | /usr/bin/gst-launch \
filesrc location=/dev/stdin \
! audio/x-raw-int, \
endianness='(int)'1234, \
signed='(boolean)'true, \
width='(int)'$Wide, \
depth='(int)'$Wide, \
rate='(int)'$Rate, \
channels='(int)'$Chan \
! queue \
! mixersink&
;;
*)
echo "Unknown sound driver, cannot play media."
;;
esac
|
05-10-2020, 09:05 PM | #42 |
Guru
Posts: 831
Karma: 2525050
Join Date: Jun 2010
Device: K3W, PW4
|
Ugh. Missed that change when I copy/pasted the sox part. Glad you were able to spot it. Now that the concept is proven I can adapt the existing scripts and release with pw3 support as well. Thank you for your assistance in testing this out.
Dave |
05-11-2020, 11:07 AM | #43 |
Guru
Posts: 831
Karma: 2525050
Join Date: Jun 2010
Device: K3W, PW4
|
I have tweaked the script a bit more giving priority to ALSA if available, which required dealing with the case of ALSA being present but not usable. I have attached the modified script and would appreciate confirmation that I didn't break ALSA support for you.
Dave |
05-11-2020, 01:15 PM | #44 |
curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
Posts: 3,002
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
|
Nothing broken, I can still play Dylan
Code:
[root@kindle root]# cd /mnt/us/extensions/sox [root@kindle sox]# ./playfile2.sh /mnt/us/music/Multitudes.mp3 Playing via ALSA. Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo [root@kindle sox]# |
05-11-2020, 04:34 PM | #45 |
Guru
Posts: 831
Karma: 2525050
Join Date: Jun 2010
Device: K3W, PW4
|
I am releasing a new version with pw3 support. I am updating first post with the new zip.
Dave |
Tags |
kt4, mp3, pw3, pw4, sox |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PW [KUAL] Yet another clock extension | MrTick | Kindle Developer's Corner | 3 | 10-21-2019 03:06 PM |
xmahjongg for Kindle as Kual extension | Hanspeter | Kindle Developer's Corner | 86 | 12-02-2016 07:06 PM |
kual extension to open a book | shoelesshunter | Kindle Developer's Corner | 14 | 08-16-2016 12:30 PM |
is there any KUAL extension development guide? | fangzi | Kindle Developer's Corner | 2 | 01-02-2014 10:11 AM |