Archive

Posts Tagged ‘audio’

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."

Request to download the digital audio lab classroom audio configuration on the fly, program and source for Windows XP

UPDATE: A Windows7 (and Vista) version is in the works, check back for a new post here.

Back to description of reset of classroom audio configuration on the fly program

No usable dual track audio from Sanako Study 1200 version 7 when saving as MP3?

  1. We have not been using the dual track recording capabilities of the Sanako much here yet, or have relied on the diachronic separation of channels that the Sanako voice-insert mode provides. Now, however, we want to apply the Sanako to consecutive interpreting in our MA program where there is more of a need for the reviewing student/grading teacher to switch between source and target language on the recorded dual-track audio.
  2. As far as I remember, dual track recording, one of the core features of the digital audio lab, used to work out of the box in Sanako (up to version 5 on XP?), but to my surprise, no more when I saved a student exercise, the left and right channel were identical (and the source and interpreter voices very hard to separate, the entire interpretation impossible to follow).
    1. I had noticed before that with version 7 (at least, we skipped 6) all recording was dual channel, but simply duplicated the left and right audio channel (isn’t this a waste of bandwidth and storage resources?).
  3. I tested our 7.1 installation (on Windows 7 64-bit), by changing the advanced collection settings, for an interpreting audio file, clapping from the teacher station:
  4. First I changed the tracks to be saved:
  5. Test1: image.This mixes student and program down onto each channel: image
  6. Test 2: clip_image004, Program track only, as expected (no clapping)clip_image005
  7. Test 3: clip_image006 Student track, as expected (only clapping – pretty much)clip_image007
  8. Workaround: After trying whether I can save manually from the student station, it occurred to me to change the file format also
    1. WMA:
      1. dual track
        1. works with “Save AS” from the student.exe (where the mp# options is conspicuously absent, or am I missing something): image
        2. won’t work with “collect” from the tutor.exe: both tracks (saving both is – fortunately – only an option for “save as“ WMA from the  student exe. You can also save only the student track as WMA) get mixed down to one (and the student is far too soft) , as you can witness here: image
      2. WMA is a technically nice, efficient (small file size)  and widely supported format, but does require an add-on installation on the MacOS X, not to mention mobile devices.
      3. WMA on Windows plays in Windows Media Player, but from version 12, Windows Media Player has no easy way to adjust the balance anymore, you have to dig relatively deeply into the OS (mmsys.cpl) itself.
    2. MFF:
      1. dual track works also (saving single track is actually not an option in this format)both using
        1. the student recorder “Save as” (which can also mix both tracks, see above)
        2. “collect” from the tutor.exe: you can fade in the left and right channel with the balance tool that you find in the student recorder to the left of the timeline.
      2. Unfortunately,
          1. the file size quickly gets out of hand: image
          2. and for no obvious reason, the biggest here is 12 times the size, but not longer than the smallest, and also only a 5-minute recording (I know that mff stores also the user’s bookmark information, but  this can hardly be the culprit): image
          3. compare this with how WMA compresses: image
        1. MFF is a proprietary format, which only the Sanako recorder can play. This may be a nice way to get more adoption of the free Sanako student recorder which is great for language learning. However, I had not originally planned on forcing my users to use it who are most comfortable with mp3.
    3. In addition, I now have a the problem with how to switch the Sanako default collection to MFF for interpreting teachers without confusing regular users.

Manage some of your teacher computer settings per logged in user

  1. Another day, another hack, and inconsequential, unless of course you are in my situation:
  2. If you need a simple way to change some of your Sanako settings per logged in user
  3. but cannot use the logged-in user system built into Sanako Study 1200:

 

$path = "C:\ProgramData\Sanako\Study\Tutor\"

If (@UserName = "PRTOTECTTHEINNOCENT") Then	
; change the sanako default save to dual track supporting mff
	; prereq: customized settings files in the folder ready to rename 
	FileCopy($path & "mffTutor.Settings", $path & "Tutor.Settings", 1)
ElseIf (@UserName = "tplagwit") Then 
; change the sanako default save to dual track supporting wma, for testing
	FileCopy($path & "wmaTutor.Settings", $path & "Tutor.Settings", 1)
Else 
; keep the default mp3, but we may have to reset the tutorsettings on this unfrozen computer
	FileCopy($path & "mp3Tutor.Settings", $path & "Tutor.Settings", 1)
EndIf
; tutor.exe could be hardcoded to (re)load here
If ProcessExists("Tutor.exe") Then
	; determine: we could kill tutor to reload it, but that could be disruptive of a class
Else
	Run("C:\Program Files (x86)\SANAKO\Study\Tutor\Tutor.exe")
EndIf
Exit

How to manage balance on stereo audio using Audacity, Sanako student recorder, or any audio player on Windows

  1. For language lab use, stereo is more important than usual, since the channels may carry source versus translation/interpretation, L1 versus L2, teacher versus student, model versus imitation and so forth.
  2. You can choose which channel to listen to by adjusting the balance for stereo playback.
  3. In the Sanako Student recorder (free for all), click here: image
  4. In Audacity, click here:: image
  5. From any other player on Windows, hold Win-key and press R, type mmsys.cpl, on tab playback, double click the speaker you are outputting to, and  on tab levels, change “Balance”: image

Audio player error message involving “pluginfile.php” in Moodle quiz

  1. LRC assistants may get called by students with this error regarding pluginfile.php in a Moodle quiz, it appears in the audio player interface itself and looks like this:DSCF0248
    1. The error messages flashes only briefly, and afterwards the audio simply will not play.
    2. In a Respondus lockdown browser quiz, you can bring up the error message again by clicking “next” and then resuming the attempt. When the quiz page reloads, the error message will briefly flash again.
  2. LRC assistants cannot work around this error, they need to alert permanent staff. Usually it is related to a quiz author needing to update the audio file link, like so:
    1. Go into the quiz, on the left, click “edit the quiz”): image
    2. Find the audio file link, edit the link: image
      1. Can you actually load the link? If it says “file not found”, you have the root cause:
      2. image
      3. Does it say “draft” in there? Not good. Copy the unique identifier from the path: image
    3. Go to in Moodle course / Files section, locate the offending file (you can use the unique id you put in the clip board to search), i.e. make sure it actually exists: image
    4. Get the correct URL for the file, puit it int the clipboard: image
    5. Go back to editing the quiz, update the wrong URL with the correct one.
    6. Save the updated quiz.
  3. Now the student can reload the quiz, if in Respondus lockdown browser, like above by clicking “next”and back.

