Archive

Archive for the ‘service-is-learning-materials-creation’ Category

Adding APE input format support (and WMA output format) to Convert2MP3.ps

  1. FWIIW: When trying to run Paul Weterings’ script  against a media folder, it failed.
  2. I added exception handling, to arrive at : “Exception calling “Create” with “1” argument(s): “s:\multimedia1\Piano.Sonatas\vol1\I1.ape (taglib/ape)”.
  3. Took me a while to realize: Taglib-sharp seems to stumble over APE file formats. Even though the taglib release notes seem to say it is supported since 2009. And even though I upgraded taglib-sharp to current version 2.1.0.0.
  4. Now I am simply bypassing the call to taglib-sharp for files with the APE extension, and default to a bitrate of 64 for those.
  5. I also
    1. changed the conversion direction to WMA format, including from MP3 source format.
    2. added an option $blndelete to not delete source files.
  6. No warranties of any kind. All due credit goes to  Paul Weterings’ script here.
# trp: any2wma.ps1
# wma2mp3 conversion powershell script...
# dec 2010 version 1.1 Servercare, Paul Weterings
# Feb 2013 version 1.2 ServerCare, Paul Weterings, Byron & Chuck, added DRM check,
# more formats and bitrate
# trp: nov 2015: using *.wma as output, added *.ape as input (and *.mp3)
Set-StrictMode -Version Latest
# Set-PSDebug -trace 1
$blndelete = $true # $false # control whether originals get deleted after some success conversionchekc - good idea, but not yet
# Where are we?
# $loc = Get-Location
$loc = $PSScriptRoot # trp
# $tag = $tag = $loc.Path + "\MPTag" # trp: not really? butr this syntax apears more often , is this ps' append to existing variable
# trp:
$tag = $tag = $loc + "\MPTag" # trp: not really? butr this syntax apears more often , is this ps' append to existing variable

# Import MPTag module
# See: http://powershell.com/cs/media/p/9129/download.aspx

$errorcountbefore = $error.count

Import-Module $tag
If ($error.count > $errorcountbefore)
{
Write-host "trp:" + $lastexitcode + \n + $error[0]
}

# Use Windows Media Player
# See: http://msdn.microsoft.com/en-us/library/ee485348.aspx
$errorcountbefore = $error.count
$mpobj = New-Object -ComObject wmplayer.ocx
If ($error.count > $errorcountbefore)
{
Write-host "trp:"+ $lastexitcode + \n + $error[0]
}

$tool = "ffmpeg.exe" # trp: done:test:can i have ffmpeg in $env:Path?$loc.path+"\ffmpeg.exe"
$successcounter = $failurecounter = 0

# This is the root folder where script looks for the music, adjust this to your liking.#
# #
$strBaseDir = "S:\multimedia1\Piano.Sonatas" # ape
#
########################################################################################

