diff --git a/Main.hs b/Main.hs index 55a15f6..a738aef 100644 --- a/Main.hs +++ b/Main.hs @@ -8,7 +8,7 @@ import Control.Applicative ((<|>)) import Control.Monad ((>=>), forM_, unless) import Data.Char (toLower) import Data.List (sort, nub, partition) -import Data.Maybe (mapMaybe, fromMaybe, listToMaybe) +import Data.Maybe (catMaybes, mapMaybe, fromMaybe, listToMaybe) import Data.Version (showVersion) import qualified System.Console.GetOpt as Opt import qualified System.Environment as Env @@ -97,13 +97,12 @@ main = do in do putStrLn "Exporting backing audio (could take a while)" runAudio [fback] others fout - case matches of + clickTracks <- mapM loadBeats $ map (\(fp, _, _) -> fp) matches + case catMaybes clickTracks of [] -> return () - (fp, _, _) : _ -> loadBeats fp >>= \mb -> case mb of - Nothing -> return () - Just beats -> do - putStrLn "Exporting metronome click track" - writeMetronomeTrack (dout "click.wav") beats + beats : _ -> do + putStrLn "Exporting metronome click track" + writeMetronomeTrack (dout "click.wav") beats case function args of PrintUsage -> printUsage ShowDatabase -> do @@ -117,16 +116,13 @@ main = do (_ , Left err ) -> error err (Right yaifcs, Right naifcs) -> runAudio yaifcs naifcs fout ExportClick fout -> do - matches <- searchResultsChecked args - case matches of + matches <- map (\(fp, _, _) -> fp) <$> searchResultsChecked args + clickTracks <- mapM loadBeats matches + case catMaybes clickTracks of [] -> do - putStrLn "No songs matched your search." + putStrLn $ "Couldn't load beats.plist from any of these folders: " ++ show matches exitFailure - (fp, _, _) : _ -> loadBeats fp >>= \mb -> case mb of - Nothing -> do - putStrLn $ "Couldn't load beats.plist from the folder: " ++ fp - exitFailure - Just beats -> writeMetronomeTrack fout beats + beats : _ -> writeMetronomeTrack fout beats CheckPresence -> do matches <- getAudioParts <$> searchResultsChecked args let f = mapM (`getOneResult` matches) . mapMaybe charToAudioPart diff --git a/Makefile b/Makefile index 08b9f99..834496f 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ release/${release}-osx-x64.zip: stack build cp .stack-work/install/x86_64-osx/*/*/bin/jammittools jammittools strip jammittools - zip $@ jammittools README.md LICENSE + zip $@ jammittools README.md LICENSE easy-export.applescript rm jammittools release/${release}-linux-x64.tar.gz: diff --git a/README.md b/README.md index 3c63a60..000d638 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,20 @@ [![Available on Hackage](https://img.shields.io/hackage/v/jammittools.svg)](http://hackage.haskell.org/package/jammittools) -A command-line tool for exporting sheet music and audio from the Windows/Mac app [Jammit]. -It should go without saying, but please do not distribute content from songs you have purchased -- -it is for your use only! - -Download the latest Windows/Mac/Linux binaries from the [releases page](https://github.com/mtolly/jammittools/releases). +A command-line tool for exporting sheet music and audio from the (defunct) Windows/Mac app [Jammit]. +It should go without saying, but please do not distribute content from songs you have purchased—it is for your use only! [Jammit]: https://www.jammit.com/ -## Usage +## Easy export instructions + +1. Download songs through the Windows or Mac Jammit app. + +2. Download `jammittools` from the [releases page](https://github.com/mtolly/jammittools/releases). + +3. Unzip somewhere, and run the included `easy-export` script. Song folders will start being extracted in that same folder. + +## Command-line instructions jammittools -? # Print usage info. @@ -105,8 +110,8 @@ This uses the `-n` flag to mix many audio files in after inverting them. The `D` part is the backing track for the drums package. What this does is subtract the non-drums instrument parts from this backing track, leaving you with just the portion of the song that isn't present in any of the transcribed -parts. If you use the `-x` option to export all parts of a song, this process -will be done for you and placed in a file called `backing.wav`. +parts. If you use the `-x` or `-b` options to export all parts of a song, this +process will be done for you and placed in a file called `backing.wav`. The resulting file has a thin layer of noise, because all the audio used in Jammit is lossily encoded, which means the backing tracks are not quite perfect diff --git a/Vagrantfile b/Vagrantfile index d227ccb..9e4df92 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -3,7 +3,7 @@ # Sets up boxes for both Linux and Windows (Wine). Vagrant.configure(2) do |config| - config.vm.box = 'ubuntu/xenial32' + config.vm.box = 'ubuntu/vervet32' config.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--memory", "2048"] vb.customize ["modifyvm", :id, "--cpus", "2"] diff --git a/easy-export.applescript b/easy-export.applescript new file mode 100755 index 0000000..a967dc7 --- /dev/null +++ b/easy-export.applescript @@ -0,0 +1,4 @@ +#!/usr/bin/osascript +on run argv + do shell script "\"" & (POSIX path of ((path to me as text) & "::")) & "jammittools\" -b ." +end run diff --git a/easy-export.sh b/easy-export.sh new file mode 100755 index 0000000..13eea89 --- /dev/null +++ b/easy-export.sh @@ -0,0 +1,3 @@ +#!/bin/bash +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +"$DIR/jammittools" -b . diff --git a/jammittools.cabal b/jammittools.cabal index a497f49..9d44198 100644 --- a/jammittools.cabal +++ b/jammittools.cabal @@ -1,5 +1,5 @@ Name: jammittools -Version: 0.5.1 +Version: 0.5.2 Synopsis: Export sheet music and audio from Windows/Mac app Jammit Description: @@ -61,7 +61,7 @@ executable jammittools , directory >= 1.2.0.1 && < 1.3 , filepath >= 1.3.0.1 && < 1.5 , boxes >= 0.1.3 && < 0.2 - , jammittools == 0.5.1 + , jammittools == 0.5.2 ghc-options: -Wall -O2 source-repository head