IPB

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
AudioShell Beta Release, A multi-format audio conversion and tagging module for PowerShell
Jebus
post Oct 27 2014, 20:53
Post #1





Group: Developer
Posts: 1334
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



AudioShell is a new PowerShell-driven interface for converting, tagging and analyzing audio / music files.

edit: Renamed to PowerShell Audio. There is already an AudioShell out there. Oops!

Stable release 1.1 is now available, which adds cover art support.

Features:
  • A unified interface to popular codecs (Currently Lame MP3, Ogg Vorbis, Apple AAC, FLAC, Apple Lossless, and Wave).
  • Fast and highly concurrent ("multi-threaded") for modern, multi-core systems.
  • ReplayGain integration. Batch-analyze thousands of files quickly, then save the results to disk, convert to Apple SoundCheck format, or apply the changes directly during encoding.
  • Metadata preservation between formats.
  • Import, export and modify cover art.
  • PowerShell interface brings powerful integration and scripting capabilities.
  • API is open-source and extensible.

With a bit of PowerShell know-how, you can create short scripts to remove the word "The" from artist names, arrange albums in chronological order, and so on.

The current version is considered a beta, so make a backup of your files. You can give me feedback in this thread, and I'll try to fix any bugs quickly.

You can download it here. The installer's source code is also provided. It will install PowerShell 4.0 and .NET 4.5.2 if they aren't already present. If you really don't want to use the installer, there is a .zip download as well.

This post has been edited by Jebus: Jan 25 2015, 23:14
Go to the top of the page
+Quote Post
Jebus
post Oct 28 2014, 17:55
Post #2





Group: Developer
Posts: 1334
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



Here are some simple examples:

This command simply converts a folder full of FLAC files into Lame MP3s:
CODE
Get-AudioFile *.flac  | Export-AudioFile "Lame MP3" -Directory C:\Output


To list all the available encoders:
CODE
Get-AudioEncoderInfo


To get the available settings, default settings etc. for Lame:
CODE
Get-AudioEncoderInfo "Lame MP3"


All the available cmdlets are documented, so for examples and a list of parameters, use the Get-Help cmdlet:
CODE
Get-Help Export-AudioFile -Full


Here are some more advanced examples, which illustrate some of my favorite use cases:

Add ReplayGain 2.0 to your entire FLAC library, treating each directory as a separate album:
CODE
Get-ChildItem C:\Users\Myself\Music -Directory -Recurse | % { $_ | Get-ChildItem -File -Filter *.flac | Measure-AudioFile "ReplayGain 2.0"
-PassThru | Save-AudioFileMetadata }


Convert your whole FLAC library to VBR AAC, with SoundCheck tags calculated from album ReplayGain information:
CODE
Get-ChildItem C:\Users\Myself\Music -Filter *.flac -Recurse | Get-AudioFile | Export-AudioFile "Apple AAC" "C:\Output\{Artist}\{Album}" -Setting @{AddSoundCheck = "Album"} -Name "{TrackNumber} - {Title}"


Convert your whole FLAC library to VBR MP3, with ReplayGain directly applied to the resulting volume levels:
CODE
Get-ChildItem C:\Users\Myself\Music -Filter *.flac -Recurse | Get-AudioFile | Export-AudioFile "Lame MP3" "C:\Output\{Artist}\{Album}" -Setting @{ApplyGain = "Album"} -Name "{TrackNumber} - {Title}"


Hope this helps! PowerShell is really wonderful, once you get used to an object-oriented shell.

This post has been edited by Jebus: Jan 25 2015, 23:12
Go to the top of the page
+Quote Post
nu774
post Oct 29 2014, 11:42
Post #3





Group: Developer
Posts: 596
Joined: 22-November 10
From: Japan
Member No.: 85902



Interesting to see you are directly using libmp3lame, libFLAC, libVorbis, and especially, CoreAudioToolbox for Apple AAC.
Go to the top of the page
+Quote Post
Jebus
post Oct 29 2014, 18:08
Post #4





Group: Developer
Posts: 1334
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



Yes, I really want to ditch the old DOS prompt for good.

Internally, chunks of samples are passed around asynchronously, as 32-bit floating-point data. Metadata is handled in Unicode. And everything is done in-memory (no temp files). That stuff is all pretty hard to do when you're trying to automate the old-school cmd.exe shell.

Also, it was fun working with the different APIs, and the native code interop stuff was pretty challenging, in a good way.


Go to the top of the page
+Quote Post
viktor
post Oct 29 2014, 20:10
Post #5





Group: Members
Posts: 302
Joined: 17-November 06
Member No.: 37682



