a script for users of crappy mp3 players

Hey drop us a line about the show. Feel free to ask questions, provide feedback and criticism, or just ramble on about anything your little heart desires.

Moderators: snarkout, Patrick, dann

Post Reply
User avatar
DaveQB
Posts: 188
Joined: Wed Mar 30, 2005 6:50 am
Location: Sydney
Contact:

a script for users of crappy mp3 players

Post by DaveQB » Thu May 19, 2005 5:24 pm

I am not sure how many are in this same situation, but my mp3 player requires 44100hz sampled audio. Also its seeking is rather slow, so an hour of audio, stopped, say 30 mins into, takes about 10mins to seek back to that spot. So i cut mine up into smaller pieces so i can jump tracks to where i was last at.

Here's the script i use:

Code: Select all

#!/bin/bash
lame -f --scale 2 --resample 44100 -b 80 $1
mpgsplit "$1".mp3 [1/8] -o "$1"a.mp3
mpgsplit "$1".mp3 [2/8] -o "$1"b.mp3
mpgsplit "$1".mp3 [3/8] -o "$1"c.mp3
mpgsplit "$1".mp3 [4/8] -o "$1"d.mp3
mpgsplit "$1".mp3 [5/8] -o "$1"e.mp3
mpgsplit "$1".mp3 [6/8] -o "$1"f.mp3
mpgsplit "$1".mp3 [7/8] -o "$1"g.mp3
mpgsplit "$1".mp3 [8/8] -o "$1"h.mp3

What it does is re-ecnode it to 44100hz and add some extra volume (Patrick, i struggle to hear you when i am driving and listening)

Then it splits them into 8 8ths with the extension shown for each one.

All you need to do is supply the script with the audio file as an argument, so if called the script tllts-split.sh i would do this

tllts-split.sh tllts_84-05-18-05.mp3



Hope that helps someone.
Last edited by DaveQB on Mon Jun 13, 2005 1:40 pm, edited 1 time in total.
Linux david 2.6.29.3-desktop-1mnb #1 SMP Thu May 14 15:19:40 EDT 2009 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 6000+
Distro: Mandriva 2009.1

User avatar
Patrick
Site Admin
Posts: 2519
Joined: Tue Apr 27, 2004 11:38 am
Location: Easton, PA
Contact:

Re: ascript for users of crappy mp3 players

Post by Patrick » Fri May 20, 2005 9:35 am

DaveQB wrote:Patrick, i struggle to hear you when i am driving and listening
I know I have marble mouth! :) I'll try to speak more clearly going forward.

User avatar
mowestusa
Posts: 298
Joined: Mon Apr 04, 2005 10:27 pm
Location: Farm Fields of Wheat and Corn
Contact:

ascript for users of crappy mp3 players

Post by mowestusa » Fri May 20, 2005 11:01 am

Thanks for the script. I look forward to trying it out. I have the same problem with my mp3 player, but I'm too cheap to get a new one.

I know nothing about bash scripts, but can you put multiple files after the script name and then have the script run again on the next file listed on the cli?

Or would it be easy to have this script do this to ever mp3 in a directory (lets say a bashpodder created directory full of your podcasts) What changes would we need to make?

Thanks again.
Steve
mowestusa@yahoo.com

User avatar
DaveQB
Posts: 188
Joined: Wed Mar 30, 2005 6:50 am
Location: Sydney
Contact:

Post by DaveQB » Sat May 21, 2005 3:44 am

To be honest, I am not bash scripting expert. But i can't see why it can't take a directory as an argument.

To add mutliple files as arguments, you could

1) copy the conent of the section, paste it below and change all the $1's to $2 in the newly pasted part, repeat for as many arguments you think you will need.

2) you might be able to use a for do loop. But again I am no expert.


Here is the file as a download, simply save, make it executable and your away. You'll see i started to add a little more to it, ie ask to delete the new file that is created.

Link
Linux david 2.6.29.3-desktop-1mnb #1 SMP Thu May 14 15:19:40 EDT 2009 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 6000+
Distro: Mandriva 2009.1

User avatar
mowestusa
Posts: 298
Joined: Mon Apr 04, 2005 10:27 pm
Location: Farm Fields of Wheat and Corn
Contact:

Post by mowestusa » Thu May 26, 2005 10:01 am

Dave,

You'll have to forgive me, but what did you install in order to get "mpgsplit". I run on Debian and on Slackware. I couldn't find a package on Linuxpackages. I also didn't find it on Debian by doing in "apt-get install mpgsplit".

If you could help me find this and install it I would appreciate it.

Thanks
mowestusa

User avatar
DaveQB
Posts: 188
Joined: Wed Mar 30, 2005 6:50 am
Location: Sydney
Contact:

Post by DaveQB » Thu May 26, 2005 10:20 am

OH sorry dude. I ment to mention the "dependancies"

I should find a way to script into it a little check on the system.


I believe what your after is the mpgtx package
Linux david 2.6.29.3-desktop-1mnb #1 SMP Thu May 14 15:19:40 EDT 2009 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 6000+
Distro: Mandriva 2009.1

User avatar
DaveQB
Posts: 188
Joined: Wed Mar 30, 2005 6:50 am
Location: Sydney
Contact:

Post by DaveQB » Mon Jun 13, 2005 1:46 pm

Updated

Made it a Python script (as I am trying to learn Python)

Now all you need to do it supply the URL as the argument and it will download it to the current directory, re-encode it with a 44100hz sample rate and split it into 8 equal pieces.

example
[david@laptop ~]$ tllts-split http://mirror.linuxquestions.org/pub/ar ... -08-05.mp3



Link to download
Linux david 2.6.29.3-desktop-1mnb #1 SMP Thu May 14 15:19:40 EDT 2009 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 6000+
Distro: Mandriva 2009.1

User avatar
DaveQB
Posts: 188
Joined: Wed Mar 30, 2005 6:50 am
Location: Sydney
Contact:

Post by DaveQB » Thu Jun 30, 2005 10:00 pm

Ok I made some changes on it as i downloaded an episode of LugRadio through torrent and then realised i could use this on it as it downloads first.

http://www.dward.us/software/

This new revision checks when arument you give to it, if its a local file it doesnt try to download it, but just starts resampling and cutting up. If its is an ftp or http adres it will download to local dir first and then reasmaple and cut up.

Also got error checking too if you use it incorrectly.

Curious, is anyone using this sript, or just me ? :)
Linux david 2.6.29.3-desktop-1mnb #1 SMP Thu May 14 15:19:40 EDT 2009 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 6000+
Distro: Mandriva 2009.1

Post Reply