$objParent = Get-ChildItem $strBaseDir -recurse -Include *.aac, *.flac, *.m4p, *.ogg, *.ra, *.rm,`
*.ram, *.raw, *.wav, *.mp3, *.ape
# trp: now target instead: *.wma
# todo: *.m4a,

foreach ($child in $objParent)
{

trap {
Write-Warning ('Failed to access "{0}" : {1} in "{2}"' -f $child.FullName, $_.Exception.Message, $_.InvocationInfo.ScriptName)
continue
}

# trp: exclude .ape from taglib-sharp and set default bitrate of 64k
if ($child.Fullname.EndsWith(".ape"))
{
$bitrate = 64
}
else
{
# Use the MPTag library to get the correct bitrate
$libmedia = Get-MediaInfo $child.Fullname
$bitrate = $libmedia.Properties.AudioBitrate

# sometimes the bitrate is reported way to high... anything over 192 gets lowered.
# adjust if wanted/needed
if ($bitrate -gt 192)
{
$bitrate = 192
}
}
# trp : work around Get-MediaInfo not working
if (!$bitrate) # yes = null-valued expression
{
$bitrate = 64
}
"-----------------------------------------------------------------------------"
"- Processing: " + $child.FullName + " at Bitrate $bitrate"

$media = $mpobj.newMedia($child.Fullname)
$protected = $media.getItemInfo('Is_Protected')
# Some files, such as flac or ogg may have the protection attribute empty
if ($protected)
{
$prot = [System.Convert]::ToBoolean($protected)
}
else
{
$prot = $false
}

if (!$prot)
{
$strInName = $child.FullName
$strOutName = $child.DirectoryName + "\" + $child.BaseName + ".wma" # trp ".mp3"

# The argument string that tells ffmpeg what to do...
# The generic syntax is:
# ffmpeg [global options] [[infile options][‘-i’ infile]]...
# {[outfile options] outfile}...
#
# -i filename (input) :: -i <string> :: input file name
# -y (global) :: -y :: Overwrite output files without asking.
# -acodec codec (input/output) :: -acodec libmp3lame :: Set the audio codec.
# This is an alias for -codec:a.
# trp: acodec wmav2 A..... wmav2 Windows Media Audio 2
# :: -ab 128k :: Set bitrate in bits to constant 128k bit rate
# -ac[:stream_specifier] channels (input/output,per-stream) :: -ac 2 ::
# Set the number of audio channels. For output streams it is set by default
# to the number of input audio channels. For input streams this option only
# makes sense for audio grabbing devices and raw demuxers and is mapped to the
# corresponding demuxer options.
# -ar[:stream_specifier] freq (input/output,per-stream) :: -ar 44100 ::
# Set the audio sampling frequency. For output streams it is set by default
# to the frequency of the corresponding input stream. For input streams this
# option only makes sense for audio grabbing devices and raw demuxers and is
# mapped to the corresponding demuxer options.
# :: $mp3name :: Output name
# file:///C:/ffmpeg-git-1eabd71-win32-static/doc/ffmpeg.html

# trp: $arguments = '-i ' + '"'+$strInName +'"' +' -y -acodec libmp3lame -ab ' + $bitrate`
$arguments = '-i ' + '"'+$strInName +'"' +' -y -acodec wmav2 -ab ' + $bitrate`
+'k -ac 2 -ar 44100 ' + '"' + $strOutName+ '"'

# This is where the conversion takes place
# trp:debug
Write-Warning "$tool + `r`n"
Write-Warning "$arguments + `r`n"
Invoke-Expression "$tool $arguments"

# Lets see what we just converted, did everything go OK?
$objOutFile = get-item $strOutName

# if conversion went well the mp3 file is larger than 0 bytes, so remove the original file,
# otherwise leave the wma file & remove the (zero length) mp3 file

if (!$strOutName.Length -gt 0) # no success converting -> delete failed converted file
{
echo "----- removing $strOutName"
Remove-Item -LiteralPath $strOutName
$failurecounter++
}
else # success converting
{
$successcounter++
if ($blndelete) # delete original requested
{
# you might want to consider moving the original file to
# anther location instead of removing it.
# Allowing you time to manually check if the conversions went OK
echo "----- removing $strInName"
Remove-Item -LiteralPath $strInName
}
}
}
else # $prot
{
"! File " + $child.FullName + " is DRM protected, skipping..."
$failurecounter++
}
}

# We are done, so lets inform the user what the success rate was.
Echo "Processing completed, $successcounter conversions were succesfull `
and $failurecounter were not."

Learning-materials-related posts

Here is an overview of learning materials (Creation service) related articles, per language, on this blog/CMS, including shortcut links that save you building the advanced-search URLS as described in the upper right corner here.

Blogposts

With learning materials or on Creation of

To date 7/22/2014

lm

lmC

Grand Total

Arabic

7

4

11

English

8

10

18

Farsi

7

4

11

French

11

8

19

German

12

8

20

Hebrew

2

0

2

Hindi

7

5

12

Italian

8

6

14

Japanese

9

5

14

Korean

7

4

11

Latin

3

0

3

Mandarin

8

6

14

Polish

5

4

9

Portuguese

9

4

13

Russian

8

5

13

Spanish

9

9

18

Swahili

5

4

9

Yoruba

4

4

8

Grand Total

129

90

219