Run mmsys.cpl if you get no audible output in a Blackboard IM call on your PC

  1. Problem: Blackboard IM (4.5.3), in its call window , gives you audio output volume meters image, but no actual audio output.
  2. Reason: Blackboard IM seems to have its on in-built idea which device to output audio to, even if you have no actual speakers plugged in to hear, and it is rather difficult to dissuade.
  3. Solution:
    1. Start / Run /”mmsys.cpl”, “OK”: Do the volume meters in there indicate that Blackboard IM outputs to another but your expected speaker (even if the other device is not the default)?
    2. imageimage
    3. Right-click on the other speaker device and Disable it.
    4. Also make sure to restart Blackboard IM. The built-in startup / dial tones will tell you immediately whether audio output works now

How to test Voice boards (Blackboard Collaborate, formerly Wimba voice) for Vista Higher Learning (Supersite3) Textbooks

2014/02/04 1 comment
  1. First I create a voice board,
    1. image
    2. image
    3. image
    4. and add an audio contribution so that students can respond:
    5. image
    6. Fail:
    7. image
    8. image
    9. image
    10. More fail
    11. image
    12. image
    13. The help offered is of no use: “If the Applet displayed the message “Audio Unavailable”, click here. “  This is neither the error message, nor does the help address Java (but rather audio hardware config) issues
    14. But if you refresh (F5 suffices) the window with the Setup Wizard, it starts working?
    15. image
    16. Even the audio recorder:
    17. image
    18. And the voice board (after F5):
    19. image
    20. image
    21. image
  2. What Java version is this under ?
    1. imagereally? have I restarted after uninstall of 7.54?
    2. The running process here is now Java 6.
    3. image
    4. Still need to test on Java 7.45.
  3. Now a user needs to test from the student view