-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,604 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
Builds/MacOSX/msproc.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file added
BIN
+25.9 KB
...xcodeproj/project.xcworkspace/xcuserdata/panos.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
...MacOSX/msproc.xcodeproj/xcuserdata/panos.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Bucket | ||
type = "1" | ||
version = "2.0"> | ||
</Bucket> |
97 changes: 97 additions & 0 deletions
97
Builds/MacOSX/msproc.xcodeproj/xcuserdata/panos.xcuserdatad/xcschemes/msproc.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "0700" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "10694C6E89BC9380CDDF2818" | ||
BuildableName = "msproc" | ||
BlueprintName = "msproc" | ||
ReferencedContainer = "container:msproc.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
</Testables> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "10694C6E89BC9380CDDF2818" | ||
BuildableName = "msproc" | ||
BlueprintName = "msproc" | ||
ReferencedContainer = "container:msproc.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "10694C6E89BC9380CDDF2818" | ||
BuildableName = "msproc" | ||
BlueprintName = "msproc" | ||
ReferencedContainer = "container:msproc.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
<CommandLineArguments> | ||
<CommandLineArgument | ||
argument = "decode B13h12m44s18oct2015y.wav" | ||
isEnabled = "YES"> | ||
</CommandLineArgument> | ||
</CommandLineArguments> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "10694C6E89BC9380CDDF2818" | ||
BuildableName = "msproc" | ||
BlueprintName = "msproc" | ||
ReferencedContainer = "container:msproc.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
22 changes: 22 additions & 0 deletions
22
...s/MacOSX/msproc.xcodeproj/xcuserdata/panos.xcuserdatad/xcschemes/xcschememanagement.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>SchemeUserState</key> | ||
<dict> | ||
<key>msproc.xcscheme</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>0</integer> | ||
</dict> | ||
</dict> | ||
<key>SuppressBuildableAutocreation</key> | ||
<dict> | ||
<key>10694C6E89BC9380CDDF2818</key> | ||
<dict> | ||
<key>primary</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
msproc: command line tool for working with Mid-Side audio files | ||
|
||
Copyright (C) <2015> <Panos Kountanis> | ||
|
||
This program is free software; you can redistribute it and/or modify it under the terms of | ||
the GNU General Public License version 2 as published by the Free Software Foundation; | ||
|
||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
See the GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License along with this program; | ||
if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
msproc | ||
------ | ||
|
||
command line tool for working with Mid-Side audio files | ||
|
||
- Decodes M/S recordings to stereo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
/* | ||
============================================================================== | ||
msproc: command line tool for working with Mid-Side audio files | ||
Copyright (C) <2015> <Panos Kountanis> | ||
This program is free software; you can redistribute it and/or modify it under the terms of | ||
the GNU General Public License version 2 as published by the Free Software Foundation; | ||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
See the GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along with this program; | ||
if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
============================================================================== | ||
*/ | ||
|
||
#include "../JuceLibraryCode/JuceHeader.h" | ||
|
||
|
||
int BUFFER_SIZE = 44100; | ||
int CHANNELS = 2; | ||
|
||
|
||
using namespace juce; | ||
|
||
|
||
void Usage(String error) | ||
{ | ||
std::cout << error << std::endl; | ||
std::cout << "usage: msproc decode <file>" << std::endl; | ||
} | ||
|
||
void PrintMessage(String msg) | ||
{ | ||
std::cout << msg << std::endl; | ||
} | ||
|
||
|
||
void decodeMidSide(AudioSampleBuffer *input, AudioSampleBuffer *output, long frameSize) | ||
{ | ||
auto mid = input->getReadPointer(0); | ||
auto side = input->getReadPointer(1); | ||
auto outLeft = output->getWritePointer(0); | ||
auto outRight = output->getWritePointer(1); | ||
for (int i =0; i < frameSize; i++) { | ||
outLeft[i] = mid[i] + side[i]; | ||
outRight[i] = mid[1] - side[i]; | ||
|
||
} | ||
} | ||
|
||
|
||
class MidSideProcessor { | ||
|
||
public: | ||
MidSideProcessor(String &filePath_) | ||
: filePath(filePath_) | ||
{ | ||
file = juce::File(File::getCurrentWorkingDirectory().getChildFile(filePath)); | ||
manager.registerBasicFormats(); | ||
} | ||
~MidSideProcessor() | ||
{ | ||
manager.clearFormats(); | ||
} | ||
|
||
int process() { | ||
juce::ScopedPointer<AudioFormatReader> reader = manager.createReaderFor(file); | ||
|
||
if (reader->numChannels != 2) { | ||
PrintMessage("Exactly 2 channels required"); | ||
return 1; | ||
} | ||
|
||
auto formatName = reader->getFormatName(); | ||
auto format = manager.findFormatForFileExtension(file.getFileExtension()); | ||
|
||
if (format == nullptr) { | ||
PrintMessage(String("Can not find format") + formatName); | ||
return 1; | ||
} | ||
|
||
const auto outFile = juce::File(File::getCurrentWorkingDirectory() | ||
.getChildFile("./ms_decoded" + file.getFileExtension())); | ||
if (outFile.existsAsFile()) { | ||
outFile.deleteFile(); | ||
} | ||
ScopedPointer<FileOutputStream> outStream = outFile.createOutputStream(); | ||
if (outStream == nullptr) { | ||
PrintMessage("Failed to create output stream for file"); | ||
return 1; | ||
} | ||
|
||
juce::ScopedPointer<AudioFormatWriter> writer = | ||
format->createWriterFor(outStream, reader->sampleRate, reader->numChannels, | ||
24, StringPairArray(), 0); | ||
|
||
if (writer != nullptr) { | ||
outStream.release(); | ||
auto audioBuffer = juce::AudioSampleBuffer(CHANNELS, BUFFER_SIZE); | ||
auto outBuffer = juce::AudioSampleBuffer(CHANNELS, BUFFER_SIZE); | ||
unsigned long j = 0; | ||
int samplesToRead = BUFFER_SIZE; | ||
while (j < reader->lengthInSamples) { | ||
if (j + samplesToRead >= reader->lengthInSamples) { | ||
int diff = (j + samplesToRead) - reader->lengthInSamples; | ||
samplesToRead -= diff; | ||
} | ||
reader->read(&audioBuffer, 0, samplesToRead, j, true, true); | ||
decodeMidSide(&audioBuffer, &outBuffer, samplesToRead); | ||
writer->writeFromAudioSampleBuffer(outBuffer, 0, samplesToRead); | ||
j += BUFFER_SIZE; | ||
} | ||
|
||
} | ||
|
||
return 0; | ||
} | ||
|
||
private: | ||
String &filePath; | ||
File file; | ||
AudioFormatManager manager; | ||
|
||
}; | ||
|
||
|
||
//============================================================================== | ||
int main (int argc, char* argv[]) | ||
{ | ||
PrintMessage("msproc v1.0.0"); | ||
if (argc == 2 && String(argv[1]).compare("--help") != -1) { | ||
Usage(""); | ||
return 0; | ||
} | ||
|
||
if (argc < 3) { | ||
Usage("too few arguments"); | ||
return 1; | ||
} | ||
String action, filePath; | ||
|
||
if (argc > 3) { | ||
Usage("too many arguments"); | ||
return 1; | ||
} else { | ||
action = String(argv[1]); | ||
filePath = String(argv[2]); | ||
} | ||
|
||
|
||
if (action != "decode") { | ||
Usage("action not recognized. Possible values: (encode)"); | ||
return 1; | ||
} | ||
|
||
PrintMessage("Perfoming action on file"); | ||
|
||
MidSideProcessor processor(filePath); | ||
auto result = processor.process(); | ||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<JUCERPROJECT id="SIiM9v" name="msproc" projectType="consoleapp" version="1.0.0" | ||
bundleIdentifier="com.seerealized.msproc" includeBinaryInAppConfig="1" | ||
jucerVersion="3.2.0" companyWebsite="http://seerealized.com" | ||
companyName="seerealized"> | ||
<MAINGROUP id="IahUA8" name="msproc"> | ||
<GROUP id="{CDAA3DAE-39C0-2E8C-8620-F9B30DDA1374}" name="Source"> | ||
<FILE id="x8c1kG" name="Main.cpp" compile="1" resource="0" file="Source/Main.cpp"/> | ||
</GROUP> | ||
</MAINGROUP> | ||
<EXPORTFORMATS> | ||
<XCODE_MAC targetFolder="Builds/MacOSX"> | ||
<CONFIGURATIONS> | ||
<CONFIGURATION name="Debug" osxSDK="default" osxCompatibility="default" osxArchitecture="default" | ||
isDebug="1" optimisation="1" targetName="msproc"/> | ||
<CONFIGURATION name="Release" osxSDK="default" osxCompatibility="default" osxArchitecture="default" | ||
isDebug="0" optimisation="3" targetName="msproc"/> | ||
</CONFIGURATIONS> | ||
<MODULEPATHS> | ||
<MODULEPATH id="juce_core" path="../JUCE/modules"/> | ||
<MODULEPATH id="juce_events" path="../JUCE/modules"/> | ||
<MODULEPATH id="juce_audio_basics" path="../JUCE/modules"/> | ||
<MODULEPATH id="juce_audio_formats" path="../JUCE/modules"/> | ||
</MODULEPATHS> | ||
</XCODE_MAC> | ||
</EXPORTFORMATS> | ||
<MODULES> | ||
<MODULE id="juce_audio_basics" showAllCode="1" useLocalCopy="0"/> | ||
<MODULE id="juce_audio_formats" showAllCode="1" useLocalCopy="0"/> | ||
<MODULE id="juce_core" showAllCode="1" useLocalCopy="0"/> | ||
<MODULE id="juce_events" showAllCode="1" useLocalCopy="0"/> | ||
</MODULES> | ||
<JUCEOPTIONS/> | ||
</JUCERPROJECT> |