That's some powerful stuff you're working on, mate, thanks!
Go to the top of the page
+Quote Post
Jebus
post Oct 30 2014, 18:28
Post #6





Group: Developer
Posts: 1334
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



Updated version 0.9.1:

Added the ApplyGain setting (previously available for the Lame MP3 encoder) to the other lossy formats (Apple AAC and Ogg Vorbis).

No bug fixes, because no one has reported any yet smile.gif

I've also provided a .zip version for those who don't trust installers (even open source ones). The files need to be placed somewhere in your PSModulePath. You are responsible for making sure .NET 4.5.2 and PowerShell 4.0 or later are present. If you get confused, use the installer. It's very tidy.






This post has been edited by Jebus: Oct 30 2014, 18:43
Go to the top of the page
+Quote Post
eahm
post Oct 30 2014, 20:33
Post #7





Group: Members
Posts: 1243
Joined: 11-February 12
Member No.: 97076



QUOTE (Jebus @ Oct 30 2014, 10:28) *
I've also provided a .zip version for those who don't trust installers (even open source ones).

Thanks for the zip but it's not matter of trust, I choose to not install anything mainly to keep Windows free of issues over the years.

I've had this conversation few times before, people that create apps take this argument so personally, nothing personal, I like to push for portable versions, all the settings are there, they are efficient, stable and operational in the same way and there is less to do from the user/client. Of course I install software on customers' workstations, I install some on mine too (for example 7-Zip, Chrome, LogMeIn, Office, PDF Printer), I just don't want to install everything, especially for a test.

This post has been edited by eahm: Oct 30 2014, 20:35
Go to the top of the page
+Quote Post
The Seeker
post Oct 30 2014, 21:53
Post #8





Group: Members
Posts: 103
Joined: 15-June 04
From: Buxton, UK
Member No.: 14694



Not related to this in any way?


--------------------
Music washes away from the soul the dust of everyday life.
Go to the top of the page
+Quote Post
Jebus
post Oct 30 2014, 22:52
Post #9





Group: Developer
Posts: 1334
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



No,. I thought I'd checked the name but clearly I didn't unsure.gif . Might change it before 1.0.
Go to the top of the page
+Quote Post
Jebus
post Nov 2 2014, 17:43
Post #10





Group: Developer
Posts: 1334
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



Bug fix release 0.9.2:
  • Save-Metadata now preserves existing SoundCheck tags unless AddSoundCheck=$false, or a new tag is being generated (MP4 and ID3)
  • Save-Metadata now properly updates atoms, instead of just appending new ones (MP4)
  • Partial output is now cleaned up correctly on failure
Any feedback guys? I had hoped for greater adoption here... I feel like this tool should replace whatever command-line stuff you're doing now. Let me know what's missing and/or preventing you from switching.

This post has been edited by Jebus: Nov 2 2014, 17:43
Go to the top of the page
+Quote Post
eleria
post Nov 3 2014, 10:49
Post #11





Group: Members
Posts: 11
Joined: 23-January 10
Member No.: 77439



Hi, this looks pretty good. Going to give it a try.
I wonder if LossyWAV support could be a possibility happy.gif

This post has been edited by eleria: Nov 3 2014, 10:52
Go to the top of the page
+Quote Post
sundance
post Nov 3 2014, 12:59
Post #12





Group: Members
Posts: 180
Joined: 17-April 02
Member No.: 1804



QUOTE
Let me know what's missing and/or preventing you from switching...

Just guessing from my own state-of-knowledge: Few people know how to use powershell while using a batch file or a command line utility is rather simple...
Maybe some readme / first steps / tutorial / how-to would help.

This post has been edited by sundance: Nov 3 2014, 13:04
Go to the top of the page
+Quote Post
mjb2006
post Nov 3 2014, 14:47
Post #13





Group: Members
Posts: 916
Joined: 12-May 06
From: Colorado, USA
Member No.: 30694



Is the ReplayGain implementation using EBU R128 or the original algorithm?
Go to the top of the page
+Quote Post
Jebus
post Nov 3 2014, 21:42
Post #14





Group: Developer
Posts: 1334
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



QUOTE (sundance @ Nov 3 2014, 04:59) *
QUOTE
Let me know what's missing and/or preventing you from switching...

Just guessing from my own state-of-knowledge: Few people know how to use powershell while using a batch file or a command line utility is rather simple...
Maybe some readme / first steps / tutorial / how-to would help.


Makes sense. Here's a quick primer on some basic PowerShell concepts. Please read through it and tell me what you think! I'm happy to clarify or elaborate as needed.

