change length of multiple mp3 files - automation

I have several hundred short mp3 files (1-5 seconds) I would like to trim them. namely, the length should be rounded up getting a whole second. for example if a mp3 file is 1.32s long, it should be afterwards 2.00 in length, the lack of time should be filled with silence. is it possible to automate this process? if so with what tool? thanks

Try Audacity, it allows batch processing: http://manual.audacityteam.org/index.php?title=Batch_Processing
I'm not sure whether it will do everything that you need it to do but it's worth checking out what all your options are within this program.
[EDIT]
Ok, so if you do have hundred and also might be something useful for you in the future this is what I would recommend or would personally do myself.
Get mp3DirectCut [freeware]
Get AutoHotKeys [freeware]
Learn how to use both, particularly AutoHotkeys
Save All filenames into a spreadsheet
Create a script that does the following with mp3DirectCut
Load file by name on spreadsheet
Hit the "End" button
Paste a pre-copied silent 1 sec long clip from clipboard
Parse the NAV field in the program (bottom left) to get the Total length
Calculate and enter desired endpoint to total length for Selection (then hit Enter)
Hit the "Del" button
Save complete song
Repeat

Related

How to limit cell text output in Google Colaboratory?

Is it possible to limit the number of lines output by a code cell in Google Colaboratory? As to mimic the behavior of the command shell that keeps only the last n lines?
Sometimes it happens that the browser crashes because of the size of the generated tab, due to the huge amount of text produced by debug text.
Is there a solution without having to reduce the amount of text actually generated by the code itself?
Add %%capture to the top of the cell to completely discard the output.
Found on: How do you suppress output in IPython Notebook?

Autohotkey: how to determine clipboard buffer contents size

