How can I slow down .avi files when creating them from Mathematica? - wolfram-mathematica

I have created a list of plots that I want to run as a movie.
list11 = {pic0, pic001, pic01, pic02, pic05, pic1, pic2, pic5, pic10};
First I created an animation which I slowed down to 1 frame per second using the following code:
ListAnimate[list11, AnimationRate -> 1]
I now wanted to export this to an avi file so I tried the following:
Export["periodic.avi", ListAnimate[list11, 1]]
However the result of this was a movie that played too fast (I think it was playing at the default total duration of 5 seconds rather than the 9 that I wanted)
I then tried to export the list directly:
Export["periodic2.avi", list11]
This however went even faster again (the whole thing was finished in about 1 second)
Looking in the help files it said that there was an advanced export option called "framerate", so I tried:
Export["periodic2.avi", list11,"framerate"->1]
But this just gave me the exact same output as the previous .avi file (it seemed that the framrate option was completely ignored because I tried different values instead of 1 but the output was always the same speed).
Can anyone enlighten me on how I can control the animation speed of the .avi file?

Mathematica is case sensitive."framerate" should be written as "FrameRate".

Related

How can I cut several sound files using a script?

I am new to Praat and wondering, if someone can help me to find out, how I can cut all my sound files with a script or anything.
I have like 100 sound files I need for my research. They all have a different length, some are 1 min and others are 3 min long.
I would like to have only the first 22 sec from each sound file.
Thanks in advance!
Kind regards
Olga
The first step is to construct a script that extracts the initial 22 seconds of some specific sound object that is already open. In general, the easiest way to at least start a script is to do a thing manually once, and after you've done that, in a Praat script window, copy the command history (with ctrl-h) to see what the underlying commands are. The manual approach is to look for "Extract part" under "Convert", which corresponds to the command
Extract part: 0, 22, "rectangular", 1, "no"
There is also a command to save a file as a wav file, so you would add that to the core of the script.
Then you need to add a loop that does this a number of times, to different files. You will (probably) need a file with wav file names, and some system for naming the output files, for example if you have "input1.wav", you might want to call the cut-down version "output1.wav". This implies some computation of the output file name based on the input file name, so you need to get familiar with how string manipulation works in Praat.
If you have that much sorted out, then the basic logic is
get next input file name file
compute output name
open the input file
extract from that file
save the extracted file
remove the extract
remove the original
loop until no more files
I would plan on spending a lot of time trying to understand simple things like string variables, or object selection. I left out explicitly selecting objects since it is not necessarily required, but every command works on "the selected object" and it's easy to lose track of what is selected.
Another common approach is to beg a colleague to write it for you.

Reset MeasurementIndex to 0 in Vector CANoe?

Is there a way to reset the MeasurementIndex of a CANoe Simulation to 0?
I'm currently working on a myCANoe.cfg simulation that was saved multiple times. I'm creating log files with the structure myCANoe_{MeasurementIndex}.blf and MeasurementIndex = 800 right now. I'd like to tweak the text in myCANoe.cfg to reset it to zero. So far, searching for the string was not effective, nor it was changing the preview text myCANoe_800.blf in myCANoe.cfg. Can we achive this result somehow?
Turns out there is a simple way. Please be sure to have a back-up plan in case the following edits go south. You'll need to manually edit the myCANoe.cfg file, possibly resulting in complete corruption of the simulation. I was able to achieve the result with the following:
Note the current measurement index (e.g. 800)
Delete myCANoe.stcfg compiled file
Open the simulation
Check current measurement index again and close simulation
Delete myCANoe.stcfg again
edit myCANoe.cfg with a text editor
Search for the measurement index value (800). I found two results: one on row 609, one with the format <VFileName V7 QL> 1 "myCANoe_800.blf"
Edit both to 0 and 000, respectively. Save
Open the CANoe configuration, My measurement index was re-set.

init seg_duration option for dash similar to -hls_init_time option

Is there any option to set first segment duration for dash files, There is similar option for HLS: hls_init_time?
I could not found any such option in documentation.
Why I want such option to be there:
From generated DASH files: in Android ExoPlayer, It always plays first chunk of lowest quality(bitrate/resolution), after first chunk, basis user's internet speed, it picks the next chunk. If there is no init_seg_duration option, I have to rely only on seg_duration and I can not keep it bit large. Why I will like to keep it large: to reduce the number of files generated.
With such option, I could had given -init_seg_duraion 2 -seg_duration 6, so video quality would had increased after 2 seconds and total number of files generated would also not had exploded.
According to latest source file: https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/dashenc.c
There is no such option implemented.
(I just wondered, why such option is needed?)

How to reuse a path in PDF generation?

I am learning the PDF "syntax" and try to create various PDF documents manually (on Windows 7, Notepad++ to write the 1st unreferenced, broken, file, then run them through pdftk to produce a valid file with updated references, as explained here...).
My learning materials:
PDF Reference 6th edition, version 1.7
+ various online resources.
My question : I would like to create a path only once in the document, then possibly reuse it many times in other parts of the same document. E.g. I could define a logo once then reuse it in different pages, maybe several times at different positions in the same page, maybe with different scaling factors... What is the best way to achieve this?
To give a better idea, I could define a logo (here a cross) that way :
3 0 obj
<< /Length 32>>
stream
10 0 10 30 re f
0 10 30 10 re S
endstream
endobj
And would like to reuse the same "shape" (possibly with different scalings) in other places in the document, without having to specify the path again.
I am not looking for a software to do the job (eg. Acrobat...). I want to learn how to write this manually (then ask pdftk to fix the file).
You can look in this recently created GitHub repository for some examples of handcoded PDF files.
This file specifically is re-using a (very small, 2x2 pixels) image multiple times on one page, at different positions, with different skews, scalings and rotations.
Here is a screenshot of that PDF file:

Excel 2003: Why does creating links to other spreadsheets take so long?

My Excel application creates links to other Excel files. It takes approx 1 sec to create a link for 1 cell, but I have several hundred cells to link so it's painfully slow.
There is no difference in speed whether the source file is opened or closed. I have, however, noticed that creating links manually (e.g., by copying and pasting the formula containing the link into other cells by hand) is much faster while the source file is opened.
In my program I have configured
Application.Calculation to be Manual instead of Automatic.
I tried accomplish the linking in two ways (please note this is not a real code, but I hope it shows what I mean):
1.
Copy the formula link to the external source from Range("A1") using
a foreach loop on every Cell in a range:
Cell.FormulaR1C1 = Range("A1").FormulaR1C1
2.
Copy the formula from Range("A1") to another range without using a foreach loop:
Range("thisIsMyTargetRange").FormulaR1C1 = Range("A1").FormulaR1C1
Both methods are equally slow, and as I said I've checked both of the above methods with the source file opened and closed.
Is there any way to speed this up? Does anyone know enough about the linking mechanism in Excel 2003 to offer advice on how to improve the linking performance?
Is it pertinent to have the formulas? If not use .value instead of .formular1c1.
Also if the ranges are the same size then use a range copy instead of the loop. e.g.
range(a1:a500).value = range(a1:a500)
Added Alternative Method:
Also, an alternative method would be to create a table using the data import functionthat is refreshed when the file opens, if a sheet is what you after. Then if you wanted bits of that sheet, use the data in the import sheet/table. This will keep the updating or linking to only one large import when opening the file.
I had to do this for months of data taken around once a second.
Open the document you want to copy data from. Then copy any sheets that hold that data into the workbook you are using. Grab the data from them, then delete those sheets from your workbook. Do this in a macro so it can be done quickly and repeatedly.

Resources