https://github.com/jherby2k/AudioShell/wiki...werShell-Primer
Go to the top of the page
+Quote Post
Jebus
post Nov 3 2014, 21:45
Post #15





Group: Developer
Posts: 1334
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



QUOTE (mjb2006 @ Nov 3 2014, 06:47) *
Is the ReplayGain implementation using EBU R128 or the original algorithm?


Currently implements the original algorithm, or I guess technically an all-new algorithm producing RG 1.0 -compliant results, but somewhat faster by using multiple threads. I'd definitely like to add R128 in the near future.
Go to the top of the page
+Quote Post
lothario15
post Nov 3 2014, 23:19
Post #16





Group: Members
Posts: 24
Joined: 3-November 14
Member No.: 117719



QUOTE (Jebus @ Nov 3 2014, 21:42) *
QUOTE (sundance @ Nov 3 2014, 04:59) *
QUOTE
Let me know what's missing and/or preventing you from switching...

Just guessing from my own state-of-knowledge: Few people know how to use powershell while using a batch file or a command line utility is rather simple...
Maybe some readme / first steps / tutorial / how-to would help.


Makes sense. Here's a quick primer on some basic PowerShell concepts. Please read through it and tell me what you think! I'm happy to clarify or elaborate as needed.

https://github.com/jherby2k/AudioShell/wiki...werShell-Primer


I'm another who is unfamiliar with PowerShell so appreciate the primer. Combine this with a 'man-page' full of practical examples/frequent use-cases and you'll be close to nailing the documentation.

I did, however, run into a problem during use. I maintain three concurrent music libraries; I keep a primary archival FLAC library and transcode to two different Vorbis settings for different devices. I've found that attempting to view AudioShell Ogg Vorbis settings causes it to crash with an 'unable to find libVorbis' error.
Go to the top of the page
+Quote Post
Jebus
post Nov 3 2014, 23:53
Post #17





Group: Developer
Posts: 1334
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



QUOTE (lothario15 @ Nov 3 2014, 15:19) *
I did, however, run into a problem during use. I maintain three concurrent music libraries; I keep a primary archival FLAC library and transcode to two different Vorbis settings for different devices. I've found that attempting to view AudioShell Ogg Vorbis settings causes it to crash with an 'unable to find libVorbis' error.


Having trouble reproducing this.

What's your command line? I'm assuming Get-AudioEncoderAvailableSettingList "Ogg Vorbis"

Can you, after running that command, run $env:PATH and then paste the results here? Specifically, the first part of the path variable should be pointing to where libVorbis is installed. Please look in that location and let me know what you see.

Also, are you on 64-bit windows, and if so, is this 64-bit PowerShell?
Go to the top of the page
+Quote Post
nu774
post Nov 4 2014, 10:00
Post #18





Group: Developer
Posts: 596
Joined: 22-November 10
From: Japan
Member No.: 85902



QUOTE (Jebus @ Nov 3 2014, 01:43) *
I feel like this tool should replace whatever command-line stuff you're doing now. Let me know what's missing and/or preventing you from switching.

Since your cmdlets deal with "AudioFile" objects instead of a simple octet stream of PCM, I guess your cmdlets don't work with any existing solutions such as piping from ffmpeg (can read almost anything) or piping through sox (to do some DSP).
I think this is the most missing feature ... interoperability.
Any solution that can make them work with external commands in some ways would be nice.

Add to that, support for cuesheet would be nice.

Go to the top of the page
+Quote Post
Jebus
post Nov 4 2014, 18:55
Post #19





Group: Developer
Posts: 1334
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



You can use a script like this to work with ffmpeg, via a temp file:

CODE
$tempFile = tempoutput.wav
Start-Process ffmpeg.exe -ArgumentList "<options> -i input.wav $tempFile" -Wait
Get-AudioFile $tempFile | Export-AudioFile "FLAC"
Remove-Item $tempFile


You can easily send an AudioFile into sox, too. Just not as stdin.

Consider what a "simple octet stream of PCM" is. It's PCM audio without any additional information (bitrate, sample rate, channels etc), disguised as text so cmd.exe can deal with it. That's not elegant, simple or even all that safe. It's definitely not object-oriented, so I don't think it's a good idea.

You did get me thinking again about some sort of low-level API, where you'd pass around SampleCollection objects instead of full AudioFiles. I'll park it for now, though.

Cuesheets, yes. I will log a feature request.

This post has been edited by Jebus: Nov 4 2014, 19:05
Go to the top of the page
+Quote Post
nu774
post Nov 5 2014, 02:05
Post #20





Group: Developer
Posts: 596
Joined: 22-November 10
From: Japan
Member No.: 85902



