Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: AudioShell Beta Release (Read 31643 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

AudioShell Beta Release

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.2 is now available, which adds AAC and Apple Lossless support under 64-bit PowerShell.

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 and R128 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.

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.

AudioShell Beta Release

Reply #1
Here are some simple examples:

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


To list all the available encoders:
Code: [Select]
Get-AudioEncoderInfo


To get the available settings, default settings etc. for Lame:
Code: [Select]
Get-AudioEncoderInfo "Lame MP3"


All the available cmdlets are documented, so for examples and a list of parameters, use the Get-Help cmdlet:
Code: [Select]
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: [Select]
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: [Select]
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: [Select]
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.

AudioShell Beta Release

Reply #2
Interesting to see you are directly using libmp3lame, libFLAC, libVorbis, and especially, CoreAudioToolbox for Apple AAC.

AudioShell Beta Release

Reply #3
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.



AudioShell Beta Release

Reply #4
That's some powerful stuff you're working on, mate, thanks!

AudioShell Beta Release

Reply #5
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 

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.


 


AudioShell Beta Release

Reply #6
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.

AudioShell Beta Release

Reply #7
Not related to this in any way?
Music washes away from the soul the dust of everyday life.

AudioShell Beta Release

Reply #8
No,. I thought I'd checked the name but clearly I didn't  . Might change it before 1.0.

AudioShell Beta Release

Reply #9
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.

AudioShell Beta Release

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

AudioShell Beta Release

Reply #11
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.

AudioShell Beta Release

Reply #12
Is the ReplayGain implementation using EBU R128 or the original algorithm?

AudioShell Beta Release

Reply #13
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

AudioShell Beta Release

Reply #14
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.

AudioShell Beta Release

Reply #15
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.

AudioShell Beta Release

Reply #16
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?

AudioShell Beta Release

Reply #17
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.


AudioShell Beta Release

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

Code: [Select]
$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.

AudioShell Beta Release

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

Code: [Select]
$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...

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.

AudioShell Beta Release

Reply #20
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: [Select]
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: [Select]
$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

AudioShell Beta Release

Reply #21
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.

AudioShell Beta Release

Reply #22
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.

AudioShell Beta Release

Reply #23
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).

AudioShell Beta Release

Reply #24
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.