How to work around broken links and visible “Machine generated alternative text”issues with images from MS-OneNote in Windows Live Writer

  1. Problem: Sometimes when you use Windows Live Writer (2012) to post images copied from MS-OneNote (2010, 2013), the result (on WordPress) can get messed up, like so (post has since been fixed as described below): clip_image001
    1. The image is missing (“src=” link broken).
    2. The “alt=” text is visible instead (and you did not want to post this “alt=”text anyway. (MS-OneNote OCRs images to make the text therein searchable; this text is put into the “alt”when pasting from MS-OneNote).
  2. Root cause:
    1. Windows Live Writer converts the pasted content by
      1. removing the “alt=”Machine generated alternative text: [deleted for brevity]”
      2. creating from the pasted content thumbnail images
      3. which it links in the “src=” tag, and links the thumbnail image to the full-size original image.
    2. If something – unclear what – prevents this conversion, Unfortunately, this is not obvious from the “edit” tab view or elsewhere within Windows Live Writer. But when posted, will result in “Machine generated alternative text” from MS-OneNote in place, but even  break the image src link: image.
    3. What exactly triggers (and would allow you to force) a successful conversion within Windows Live Writer I do not know. However, there is a simple:
  3. Workaround:
  1. After pasting your images, be patient : The trick seems to be to give Windows Live Writer enough time (more apparently if you have pasted multiple images) to finish
  2. Things you can look for in Windows Live Writer to make sure the conversion is finished:
      1. edit tab: you can tell the difference by the resizing of the image on the edit tab:
        1. before: image
        2. after (= conversion finished): image
      2. source code  tab: A somewhat radical solution, but here beneficial  is that the conversion removes the imported “alt” text of the image.
        1. before: alt=”Machine generated alternative text: [deleted for brevity]” src=”$clip_image006.jpg”
        2. after: alt=”clip_image006″ src=”$clip_image006_thumb.jpg”

ScreenToGif Debugging: Object reference not set to an instance of an object (#7)

  1. Trying to contribute a tiny bit to the development of this great utility ScreenToGif:
  2. 1st version: image
    1. crashes on pressing “stop”: image
    2. the Log
    3. Title: NullPointer in the Stop function 7
      Message: Object reference not set to an instance of an object.
      Source: ScreenToGif
      TargetSite: Void Stop()
      StackTrace:    at ScreenToGif.Legacy.Stop()
      Date/Time: 7/3/2014 12:55:16 PM
      ==============================
  3. Newer version: image
    1. does not hang on “stop”
      1. after adding overlay text (great new feature!), image
        1. seems to hang on pressing “Done” with “Analizing [sic] Unchanged Pixels”
        2. crashes on pressing window close: image
        3. Maybe I was just not patient enough? for:
      2. without adding overlay pixels:
        1. seems to also take a long time (2-3minutes analyzing, without a progress bar, or any other indication that the program is still working and has not crashed – the couple of minutes “Processing” seem to go by faster, thanks to the progress bar and frame counter) for a 5fps 1073*810, about 300frames, but hey! It works:image
        2. Plus you can now open the resulting GIF file directly from the creator.
        3. Actually, when I click “Stop” (I realize  I am supposed to click “Close”), I still get a NullReferenceException (#9), probably should not: image
    2. No log has been outputted with the new version .

Paper @ CALICO 2014: Using NLP Platforms for Language Learning Material Production

…has been accepted for inclusion in the program for CALICO 2014, May 9-10 at Ohio University, (Athens, OH) and was presented on May 9: Here are abstract and slide deck:

Installing dkPro in 2014…

  • … proved easier than 2012  (thanks, Richard Smile), but still not for the faint of heart…
  • I got it to work maven-download-sources, despite an update release of ver 1.6 – once again like in 2012 – in the middle of my installation travails.
  • Read all about those in here.

Slowing source audio for interpreting classes in the digital audio lab

  1. To judge from listening to Simult. Lesson 1, text 2 on Acebo Interpreter’s Edge (ISBN 1880594323), I am wondering  whether some of our students (= personalization) would need this audio to be simplified, to gain the benefit of a well-adjusted i+1?  I can pre-process the audio :
    1. Where the flatlines = natural pauses are in above graph, insert a audio signal as where students can press voice insert recording,  Example: clip_image001
    2. We can also  insert a pause and a cue at the beginning and end to set students a limit how long they can interpret, but if students operate  the player manually, there is no teacher control and no exam condition, and the students having to manage the technology tends to distract from the language practice.
    3. Slow down the audio without changing the pitch (just have to make sure not to overdo it, else will sound like drunken speech  – my time stretching software would be able to avoid “drunken speech” syndrome, but I have not been able to work on it since briefly for IALLT in Summer 2011 for 3 years now…)
      1. clip_image002
      2. clip_image003
    4. We can use this adjusted with the Sanako grouping feature to personalize instruction (find the right i+1 for each of your student, useful if there are considerable variations in their proficiency): How to group students into sessions  (in 3 different ways)    goo.gl/JgXUP/.