QUOTE (Jebus @ Nov 5 2014, 02:55) *
You can use a script like this to work with ffmpeg, via a temp file:

CODE
$tempFile = tempoutput.wav
Start-Process ffmpeg.exe -ArgumentList "<options> -i input.wav $tempFile" -Wait
Get-AudioFile $tempFile | Export-AudioFile "FLAC"
Remove-Item $tempFile


You can easily send an AudioFile into sox, too. Just not as stdin.

Oh, I see. I have to say that tempfile is worse than good-old piping, but it should at least work...

QUOTE (Jebus @ Nov 5 2014, 02:55) *
Consider what a "simple octet stream of PCM" is. It's PCM audio without any additional information (bitrate, sample rate, channels etc), disguised as text so cmd.exe can deal with it. That's not elegant, simple or even all that safe. It's definitely not object-oriented, so I don't think it's a good idea.

Well, I'm not saying that your software should use PCM instead of AudioFile.
What I was saying is: object-oriented piping has many good points, but it will be poorer in terms of generality/interoperability without sub-channels to support good-old way.

That being said... most software don't actually use raw PCM for piping. What they use is WAV, AIFF or some other proper audio format that wraps PCM.
Therefore, I think most of your description about "simple octet stream of PCM" doesn't hold true there.
ffmpeg even writes tags in some containers, which can be read on the other end point of the pipe, by a program which authors of ffmpeg don't even know.
Go to the top of the page
+Quote Post
lothario15
post Nov 6 2014, 18:03
Post #21





Group: Members
Posts: 24
Joined: 3-November 14
Member No.: 117719



QUOTE (Jebus @ Nov 3 2014, 23:53) *
QUOTE (lothario15 @ Nov 3 2014, 15:19) *
I did, however, run into a problem during use. I maintain three concurrent music libraries; I keep a primary archival FLAC library and transcode to two different Vorbis settings for different devices. I've found that attempting to view AudioShell Ogg Vorbis settings causes it to crash with an 'unable to find libVorbis' error.


Having trouble reproducing this.

What's your command line? I'm assuming Get-AudioEncoderAvailableSettingList "Ogg Vorbis"

Can you, after running that command, run $env:PATH and then paste the results here? Specifically, the first part of the path variable should be pointing to where libVorbis is installed. Please look in that location and let me know what you see.

Also, are you on 64-bit windows, and if so, is this 64-bit PowerShell?


You assumed correctly:

CODE
PS C:\Users\ThinkPad> Get-AudioEncoderAvailableSettingList "Ogg Vorbis"
Get-AudioEncoderAvailableSettingList : The composition produced a single composition error. The root cause is provided
below. Review the CompositionException.Errors property for more detailed information.
1) Unable to load DLL 'libvorbis.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Resulting in: An exception occurred while trying to create an instance of type
'AudioShell.Extensions.Vorbis.VorbisSampleEncoder'.
Resulting in: Cannot activate part 'AudioShell.Extensions.Vorbis.VorbisSampleEncoder'.
Element: AudioShell.Extensions.Vorbis.VorbisSampleEncoder -->  AudioShell.Extensions.Vorbis.VorbisSampleEncoder -->
DirectoryCatalog (Path="C:\Program Files\WindowsPowerShell\Modules\AudioShell\Extensions\Vorbis")
Resulting in: Cannot get export 'AudioShell.Extensions.Vorbis.VorbisSampleEncoder
(ContractName="AudioShell.ISampleEncoder")' from part 'AudioShell.Extensions.Vorbis.VorbisSampleEncoder'.
Element: AudioShell.Extensions.Vorbis.VorbisSampleEncoder (ContractName="AudioShell.ISampleEncoder") -->
AudioShell.Extensions.Vorbis.VorbisSampleEncoder -->  DirectoryCatalog (Path="C:\Program
Files\WindowsPowerShell\Modules\AudioShell\Extensions\Vorbis")
At line:1 char:1
+ Get-AudioEncoderAvailableSettingList "Ogg Vorbis"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-AudioEncoderAvailableSettingList], CompositionException
    + FullyQualifiedErrorId : System.ComponentModel.Composition.CompositionException,AudioShell.Commands.GetAudioEncod
   erAvailableSettingListCommand


Yep, it's 64-bit PowerShell running on 64-bit Windows 8.1.

CODE
$env:PATH
C:\Program Files\WindowsPowerShell\Modules\AudioShell\Extensions\Vorbis\x64


Despite the error, a quick glimpse in this directory finds both libogg.dll and libvorbis.dll sitting cosily in C:\Program Files\WindowsPowerShell\Modules\AudioShell\Extensions\Vorbis\x64. Odd.