I have a script that scrapes a certain portion of the screen and acquires about 100-200 bytes long text in to the clipboard. Sometimes, due to web server timeout or missing CSS definitions etc, the page doesn't render correctly and the sane mouse drag, selects a much larger amount of text and copies it to the clipboard.
I want to be able to notice this situation and scrap the clipboard contents and run my script again, till it is at the expected size of 100-200 bytes. Finally abort the script if large buffer keeps happening for certain number of times.
I have the logic for it but only thing I am not able to figure out the clipboard size and how to get it inside AHK script. Is there a predefined variable for it ? Or is there another, more complicated method ? What comes to mind is to paste the contents into notepad and save it. Then look at the file size, but it is very convoluted. I want something without a disk write operation.
Any ideas ? I saw the strlen command but not sure how to use it...
If it is text in your clipboard this works:
ClipSize := strlen(clipboard)
Example Script
sClip:=GetClipboardSize(Clipboard)
sClip_a:=GetClipboardSize(ClipboardAll)
MsgBox Clipboard Size: %sClip%`nClipboardAll Size: %sClip_a%
GetClipboardSize(c) {
if (!s:=strlen(c)) {
tmp:=A_temp "\clipboardsize_" A_TickCount "~~tempfile~~.tmp"
FileDelete,%tmp%
FileAppend,%ClipboardAll%,%tmp%
FileGetSize,s,%tmp%
FileDelete,%tmp%
}
return s
}

Google Apps Script on Form Submit Time Formatting Glitch/Fix

Background:
How: I suspect that this is a glitch within Google Form (submission process)/Spreadsheet, but may be part of the Date conversion utility of the Spreadsheet interface (and is an intended feature).
When entering a format in a text box in Google Forms, there is some sort of communication error between the Form submit and Response Spreadsheet, or pre-processing of the Form's data before it is sent to the spreadsheet. The glitch only seems to happen for data in a text field of the format ##:## TEXT where TEXT contains no '.' characters. For example: 4:15 pm will reproduce the glitch, but 4:15 p.m and 4:15 p.m. will not.
Result: An apostrophe character is added to the beginning of the string when it is put into the Spreadsheet (i.e. '4:15 pm) which throws off several sub-systems I have in place that use that time data. Here are two screenshots (sorry for the bad sizing on the second):
I'm 99% certain that the glitch is caused by the ##: combination.
Temporary Fix?: The real question is... how might I go about removing that pesky apostrophe before I start manipulating the time data? I know how to getValue() of a cell/Range. Assume I have the value of a cell in the following manner:
var value = myRange.getValue();
// value = '4:15 pm
How can I go about processing that value into 4:15 pm? A simple java function could be
value = value.substring(1); // Assuming "value" is a String
But in Google App Scripts for Spreadsheets, I don't know how I would do that.
Post-Script: It is necessary to post-process this data so that I don't have to lecture university faculty in the language department about inputting time format correctly in their forms.
Thanks in advance to those who can help!
How can I go about processing that value into 4:15 pm? A simple java
function could be
value = value.substring(1); // Assuming "value" is a String But in
Google App Scripts for Spreadsheets, I don't know how I would do that.
Google Apps Scripts uses Javascript which has the exact same method.
value = value.substring(1);
should return all except the first character.
More about Javascript substring at: http://www.w3schools.com/jsref/jsref_substring.asp
If you remove the ' in the spreadsheet cell the spreadsheet interface will convert this entry to a date object.
This might (or not) be an issue for you so maybe you should handle this when you read back your data for another use...
It doesn't happen when text is different (for example with P.M) simply because in this case the ' is not necessary for the spreadsheet to keep it as a string since the spreadsheet can't convert it to a date object (time value).
Artificial intelligence has its bad sides ;-)
edit :
You cant do this in an onFormSubmit triggered function using the javascript substring() you mentioned. If you're not familiar with that, here is the way to go :
To run a script when a particular action is performed:
Open or a create a new Spreadsheet.
Click the Unsaved Spreadsheet dialog box and change the name.
Choose Tools > Script Editor and write the function you want to run.
Choose Resources > Current project's triggers. You see a panel with
the message No triggers set up. Click here to add one now.
Click the link.
Under Run, select the function you want executed by the trigger.
Under Events, select From Spreadsheet.
From the next drop-down list, select On open, On edit, or On form
submit.
Click Save.
see doc here and here

Printing only starts after last page spools

I'm having a problem that printing in VB.net where any network printer I choose is waiting until the last page is spooled before printing begins. However I'm looking to have it begin printing after the first page.
The printer is set to 'Start printing immediately', and this is giving me huge problems as we're trying to print duplex documents that may be 75 ~ 100 pages long.
Any ideas?
Can you paste a little sample of the code you are using to print? First off, I would look at the queue itself and ensure that things like the Print Processor are set to RAW and also confirm that other applications such as Word have no issue 'starting immediately' to this device.
Why is this such a big deal? Does you application take a long time to generate the data that this causes issue? You should be able to generate the print output quickly (assuming it's not a bunch of high res images or something) and get it into the queue fast. Assuming you have an up to date printer that's doing 30-40ppm the entire process should only take a couple of minutes.

Incremental paste plugin?

I know that often using a for loop to generate repetitive content is the better way than pasting something 20 times and changing each paste to the correct number by hand. But let's say for cases where content is hard-coded and I just want a list from 1-20.
I would like a text editor with a "smart" paste command that takes any number imbedded in a string on the clipboard and increments it each time I paste. If it doesn't exist, I will make a plugin.
I'm trying to think of a good 2-stroke keyboard shortcut to do it, close to the ctrl-V. Maybe ctrl-g or numpad_+ (in an app with no zooming).
Does it exist?
In Zeus this can be easily done as follows:
Column mark the area to be converted to a numbers
Use the Macros, Execute Script menu
Type in numbers to run the numbers Lua macro
Type in the first number of the sequence
The marked area will be replaced by an incrementing sequence of number starting at the first number provided in step 4.
I'm trying to think of a good 2-stroke
keyboard shortcut to do it,
Making this into a key stoke action is as simple as binding the numbers Lua macro to the keyboard.
Here is an example of how it works. If 1 values in the text below are column marked and the macro executed with a starting number of 1000:
Field_1
Field_1
Field_1
Field_1
the following text changes will be made:
Field_1000
Field_1001
Field_1002
Field_1003
Armed bear J has a renumber region command, as well as a case-preserving replace-in-files, which means I often keep it around for those features.
TextPad is another text editor with a Fill Region function, for filling with a character, a string, or incrementing numbers (starting from X, with left- or right-alignment, and space- or zero-filled.)
I used Notepad++ now, but I have to keep TextPad around just for that number-filling function.