I toyed a little with MP3 encoding and found that everything worked well except transference of some metadata. Most of my music contains song lyrics stored in the FLAC VorbisComment field UNSYNCEDLYRICS. AudioShell transferred all the main fields but excluded the lyrics field in the sample MP3's tags. Since Vorbis fails, I haven't been able to test the transfer of VorbisComments. I hope this is of help.

Oh also, I wonder whether you could add a list of all AudioShell cmdlets to the primer? Get-help AudioShell lists only two cmdlets so aside from the examples, I'm unsure of AudioShell's scope. It needn't be as detailed; just a simple list of all cmdlets would be incredibly helpful.

Thanks

This post has been edited by lothario15: Nov 6 2014, 18:06
Go to the top of the page
+Quote Post
Jebus
post Nov 10 2014, 05:58
Post #22





Group: Developer
Posts: 1334
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



Found the issue, I think. Thanks for the feedback!

Version 0.9.3:
  • Renamed PowerShell Audio from AudioShell, due to a name conflict.
  • Added Visual C++ 2012 Redistributable merge module to the installer, since it is a dependency for the native Vorbis libraries.
  • Corrected minor issue where the native Vorbis library was being loaded prematurely.


This post has been edited by Jebus: Nov 10 2014, 06:01
Go to the top of the page
+Quote Post
Jebus
post Nov 10 2014, 06:05
Post #23





Group: Developer
Posts: 1334
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



QUOTE (lothario15 @ Nov 6 2014, 10:03) *
I toyed a little with MP3 encoding and found that everything worked well except transference of some metadata. Most of my music contains song lyrics stored in the FLAC VorbisComment field UNSYNCEDLYRICS. AudioShell transferred all the main fields but excluded the lyrics field in the sample MP3's tags. Since Vorbis fails, I haven't been able to test the transfer of VorbisComments. I hope this is of help. Oh also, I wonder whether you could add a list of all AudioShell cmdlets to the primer? Get-help AudioShell lists only two cmdlets so aside from the examples, I'm unsure of AudioShell's scope. It needn't be as detailed; just a simple list of all cmdlets would be incredibly helpful. Thanks


Right now only a common set of tags are maintained, even from FLAC -> Vorbis. I'll think about adding support for arbitrary tags for the formats which support them (ID3 for example has a fixed set of frame types, and nothing for lyrics AFAIK).

I've added a quick page to the PowerShell Audio wiki listing the available cmdlets.

This post has been edited by Jebus: Nov 10 2014, 06:52
Go to the top of the page
+Quote Post
Jebus
post Nov 10 2014, 23:10
Post #24





Group: Developer
Posts: 1334
Joined: 17-March 03
From: Calgary, AB
Member No.: 5541



Version 0.9.4:
  • ApplyGain=Album now works when track ReplayGain is missing, and vice versa.
  • Metadata is now always removed when a field is set to an empty string (""), instead of potentially throwing an exception.
  • Corrected a null reference exception in the Vorbis extension (introduced in 0.9.3).


This post has been edited by Jebus: Nov 10 2014, 23:11
Go to the top of the page
+Quote Post
lothario15
post Nov 12 2014, 15:38
Post #25





Group: Members
Posts: 24
Joined: 3-November 14
Member No.: 117719



QUOTE (Jebus @ Nov 10 2014, 06:05) *
QUOTE (lothario15 @ Nov 6 2014, 10:03) *
I toyed a little with MP3 encoding and found that everything worked well except transference of some metadata. Most of my music contains song lyrics stored in the FLAC VorbisComment field UNSYNCEDLYRICS. AudioShell transferred all the main fields but excluded the lyrics field in the sample MP3's tags. Since Vorbis fails, I haven't been able to test the transfer of VorbisComments. I hope this is of help. Oh also, I wonder whether you could add a list of all AudioShell cmdlets to the primer? Get-help AudioShell lists only two cmdlets so aside from the examples, I'm unsure of AudioShell's scope. It needn't be as detailed; just a simple list of all cmdlets would be incredibly helpful. Thanks


Right now only a common set of tags are maintained, even from FLAC -> Vorbis. I'll think about adding support for arbitrary tags for the formats which support them (ID3 for example has a fixed set of frame types, and nothing for lyrics AFAIK).

I've added a quick page to the PowerShell Audio wiki listing the available cmdlets.


Thanks, the improved documentation is very useful.

As an aside, I used Get-AudioInfo of multiple files. The cmdlet works as expected however it outputs a list of info without file names. A quick check of file sizes will determine which files have been checked but it would be easier if file names were included by default.
Go to the top of the page
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 6th March 2015 - 11:21